diff options
author | TymanWasTaken <32660892+tymanwastaken@users.noreply.github.com> | 2021-05-28 21:51:02 -0600 |
---|---|---|
committer | TymanWasTaken <32660892+tymanwastaken@users.noreply.github.com> | 2021-05-28 21:51:02 -0600 |
commit | 1e9e334097702c68d871365fc016aa096d03c491 (patch) | |
tree | 65b22d1d529cda850e5c30e9fe19a2504fca2645 /src/commands/owner/reload.ts | |
parent | 53d8d5e551e9a239fd4c48c7dca4e1f6fb8d81e9 (diff) | |
download | tanzanite-1e9e334097702c68d871365fc016aa096d03c491.tar.gz tanzanite-1e9e334097702c68d871365fc016aa096d03c491.tar.bz2 tanzanite-1e9e334097702c68d871365fc016aa096d03c491.zip |
Remove references - caused some issues, comment out some image gen code
Diffstat (limited to 'src/commands/owner/reload.ts')
-rw-r--r-- | src/commands/owner/reload.ts | 43 |
1 files changed, 34 insertions, 9 deletions
diff --git a/src/commands/owner/reload.ts b/src/commands/owner/reload.ts index 0330b27..8ba6160 100644 --- a/src/commands/owner/reload.ts +++ b/src/commands/owner/reload.ts @@ -2,6 +2,8 @@ import { BotCommand } from '../../lib/extensions/BotCommand'; import { stripIndent } from 'common-tags'; import { Message } from 'discord.js'; import { CommandInteraction } from 'discord.js'; +import { SlashCommandOption } from '../../lib/extensions/Util'; +import { ApplicationCommandOptionType } from 'discord-api-types'; export default class ReloadCommand extends BotCommand { constructor() { @@ -12,19 +14,36 @@ export default class ReloadCommand extends BotCommand { usage: 'reload', examples: ['reload'] }, + args: [ + { + id: 'fast', + match: 'flag', + flag: '--fast' + } + ], ownerOnly: true, - typing: true + typing: true, + slashCommandOptions: [ + { + type: ApplicationCommandOptionType.BOOLEAN, + name: 'fast', + description: 'Wheather to use esbuild for fast compiling or not', + required: false + } + ] }); } - private async getResponse(): Promise<string> { + private async getResponse(fast: boolean): Promise<string> { try { - await this.client.util.shell('yarn rimraf dist/'); - await this.client.util.shell('yarn tsc'); + 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!'; + return `🔁 Successfully reloaded! (${ + new Date().getTime() - s.getTime() + }ms)`; } catch (e) { return stripIndent` An error occured while reloading: @@ -33,11 +52,17 @@ export default class ReloadCommand extends BotCommand { } } - public async exec(message: Message): Promise<void> { - await message.util.send(await this.getResponse()); + public async exec( + message: Message, + { fast }: { fast: boolean } + ): Promise<void> { + await message.util.send(await this.getResponse(fast)); } - public async execSlash(message: CommandInteraction): Promise<void> { - await message.reply(await this.getResponse()); + public async execSlash( + message: CommandInteraction, + { fast }: { fast: SlashCommandOption<boolean> } + ): Promise<void> { + await message.reply(await this.getResponse(fast?.value)); } } |