Guest User

discord.js problem

a guest
Feb 12th, 2021
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if (!message.mentions.users.first()){
  2.             message.channel.send('Whoops! You need to specify a person to warn!')
  3.         }
  4.         else{
  5.             try{
  6.                 const mentionedUser = message.mentions.members.first();
  7.                 if (!message.member.hasPermission('MANAGE_ROLES')) return message.channel.send('You do not have the necessary permissions!');
  8.                 if (!mentionedUser) {
  9.                     message.channel.send('You have to mention the person you want to assign the role to!');
  10.                 }
  11.                 if (mentionedUser.roles.cache.has(warn1)){
  12.                     if (mentionedUser.roles.cache.has(warn2)){
  13.                         if (mentionedUser.roles.cache.has(warn3)){
  14.                             if (mentionedUser.roles.cache.has(beenMuted)){
  15.                                 message.guild.kick(mentionedUser);
  16.                             }
  17.                             else{
  18.                                 mentionedUser.roles.add(mute);
  19.                                 mentionedUser.roles.add(beenMuted);
  20.                             }
  21.                         }
  22.                         else{
  23.                             message.channel.send('Already has 2 warnings.');
  24.                             mentionedUser.roles.add(warn3);
  25.                         }
  26.                     }
  27.                     else{
  28.                         message.channel.send('Already has 1 warning.')
  29.                         mentionedUser.roles.add(warn2);
  30.                     }
  31.                 }
  32.                 else{
  33.                     mentionedUser.roles.add(warn1);
  34.                     message.channel.send('Warned the user.');
  35.                 }
  36.             }
  37.             catch(error){
  38.                 message.channel.send('Whoops! I failed to execute that command.');
  39.                 console.error(error);
  40.             }
  41.         }
Advertisement
Add Comment
Please, Sign In to add comment