'How do I check if the bot has permission to send messages in channel?
How can I check if the bot has permission to send messages in a channel? This is what I tried:
let test = "45673452348954"
const test11 = client.channels.cache.get(test)
if(client.user.permissionsIn(test1).has("SEND_MESSAGES")) {
console.log("has permission")
Solution 1:[1]
You did it correctly for the most part, the only thing that you messed up in is that it needs to be a GuildMember to check if it has permissions in a channel, not a user.
<Guild>.me.permissionsIn(test1).has("SEND_MESSAGES")
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | 779804 |
