From fb4bb67821124be3971c3caa0babb99934b4f857 Mon Sep 17 00:00:00 2001 From: Daniel Odendahl Jr Date: Sat, 23 Sep 2017 03:41:18 +0000 Subject: [PATCH] Shutdown Command --- commands/util/shutdown.js | 30 ++++++++++++++++++++++++++++++ package.json | 2 +- 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 commands/util/shutdown.js diff --git a/commands/util/shutdown.js b/commands/util/shutdown.js new file mode 100644 index 00000000..33f2513d --- /dev/null +++ b/commands/util/shutdown.js @@ -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; + } +}; diff --git a/package.json b/package.json index c0548be6..cb44d74c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiaobot", - "version": "42.3.0", + "version": "42.4.0", "description": "Your personal server companion.", "main": "Shard.js", "scripts": {