Skip to content
Advertisement

How to check if the mentioned participant has rights Discord.js

I’m trying to check if the mentioned member has admin rights, but I only know the option with the author of the post

message.member.permissions.has("BAN_MEMBERS")

Is there another option?

Advertisement

Answer

I’m not entirely sure but if your issue is checking to see if they have admin or finding that was mentioned, but just for checking to see if they have admin you can use

<user>.permissions.has("ADMINISTRATOR");

If your issue was finding the user that was mentioned, you can use skara9’s solution of

message.mentions.members.first()?.permissions.has("BAN_MEMBERS");

The ?. allows it to not throw an error if no user was mentioned.

You could combine both with

message.mentions.members.first()?.permissions.has("ADMINISTRATOR");
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement