ButtonEvent

Interaction event for buttons.

Localization

You can send localized replies and edit messages using the user, guild and also any Locale, by using this event directly, but also the interaction hook, see LocalizableInteraction for more details and configuration.

An alternative to using this event is injecting an AppLocalizationContext in a parameter, or retrieving one using getLocalizationContext.

In both cases, you can configure the user and guild locales, using UserLocaleProvider and GuildLocaleProvider.

Rate limit cancellation

Although it is recommended to reject commands using ComponentInteractionFilter, you can also return the bucket token with cancelRateLimit if you want to avoid consuming bandwidth in certain conditions.

Properties

Link copied to clipboard
@get:Nonnull
open val button: Button
Link copied to clipboard
@get:Nonnull
open override val channel: MessageChannelUnion
Link copied to clipboard
@get:Nullable
open val channelId: String?
Link copied to clipboard
open override val channelIdLong: Long
Link copied to clipboard
@get:Nonnull
open val channelType: ChannelType
Link copied to clipboard
@get:Nonnull
open val component: Button
Link copied to clipboard
@get:Nonnull
open override val componentId: String
Link copied to clipboard
@get:Nonnull
open override val componentType: Component.Type
Link copied to clipboard
@get:Nonnull
open override val context: InteractionContextType
Link copied to clipboard
@get:Nonnull
open val customId: String
Link copied to clipboard
@get:Nonnull
open override val entitlements: List<Entitlement?>
Link copied to clipboard
@get:Nullable
open override val guild: Guild?
Link copied to clipboard
@get:Nonnull
open override val guildChannel: GuildMessageChannelUnion
Link copied to clipboard
@get:Nonnull
open override val guildLocale: DiscordLocale
Link copied to clipboard
open override val hook: LocalizableInteractionHook
Link copied to clipboard
@get:Nonnull
open val id: String
Link copied to clipboard
open override val idLong: Long
Link copied to clipboard

Gets the interaction user as an InputUser.

Link copied to clipboard
@get:Nonnull
open override val integrationOwners: IntegrationOwners
Link copied to clipboard
@get:Nonnull
open val interaction: ButtonInteraction
Link copied to clipboard
open override val isAcknowledged: Boolean
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override val isRateLimitCancelled: Boolean
Link copied to clipboard
@get:Nonnull
open override val jda: JDA
Link copied to clipboard
open override var localizationBundle: String?

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

Link copied to clipboard
open override 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.

Link copied to clipboard
@get:Nullable
open override val member: Member?
Link copied to clipboard
@get:Nonnull
open override val message: Message
Link copied to clipboard
@get:Nonnull
open val messageChannel: MessageChannel
Link copied to clipboard
@get:Nonnull
open val messageId: String
Link copied to clipboard
open override val messageIdLong: Long
Link copied to clipboard
open override val rawData: DataObject?
Link copied to clipboard
Link copied to clipboard
@get:Nonnull
open val timeCreated: OffsetDateTime
Link copied to clipboard
@get:Nonnull
open override val token: String
Link copied to clipboard
@get:Nonnull
open val type: InteractionType
Link copied to clipboard
open override val typeRaw: Int
Link copied to clipboard
open val uniqueId: Int
Link copied to clipboard
@get:Nonnull
open override val user: User
Link copied to clipboard
@get:Nonnull
open override val userLocale: DiscordLocale

Functions

Link copied to clipboard
open override fun cancelRateLimit()

Cancels the token consumption of the current rate limited interaction.

Link copied to clipboard
@Nonnull
@CheckReturnValue
open fun deferEdit(): MessageEditCallbackAction
Link copied to clipboard
@Nonnull
@CheckReturnValue
open fun deferReply(): ReplyCallbackAction
@Nonnull
@CheckReturnValue
open fun deferReply(ephemeral: Boolean): ReplyCallbackAction
Link copied to clipboard
@Nonnull
@CheckReturnValue
open fun editButton(@Nullable newButton: Button?): RestAction<Void?>
Link copied to clipboard
@Nonnull
@CheckReturnValue
open fun editComponents(@Nonnull components: Collection<out MessageTopLevelComponent?>): MessageEditCallbackAction
@Nonnull
@CheckReturnValue
open fun editComponents(@Nonnull vararg components: MessageTopLevelComponent?): MessageEditCallbackAction
@Nonnull
@CheckReturnValue
open fun editComponents(@Nonnull tree: ComponentTree<out MessageTopLevelComponent?>): MessageEditCallbackAction
Link copied to clipboard
@CheckReturnValue
open override fun editGuild(localizationPath: String, vararg entries: Localization.Entry): MessageEditCallbackAction

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

Link copied to clipboard

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

Link copied to clipboard
@CheckReturnValue
open override fun editLocalized(locale: Locale, localizationPath: String, vararg entries: Localization.Entry): MessageEditCallbackAction
@CheckReturnValue
open override fun editLocalized(locale: DiscordLocale, localizationPath: String, vararg entries: Localization.Entry): MessageEditCallbackAction

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

Link copied to clipboard

Edits the text content of the original message with a localized message.

fun LocalizableEditCallback.editLocalized(locale: Locale, localizationPath: String, vararg entries: PairEntry): MessageEditCallbackAction

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

Link copied to clipboard
@Nonnull
@CheckReturnValue
open fun editMessage(@Nonnull content: String): MessageEditCallbackAction
@Nonnull
@CheckReturnValue
open fun editMessage(@Nonnull message: MessageEditData): MessageEditCallbackAction
Link copied to clipboard
@Nonnull
@CheckReturnValue
open fun editMessageAttachments(@Nonnull attachments: Collection<out AttachedFile?>): MessageEditCallbackAction
@Nonnull
@CheckReturnValue
open fun editMessageAttachments(@Nonnull vararg attachments: AttachedFile?): MessageEditCallbackAction
Link copied to clipboard
@Nonnull
@CheckReturnValue
open fun editMessageEmbeds(@Nonnull embeds: Collection<out MessageEmbed?>): MessageEditCallbackAction
@Nonnull
@CheckReturnValue
open fun editMessageEmbeds(@Nonnull vararg embeds: MessageEmbed?): MessageEditCallbackAction
Link copied to clipboard
@Nonnull
@CheckReturnValue
open fun editMessageFormat(@Nonnull format: String, @Nonnull vararg args: Any?): MessageEditCallbackAction
Link copied to clipboard
@CheckReturnValue
open override fun editUser(localizationPath: String, vararg entries: Localization.Entry): MessageEditCallbackAction

Edits the original message with the localized message at the following path, using the user's locale and provided parameters.

Link copied to clipboard

Edits the original message with the localized message at the following path, using the user's locale and provided parameters.

Link copied to clipboard

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

Link copied to clipboard
@Nonnull
open fun getChannel(): MessageChannelUnion
Link copied to clipboard
Link copied to clipboard
@Nonnull
open fun getComponentId(): String
Link copied to clipboard
@Nonnull
open fun getComponentType(): Component.Type
Link copied to clipboard
Link copied to clipboard
open override fun getDefaultMessages(): DefaultMessages

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

Link copied to clipboard
@Nonnull
open fun getEntitlements(): List<Entitlement?>
Link copied to clipboard
@Nullable
open fun getGuild(): Guild?
Link copied to clipboard
Link copied to clipboard
@Nonnull
open fun getGuildLocale(): DiscordLocale
Link copied to clipboard
open override fun getGuildMessage(localizationPath: String, vararg entries: Localization.Entry): String

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

Link copied to clipboard
fun LocalizableInteraction.getGuildMessage(localizationPath: String, vararg entries: PairEntry): String

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

Link copied to clipboard
open override fun getHook(): LocalizableInteractionHook
Link copied to clipboard
open fun getIdLong(): Long
Link copied to clipboard
Link copied to clipboard
@Nonnull
open fun getJDA(): JDA
Link copied to clipboard
open override fun getLocalizationContext(bundleName: String, pathPrefix: String?): AppLocalizationContext

Returns a localization context for the provided bundle name and path prefix, using the locales from UserLocaleProvider.getDiscordLocale and GuildLocaleProvider.getDiscordLocale.

Link copied to clipboard
open override fun getLocalizedMessage(locale: Locale, localizationPath: String, vararg entries: Localization.Entry): String
open override 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
@Nullable
open fun getMember(): Member?
Link copied to clipboard
@Nonnull
open fun getMessage(): Message
Link copied to clipboard
Link copied to clipboard
open override fun getRawData(): DataObject?
Link copied to clipboard
@Nonnull
open fun getToken(): String
Link copied to clipboard
open fun getTypeRaw(): Int
Link copied to clipboard
@Nonnull
open fun getUser(): User
Link copied to clipboard
@Nonnull
open fun getUserLocale(): DiscordLocale
Link copied to clipboard
open override fun getUserMessage(localizationPath: String, vararg entries: Localization.Entry): String

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

Link copied to clipboard
fun LocalizableInteraction.getUserMessage(localizationPath: String, vararg entries: PairEntry): String

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

Link copied to clipboard
Link copied to clipboard

Replaces the entire original message with a localized message.

Link copied to clipboard
@Nonnull
@CheckReturnValue
open fun reply(@Nonnull content: String): ReplyCallbackAction
@Nonnull
@CheckReturnValue
open fun reply(@Nonnull message: MessageCreateData): ReplyCallbackAction
Link copied to clipboard
@Nonnull
@CheckReturnValue
open fun replyComponents(@Nonnull components: Collection<out MessageTopLevelComponent?>): ReplyCallbackAction
@Nonnull
@CheckReturnValue
open fun replyComponents(@Nonnull tree: ComponentTree<out MessageTopLevelComponent?>): ReplyCallbackAction
@Nonnull
@CheckReturnValue
open fun replyComponents(@Nonnull component: MessageTopLevelComponent, @Nonnull vararg other: MessageTopLevelComponent?): ReplyCallbackAction
Link copied to clipboard
@Nonnull
@CheckReturnValue
open fun replyEmbeds(@Nonnull embeds: Collection<out MessageEmbed?>): ReplyCallbackAction
@Nonnull
@CheckReturnValue
open fun replyEmbeds(@Nonnull embed: MessageEmbed, @Nonnull vararg embeds: MessageEmbed?): ReplyCallbackAction
Link copied to clipboard
@Nonnull
@CheckReturnValue
open fun replyFiles(@Nonnull files: Collection<out FileUpload?>): ReplyCallbackAction
@Nonnull
@CheckReturnValue
open fun replyFiles(@Nonnull vararg files: FileUpload?): ReplyCallbackAction
Link copied to clipboard
@Nonnull
@CheckReturnValue
open fun replyFormat(@Nonnull format: String, @Nonnull vararg args: Any?): ReplyCallbackAction
Link copied to clipboard
@CheckReturnValue
open override fun replyGuild(localizationPath: String, vararg entries: Localization.Entry): ReplyCallbackAction

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

Link copied to clipboard

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

Link copied to clipboard
@CheckReturnValue
open override fun replyLocalized(locale: Locale, localizationPath: String, vararg entries: Localization.Entry): ReplyCallbackAction
@CheckReturnValue
open override fun replyLocalized(locale: DiscordLocale, localizationPath: String, vararg entries: Localization.Entry): ReplyCallbackAction

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

Link copied to clipboard
fun IReplyCallback.replyLocalized(context: LocalizationContext, localizationPath: String, vararg entries: PairEntry): ReplyCallbackAction

Replies a localized message to this interaction and acknowledges it.

fun LocalizableReplyCallback.replyLocalized(locale: Locale, localizationPath: String, vararg entries: PairEntry): ReplyCallbackAction

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

Link copied to clipboard

Replies a localized ephemeral message to this interaction and acknowledges it.

Link copied to clipboard
@Nonnull
@CheckReturnValue
open fun replyModal(@Nonnull modal: Modal): ModalCallbackAction
Link copied to clipboard
@Nonnull
@CheckReturnValue
open fun replyPoll(@Nonnull poll: MessagePollData): ReplyCallbackAction
Link copied to clipboard
@CheckReturnValue
open override fun replyUser(localizationPath: String, vararg entries: Localization.Entry): ReplyCallbackAction

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

Link copied to clipboard
fun LocalizableReplyCallback.replyUser(localizationPath: String, vararg entries: PairEntry): ReplyCallbackAction

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