From 280a84d30906a5b80a2918369f25f5ede378e63a Mon Sep 17 00:00:00 2001 From: Evorp <3vorpgaming@gmail.com> Date: Mon, 25 Dec 2023 14:53:15 -0800 Subject: [PATCH] make invalid faq message translatable --- lang/en-US/commands.json | 6 ++++++ src/commands/faithful/faq.ts | 18 ++++++++++-------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/lang/en-US/commands.json b/lang/en-US/commands.json index 4790cf97..d9dab09d 100644 --- a/lang/en-US/commands.json +++ b/lang/en-US/commands.json @@ -29,6 +29,12 @@ "not_enough_arguments": "Not enough information was provided!", "need_more_info": "You need to have either a description or title for an embed." }, + "faq": { + "invalid_choice": { + "title": "Invalid choice!", + "description": "`%CHOICE%` is not a valid FAQ keyword! Have you made a typo?" + } + }, "poll": { "ended": "This poll has ended!", "suggestion": "Use /poll to make a poll!", diff --git a/src/commands/faithful/faq.ts b/src/commands/faithful/faq.ts index 2c87268b..313d41fa 100644 --- a/src/commands/faithful/faq.ts +++ b/src/commands/faithful/faq.ts @@ -46,14 +46,16 @@ export const command: SlashCommand = { const faqChoice = faqStrings.find((faq) => faq.keywords.includes(choice)); - if (!faqChoice) { - const errorEmbed = new EmbedBuilder() - .setTitle("Invalid choice!") - .setDescription(`\`${choice}\` is not a valid FAQ keyword! Have you made a typo?`) - .setColor(colors.red); - - return interaction.reply({ embeds: [errorEmbed], ephemeral: true }); - } + if (!faqChoice) + return interaction.reply({ + embeds: [ + new EmbedBuilder() + .setTitle(interaction.strings().command.faq.invalid_choice.title) + .setDescription(interaction.strings().command.faq.invalid_choice.description) + .setColor(colors.red), + ], + ephemeral: true, + }); const question: string = ( await axios.get(`${interaction.client.tokens.apiUrl}settings/images.question`)