1
votes

I'm stuck on a dumb loop, cannot figure out how to check if my BOT has permission to send messages in a specific channel. All I got is this:

if (msg.guild.me.hasPermission('SEND_MESSAGES')){
  msg.channel.send('hello!');
}

And of course this gives the Missing Permissions error since my BOT has permissin to send as Role but not in the channel since @everyone is negating permission. So how do I check if my BOT can actually send messages in this specific channel?

1

1 Answers

0
votes

GuildChannel#permissionsFor should do it.

E.g.

msg.channel.permissionsFor(msg.guild.me).has("SEND_MESSAGES") // returns a boolean