mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-21 14:04:38 +02:00
Better Error Handling
This commit is contained in:
@@ -15,8 +15,7 @@ module.exports = class LockdownCommand extends Command {
|
||||
prompt: 'Please enter either `start` or `stop`.',
|
||||
type: 'string',
|
||||
validate: type => {
|
||||
if(['start', 'stop'].includes(type.toLowerCase()))
|
||||
return true;
|
||||
if(['start', 'stop'].includes(type.toLowerCase())) return true;
|
||||
return 'Please enter either `start` or `stop`.';
|
||||
},
|
||||
parse: type => type.toLowerCase()
|
||||
@@ -38,17 +37,17 @@ module.exports = class LockdownCommand extends Command {
|
||||
await msg.channel.overwritePermissions(msg.guild.defaultRole, { SEND_MESSAGES: false });
|
||||
return msg.say(stripIndents`
|
||||
Lockdown Started, users without Administrator can no longer post messages.
|
||||
Please use \`;lockdown stop\` to end the lockdown.
|
||||
Please use \`lockdown stop\` to end the lockdown.
|
||||
`);
|
||||
} catch(err) {
|
||||
return msg.say('Something went wrong!');
|
||||
return msg.say(`An Error Occurred: ${err}`);
|
||||
}
|
||||
} else if(type === 'stop') {
|
||||
try {
|
||||
await msg.channel.overwritePermissions(msg.guild.defaultRole, { SEND_MESSAGES: true });
|
||||
return msg.say('Lockdown Ended, users without Administrator can now post messages.');
|
||||
} catch(err) {
|
||||
return msg.say('An Unknown Error Occurred.');
|
||||
return msg.say(`An Error Occurred: ${err}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user