Class ModalSubmitInteractionEvent
- java.lang.Object
-
- discord4j.core.event.domain.Event
-
- discord4j.core.event.domain.interaction.InteractionCreateEvent
-
- discord4j.core.event.domain.interaction.DeferrableInteractionEvent
-
- discord4j.core.event.domain.interaction.ComponentInteractionEvent
-
- discord4j.core.event.domain.interaction.ModalSubmitInteractionEvent
-
@Experimental public class ModalSubmitInteractionEvent extends ComponentInteractionEvent
Dispatched when a user has pressed submit on a modal presented to them earlierYou are required to respond to this interaction within a three-second window by using one of the following:
DeferrableInteractionEvent.reply()
to directly include a messageDeferrableInteractionEvent.deferReply()
to acknowledge without a message, typically to perform a background task and give the user a loading state until it is editedComponentInteractionEvent.edit()
to modify the message that presented the modalComponentInteractionEvent.deferEdit()
to acknowledge without a message, will not display a loading state and allows later modifications to the message that presented the modal
DeferrableInteractionEvent.editReply()
to edit the initial responseDeferrableInteractionEvent.getReply()
to fetch the initial responseDeferrableInteractionEvent.deleteReply()
to delete the initial response
DeferrableInteractionEvent.createFollowup()
to create a followup messageDeferrableInteractionEvent.editFollowup(Snowflake)
to update a followup message, given its IDDeferrableInteractionEvent.deleteFollowup(Snowflake)
to delete a followup message, given its ID
This is not directly dispatched by Discord, but is a utility specialization of
InteractionCreateEvent
.- See Also:
- Interaction Create
-
-
Constructor Summary
Constructors Constructor Description ModalSubmitInteractionEvent(GatewayDiscordClient gateway, ShardInfo shardInfo, Interaction interaction)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<MessageComponent>
getComponents()
Gets the components from the modal<T extends MessageComponent>
List<T>getComponents(Class<T> componentType)
Gets the components from the modal that match the given component type.String
getCustomId()
Gets the developer defined custom ID of this modalMono<Void>
presentModal(discord4j.core.spec.InteractionPresentModalSpec spec)
Requests to respond to the interaction by presenting a modal for the user to fill out and submit with the given spec contents.-
Methods inherited from class discord4j.core.event.domain.interaction.ComponentInteractionEvent
acknowledge, acknowledgeEphemeral, deferEdit, deferEdit, edit, edit, edit, edit, getMessage, getMessageId
-
Methods inherited from class discord4j.core.event.domain.interaction.DeferrableInteractionEvent
createFollowup, createFollowup, createFollowup, deferReply, deferReply, deleteFollowup, deleteReply, editFollowup, editFollowup, editReply, editReply, editReply, getInteractionResponse, getReply, presentModal, presentModal, reply, reply, reply, reply
-
Methods inherited from class discord4j.core.event.domain.interaction.InteractionCreateEvent
createInteractionResponse, createInteractionResponse, getInteraction
-
Methods inherited from class discord4j.core.event.domain.Event
getClient, getShardInfo
-
-
-
-
Constructor Detail
-
ModalSubmitInteractionEvent
public ModalSubmitInteractionEvent(GatewayDiscordClient gateway, ShardInfo shardInfo, Interaction interaction)
-
-
Method Detail
-
getCustomId
public String getCustomId()
Gets the developer defined custom ID of this modal- Overrides:
getCustomId
in classComponentInteractionEvent
- Returns:
- The custom ID of this modal
- See Also:
Button.getCustomId()
-
getComponents
public List<MessageComponent> getComponents()
Gets the components from the modal- Returns:
- The components from the modal
-
getComponents
public <T extends MessageComponent> List<T> getComponents(Class<T> componentType)
Gets the components from the modal that match the given component type.- Parameters:
componentType
- the modal component type to return- Returns:
- The components from the modal
-
presentModal
public Mono<Void> presentModal(discord4j.core.spec.InteractionPresentModalSpec spec)
Description copied from class:DeferrableInteractionEvent
Requests to respond to the interaction by presenting a modal for the user to fill out and submit with the given spec contents. Once the user submits the modal, it will be received as a newModalSubmitInteractionEvent
.- Overrides:
presentModal
in classDeferrableInteractionEvent
- Parameters:
spec
- an immutable object that specifies how to present the modal window- Returns:
- A
Mono
where, upon successful completion, emits nothing; indicating the interaction response has been sent. If an error is received, it is emitted through theMono
.
-
-