From 1e9e334097702c68d871365fc016aa096d03c491 Mon Sep 17 00:00:00 2001 From: TymanWasTaken <32660892+tymanwastaken@users.noreply.github.com> Date: Fri, 28 May 2021 21:51:02 -0600 Subject: Remove references - caused some issues, comment out some image gen code --- src/commands/owner/reload.ts | 43 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 9 deletions(-) (limited to 'src/commands/owner/reload.ts') 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 { + private async getResponse(fast: boolean): Promise { 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 { - await message.util.send(await this.getResponse()); + public async exec( + message: Message, + { fast }: { fast: boolean } + ): Promise { + await message.util.send(await this.getResponse(fast)); } - public async execSlash(message: CommandInteraction): Promise { - await message.reply(await this.getResponse()); + public async execSlash( + message: CommandInteraction, + { fast }: { fast: SlashCommandOption } + ): Promise { + await message.reply(await this.getResponse(fast?.value)); } } -- cgit