aboutsummaryrefslogtreecommitdiff
path: root/src/commands/dev/reload.ts
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-06-27 18:08:14 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-06-27 18:08:14 -0400
commit747b3c8302245699294b671d19b3d31d63f80bc1 (patch)
treead3d987bb38d5bdaed67e6aca1263fb06331f746 /src/commands/dev/reload.ts
parent4176b6258e44e4a095376aaf0f4c687244243a69 (diff)
downloadtanzanite-747b3c8302245699294b671d19b3d31d63f80bc1.tar.gz
tanzanite-747b3c8302245699294b671d19b3d31d63f80bc1.tar.bz2
tanzanite-747b3c8302245699294b671d19b3d31d63f80bc1.zip
did this a while ago so I don't remeber what I did
Diffstat (limited to 'src/commands/dev/reload.ts')
-rw-r--r--src/commands/dev/reload.ts26
1 files changed, 12 insertions, 14 deletions
diff --git a/src/commands/dev/reload.ts b/src/commands/dev/reload.ts
index f5fee88..07218f2 100644
--- a/src/commands/dev/reload.ts
+++ b/src/commands/dev/reload.ts
@@ -1,7 +1,7 @@
-import { stripIndent } from 'common-tags';
-import { Message } from 'discord.js';
+import { ApplicationCommandOptionType } from 'discord-api-types';
import { BushCommand } from '../../lib/extensions/BushCommand';
-import { BushSlashMessage } from '../../lib/extensions/BushInteractionMessage';
+import { BushMessage } from '../../lib/extensions/BushMessage';
+import { BushSlashMessage } from '../../lib/extensions/BushSlashMessage';
export default class ReloadCommand extends BushCommand {
constructor() {
@@ -24,7 +24,7 @@ export default class ReloadCommand extends BushCommand {
typing: true,
slashOptions: [
{
- type: 'BOOLEAN',
+ type: ApplicationCommandOptionType.BOOLEAN,
name: 'fast',
description: 'Whether to use esbuild for fast compiling or not',
required: false
@@ -34,23 +34,21 @@ export default class ReloadCommand extends BushCommand {
});
}
- private async getResponse(fast: boolean): Promise<string> {
+ public async exec(message: BushMessage | BushSlashMessage, { fast }: { fast: boolean }): Promise<unknown> {
+ if (!message.author.isOwner())
+ return await message.util.reply(`${this.client.util.emojis.error} Only my developers can run this command.`);
+
try {
const s = new Date();
await this.client.util.shell(`yarn build-${fast ? 'esbuild' : 'tsc'}`);
this.client.commandHandler.reloadAll();
this.client.listenerHandler.reloadAll();
this.client.inhibitorHandler.reloadAll();
- return `🔁 Successfully reloaded! (${new Date().getTime() - s.getTime()}ms)`;
+ return message.util.send(`🔁 Successfully reloaded! (${new Date().getTime() - s.getTime()}ms)`);
} catch (e) {
- return stripIndent`
- An error occured while reloading:
- ${await this.client.util.haste(e.stack)}
- `;
+ return message.util.send(
+ `An error occurred while reloading:\n${await this.client.util.codeblock(e.stack, 2048 - 34, 'js')}`
+ );
}
}
-
- public async exec(message: Message | BushSlashMessage, { fast }: { fast: boolean }): Promise<void> {
- await message.util.send(await this.getResponse(fast));
- }
}