aboutsummaryrefslogtreecommitdiff
path: root/src/commands/owner/reload.ts
diff options
context:
space:
mode:
authorTymanWasTaken <tyman@tyman.tech>2021-05-18 23:16:35 -0400
committerTymanWasTaken <tyman@tyman.tech>2021-05-18 23:16:35 -0400
commit3b02bab4f786b9beb5afa18606d3e1d8fea0003d (patch)
tree5a7803bc265390fc6c952d13f3b64cf884f60fb9 /src/commands/owner/reload.ts
parent4309aa31de6431a0a8f2140238227ae5d8751c3c (diff)
downloadtanzanite-3b02bab4f786b9beb5afa18606d3e1d8fea0003d.tar.gz
tanzanite-3b02bab4f786b9beb5afa18606d3e1d8fea0003d.tar.bz2
tanzanite-3b02bab4f786b9beb5afa18606d3e1d8fea0003d.zip
that should be it for adding slash commands to existing commands (yes I skipped eval)
Diffstat (limited to 'src/commands/owner/reload.ts')
-rw-r--r--src/commands/owner/reload.ts17
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())
+ }
}