I'm looking to see if you can check if you can test for a specific user having a role. Only problem is that I'm fairly new to Discord.js and everything I searched up was either outdated, was something I couldn't fully understand or only showed how to test if the author of the message has the role, which is not what I'm trying to find out. What should I change in my current coding?
if (message.member.permissions.has("MANAGE_ROLES")) {
const member = message.mentions.users.first();
const memberTarget = message.guild.members.cache.get(member.id);
const role = message.guild.roles.cache.find(role => role.name === "Awesome Role Name");
if (memberTarget.roles.cache.has(role)) {
message.channel.send(`${memberTarget} has the role!`);
} else {
message.channel.send(`${memberTarget} does not have the role!`);
}
}
}
};