I need to check if a user has a predefined role, and if it has the role, remove it. If it does not, then send a message saying something.
let user = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0]));
let muterole = message.guild.roles.find(x => x.name === "Muted");
if (user.roles.has(muterole)) user.removeRole(muterole);
if (!user.roles.has(muterole)) message.channel.send("This user does not have the muted role!");
I expected it to remove the role if the user
had it, and to send a message if he did not.
However my current results are it sends the message no matter if he has the Muted
role, and if he does have it, it does not remove it.
My end goal is this. My mute
command uses node ms
so I can mute for a specified time, so I need an unmute, but if the user is unmuted, that does not stop the timer (I don't think there is a way) so my idea was to put in the mute command -> "If user has mute
after time remove the role, but if the user does not have the mute
role, return"