0
votes

Hello I am trying to do sending message all my friend from my discord bot(Js) when ı write &acil,but when ı write this commands something is going wrong and sending so much messages and sometimes giving => TypeError: Cannot read property 'send' of undefined error

 require("dotenv").config();
 const fetch = require("node-fetch");
 const Discord=require("discord.js");
 const client = new Discord.Client();

 client.on("message",message =>{
  console.log("Gelen mesaj"+message.content);
  if(message.content === "&acil")
    message.client.users.cache.get('777206236986474526').send('ACİL TOPLANTI!');
    message.client.users.cache.get('675607935380094986').send('ACİL TOPLANTI!');
    message.client.users.cache.get('777206236986474526').send('ACİL TOPLANTI!');
    message.client.users.cache.get('7175607935380094986').send('ACİL TOPLANTI!');
   
    

});
  
    
1
Maybe try removing the message at the beginning and let it simply be client.users.cache.get('userID').send(''); insteadPerplexingParadox
ı tryied that but result is not changedMustafa Kendigüzel
One of the IDs is wrong or the user is not in the cacheLioness100

1 Answers

0
votes

Try it without “message” and “cache”. You also need to make sure that the bot and the user have at least 1 mutual server or else it is impossible to send it to them.