diff options
Diffstat (limited to 'src/commands/utilities/highlight-clear.ts')
-rw-r--r-- | src/commands/utilities/highlight-clear.ts | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/commands/utilities/highlight-clear.ts b/src/commands/utilities/highlight-clear.ts index e1cce2d..33893b9 100644 --- a/src/commands/utilities/highlight-clear.ts +++ b/src/commands/utilities/highlight-clear.ts @@ -1,4 +1,4 @@ -import { AllowedMentions, BushCommand, ConfirmationPrompt, Highlight, type BushMessage, type BushSlashMessage } from '#lib'; +import { AllowedMentions, BushCommand, ConfirmationPrompt, type BushMessage, type BushSlashMessage } from '#lib'; import assert from 'assert'; import { highlightSubcommands } from './highlight-!.js'; @@ -18,18 +18,13 @@ export default class HighlightClearCommand extends BushCommand { public override async exec(message: BushMessage | BushSlashMessage) { assert(message.inGuild()); - const [highlight] = await Highlight.findOrCreate({ - where: { - guild: message.guild.id, - user: message.author.id - } - }); + if (message.util.isSlashMessage(message)) await message.interaction.deferReply(); const confirm = await ConfirmationPrompt.send(message, { content: `Are you sure you want to clear your highlight list?` }); if (!confirm) return await message.util.reply(`${util.emojis.warn} You decided not to clear your highlight list.`); - highlight.words = []; - await highlight.save(); + const success = await client.highlightManager.removeAllHighlights(message.author.id, message.guild.id); + if (!success) return await message.util.reply(`${util.emojis.error} There was an error clearing your highlight list.`); return await message.util.reply({ content: `${util.emojis.success} Successfully cleared your highlight list.`, |