Reputation: 103
I want to check two things
Upvotes: 3
Views: 5610
Reputation: 905
for v14 you now have to use the MemberManager
within Guild
to access me
like so
msg.guild.members.me?.permissionsIn(message.channel).has(permissions);
Upvotes: 3
Reputation: 14148
LDinos' answer is correct for Discord.js v12. However, Discord.js v13 removed the hasPermission
permission in favour of permissions.has
.
Channel permissions:
msg.guild.me.permissionsIn(msg.channel).has(permissions)
Guild (server) permissions:
msg.guild.me.permissions.has(permissions)
Upvotes: 2
Reputation: 103
Found it! To find the bot's permissions, let's say, after a message (msg =>) was sent by a user:
CHANNEL permission:
msg.guild.me.permissionsIn(msg.channel).has(<permission string here>)
SERVER permission
msg.guild.me.hasPermission(<permission string here>)
Upvotes: 6