Skip to content

Conversation

@freya022
Copy link
Owner

@freya022 freya022 commented Jul 10, 2025

Please see the readme for details about this feature.

  • Add enum LocaleScope
    • Values:
      • PREFER_USER: Use the user locale if available
      • GUILD: Use the guild locale
  • Add @PreferLocaleScope, throw if both a preferred scope and a required locale parameter exists
    • value: LocaleScope
  • Support first parameter being DiscordLocale/Locale, null = use initial locale
  • Convert camelCase parameters to snake_case
  • Throw if a formattable parameter is nullable or the argument is null at runtime (Use Objects.requireNonNull(T, String) to simplify)
  • Add FormattableArgumentConverter/ArgumentFormatter, maybe extend on ParameterResolver
    • Examples of built-ins:
      • Do not add Duration unless the user is able to localize those
      • IMentionables where any mentionable entity is transformed into its mention
    • Add @FormatWith to force usage of a specific formatter, for example the default IMentionable formatter could be overridden for Member and instead insert the member's effective name
  • (Breaking) Add LocalizableTemplate#arguments: List<FormattableArgument>
  • Add FormattableArgument#canFormat(Class<?>)
    • Return true by default, document that in unknown cases, it should return true and just let it fail at runtime
    • Make sure to pass the final type (after conversion)

@freya022 freya022 added this to the V3.1 milestone Jul 10, 2025
@freya022 freya022 added type: breaking Contains a backwards incompatible change type: feature V3 Targets BotCommands 3.x.x labels Jul 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: breaking Contains a backwards incompatible change type: feature V3 Targets BotCommands 3.x.x

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant