Class GenericComponentInteractionCreateEvent
- All Implemented Interfaces:
ISnowflake
,GenericEvent
,IDeferrableCallback
,IMessageEditCallback
,IModalCallback
,IPremiumRequiredReplyCallback
,IReplyCallback
,ComponentInteraction
,Interaction
- Direct Known Subclasses:
ButtonInteractionEvent
,GenericSelectMenuInteractionEvent
ComponentInteraction
was created in a channel.
Every component interaction event is derived from this event.
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
ConstructorDescriptionGenericComponentInteractionCreateEvent
(JDA api, long responseNumber, ComponentInteraction interaction) -
Method Summary
Modifier and TypeMethodDescriptionNo-op acknowledgement of this interaction.Acknowledge this interaction and defer the reply to a later time.The channel this interaction happened in.TheActionComponent
instance.The custom component ID provided to the component when it was originally created.TheComponent.Type
getHook()
TheInteractionHook
which can be used to send deferred replies or followup messages.TheInteraction
instance.TheMessage
instance.long
The id of the message.replyModal
(Modal modal) Acknowledgement of this interaction with aModal
.Deprecated.Methods inherited from class net.dv8tion.jda.api.events.interaction.GenericInteractionCreateEvent
getChannelIdLong, getEntitlements, getGuild, getGuildLocale, getIdLong, getMember, getToken, getTypeRaw, getUser, getUserLocale, isAcknowledged
Methods inherited from class net.dv8tion.jda.api.events.Event
getJDA, getRawData, getResponseNumber, toString
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.dv8tion.jda.api.interactions.components.ComponentInteraction
getGuildChannel, getMessageId
Methods inherited from interface net.dv8tion.jda.api.interactions.callbacks.IMessageEditCallback
editComponents, editComponents, editMessage, editMessage, editMessageAttachments, editMessageAttachments, editMessageEmbeds, editMessageEmbeds, editMessageFormat
Methods inherited from interface net.dv8tion.jda.api.interactions.Interaction
getChannelId, getChannelIdLong, getChannelType, getEntitlements, getGuild, getGuildLocale, getJDA, getMember, getMessageChannel, getToken, getType, getTypeRaw, getUser, getUserLocale, isAcknowledged, isFromGuild
Methods inherited from interface net.dv8tion.jda.api.interactions.callbacks.IReplyCallback
deferReply, reply, reply, replyComponents, replyComponents, replyEmbeds, replyEmbeds, replyFiles, replyFiles, replyFormat, replyPoll
Methods inherited from interface net.dv8tion.jda.api.entities.ISnowflake
getId, getIdLong, getTimeCreated
-
Constructor Details
-
GenericComponentInteractionCreateEvent
public GenericComponentInteractionCreateEvent(@Nonnull JDA api, long responseNumber, @Nonnull ComponentInteraction interaction)
-
-
Method Details
-
getInteraction
Description copied from class:GenericInteractionCreateEvent
TheInteraction
instance.
Note that this event is a delegate which implements the same interface.- Overrides:
getInteraction
in classGenericInteractionCreateEvent
- Returns:
- The
Interaction
-
getChannel
Description copied from interface:Interaction
The channel this interaction happened in.- Specified by:
getChannel
in interfaceComponentInteraction
- Specified by:
getChannel
in interfaceInteraction
- Overrides:
getChannel
in classGenericInteractionCreateEvent
- Returns:
- The channel or null if the channel is not provided
-
getComponentId
Description copied from interface:ComponentInteraction
The custom component ID provided to the component when it was originally created.
This value should be used to determine what action to take in regard to this interaction.
This id does not have to be numerical.- Specified by:
getComponentId
in interfaceComponentInteraction
- Returns:
- The component ID
- See Also:
-
getComponent
Description copied from interface:ComponentInteraction
TheActionComponent
instance.- Specified by:
getComponent
in interfaceComponentInteraction
- Returns:
- The
ActionComponent
-
getMessage
Description copied from interface:ComponentInteraction
TheMessage
instance.- Specified by:
getMessage
in interfaceComponentInteraction
- Returns:
- The
Message
-
getMessageIdLong
public long getMessageIdLong()Description copied from interface:ComponentInteraction
The id of the message.- Specified by:
getMessageIdLong
in interfaceComponentInteraction
- Returns:
- The message id
-
getComponentType
Description copied from interface:ComponentInteraction
TheComponent.Type
- Specified by:
getComponentType
in interfaceComponentInteraction
- Returns:
- The
Component.Type
-
deferEdit
Description copied from interface:IMessageEditCallback
No-op acknowledgement of this interaction.
This tells discord you intend to update the message that the triggering component is a part of using theInteractionHook
instead of sending a reply message. You are not required to actually update the message, this will simply acknowledge that you accepted the interaction.You only have 3 seconds to acknowledge an interaction!
When the acknowledgement is sent after the interaction expired, you will receiveErrorResponse.UNKNOWN_INTERACTION
.Use
IMessageEditCallback.editMessage(String)
to edit it directly.- Specified by:
deferEdit
in interfaceIMessageEditCallback
- Returns:
MessageEditCallbackAction
that can be used to update the message- See Also:
-
getHook
Description copied from interface:IDeferrableCallback
TheInteractionHook
which can be used to send deferred replies or followup messages.- Specified by:
getHook
in interfaceIDeferrableCallback
- Returns:
- The interaction hook
-
deferReply
Description copied from interface:IReplyCallback
Acknowledge this interaction and defer the reply to a later time.
This will send a<Bot> is thinking...
message in chat that will be updated later through eitherInteractionHook.editOriginal(String)
orWebhookClient.sendMessage(String)
.You can use
deferReply(true)
to send a deferred ephemeral reply. If your initial deferred message is not ephemeral it cannot be made ephemeral later. Your first message to theInteractionHook
will inherit whether the message is ephemeral or not from this deferred reply.You only have 3 seconds to acknowledge an interaction!
When the acknowledgement is sent after the interaction expired, you will receiveErrorResponse.UNKNOWN_INTERACTION
.Use
IReplyCallback.reply(String)
to reply directly.- Specified by:
deferReply
in interfaceIReplyCallback
- Returns:
ReplyCallbackAction
-
replyModal
Description copied from interface:IModalCallback
Acknowledgement of this interaction with aModal
.This will open a popup on the target user's Discord client.
Interactions can only be acknowledged once.
You only have 3 seconds to acknowledge an interaction!
When the acknowledgement is sent after the interaction expired, you will receiveErrorResponse.UNKNOWN_INTERACTION
.- Specified by:
replyModal
in interfaceIModalCallback
- Parameters:
modal
- The Modal to send- Returns:
- ModalCallbackAction
-
replyWithPremiumRequired
@Nonnull @Deprecated @CheckReturnValue public PremiumRequiredCallbackAction replyWithPremiumRequired()Deprecated.- Specified by:
replyWithPremiumRequired
in interfaceIPremiumRequiredReplyCallback
-