Skip to content

Commit

Permalink
make invalid faq message translatable
Browse files Browse the repository at this point in the history
  • Loading branch information
3vorp committed Dec 25, 2023
1 parent d377cd2 commit 280a84d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
6 changes: 6 additions & 0 deletions lang/en-US/commands.json
Original file line number Diff line number Diff line change
Expand Up @@ -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!",
Expand Down
18 changes: 10 additions & 8 deletions src/commands/faithful/faq.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
Expand Down

0 comments on commit 280a84d

Please sign in to comment.