if a member has this role do this discord.js code example
Example 1: if member has role discord.js
let allowedRole = message.guild.roles.find("name", "rolename");
if (message.member.roles.has(allowedRole.id) {
} else {
})
Example 2: checking if a user has a role in discord js
else if (command === "addquote" && arg) {
let adminRole = message.guild.roles.find("name", "Admin");
let modRole = message.guild.roles.find("name", "Mod");
if(message.member.roles.has(adminRole) || message.member.roles.has(modRole)){
const hasArr = arr.some((el) => {
return el.toLowerCase().replace(/\s/g, '') === arg.toLowerCase().replace(/\s/g, '');
});
if(hasArr){
message.channel.send(arg.replace(/\s+/g,' ').trim() + " is already a Quote");
} else {
fs.appendFileSync('./Quotes.txt', '\r\n' + arg);
message.channel.send("Quote added: " + arg);
arr.push(arg);
}
}
}