check roles of user with id discord.js code example

Example 1: check member role discordjs 12

if (message.member.roles.find(r => r.name === "ROLE_NAME")) {
        //Rest of your code
    }

Example 2: checking if a user has a role in discord js

//other code
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);            
        }   
    }
}