Class ComponentInteractEvent
- java.lang.Object
-
- discord4j.core.event.domain.Event
-
- discord4j.core.event.domain.interaction.InteractionCreateEvent
-
- discord4j.core.event.domain.interaction.ComponentInteractEvent
-
- Direct Known Subclasses:
ButtonInteractEvent
,SelectMenuInteractEvent
public class ComponentInteractEvent extends InteractionCreateEvent
Dispatched when a user interacts with aMessageComponent
the bot has sent.This is not directly dispatched by Discord, but is a utility specialization of
InteractionCreateEvent
.
-
-
Constructor Summary
Constructors Constructor Description ComponentInteractEvent(GatewayDiscordClient gateway, ShardInfo shardInfo, Interaction interaction)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Mono<Void>
acknowledge()
Acknowledges the interaction indicating a response will be edited later.Mono<Void>
acknowledgeEphemeral()
Acknowledges the interaction indicating a response will be edited later.Mono<Void>
edit(Consumer<? super InteractionApplicationCommandCallbackSpec> spec)
Requests to respond to the interaction by immediately editing the message the button is on.String
getCustomId()
Gets the developer-defined custom id associated with the component.Message
getMessage()
Gets the message the component is on.-
Methods inherited from class discord4j.core.event.domain.interaction.InteractionCreateEvent
createInteractionResponse, getInteraction, getInteractionResponse, reply, reply, replyEphemeral
-
Methods inherited from class discord4j.core.event.domain.Event
getClient, getShardInfo
-
-
-
-
Constructor Detail
-
ComponentInteractEvent
public ComponentInteractEvent(GatewayDiscordClient gateway, ShardInfo shardInfo, Interaction interaction)
-
-
Method Detail
-
getCustomId
public String getCustomId()
Gets the developer-defined custom id associated with the component.- Returns:
- The component's custom id.
- See Also:
Button.getCustomId()
-
getMessage
public Message getMessage()
Gets the message the component is on.- Returns:
- The message the component is on.
-
edit
public Mono<Void> edit(Consumer<? super InteractionApplicationCommandCallbackSpec> spec)
Requests to respond to the interaction by immediately editing the message the button is on.- Parameters:
spec
- AConsumer
that provides a "blank"InteractionApplicationCommandCallbackSpec
to be operated on.- 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
.
-
acknowledge
public Mono<Void> acknowledge()
Description copied from class:InteractionCreateEvent
Acknowledges the interaction indicating a response will be edited later. The user sees a loading state, visible to all participants in the invoking channel. For a "only you can see this" response, seeInteractionCreateEvent.acknowledgeEphemeral()
, or to include a message,InteractionCreateEvent.replyEphemeral(String)
- Overrides:
acknowledge
in classInteractionCreateEvent
- Returns:
- A
Mono
where, upon successful completion, emits nothing; acknowledging the interaction and indicating a response will be edited later. The user sees a loading state. If an error is received, it is emitted through theMono
.
-
acknowledgeEphemeral
public Mono<Void> acknowledgeEphemeral()
Description copied from class:InteractionCreateEvent
Acknowledges the interaction indicating a response will be edited later. Only the invoking user sees a loading state.- Overrides:
acknowledgeEphemeral
in classInteractionCreateEvent
- Returns:
- A
Mono
where, upon successful completion, emits nothing, acknowledging the interaction and indicating a response will be edited later. If an error is received, it is emitted through theMono
.
-
-