diff --git a/src/client/interaction.ts b/src/client/interaction.ts index 4741c2648..c53352e93 100644 --- a/src/client/interaction.ts +++ b/src/client/interaction.ts @@ -16,23 +16,23 @@ export type PermissionType = "manager" | "dev" | "moderator" | "council"; declare module "discord.js" { interface ChatInputCommandInteraction { client: ExtendedClient; // so you don't have to cast it every time - strings(): AllStrings; + strings(forceEnglish?: boolean): AllStrings; hasPermission(type: PermissionType): boolean; } interface ButtonInteraction { client: ExtendedClient; - strings(): AllStrings; + strings(forceEnglish?: boolean): AllStrings; } interface StringSelectMenuInteraction { client: ExtendedClient; - strings(): AllStrings; + strings(forceEnglish?: boolean): AllStrings; } interface ModalSubmitInteraction { client: ExtendedClient; - strings(): AllStrings; + strings(forceEnglish?: boolean): AllStrings; } } diff --git a/src/client/message.ts b/src/client/message.ts index ff9bcd493..8a8a68de2 100644 --- a/src/client/message.ts +++ b/src/client/message.ts @@ -9,7 +9,7 @@ declare module "discord.js" { client: ExtendedClient; // so you don't have to cast it every time /** @param hasAuthorID whether to search for an author id in the footer or the interaction owner */ deleteButton(hasAuthorID?: boolean): Promise; - strings(): AllStrings; + strings(forceEnglish?: boolean): AllStrings; } } diff --git a/src/helpers/images/palette.ts b/src/helpers/images/palette.ts index d2043b377..e29a500c2 100644 --- a/src/helpers/images/palette.ts +++ b/src/helpers/images/palette.ts @@ -206,9 +206,10 @@ export async function paletteTooBig( | StringSelectMenuInteraction | Message, ) { + // force english if it's a message return warnUser( interaction, - interaction.strings().command.images.too_big.replace("%ACTION%", "take the palette of"), - interaction.strings().command.images.max_size, + interaction.strings(interaction instanceof Message).command.images.too_big.replace("%ACTION%", "take the palette of"), + interaction.strings(interaction instanceof Message).command.images.max_size, ); } diff --git a/src/helpers/images/tile.ts b/src/helpers/images/tile.ts index 8057eae28..9936e1350 100644 --- a/src/helpers/images/tile.ts +++ b/src/helpers/images/tile.ts @@ -156,9 +156,10 @@ export async function tileTooBig( | StringSelectMenuInteraction | Message, ) { + // force english if it's a message return warnUser( interaction, - interaction.strings().command.images.too_big.replace("%ACTION%", "be tiled"), - interaction.strings().command.images.max_size, + interaction.strings(interaction instanceof Message).command.images.too_big.replace("%ACTION%", "be tiled"), + interaction.strings(interaction instanceof Message).command.images.max_size, ); } diff --git a/src/helpers/strings.ts b/src/helpers/strings.ts index 003a048c8..2376e1ed0 100644 --- a/src/helpers/strings.ts +++ b/src/helpers/strings.ts @@ -10,7 +10,7 @@ export type AllStrings = typeof baseTranslations; * @author Evorp * @returns string output in correct language */ -export function strings(): AllStrings { +export function strings(forceEnglish = false): AllStrings { const countryCode = this.locale; let lang: AllStrings; // load all english strings into one lang object @@ -20,7 +20,7 @@ export function strings(): AllStrings { ...require(`@/lang/en-US/${json}.json`), // fallback }; - if (countryCode == "en-GB" || countryCode == "en-US") return lang; + if (countryCode == "en-GB" || countryCode == "en-US" || forceEnglish) return lang; // because the fallback is already IN ENGLISH for (const json of JSONFiles)