how do i check if a user is an admin

i want to have a discord command which deletes everything in a server. but i don't know how to check if the user who sent it is an admin how do i check?
7 Replies
d.js toolkit
d.js toolkit2d ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
bringupyourpost
bringupyourpostOP2d ago
i did this interaction.member.permissions.has(PermissionFlagsBits.Administrator) but it didn't work
bringupyourpost
bringupyourpostOP2d ago
No description
d.js docs
d.js docs2d ago
documentation suggestion for @bringupyourpost: :property: BaseInteraction#memberPermissions [email protected] The permissions of the member, if one exists, in the channel this interaction was executed in
Булочка | pasha_boez
It's better. But i can't understand if your case not working Do you import PermissionFlagsBits?
sludge
sludge2d ago
when you say it didn't work, how so?
bringupyourpost
bringupyourpostOP2d ago
oh ok i fixed it

Did you find this page helpful?