Skip to content

how to know if the user have administrator permission in latest version #8570

Closed Answered by almostSouji
plaraje asked this question in Q&A
Discussion options

You must be logged in to vote

For base permissions (guild level, default role and any roles the member might have):

message.member.permissions.has(PermissionFlagsBits.Administrator);

For permissions after channel overwrites:
https://discordjs.guide/popular-topics/permissions.html#permissions-after-overwrites

If using command interactions, you can get the permissions of the member executing the command after overwrites through
https://discord.js.org/#/docs/discord.js/14.3.0/class/CommandInteraction?scrollTo=memberPermissions instead. Checking for the flag works exactly the same as above.

You can find more information on Permissions in general in our guide at https://discordjs.guide/popular-topics/permissions.html

Replies: 3 comments 6 replies

Comment options

You must be logged in to vote
3 replies
@imranbarbhuiya
Comment options

@shr3wcl
Comment options

@plaraje
Comment options

Comment options

You must be logged in to vote
1 reply
@almostSouji
Comment options

Comment options

You must be logged in to vote
2 replies
@shr3wcl
Comment options

@plaraje
Comment options

Answer selected by plaraje
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants