From 3b02bab4f786b9beb5afa18606d3e1d8fea0003d Mon Sep 17 00:00:00 2001 From: TymanWasTaken Date: Tue, 18 May 2021 23:16:35 -0400 Subject: that should be it for adding slash commands to existing commands (yes I skipped eval) --- src/commands/owner/reload.ts | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'src/commands/owner/reload.ts') 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 { + private async getResponse(): Promise { 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 { + await message.util.send(await this.getResponse()) + } + + public async execSlash(message: CommandInteraction): Promise { + await message.reply(await this.getResponse()) + } } -- cgit