A variety of fixes and a change in the way errors are handled.

This commit is contained in:
Daniel Odendahl Jr
2017-04-25 17:37:01 +00:00
parent d3dad31c6d
commit 49d092d7c1
51 changed files with 117 additions and 108 deletions
+7 -7
View File
@@ -6,11 +6,11 @@ module.exports = class LockdownCommand extends Command {
name: 'lockdown',
group: 'moderation',
memberName: 'lockdown',
description: 'Locks down the current channel or removes a lockdown, which prevents non-roled members from speaking.',
description: 'Locks down the current channel or removes a lockdown, which prevents non-administrator members from speaking.',
guildOnly: true,
args: [{
key: 'type',
prompt: 'Please enter either start or stop.',
prompt: 'Please enter either `start` or `stop`.',
type: 'string',
validate: type => {
if (['start', 'stop'].includes(type.toLowerCase()))
@@ -28,25 +28,25 @@ module.exports = class LockdownCommand extends Command {
async run(message, args) {
if (!message.channel.permissionsFor(this.client.user).hasPermission('ADMINISTRATOR'))
return message.say(':x: Error! I don\'t have the Administrator Permission!');
return message.say('This Command requires the `Administrator` Permission.');
const { type } = args;
if (type === 'start') {
try {
await message.channel.overwritePermissions(message.guild.defaultRole, {
SEND_MESSAGES: false
});
return message.say('**Lockdown Started, users without Administrator can no longer post messages. Please use `;lockdown stop` to end the lockdown.**');
return message.say('Lockdown Started, users without Administrator can no longer post messages. Please use `;lockdown stop` to end the lockdown.');
} catch (err) {
return message.say(':x: Error! Something went wrong!');
return message.say('Something went wrong!');
}
} else if (type === 'stop') {
try {
await message.channel.overwritePermissions(message.guild.defaultRole, {
SEND_MESSAGES: true
});
return message.say('**Lockdown Ended, users without Administrator can now post messages.**');
return message.say('Lockdown Ended, users without Administrator can now post messages.');
} catch (err) {
return message.say(':x: Error! Something went wrong!');
return message.say('An Unknown Error Occurred.');
}
}
}