aboutsummaryrefslogtreecommitdiff
path: root/src/commands/dev/reload.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands/dev/reload.ts')
-rw-r--r--src/commands/dev/reload.ts22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/commands/dev/reload.ts b/src/commands/dev/reload.ts
index 96c395f..8c2000f 100644
--- a/src/commands/dev/reload.ts
+++ b/src/commands/dev/reload.ts
@@ -1,4 +1,13 @@
-import { BushCommand, type CommandMessage, type SlashMessage } from '#lib';
+import {
+ BushCommand,
+ clientSendAndPermCheck,
+ codeblock,
+ emojis,
+ formatError,
+ shell,
+ type CommandMessage,
+ type SlashMessage
+} from '#lib';
export default class ReloadCommand extends BushCommand {
public constructor() {
@@ -22,19 +31,18 @@ export default class ReloadCommand extends BushCommand {
ownerOnly: true,
typing: true,
slash: true,
- clientPermissions: (m) => util.clientSendAndPermCheck(m),
+ clientPermissions: (m) => clientSendAndPermCheck(m),
userPermissions: []
});
}
public override async exec(message: CommandMessage | SlashMessage /* args: { fast: ArgType<'flag'> } */) {
- if (!message.author.isOwner())
- return await message.util.reply(`${util.emojis.error} Only my developers can run this command.`);
+ if (!message.author.isOwner()) return await message.util.reply(`${emojis.error} Only my developers can run this command.`);
let output: { stdout: string; stderr: string };
try {
const s = new Date();
- output = await util.shell(`yarn build:${/* args.fast ? 'esbuild' : */ 'tsc'}`);
+ output = await shell(`yarn build:${/* args.fast ? 'esbuild' : */ 'tsc'}`);
await Promise.all([
client.commandHandler.reloadAll(),
client.listenerHandler.reloadAll(),
@@ -46,9 +54,7 @@ export default class ReloadCommand extends BushCommand {
return message.util.send(`🔁 Successfully reloaded! (${new Date().getTime() - s.getTime()}ms)`);
} catch (e) {
if (output!) void client.logger.error('reloadCommand', output);
- return message.util.send(
- `An error occurred while reloading:\n${await util.codeblock(util.formatError(e), 2048 - 34, 'js', true)}`
- );
+ return message.util.send(`An error occurred while reloading:\n${await codeblock(formatError(e), 2048 - 34, 'js', true)}`);
}
}
}