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');
@@ -11,6 +11,9 @@ module.exports = class BanCommand extends Command {
memberName: 'ban',
description: 'Bans a user and logs the ban to the mod logs.',
guildOnly: true,
clientPermissions: ['BAN_MEMBERS'],
userPermissions: ['BAN_MEMBERS'],
allowStaff: true,
args: [
{
key: 'member',
@@ -30,22 +33,13 @@ module.exports = class BanCommand 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('BAN_MEMBERS')) return 'You do not have the `Ban Members` Permission.';
else return true;
}
async run(msg, args) {
if (!msg.channel.permissionsFor(this.client.user).has('BAN_MEMBERS'))
return msg.say('This Command requires the `Ban 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.bannable) return msg.say('This member is not bannable. Perhaps they have a higher role than me?');
try {
@@ -68,7 +62,7 @@ module.exports = class BanCommand extends Command {
**Action:** Ban
**Reason:** ${reason}
`);
await modlogs.send({ embed });
modlogs.send({ embed });
return null;
} catch (err) {
return msg.say(`${err.name}: ${err.message}`);
+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}`);
+4 -10
View File
@@ -1,4 +1,4 @@
const { Command } = require('discord.js-commando');
const Command = require('../../structures/Command');
const { stripIndents } = require('common-tags');
module.exports = class LockdownCommand extends Command {
@@ -9,6 +9,9 @@ module.exports = class LockdownCommand extends Command {
memberName: 'lockdown',
description: 'Locks down the current channel or removes a lockdown, which prevents non-administrator members from speaking.',
guildOnly: true,
clientPermissions: ['ADMINISTRATOR'],
userPermissions: ['ADMINISTRATOR'],
allowStaff: true,
args: [
{
key: 'type',
@@ -25,16 +28,7 @@ module.exports = class LockdownCommand 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('ADMINISTRATOR')) return 'You do not have the `Administrator` Permission.';
else return true;
}
async run(msg, args) {
if (!msg.channel.permissionsFor(this.client.user).has('ADMINISTRATOR'))
return msg.say('This Command requires the `Administrator` Permission.');
const { type } = args;
if (type === 'start') {
try {
+4 -13
View File
@@ -1,4 +1,4 @@
const { Command } = require('discord.js-commando');
const Command = require('../../structures/Command');
module.exports = class PruneCommand extends Command {
constructor(client) {
@@ -12,6 +12,9 @@ module.exports = class PruneCommand extends Command {
usages: 1,
duration: 15
},
clientPermissions: ['READ_MESSAGE_HISTORY', 'MANAGE_MESSAGES'],
userPermissions: ['MANAGE_MESSAGES'],
allowStaff: true,
args: [
{
key: 'count',
@@ -26,19 +29,7 @@ module.exports = class PruneCommand 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('MANAGE_MESSAGES')) return 'You do not have the `Manage Messages` Permission.';
else return true;
}
async run(msg, args) {
if (!msg.channel.permissionsFor(this.client.user).has('READ_MESSAGE_HISTORY'))
return msg.say('This Command requires the `Read Message History` Permission.');
if (!msg.channel.permissionsFor(this.client.user).has('MANAGE_MESSAGES'))
return msg.say('This Command requires the `Manage Messages` Permission.');
const { count } = args;
try {
const messages = await msg.channel.fetchMessages({ limit: count + 1 });
+8 -16
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');
@@ -11,6 +11,9 @@ module.exports = class SoftbanCommand extends Command {
memberName: 'softban',
description: 'Kicks a user and deletes their messages, and logs the softban to the mod logs.',
guildOnly: true,
clientPermissions: ['BAN_MEMBERS'],
userPermissions: ['KICK_MEMBERS'],
allowStaff: true,
args: [
{
key: 'member',
@@ -30,24 +33,13 @@ module.exports = class SoftbanCommand 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('BAN_MEMBERS'))
return msg.say('This Command requires the `Ban Members` Permission.');
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.bannable) return msg.say('This member is not softbannable. Perhaps they have a higher role than me?');
try {
@@ -71,7 +63,7 @@ module.exports = class SoftbanCommand extends Command {
**Action:** Softban
**Reason:** ${reason}
`);
await modlogs.send({ embed });
modlogs.send({ embed });
return null;
} catch (err) {
return msg.say(`${err.name}: ${err.message}`);
+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');
@@ -11,6 +11,9 @@ module.exports = class UnbanCommand extends Command {
memberName: 'unban',
description: 'Unbans a user and logs the unban to the mod logs.',
guildOnly: true,
clientPermissions: ['BAN_MEMBERS'],
userPermissions: ['BAN_MEMBERS'],
allowStaff: true,
args: [
{
key: 'id',
@@ -30,22 +33,13 @@ module.exports = class UnbanCommand 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('BAN_MEMBERS')) return 'You do not have the `Ban Members` Permission.';
else return true;
}
async run(msg, args) {
if (!msg.channel.permissionsFor(this.client.user).has('BAN_MEMBERS'))
return msg.say('This Command requires the `Ban 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 { id, reason } = args;
const bans = await msg.guild.fetchBans();
if (!bans.has(id)) return msg.say('This ID is not in the Guild Banlist.');
@@ -62,7 +56,7 @@ module.exports = class UnbanCommand extends Command {
**Action:** Unban
**Reason:** ${reason}
`);
await modlogs.send({ embed });
modlogs.send({ embed });
return null;
} catch (err) {
return msg.say(`${err.name}: ${err.message}`);
+6 -11
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,8 @@ module.exports = class WarnCommand extends Command {
memberName: 'warn',
description: 'Warns a user and logs the warn to the mod logs.',
guildOnly: true,
allowStaff: true,
userPermissions: ['KICK_MEMBERS'],
args: [
{
key: 'member',
@@ -29,20 +31,13 @@ module.exports = class WarnCommand 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) {
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 warnable. Perhaps they have a higher role than me?');
try {