aboutsummaryrefslogtreecommitdiff
path: root/commands/Moderation/ban.js
diff options
context:
space:
mode:
authorJustin <jtsshieh@outlook.com>2019-11-02 11:02:19 -0400
committerJustin <jtsshieh@outlook.com>2019-11-02 11:02:19 -0400
commit7031fa12ba79281edc49df972311c13ad0e8fa53 (patch)
tree60410a33fe45add85a9dc962c975be478f3f8cff /commands/Moderation/ban.js
parent106530d5dc53166632a6a0ecc8930eb2b1ed4bfd (diff)
downloadPokeBot-7031fa12ba79281edc49df972311c13ad0e8fa53.tar.gz
PokeBot-7031fa12ba79281edc49df972311c13ad0e8fa53.tar.bz2
PokeBot-7031fa12ba79281edc49df972311c13ad0e8fa53.zip
es-lint settings added + linted all files
Diffstat (limited to 'commands/Moderation/ban.js')
-rw-r--r--commands/Moderation/ban.js39
1 files changed, 22 insertions, 17 deletions
diff --git a/commands/Moderation/ban.js b/commands/Moderation/ban.js
index 593d9e7..a4da613 100644
--- a/commands/Moderation/ban.js
+++ b/commands/Moderation/ban.js
@@ -8,21 +8,25 @@
* *************************************/
exports.run = async (bot, msg, args) => {
- if (!msg.guild.member(bot.user).hasPermission('BAN_MEMBERS')) return msg.reply('I don\'t have permission to ban members.');
+ if (!msg.guild.member(bot.user).hasPermission('BAN_MEMBERS')) {
+ return msg.reply('I don\'t have permission to ban members.');
+ }
const member = msg.mentions.members.first();
- if (!member) return await msg.reply('Who am I gonna ban? (Remember to @mention them)');
+ if (!member) {
+ return msg.reply('Who am I gonna ban? (Remember to @mention them)');
+ }
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.'); return console.error(err.stack);
- })
- .then(() => {
- msg.channel.send(`Alright, I banned **${member.user.tag}**${(reason ? ` for the reason **${reason}**.` : '.')}`);
- });
+ try {
+ await member.ban({days: 7, reason: msg.author.tag + (reason ? `: ${ reason}` : '')});
+ msg.channel.send(`Alright, I banned **${member.user.tag}**${(reason ? ` for the reason **${reason}**.` : '.')}`);
+
+ } catch(err) {
+ msg.reply('There was an error.'); return console.error(err.stack);
+ }
- const { RichEmbed } = require('discord.js');
+ const {RichEmbed} = require('discord.js');
try {
const embed = new RichEmbed()
.setColor(0x00ae86)
@@ -34,25 +38,26 @@ exports.run = async (bot, msg, args) => {
.setTimestamp()
.setFooter(`${msg.author.tag} banned ${member.user.tag}`, msg.author.avatarURL);
const logChannel = await bot.plugins.settings.getStr('logs', msg.guild.id);
- msg.guild.channels.find('id', logChannel).send({ embed });
- }
- catch (err) {
+ msg.guild.channels.find('id', logChannel).send({embed});
+ } catch (err) {
console.error(err.stack);
}
};
exports.checkPermission = (bot, member) => {
- if (!member.hasPermission('BAN_MEMBERS')) return 'You don\'t have permission to ban members.';
+ if (!member.hasPermission('BAN_MEMBERS')) {
+ return 'You don\'t have permission to ban members.';
+ }
return true;
-}
+};
exports.conf = {
aliases: [],
- guildOnly: true,
+ guildOnly: true
};
exports.help = {
name: 'ban',
description: 'Ban a user from this server.',
- usage: '@user <...reason>',
+ usage: '@user <...reason>'
};