Shutdown Command

This commit is contained in:
Daniel Odendahl Jr
2017-09-23 03:41:18 +00:00
parent c764d5cb85
commit fb4bb67821
2 changed files with 31 additions and 1 deletions
+30
View File
@@ -0,0 +1,30 @@
const Command = require('../../structures/Command');
module.exports = class ShutdownCommand extends Command {
constructor(client) {
super(client, {
name: 'shutdown',
aliases: ['restart', 'power-off'],
group: 'util',
memberName: 'shutdown',
description: 'Shuts down the current shard, or all shards.',
guarded: true,
ownerOnly: true,
args: [
{
key: 'all',
prompt: 'Would you like to shutdown all shards?',
type: 'boolean',
default: false
}
]
});
}
async run(msg, { all }) {
await msg.say(`Shutting down ${all ? 'all shards' : 'this shard'}...`);
if (all) await this.client.shard.broadcastEval('process.exit(0)');
else process.exit(0);
return null;
}
};