Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Permision Check
- if (!message.member.permissions.has("BAN_MEMBERS")) return message.channel.send('You cannot use this command.');
- if (!message.guild.me.permissions.has("BAN_MEMBERS")) return message.channel.send('I dont have the correct permissions to do this command.');
- // Variables
- let reason = args.slice(1).join(" ");
- const mentioned = message.mentions.members.first();
- // Input Checking
- if (!reason) reason = 'No reason provided';
- if (!args[0]) return message.channel.send('You must provide a user to ban.')
- if (!mentioned) return message.channel.send('Invalid user mentioned.')
- if (!mentioned.bannable) return message.channel.send('I could not ban that user.')
- // Executing
- const bEmbed = new Discord.MessageEmbed()
- .setTitle('Banned')
- .setDescription(`You have been banned from ${message.guild.name} for ${reason}`)
- .setTimestamp()
- await mentioned.send(bEmbed).catch(err => console.log(err));
- await mentioned.ban({
- days: 7,
- reason: reason
- }).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