I'm working on a bot for a client, and I'm making a warning system that can be triggered by (prefix) warn <user mention>
. I have the code below.
I can run the command once, and it will add the Warning 1 role, but subsequent commands don't add warnings 2 or 3.
if (mentionedUser.roles.cache.has(warn1)){
if (mentionedUser.roles.cache.has(warn2)){
message.channel.send('Already has 2 warnings.');
mentionedUser.addRole(warn3);
}
else{
message.channel.send('Already has 1 warning.')
mentionedUser.addRole(warn2);
}
}
else{
mentionedUser.roles.add(warn1);
message.channel.send('Warned the user.');
}