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 Deprecated 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.discord4j.core.spec.InteractionApplicationCommandCallbackEditMono
edit()
Requests to respond to the interaction by immediately editing the message the button is on.Mono<Void>
edit(discord4j.core.spec.InteractionApplicationCommandCallbackSpec spec)
Requests to respond to the interaction by immediately editing the message the button is on.Mono<Void>
edit(Consumer<? super LegacyInteractionApplicationCommandCallbackSpec> spec)
Deprecated.useedit()
,edit(InteractionApplicationCommandCallbackSpec)
which offer an immutable approach to build specsString
getCustomId()
Gets the developer-defined custom id associated with the component.Optional<Message>
getMessage()
Gets the message the component is on.Snowflake
getMessageId()
Gets the ID of the message the component is on.-
Methods inherited from class discord4j.core.event.domain.interaction.InteractionCreateEvent
createInteractionResponse, getInteraction, getInteractionResponse, reply, reply, reply, reply
-
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 Optional<Message> getMessage()
Gets the message the component is on.For ephemeral messages, only the ID is present. Use
getMessageId()
- Returns:
- The message the component is on.
-
getMessageId
public Snowflake getMessageId()
Gets the ID of the message the component is on.- Returns:
- The ID of the message the component is on.
-
edit
@Deprecated public Mono<Void> edit(Consumer<? super LegacyInteractionApplicationCommandCallbackSpec> spec)
Deprecated.useedit()
,edit(InteractionApplicationCommandCallbackSpec)
which offer an immutable approach to build specsRequests to respond to the interaction by immediately editing the message the button is on.
-
edit
public discord4j.core.spec.InteractionApplicationCommandCallbackEditMono edit()
Requests to respond to the interaction by immediately editing the message the button is on. Properties specifying how to edit the message can be set via thewithXxx
methods of the returnedInteractionApplicationCommandCallbackEditMono
.- Returns:
- A
InteractionApplicationCommandCallbackEditMono
where, upon successful completion, emits nothing; indicating the interaction response has been sent. If an error is received, it is emitted through theInteractionApplicationCommandCallbackMono
.
-
edit
public Mono<Void> edit(discord4j.core.spec.InteractionApplicationCommandCallbackSpec spec)
Requests to respond to the interaction by immediately editing the message the button is on.- Parameters:
spec
- an immutable object that specifies how to edit the message the button is 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,reply(String).withEphemeral(true)
- 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
.
-
-