aboutsummaryrefslogtreecommitdiff
path: root/commands
diff options
context:
space:
mode:
authorUnknown <jtsshieh@outlook.com>2018-02-23 23:10:25 -0500
committerUnknown <jtsshieh@outlook.com>2018-02-23 23:10:25 -0500
commit7ca25ab373bd3142788f69fc0ea41e99194dc0e6 (patch)
tree7681e7100a06bfab02fb0eeb4a0eeba56bcf8d32 /commands
parent806e481a875fce14278858934991d20f5e0cfc9e (diff)
downloadPokeBot-7ca25ab373bd3142788f69fc0ea41e99194dc0e6.tar.gz
PokeBot-7ca25ab373bd3142788f69fc0ea41e99194dc0e6.tar.bz2
PokeBot-7ca25ab373bd3142788f69fc0ea41e99194dc0e6.zip
Done with things
Diffstat (limited to 'commands')
-rw-r--r--commands/ban.js12
-rw-r--r--commands/kick.js12
-rw-r--r--commands/softban.js14
3 files changed, 25 insertions, 13 deletions
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 = {
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 = {
diff --git a/commands/softban.js b/commands/softban.js
index acd29fc..9d0d741 100644
--- a/commands/softban.js
+++ b/commands/softban.js
@@ -1,11 +1,15 @@
-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.guild.unban(member.user.id);
- msg.channel.send(`Alright, I softbanned **${member.user.tag}** for the reason **${args.join(' ').slice(3 + member.user.id.length)}**`);
- });
+ if (!member) return await msg.reply('Who am I gonna softban?');
+ 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);});
+ await msg.guild.unban(member.user.id).catch(msg.reply('There was an error.'));
+ msg.channel.send(`Alright, I softbanned **${member.user.tag}**${(reason ? ` for the reason **${reason}**.` : '.')}`);
};
exports.conf = {