diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-07-10 21:54:43 +0200 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-07-10 21:54:43 +0200 |
commit | 627979e836edd0801f9201a98e239bf697a211be (patch) | |
tree | 0cf2d347d4eb6f02bfcc714307c4e211664c53b9 /src/commands/utilities/wolframAlpha.ts | |
parent | 131b44f23be250aed2aeacdb51321b141d2ede4f (diff) | |
download | tanzanite-627979e836edd0801f9201a98e239bf697a211be.tar.gz tanzanite-627979e836edd0801f9201a98e239bf697a211be.tar.bz2 tanzanite-627979e836edd0801f9201a98e239bf697a211be.zip |
allow more config options to be null / not set
Diffstat (limited to 'src/commands/utilities/wolframAlpha.ts')
-rw-r--r-- | src/commands/utilities/wolframAlpha.ts | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/commands/utilities/wolframAlpha.ts b/src/commands/utilities/wolframAlpha.ts index 3cd0653..bac9f58 100644 --- a/src/commands/utilities/wolframAlpha.ts +++ b/src/commands/utilities/wolframAlpha.ts @@ -54,8 +54,17 @@ export default class WolframAlphaCommand extends BushCommand { ) { if (message.util.isSlashMessage(message)) await message.interaction.deferReply(); - args.image && void message.util.reply({ content: `${emojis.loading} Loading...`, embeds: [] }); - const waApi = WolframAlphaAPI(this.client.config.credentials.wolframAlphaAppId); + const appId = this.client.config.credentials.wolframAlphaAppId; + + if (appId === null || appId === '' || appId === '[APP_ID]') + return message.util.reply( + message.author.isSuperUser() + ? `${emojis.error} The 'wolframAlphaAppId' credential isn't set so this command cannot be used.` + : `${emojis.error} Sorry, this command is unavailable.` + ); + + if (args.image) void message.util.reply({ content: `${emojis.loading} Loading...`, embeds: [] }); + const waApi = WolframAlphaAPI(appId); const decodedEmbed = new EmbedBuilder().addFields({ name: '📥 Input', |