From 701eb132cb7a8368e868d5107cc3e9e70cac6ffd Mon Sep 17 00:00:00 2001 From: Bsian Date: Mon, 18 Nov 2019 20:14:43 +0000 Subject: [PATCH] Added restart command --- src/commands/restart.ts | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/commands/restart.ts diff --git a/src/commands/restart.ts b/src/commands/restart.ts new file mode 100644 index 0000000..0f80600 --- /dev/null +++ b/src/commands/restart.ts @@ -0,0 +1,23 @@ +import { Message } from 'eris'; +import { Client } from '..'; +import { Command } from '../class'; + +export default class Restart extends Command { + constructor(client: Client) { + super(client); + this.name = 'restart'; + this.description = 'Restart the bot'; + this.permissions = { users: ['253600545972027394', '278620217221971968'] }; + this.enabled = true; + } + + public async run(message: Message, args: string[]) { + try { + if (this.client.updating && args[0] !== '-f') return message.channel.createMessage(`${this.client.stores.emojis.error} ***Update in progress***`); + await message.channel.createMessage(`${this.client.stores.emojis.loading} ***Restarting...***`); + return process.exit(1); + } catch (error) { + return this.client.util.handleError(error, message, this); + } + } +}