How to check Send Message permission of bot in my Discord Channel?

Viewed 119

This is my code:

```
if (message.user.bot.permissions.has("SEND_MESSAGE")) {
        console.log("I can send message!!")} 
else {
        console.log("I can't send message!!")
}
```

For exp: I want to check bot permission in channel ID: 988087516844421170 What should I do?

1 Answers

To check bot permission in channel you should use Channel.permissionsFor() like in this code:

if(message.channel.permissionsFor("BOT_ID").toArray().includes("SEND_MESSAGES")) {
// code if has permission
} else {
// code if no
}
Related