From 7ca25ab373bd3142788f69fc0ea41e99194dc0e6 Mon Sep 17 00:00:00 2001 From: Unknown Date: Fri, 23 Feb 2018 23:10:25 -0500 Subject: Done with things --- commands/ban.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'commands/ban.js') diff --git a/commands/ban.js b/commands/ban.js index 6a1fffe..5e784e9 100644 --- a/commands/ban.js +++ b/commands/ban.js @@ -1,10 +1,14 @@ -exports.run = (bot, msg, args) => { +exports.run = async (bot, msg, args) => { if (!msg.member.hasPermission('BAN_MEMBERS')) return msg.reply('You don\'t have permssion to ban members'); if (!msg.guild.member(bot.user).hasPermission('BAN_MEMBERS')) return msg.reply('I don\'t have permssion to ban members'); + const member = msg.mentions.members.first(); - member.ban({ days: 7, reason: msg.author.tag + ': ' + args.join(' ').slice(3 + member.user.id.length) }).then(() => { - msg.channel.send(`Alright, I banned **${member.user.tag}** for the reason **${args.join(' ').slice(3 + member.user.id.length)}**`); - }); + if (!member) return await msg.reply('Who am I gonna ban?'); + const reason = args.join(' ').slice(3 + member.user.id.length); + + await member.ban({ days: 7, reason: msg.author.tag + (reason ? ': ' + reason : '') }) + .catch(err => { msg.reply('There was an error.'); console.error(err.stack);}); + msg.channel.send(`Alright, I banned **${member.user.tag}**${(reason ? ` for the reason **${reason}**.` : '.')}`); }; exports.conf = { -- cgit v1.2.3