aboutsummaryrefslogtreecommitdiff
path: root/commands/Moderation/softban.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/softban.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/softban.js')
-rw-r--r--commands/Moderation/softban.js52
1 files changed, 28 insertions, 24 deletions
diff --git a/commands/Moderation/softban.js b/commands/Moderation/softban.js
index 7c5119b..3bbab28 100644
--- a/commands/Moderation/softban.js
+++ b/commands/Moderation/softban.js
@@ -8,27 +8,30 @@
* *************************************/
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 softban?');
+ if (!member) {
+ return msg.reply('Who am I gonna softban?');
+ }
const reason = args.join(' ').slice(3 + member.user.id.length);
+ try {
+ await member.ban({days: 7, reason: `${msg.author.tag }: ${ reason ? reason : ''}`});
+ msg.channel.send(`Alright, I softbanned **${member.user.tag}**${(reason ? ` for the reason **${reason}**.` : '.')}`);
+ } catch(err) {
+ msg.reply('There was an error.');
+ return console.error(err.stack);
+ }
+ try{
+ await msg.guild.unban(member.user.id);
+ } catch(err) {
+ msg.reply('There was an error.');
+ return console.error(err.stack);
+ }
- 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 softbanned **${member.user.tag}**${(reason ? ` for the reason **${reason}**.` : '.')}`);
- });
- await msg.guild.unban(member.user.id)
- .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)
@@ -40,26 +43,27 @@ exports.run = async (bot, msg, args) => {
.setTimestamp()
.setFooter(`${msg.author.tag} softbanned ${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: 'softban',
description: 'Kick the user and delete their messages.',
- usage: '@user <...reason>',
+ usage: '@user <...reason>'
};