Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (!message.mentions.users.first()){
- message.channel.send('Whoops! You need to specify a person to warn!')
- }
- else{
- try{
- const mentionedUser = message.mentions.members.first();
- if (!message.member.hasPermission('MANAGE_ROLES')) return message.channel.send('You do not have the necessary permissions!');
- if (!mentionedUser) {
- message.channel.send('You have to mention the person you want to assign the role to!');
- }
- if (mentionedUser.roles.cache.has(warn1)){
- if (mentionedUser.roles.cache.has(warn2)){
- if (mentionedUser.roles.cache.has(warn3)){
- if (mentionedUser.roles.cache.has(beenMuted)){
- message.guild.kick(mentionedUser);
- }
- else{
- mentionedUser.roles.add(mute);
- mentionedUser.roles.add(beenMuted);
- }
- }
- else{
- message.channel.send('Already has 2 warnings.');
- mentionedUser.roles.add(warn3);
- }
- }
- else{
- message.channel.send('Already has 1 warning.')
- mentionedUser.roles.add(warn2);
- }
- }
- else{
- mentionedUser.roles.add(warn1);
- message.channel.send('Warned the user.');
- }
- }
- catch(error){
- message.channel.send('Whoops! I failed to execute that command.');
- console.error(error);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment