aboutsummaryrefslogtreecommitdiff
path: root/src/commands/info/help.ts
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 /src/commands/info/help.ts
parent624445fa6d6f19da1aead1aa2ecc15f878fae231 (diff)
downloadtanzanite-430787969d73de770385f5ee0a131fc85f433762.tar.gz
tanzanite-430787969d73de770385f5ee0a131fc85f433762.tar.bz2
tanzanite-430787969d73de770385f5ee0a131fc85f433762.zip
hopefully handle some errors better
Diffstat (limited to 'src/commands/info/help.ts')
-rw-r--r--src/commands/info/help.ts21
1 files changed, 12 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;
}