aboutsummaryrefslogtreecommitdiff
path: root/src/commands
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands')
-rw-r--r--src/commands/config/config.ts4
-rw-r--r--src/commands/config/features.ts2
-rw-r--r--src/commands/moderation/warn.ts1
-rw-r--r--src/commands/utilities/wolframAlpha.ts4
4 files changed, 7 insertions, 4 deletions
diff --git a/src/commands/config/config.ts b/src/commands/config/config.ts
index 4cab741..2075531 100644
--- a/src/commands/config/config.ts
+++ b/src/commands/config/config.ts
@@ -198,7 +198,7 @@ export default class SettingsCommand extends BushCommand {
const action = message.util.isSlash ? args.subcommand! : args.action!;
const value = args.value;
- let msg;
+ let msg: Message;
if (!setting || action === 'view') {
const messageOptions = await this.generateMessageOptions(message, setting ?? undefined);
@@ -241,7 +241,7 @@ export default class SettingsCommand extends BushCommand {
}
const collector = msg.createMessageComponentCollector({
time: 300_000,
- filter: (i) => i.guildId === message.guildId && i.message.id === message.id
+ filter: (i) => i.guildId === msg.guildId && i.message.id === msg.id
});
collector.on('collect', async (interaction: MessageComponentInteraction) => {
diff --git a/src/commands/config/features.ts b/src/commands/config/features.ts
index 743b243..076d469 100644
--- a/src/commands/config/features.ts
+++ b/src/commands/config/features.ts
@@ -30,7 +30,7 @@ export default class FeaturesCommand extends BushCommand {
const collector = msg.createMessageComponentCollector({
componentType: 'SELECT_MENU',
time: 300_000,
- filter: (i) => i.guildId === message.guildId && i.message.id === message.id
+ filter: (i) => i.guildId === msg.guildId && i.message.id === msg.id
});
collector.on('collect', async (interaction: SelectMenuInteraction) => {
diff --git a/src/commands/moderation/warn.ts b/src/commands/moderation/warn.ts
index 44f4f5a..b4bf74d 100644
--- a/src/commands/moderation/warn.ts
+++ b/src/commands/moderation/warn.ts
@@ -60,6 +60,7 @@ export default class WarnCommand extends BushCommand {
{ user, reason, force }: { user: BushUser; reason: string; force: boolean }
): Promise<unknown> {
const member = message.guild!.members.cache.get(user.id) as BushGuildMember;
+ if (!member) return message.util.reply(`${util.emojis.error} I cannot warn users that are not in the server.`);
const useForce = force && message.author.isOwner();
if (!message.member) throw new Error(`message.member is null`);
const canModerateResponse = await util.moderationPermissionCheck(message.member, member, 'warn', true, useForce);
diff --git a/src/commands/utilities/wolframAlpha.ts b/src/commands/utilities/wolframAlpha.ts
index 69e2ff4..2b64c9c 100644
--- a/src/commands/utilities/wolframAlpha.ts
+++ b/src/commands/utilities/wolframAlpha.ts
@@ -1,5 +1,5 @@
import { AllowedMentions, BushCommand, BushMessage, BushSlashMessage } from '@lib';
-import { MessageEmbed } from 'discord.js';
+import { CommandInteraction, MessageEmbed } from 'discord.js';
// @ts-expect-error: no types :(
import WolframAlphaAPI from 'wolfram-alpha-api';
@@ -39,6 +39,8 @@ export default class WolframAlphaCommand extends BushCommand {
});
}
public override async exec(message: BushMessage | BushSlashMessage, args: { expression: string }): Promise<unknown> {
+ if (message.util.isSlash) await (message.interaction as CommandInteraction).deferReply();
+
const waApi = WolframAlphaAPI(client.config.credentials.wolframAlphaAppId);
const decodedEmbed = new MessageEmbed().addField('📥 Input', await util.inspectCleanRedactCodeblock(args.expression));