aboutsummaryrefslogtreecommitdiff
path: root/src/commands
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands')
-rw-r--r--src/commands/info/help.ts13
-rw-r--r--src/commands/info/links.ts11
-rw-r--r--src/commands/utilities/wolframAlpha.ts13
3 files changed, 26 insertions, 11 deletions
diff --git a/src/commands/info/help.ts b/src/commands/info/help.ts
index ec079e7..d8d91d5 100644
--- a/src/commands/info/help.ts
+++ b/src/commands/info/help.ts
@@ -211,14 +211,17 @@ export default class HelpCommand extends BushCommand {
private addLinks(message: CommandMessage | SlashMessage) {
const row = new ActionRowBuilder<ButtonBuilder>();
+ const config = this.client.config;
- if (!this.client.config.isDevelopment && !this.client.guilds.cache.some((guild) => guild.ownerId === message.author.id)) {
+ if (!config.isDevelopment && !this.client.guilds.cache.some((guild) => guild.ownerId === message.author.id)) {
row.addComponents(new ButtonBuilder({ style: ButtonStyle.Link, label: 'Invite Me', url: invite(this.client) }));
}
- if (!this.client.guilds.cache.get(this.client.config.supportGuild.id)?.members.cache.has(message.author.id)) {
- row.addComponents(
- new ButtonBuilder({ style: ButtonStyle.Link, label: 'Support Server', url: this.client.config.supportGuild.invite })
- );
+ if (
+ config.supportGuild.id &&
+ config.supportGuild.invite &&
+ !this.client.guilds.cache.get(config.supportGuild.id)?.members.cache.has(message.author.id)
+ ) {
+ row.addComponents(new ButtonBuilder({ style: ButtonStyle.Link, label: 'Support Server', url: config.supportGuild.invite }));
}
if (packageDotJSON?.repository)
row.addComponents(new ButtonBuilder({ style: ButtonStyle.Link, label: 'GitHub', url: packageDotJSON.repository }));
diff --git a/src/commands/info/links.ts b/src/commands/info/links.ts
index 3671c6c..3c7add2 100644
--- a/src/commands/info/links.ts
+++ b/src/commands/info/links.ts
@@ -24,10 +24,13 @@ export default class LinksCommand extends BushCommand {
if (!this.client.config.isDevelopment || message.author.isOwner()) {
buttonRow.addComponents(new ButtonBuilder({ style: ButtonStyle.Link, label: 'Invite Me', url: invite(this.client) }));
}
- buttonRow.addComponents(
- new ButtonBuilder({ style: ButtonStyle.Link, label: 'Support Server', url: this.client.config.supportGuild.invite }),
- new ButtonBuilder({ style: ButtonStyle.Link, label: 'GitHub', url: packageDotJSON.repository })
- );
+ const supportInvite = this.client.config.supportGuild.invite;
+
+ if (supportInvite) {
+ buttonRow.addComponents(new ButtonBuilder({ style: ButtonStyle.Link, label: 'Support Server', url: supportInvite }));
+ }
+
+ buttonRow.addComponents(new ButtonBuilder({ style: ButtonStyle.Link, label: 'GitHub', url: packageDotJSON.repository }));
return await message.util.reply({ content: 'Here are some useful links:', components: [buttonRow] });
}
}
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',