Unban and fixes for the other mod commands

This commit is contained in:
Daniel Odendahl Jr
2017-03-30 20:53:08 +00:00
parent 8a44832d98
commit 34cbf278df
4 changed files with 134 additions and 32 deletions
+21 -10
View File
@@ -17,7 +17,13 @@ module.exports = class WarnCommand extends commando.Command {
}, {
key: 'reason',
prompt: 'What do you want to set the reason as?',
type: 'string'
type: 'string',
validate: reason => {
if (reason.length < 141) {
return true;
}
return "Please keep your reason under 140 characters.";
}
}]
});
}
@@ -33,14 +39,19 @@ module.exports = class WarnCommand extends commando.Command {
let userToWarn = args.member;
let reason = args.reason;
if (!message.guild.channels.exists("name", "mod_logs")) return message.say(":x: Error! Could not find the mod_logs channel! Please create it!");
let okHandMsg = await message.say(":ok_hand:");
const embed = new Discord.RichEmbed()
.setAuthor(`${message.author.username}#${message.author.discriminator}`, message.author.avatarURL)
.setColor(0xFFFF00)
.setFooter('XiaoBot Moderation', this.client.user.avatarURL)
.setTimestamp()
.setDescription(`**Member:** ${userToWarn.user.username}#${userToWarn.user.discriminator} (${userToWarn.id})\n**Action:** Warn\n**Reason:** ${reason}`);
let modLogMsg = await message.guild.channels.find('name', 'mod_logs').sendEmbed(embed);
return [okHandMsg, modLogMsg];
try {
let okHandMsg = await message.say(":ok_hand:");
const embed = new Discord.RichEmbed()
.setAuthor(`${message.author.username}#${message.author.discriminator}`, message.author.avatarURL)
.setColor(0xFFFF00)
.setFooter('XiaoBot Moderation', this.client.user.avatarURL)
.setTimestamp()
.setDescription(`**Member:** ${userToWarn.user.username}#${userToWarn.user.discriminator} (${userToWarn.id})\n**Action:** Warn\n**Reason:** ${reason}`);
let modLogMsg = await message.guild.channels.find('name', 'mod_logs').sendEmbed(embed);
return [okHandMsg, modLogMsg];
}
catch (err) {
return message.say(':x: Error! Something went wrong!');
}
}
};