Class ButtonClickEvent
- java.lang.Object
-
- net.dv8tion.jda.api.events.Event
-
- net.dv8tion.jda.api.events.interaction.GenericInteractionCreateEvent
-
- net.dv8tion.jda.api.events.interaction.GenericComponentInteractionCreateEvent
-
- net.dv8tion.jda.api.events.interaction.ButtonClickEvent
-
- All Implemented Interfaces:
ISnowflake
,GenericEvent
,ButtonInteraction
,ComponentInteraction
,Interaction
public class ButtonClickEvent extends GenericComponentInteractionCreateEvent implements ButtonInteraction
Indicates that a customButton
on one of the bots messages was clicked by a user.This fires when a user clicks one of the custom buttons attached to a bot or webhook message.
Requirements
To receive these events, you must unset the Interactions Endpoint URL in your application dashboard. You can simply remove the URL for this endpoint in your settings at the Discord Developers Portal.
-
-
Constructor Summary
Constructors Constructor Description ButtonClickEvent(JDA api, long responseNumber, ButtonInteraction interaction)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Button
getButton()
TheButton
this interaction belongs to.Button
getComponent()
TheComponent
instance.ButtonInteraction
getInteraction()
TheInteraction
instance.-
Methods inherited from class net.dv8tion.jda.api.events.interaction.GenericComponentInteractionCreateEvent
deferEdit, getChannel, getComponentId, getComponentType, getMessage, getMessageIdLong
-
Methods inherited from class net.dv8tion.jda.api.events.interaction.GenericInteractionCreateEvent
deferReply, getGuild, getHook, getIdLong, getMember, getToken, getTypeRaw, getUser, isAcknowledged
-
Methods inherited from class net.dv8tion.jda.api.events.Event
getJDA, getResponseNumber
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.dv8tion.jda.api.interactions.components.ButtonInteraction
editButton
-
Methods inherited from interface net.dv8tion.jda.api.interactions.components.ComponentInteraction
deferEdit, editComponents, editComponents, editMessage, editMessage, editMessageEmbeds, editMessageEmbeds, editMessageFormat, getChannel, getComponentId, getComponentType, getMessage, getMessageId, getMessageIdLong
-
Methods inherited from interface net.dv8tion.jda.api.interactions.Interaction
deferReply, deferReply, getChannelType, getGuild, getGuildChannel, getHook, getJDA, getMember, getMessageChannel, getPrivateChannel, getTextChannel, getToken, getType, getTypeRaw, getUser, getVoiceChannel, isAcknowledged, isFromGuild, reply, reply, replyEmbeds, replyEmbeds, replyFormat
-
Methods inherited from interface net.dv8tion.jda.api.entities.ISnowflake
getId, getIdLong, getTimeCreated
-
-
-
-
Constructor Detail
-
ButtonClickEvent
public ButtonClickEvent(@Nonnull JDA api, long responseNumber, @Nonnull ButtonInteraction interaction)
-
-
Method Detail
-
getInteraction
@Nonnull public ButtonInteraction getInteraction()
Description copied from class:GenericInteractionCreateEvent
TheInteraction
instance.
Note that this event is a delegate which implements the same interface.- Overrides:
getInteraction
in classGenericComponentInteractionCreateEvent
- Returns:
- The
Interaction
-
getComponent
@Nullable public Button getComponent()
Description copied from interface:ComponentInteraction
TheComponent
instance.
This is null on interactions for ephemeral messages.- Specified by:
getComponent
in interfaceButtonInteraction
- Specified by:
getComponent
in interfaceComponentInteraction
- Overrides:
getComponent
in classGenericComponentInteractionCreateEvent
- Returns:
- The
Component
, or null if this message is ephemeral
-
getButton
@Nullable public Button getButton()
Description copied from interface:ButtonInteraction
TheButton
this interaction belongs to.
This is null for ephemeral messages!- Specified by:
getButton
in interfaceButtonInteraction
- Returns:
- The
Button
- See Also:
ComponentInteraction.getComponentId()
-
-