Skip to content

feat(interaction): send member locale from interaction#99

Merged
Tweentyy merged 3 commits into
developfrom
feat/environment-per-user
Apr 23, 2026
Merged

feat(interaction): send member locale from interaction#99
Tweentyy merged 3 commits into
developfrom
feat/environment-per-user

Conversation

@Tweentyy
Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings April 23, 2026 21:40
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a framework-level locale abstraction (StelliaLocale) and wires Discord interaction user locale through interaction execution hooks, enabling command/button/etc handlers to receive the member’s locale directly.

Changes:

  • Add StelliaLocale enum and export it via @typescript/index.js.
  • Update interaction structure execute(...) signatures to include a memberLocale: StelliaLocale parameter.
  • Update guild configuration/translation typing to use StelliaLocale, and adjust getGuildConfiguration to return null (instead of undefined).

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/utils/translation.ts Switches translation locale typing from Discord Locale to StelliaLocale.
src/typescript/types.ts Updates configuration typing to use StelliaLocale; changes GuildConfigurationType to null-based absence.
src/typescript/locale.ts Adds the StelliaLocale enum defining supported base language codes.
src/typescript/index.ts Re-exports the new locale module.
src/structures/Interaction.ts Extends all interaction execute(...) signatures to include memberLocale.
src/client/StelliaUtils.ts Converts Discord locale to StelliaLocale and passes it into handlers; updates guild config retrieval to return null.
src/client/StelliaClient.ts Updates getGuildConfiguration return type to null-based absence.
Comments suppressed due to low confidence (1)

src/client/StelliaUtils.ts:91

  • getGuildConfiguration can return an object whose guild field is undefined when guilds[guildId] has no entry. That breaks the GuildConfiguration contract and can lead to runtime errors in handlers expecting guild.locale, etc. Consider returning null (or throwing) when guildConfiguration is missing, or changing the GuildsConfiguration.guilds type to explicitly allow missing keys and handle that case here.
		const { guilds, general } = this.guildsConfiguration;
		const guildConfiguration = guilds[guildId];

		return {
			general: general,
			guild: guildConfiguration
		} as CustomGuildConfiguration;

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/client/StelliaUtils.ts Outdated
Comment on lines +276 to +278
} else {
const modalWithoutGuildConfiguration = selectMenu as SelectMenuStructureWithoutGuildConfiguration;
await modalWithoutGuildConfiguration.execute(this.client, selectMenuInteraction);
await modalWithoutGuildConfiguration.execute(this.client, memberLocale, selectMenuInteraction);
Comment thread src/typescript/locale.ts Outdated
Comment on lines +2 to +30
Indonesian = "id",
English = "en",
Bulgarian = "bg",
Chinese = "zh",
Croatian = "hr",
Czech = "cs",
Danish = "da",
Dutch = "nl",
Finnish = "fi",
French = "fr",
German = "de",
Greek = "el",
Hindi = "hi",
Hungarian = "hu",
Italian = "it",
Japanese = "ja",
Korean = "ko",
Lithuanian = "lt",
Norwegian = "no",
Polish = "pl",
Portuguese = "pt",
Romanian = "ro",
Russian = "ru",
Spanish = "es",
Swedish = "sv",
Thai = "th",
Turkish = "tr",
Ukrainian = "uk",
Vietnamese = "vi"
@Tweentyy Tweentyy merged commit f122ce2 into develop Apr 23, 2026
@Tweentyy Tweentyy deleted the feat/environment-per-user branch April 23, 2026 21:47
@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants