Answer the question
In order to leave comments, you need to log in
How to check if a discord.js user has a role?
I tried to write:
if(message.member.roles.has(role.id))
but it does not work.
Answer the question
In order to leave comments, you need to log in
Checking for a role by name or id:
By name:
let rUser = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0]))
if (rUser.roles.cache.find(role => role.name == "Название роли")) message.channel.send("Роль всё таки есть ;)")
if (rUser.roles.cache.find(role => role.id == "айди роли")) message.channel.send("Роль всё таки есть ;)")
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question