Created /locale command to set locale of a guild#105
Open
Created /locale command to set locale of a guild#105
Conversation
1 task
# Conflicts: # src/main/kotlin/services/lavaplayer/GuildLavaPlayerService.kt
Wikijito7
commented
Feb 8, 2026
Comment on lines
+58
to
+65
| response.respond { | ||
| content = localizationService.getString( | ||
| key = LocalizationKeys.ERROR_NO_GUILD, | ||
| guildId = null, | ||
| discordLocale = discordLocale | ||
| ) | ||
| } | ||
| return |
Owner
Author
There was a problem hiding this comment.
use error managment instead (throw exception)
Comment on lines
+71
to
+78
| response.respond { | ||
| content = localizationService.getStringFormat( | ||
| key = LocalizationKeys.ERROR_NO_CONTENT_PROVIDED, | ||
| guildId = guildId, | ||
| discordLocale = discordLocale, | ||
| arguments = arrayOf(ARGUMENT_LOCALE) | ||
| ) | ||
| } |
|
javdc
approved these changes
Feb 8, 2026
| * Map of Discord locale codes to Locale objects. | ||
| * Source: https://discord.com/developers/docs/reference#locales | ||
| */ | ||
| val DISCORD_LOCALE_MAP = mapOf( |
Collaborator
There was a problem hiding this comment.
I'd avoid maintaining a list defined manually when we can do something like this:
val DISCORD_LOCALE_MAP = Locale.ALL.associateBy {
listOfNotNull(it.language, it.country).joinToString("-")
}Also, I think it would make more sense to do it the other way around (locale as key, code as value)
Comment on lines
+126
to
+127
| guildId: dev.kord.common.entity.Snowflake, | ||
| discordLocale: dev.kord.common.Locale?, |
Collaborator
There was a problem hiding this comment.
Use imports (check the rest of the class)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Solves #60.
📋 Changelist Summary
Created /locale command to set locale of a guild
💬 Description
Created /locale command to set the locale of a given Guild. This locale is saved on a json file inside data. It is read only once when the bot is loaded and kept in memory as a map guildId to locale.
In this PR we update all commands to support this new usage of LocaleService.