Clean-Ups

This commit is contained in:
Daniel Odendahl Jr
2017-05-31 04:41:01 +00:00
parent 21ebcf8537
commit 7802bb49cb
142 changed files with 351 additions and 495 deletions
+8 -14
View File
@@ -1,4 +1,4 @@
const { Command } = require('discord.js-commando');
const Command = require('../../structures/Command');
const { RichEmbed } = require('discord.js');
const { stripIndents } = require('common-tags');
@@ -10,6 +10,9 @@ module.exports = class KickCommand extends Command {
memberName: 'kick',
description: 'Kicks a user and logs the kick to the mod logs.',
guildOnly: true,
clientPermissions: ['KICK_MEMBERS'],
userPermissions: ['KICK_MEMBERS'],
allowStaff: true,
args: [
{
key: 'member',
@@ -29,22 +32,13 @@ module.exports = class KickCommand extends Command {
});
}
hasPermission(msg) {
const staffRole = msg.guild.roles.get(msg.guild.settings.get('staffRole'));
if (staffRole && !msg.member.roles.has(staffRole.id)) return `You do not have the ${staffRole.name} role.`;
else if (!msg.member.hasPermission('KICK_MEMBERS')) return 'You do not have the `Kick Members` Permission.';
else return true;
}
async run(msg, args) {
if (!msg.channel.permissionsFor(this.client.user).has('KICK_MEMBERS'))
return msg.say('This Command requires the `Kick Members` Permission.');
const modlogs = msg.guild.channels.get(msg.guild.settings.get('modLog'));
if (!modlogs) return msg.say('This Command requires a channel set with the `modchannel` command.');
if (!modlogs) return msg.say('This Command requires a channel set with the `mod-channel` command.');
if (!modlogs.permissionsFor(this.client.user).has('SEND_MESSAGES'))
return msg.say('This Command requires the `Send Messages` Permission for the Mod Log Channel.');
return msg.say('This Command requires the `SEND_MESSAGES` Permission for the Mod Log Channel.');
if (!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS'))
return msg.say('This Command requires the `Embed Links` Permission.');
return msg.say('This Command requires the `EMBED_LINKS` Permission for the Mod Log Channel.');
const { member, reason } = args;
if (!member.kickable) return msg.say('This member is not kickable. Perhaps they have a higher role than me?');
try {
@@ -67,7 +61,7 @@ module.exports = class KickCommand extends Command {
**Action:** Kick
**Reason:** ${reason}
`);
await modlogs.send({ embed });
modlogs.send({ embed });
return null;
} catch (err) {
return msg.say(`${err.name}: ${err.message}`);