diff options
Diffstat (limited to 'src/commands/owner/reload.ts')
-rw-r--r-- | src/commands/owner/reload.ts | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/commands/owner/reload.ts b/src/commands/owner/reload.ts index 6fdd74c..7a508d7 100644 --- a/src/commands/owner/reload.ts +++ b/src/commands/owner/reload.ts @@ -1,6 +1,7 @@ import { BotCommand } from '../../lib/extensions/BotCommand'; import { stripIndent } from 'common-tags'; import { Message } from 'discord.js'; +import { CommandInteraction } from 'discord.js'; export default class ReloadCommand extends BotCommand { constructor() { @@ -16,19 +17,27 @@ export default class ReloadCommand extends BotCommand { }); } - public async exec(message: Message): Promise<void> { + private async getResponse(): Promise<string> { try { await this.client.util.shell('yarn rimraf dist/'); await this.client.util.shell('yarn tsc'); this.client.commandHandler.reloadAll(); this.client.listenerHandler.reloadAll(); this.client.inhibitorHandler.reloadAll(); - await message.util.send('🔁 Successfully reloaded!'); + return '🔁 Successfully reloaded!'; } catch (e) { - await message.util.send(stripIndent` + return stripIndent` An error occured while reloading: ${await this.client.util.haste(e.stack)} - `); + `; } } + + public async exec(message: Message): Promise<void> { + await message.util.send(await this.getResponse()) + } + + public async execSlash(message: CommandInteraction): Promise<void> { + await message.reply(await this.getResponse()) + } } |