Skip to content

Commit

Permalink
fix(locale): fix locale setting problem
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-737 committed Feb 2, 2024
1 parent a4ea55d commit 63c87ad
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/commands/slash/Main/set/language.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ChatInputCommandInteraction } from 'discord.js';
import db from '../../../../utils/Db.js';
import { emojis } from '../../../../utils/Constants.js';
import { supportedLocaleCodes, t } from '../../../../utils/Locale.js';
import { supportedLocaleCodes, supportedLocales, t } from '../../../../utils/Locale.js';
import Set from './index.js';

const locales: { [key: string]: string } = {
Expand All @@ -16,11 +16,11 @@ export default class SetLanguage extends Set {
async execute(interaction: ChatInputCommandInteraction) {
const locale = interaction.options.getString('lang', true) as supportedLocaleCodes;

if (locale in locales === false) {
if (Object.keys(supportedLocales).includes(locale)) {
return await interaction.reply({
content:
t(
{ phrase: 'errors.invalidLanguageCode', locale: interaction.user.locale },
{ phrase: 'errors.invalidLangCode', locale: interaction.user.locale },
{ emoji: emojis.info },
),
ephemeral: true,
Expand Down

0 comments on commit 63c87ad

Please sign in to comment.