aboutsummaryrefslogtreecommitdiff
path: root/commands/kick.js
diff options
context:
space:
mode:
Diffstat (limited to 'commands/kick.js')
-rw-r--r--commands/kick.js12
1 files changed, 8 insertions, 4 deletions
diff --git a/commands/kick.js b/commands/kick.js
index 49906a1..c6a8408 100644
--- a/commands/kick.js
+++ b/commands/kick.js
@@ -1,10 +1,14 @@
-exports.run = (bot, msg, args) => {
+exports.run = async (bot, msg, args) => {
if (!msg.member.hasPermission('KICK_MEMBERS')) return msg.reply('You don\'t have permssion to kick members');
if (!msg.guild.member(bot.user).hasPermission('KICK_MEMBERS')) return msg.reply('I don\'t have permssion to kick members');
+
const member = msg.mentions.members.first();
- member.kick(msg.author.tag + ': ' + args.join(' ').slice(3 + member.user.id.length)).then(() => {
- msg.channel.send(`Alright, I kicked **${member.user.tag}** for the reason **${args.join(' ').slice(3 + member.user.id.length)}**`);
- });
+ if (!member) return await msg.reply('Who am I gonna kick?');
+ const reason = args.join(' ').slice(3 + member.user.id.length);
+
+ await member.kick(msg.author.tag + ': ' + (reason ? ': ' + reason : ''))
+ .catch(err => { msg.reply('There was an error.'); console.error(err.stack);});
+ msg.channel.send(`Alright, I kicked **${member.user.tag}**${(reason ? ` for the reason **${reason}**.` : '.')}`);
};
exports.conf = {