LocalizableTextCommand

Allows you to configure the localization settings of this text command event, as well as retrieve a localization context from it.

Configuring localization bundle and prefix

You can change the bundle and prefix in the first lines of your interaction handler, with localizationBundle and localizationPrefix.

Configuring the guild locale source

They are by default retrieved from the guild, but you can get them in other ways by implementing TextCommandLocaleProvider.

See also

Inheritors

Properties

Link copied to clipboard
abstract var localizationBundle: String?

If set, forces the specified localization bundle to be used.

Link copied to clipboard
abstract var localizationPrefix: String?

If set, adds the specified prefix to the path of every localization call, useful to avoid using very long strings in every reply/edit.

Functions

Link copied to clipboard

Retrieves a DefaultMessages instance, using a locale suitable for messages sent to the user.

Link copied to clipboard
abstract fun getGuildMessage(localizationPath: String, vararg entries: Localization.Entry): String

Returns the localized message at the following path, using the guild's locale and provided parameters.

Link copied to clipboard
fun LocalizableTextCommand.getGuildMessage(localizationPath: String, vararg entries: PairEntry): String
Link copied to clipboard
abstract override fun getLocalizationContext(bundleName: String, pathPrefix: String?): TextLocalizationContext

Returns a localization context for the provided bundle name and path prefix, using the locale from TextCommandLocaleProvider.getDiscordLocale.

Link copied to clipboard
abstract fun getLocalizedMessage(locale: Locale, localizationPath: String, vararg entries: Localization.Entry): String
open fun getLocalizedMessage(locale: DiscordLocale, localizationPath: String, vararg entries: Localization.Entry): String

Returns the localized message at the following path, using the provided locale and parameters.

Link copied to clipboard
fun LocalizableAction.getLocalizedMessage(locale: Locale, localizationPath: String, vararg entries: PairEntry): String
fun LocalizableAction.getLocalizedMessage(locale: DiscordLocale, localizationPath: String, vararg entries: PairEntry): String
Link copied to clipboard
@CheckReturnValue
abstract fun replyGuild(localizationPath: String, vararg entries: Localization.Entry): MessageCreateAction

Replies with the localized message at the following path, using the guild's locale and provided parameters.

Link copied to clipboard
fun LocalizableTextCommand.replyGuild(localizationPath: String, vararg entries: PairEntry): MessageCreateAction
Link copied to clipboard
@CheckReturnValue
abstract fun replyLocalized(locale: Locale, localizationPath: String, vararg entries: Localization.Entry): MessageCreateAction
@CheckReturnValue
open fun replyLocalized(locale: DiscordLocale, localizationPath: String, vararg entries: Localization.Entry): MessageCreateAction

Replies with the localized message at the following path, using the provided locale and parameters.

Link copied to clipboard
fun LocalizableTextCommand.replyLocalized(locale: Locale, localizationPath: String, vararg entries: PairEntry): MessageCreateAction
Link copied to clipboard
@CheckReturnValue
abstract fun respondGuild(localizationPath: String, vararg entries: Localization.Entry): MessageCreateAction

Responds with the localized message at the following path, using the guild's locale and provided parameters.

Link copied to clipboard
Link copied to clipboard
@CheckReturnValue
abstract fun respondLocalized(locale: Locale, localizationPath: String, vararg entries: Localization.Entry): MessageCreateAction
@CheckReturnValue
open fun respondLocalized(locale: DiscordLocale, localizationPath: String, vararg entries: Localization.Entry): MessageCreateAction

Responds with the localized message at the following path, using the provided locale and parameters.

Link copied to clipboard
fun LocalizableTextCommand.respondLocalized(locale: Locale, localizationPath: String, vararg entries: PairEntry): MessageCreateAction