diff options
Diffstat (limited to 'src/commands')
-rw-r--r-- | src/commands/dev/eval.ts | 10 | ||||
-rw-r--r-- | src/commands/moderation/purge.ts | 4 | ||||
-rw-r--r-- | src/commands/utilities/price.ts | 4 | ||||
-rw-r--r-- | src/commands/utilities/suicide.ts | 4 | ||||
-rw-r--r-- | src/commands/utilities/wolframAlpha.ts | 4 |
5 files changed, 13 insertions, 13 deletions
diff --git a/src/commands/dev/eval.ts b/src/commands/dev/eval.ts index c4a6e8f..46fe889 100644 --- a/src/commands/dev/eval.ts +++ b/src/commands/dev/eval.ts @@ -67,8 +67,8 @@ export default class EvalCommand extends BushCommand { ): Promise<unknown> { if (!message.author.isOwner()) return await message.util.reply(`${util.emojis.error} Only my developers can run this command.`); - if (message.util.isSlash) { - await (message as BushSlashMessage).interaction.deferReply({ ephemeral: args.silent }); + if (message.util.isSlashMessage(message)) { + await message.interaction.deferReply({ ephemeral: args.silent }); } const _isTypescript = args.typescript || args.code.includes('```ts'); const _code = args.code.replace(/[“”]/g, '"').replace(/```*(?:js|ts)?/g, ''); @@ -156,14 +156,14 @@ export default class EvalCommand extends BushCommand { embed.setTimestamp().setFooter(message.author.tag, message.author.displayAvatarURL({ dynamic: true }) ?? undefined); - if (!args.silent || message.util.isSlash) { + if (!args.silent || message.util.isSlashMessage(message)) { await message.util.reply({ embeds: [embed] }); } else { try { await message.author.send({ embeds: [embed] }); - if (!args.deleteMSG) await (message as BushMessage).react(emojis.successFull); + if (!args.deleteMSG) await message.react(emojis.successFull); } catch { - if (!args.deleteMSG) await (message as BushMessage).react(emojis.errorFull); + if (!args.deleteMSG) await message.react(emojis.errorFull); } } if (args.deleteMSG && (message as BushMessage).deletable) await (message as BushMessage).delete(); diff --git a/src/commands/moderation/purge.ts b/src/commands/moderation/purge.ts index 65555a1..472665c 100644 --- a/src/commands/moderation/purge.ts +++ b/src/commands/moderation/purge.ts @@ -66,9 +66,9 @@ export default class PurgeCommand extends BushCommand { client.emit('bushPurge', message.author, message.guild!, message.channel, messages); await message.util.send(`${util.emojis.success} Successfully purged **${purged.size}** messages.`); /* .then(async (purgeMessage) => { - if (!message.util.isSlash) { + if (!message.util.isSlashMessage(message)) { await util.sleep(5); - await (purgeMessage as Message).delete().catch(() => {}); + await purgeMessage.delete().catch(() => {}); } }); */ } diff --git a/src/commands/utilities/price.ts b/src/commands/utilities/price.ts index 4d21c02..059533b 100644 --- a/src/commands/utilities/price.ts +++ b/src/commands/utilities/price.ts @@ -1,5 +1,5 @@ import { BushCommand, BushMessage } from '@lib'; -import { CommandInteraction, MessageEmbed } from 'discord.js'; +import { MessageEmbed } from 'discord.js'; import Fuse from 'fuse.js'; import got from 'got'; @@ -95,7 +95,7 @@ export default class PriceCommand extends BushCommand { } public override async exec(message: BushMessage, { item, strict }: { item: string; strict: boolean }): Promise<unknown> { - if (message.util.isSlash) await (message.interaction as CommandInteraction).deferReply(); + if (message.util.isSlashMessage(message)) await message.interaction.deferReply(); const errors = new Array<string>(); //prettier-ignore diff --git a/src/commands/utilities/suicide.ts b/src/commands/utilities/suicide.ts index 9289b1c..31bdca0 100644 --- a/src/commands/utilities/suicide.ts +++ b/src/commands/utilities/suicide.ts @@ -47,8 +47,8 @@ export default class TemplateCommand extends BushCommand { return ( // If the original message was a reply -> imitate it - (message as BushMessage).reference?.messageId && !message.util.isSlash && message.guild && message.channel - ? await message.channel.messages.fetch((message as BushMessage).reference!.messageId!).then(async (message1) => { + !message.util.isSlashMessage(message) && message.reference?.messageId && message.guild && message.channel + ? await message.channel.messages.fetch(message.reference!.messageId!).then(async (message1) => { await message1.reply({ embeds: [suicideEmbed], allowedMentions: AllowedMentions.users(), target: message1 }); }) : await message.util.send({ embeds: [suicideEmbed], allowedMentions: AllowedMentions.users() }) diff --git a/src/commands/utilities/wolframAlpha.ts b/src/commands/utilities/wolframAlpha.ts index 049dd60..426a0c7 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 { CommandInteraction, MessageEmbed, MessageOptions } from 'discord.js'; +import { MessageEmbed, MessageOptions } from 'discord.js'; import WolframAlphaAPI from 'wolfram-alpha-api'; export default class WolframAlphaCommand extends BushCommand { @@ -48,7 +48,7 @@ export default class WolframAlphaCommand extends BushCommand { message: BushMessage | BushSlashMessage, args: { expression: string; image: boolean } ): Promise<unknown> { - if (message.util.isSlash) await (message.interaction as CommandInteraction).deferReply(); + if (message.util.isSlashMessage(message)) await message.interaction.deferReply(); args.image && void message.util.reply({ content: `${util.emojis.loading} Loading...`, embeds: [] }); const waApi = WolframAlphaAPI(client.config.credentials.wolframAlphaAppId); |