Sir_Spaceboi

sban

Dec 20th, 2020
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     // Permision Check
  2.     if (!message.member.permissions.has("BAN_MEMBERS")) return message.channel.send('You cannot use this command.');
  3.     if (!message.guild.me.permissions.has("BAN_MEMBERS")) return message.channel.send('I dont have the correct permissions to do this command.');
  4.  
  5.     // Variables
  6.     let reason = args.slice(1).join(" ");
  7.     const mentioned = message.mentions.members.first();
  8.  
  9.     // Input Checking
  10.     if (!reason) reason = 'No reason provided';
  11.     if (!args[0]) return message.channel.send('You must provide a user to ban.')
  12.     if (!mentioned) return message.channel.send('Invalid  user mentioned.')
  13.     if (!mentioned.bannable) return message.channel.send('I could not ban that user.')
  14.  
  15.     // Executing
  16.     const bEmbed = new Discord.MessageEmbed()
  17.     .setTitle('Banned')
  18.     .setDescription(`You have been banned from ${message.guild.name} for ${reason}`)
  19.     .setTimestamp()
  20.  
  21.     await mentioned.send(bEmbed).catch(err => console.log(err));
  22.     await mentioned.ban({
  23.       days: 7,
  24.       reason: reason
  25.     }).then(user => mentioned.unban).catch(err => console.log(err)).then(() => message.channel.send('Successfully banned ' + mentioned.user.tag)).then(() => bot.num++).then(() => console.log(bot.num))
Advertisement
Add Comment
Please, Sign In to add comment