so i've recently learned the basics of Discord.js and i tried to make my personal bot just for fun and one of the command in that bot is a !say command that lets me make the bot say whatever i want wherever i want
but i'm always getting this error:Cannot read property 'send' of undefined
client.on('message', message =>{
if(message.content === `${prefix}say`) {
const arguements = message.content.slice(prefix.length).split(/ +/);
const location = client.channels.chache.find(channel=>channel.id === arguements.shift());
const whatToSay = arguements.slice(1);
location.send(whatToSay);
// !say (channel Id) blah blah blah
}
});
I tried converting the arrow function into a normal function but it didn't work.
I tried replacing the arguements.shift() in the 4th line and it still didn't work.
I don't know where the mistake is
question from:
https://stackoverflow.com/questions/65833208/discord-js-cant-read-property-send-of-undefined 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…