From 8849ef0bec17abd1f01b63981e227707e04f151d Mon Sep 17 00:00:00 2001 From: Ben Williams Date: Sun, 28 Jan 2024 11:03:26 +0000 Subject: [PATCH] interaction already replied in faq print-all --- .github/CHANGELOG.md | 1 + src/commands/moderation/faq/functions/faqPrintAll.ts | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/CHANGELOG.md b/.github/CHANGELOG.md index 85c51f19..b51c655b 100644 --- a/.github/CHANGELOG.md +++ b/.github/CHANGELOG.md @@ -2,6 +2,7 @@ Update _ January 2024 +- fix: interaction already replied in faq print-all (28/01/2024) - fix: command names (28/01/2024) - fix: ignore Dyno bot (27/01/2024) - fix: use - instead of _ in command names (27/01/2024) diff --git a/src/commands/moderation/faq/functions/faqPrintAll.ts b/src/commands/moderation/faq/functions/faqPrintAll.ts index 859f2e76..e9f573ea 100644 --- a/src/commands/moderation/faq/functions/faqPrintAll.ts +++ b/src/commands/moderation/faq/functions/faqPrintAll.ts @@ -33,8 +33,8 @@ export async function handlePrintAllFAQ(interaction: ChatInputCommandInteraction const faqs = await FAQ.find(); if (faqs.length === 0) { - await interaction.reply('No FAQs found.'); - } else if (interaction.channel) { + return interaction.followUp('No FAQs found.'); + } if (interaction.channel) { await interaction.channel.send({ files: [FLIGHT_DECK_IMAGE_URL] }); // Divide the FAQs into sets of 5 @@ -61,12 +61,12 @@ export async function handlePrintAllFAQ(interaction: ChatInputCommandInteraction await interaction.channel.send({ embeds: [linksEmbed] }); } else { - await interaction.reply({ content: 'FAQs can only be printed in a text channel.', ephemeral: true }); + return interaction.followUp({ content: 'FAQs can only be printed in a text channel.', ephemeral: true }); } } catch (error) { Logger.error('Error fetching FAQs:', error); - await interaction.reply('An error occurred while fetching FAQs.'); + return interaction.followUp('An error occurred while fetching FAQs.'); } - await interaction.followUp({ content: 'FAQs printed successfully.', ephemeral: true }); + return interaction.followUp({ content: 'FAQs printed successfully.', ephemeral: true }); }