aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-12-11 17:09:46 -0500
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-12-11 17:09:46 -0500
commit430787969d73de770385f5ee0a131fc85f433762 (patch)
treeacd7225ad805290e2ae879765e255e4891dc3226
parent624445fa6d6f19da1aead1aa2ecc15f878fae231 (diff)
downloadtanzanite-430787969d73de770385f5ee0a131fc85f433762.tar.gz
tanzanite-430787969d73de770385f5ee0a131fc85f433762.tar.bz2
tanzanite-430787969d73de770385f5ee0a131fc85f433762.zip
hopefully handle some errors better
-rw-r--r--src/commands/info/help.ts21
-rw-r--r--src/lib/extensions/discord-akairo/BushClient.ts1
2 files changed, 13 insertions, 9 deletions
diff --git a/src/commands/info/help.ts b/src/commands/info/help.ts
index 629e57f..8b6720b 100644
--- a/src/commands/info/help.ts
+++ b/src/commands/info/help.ts
@@ -1,6 +1,7 @@
import { BushCommand, BushMessage, BushSlashMessage } from '#lib';
import { MessageActionRow, MessageButton, MessageEmbed } from 'discord.js';
-import packageDotJSON from '../../../package.json';
+
+const packageDotJSON = await import('../../../package.json').catch(() => null);
export default class HelpCommand extends BushCommand {
public constructor() {
@@ -49,7 +50,7 @@ export default class HelpCommand extends BushCommand {
const isSuperUser = client.isSuperUser(message.author);
const command = args.command
? typeof args.command === 'string'
- ? client.commandHandler.modules.get(args.command) ?? null
+ ? (client.commandHandler.findCommand(args.command) as BushCommand) ?? null
: args.command
: null;
if (!isOwner) args.showHidden = false;
@@ -138,13 +139,15 @@ export default class HelpCommand extends BushCommand {
})
);
}
- row.addComponents(
- new MessageButton({
- style: 'LINK',
- label: 'GitHub',
- url: packageDotJSON.repository
- })
- );
+ if (packageDotJSON)
+ row.addComponents(
+ new MessageButton({
+ style: 'LINK',
+ label: 'GitHub',
+ url: packageDotJSON.repository
+ })
+ );
+ else void message.channel?.send('Error importing package.json, please report this to my developer.');
return row;
}
diff --git a/src/lib/extensions/discord-akairo/BushClient.ts b/src/lib/extensions/discord-akairo/BushClient.ts
index 45ad7ca..c87a1d9 100644
--- a/src/lib/extensions/discord-akairo/BushClient.ts
+++ b/src/lib/extensions/discord-akairo/BushClient.ts
@@ -367,6 +367,7 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Re
await this.login(this.token!);
} catch (e) {
await this.console.error('start', util.inspect(e, { colors: true, depth: 1 }), false);
+ process.exit(1);
}
}