Reputation: 35
Im trying to build a discord bot but I need to send a message to a specific channel. I've given it 100 tries but keep getting:
TypeError: bot.channels.fetch(...).send is not a function.
Everywhere I read, I see "use channel.send()" but I cannot find an actual fix for my problem. Is channel.send() deprecated? Heres the line that the error throws an error on:
bot.channels.fetch(id).send(message);
I know channels.get() was depricated and when using .fetch(id), I get the channel object however it wont let me send the message. ANY help will be appreciated as I have spent days on this alone. Thanks.
Full block of code:
var reportEmbed = new Discord.MessageEmbed()
.setColor('#0099ff')
.setTitle('New Report')
.setAuthor(msg.author.tag)
.setDescription(reportMessage)
.setTimestamp();
console.log(bot.channels.fetch('my channel id'));
bot.channels.fetch('my channel id').then(channel => {
channel.send(reportEmbed);
});
When console logged, I get the correct channel object.
Upvotes: 0
Views: 505