Class InteractionCreateEvent
- java.lang.Object
-
- discord4j.core.event.domain.Event
-
- discord4j.core.event.domain.interaction.InteractionCreateEvent
-
- Direct Known Subclasses:
ComponentInteractEvent
,SlashCommandEvent
@Experimental public class InteractionCreateEvent extends Event
Dispatched when a user in a guild uses a Slash Command or clicks a Button.This event is dispatched by Discord.
- See Also:
- Interaction Create
-
-
Constructor Summary
Constructors Constructor Description InteractionCreateEvent(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.protected Mono<Void>
createInteractionResponse(InteractionResponseType responseType, discord4j.discordjson.json.InteractionApplicationCommandCallbackData data)
Interaction
getInteraction()
Gets theInteraction
associated with the event.InteractionResponse
getInteractionResponse()
Gets a handler for common operations related to an interaction followup response associated with this event.discord4j.core.spec.InteractionApplicationCommandCallbackReplyMono
reply()
Requests to respond to the interaction with a message.Mono<Void>
reply(discord4j.core.spec.InteractionApplicationCommandCallbackSpec spec)
Requests to respond to the interaction with a message.discord4j.core.spec.InteractionApplicationCommandCallbackReplyMono
reply(String content)
Requests to respond to the interaction with a message initialized with the specified content.Mono<Void>
reply(Consumer<? super LegacyInteractionApplicationCommandCallbackSpec> spec)
Deprecated.usereply(InteractionApplicationCommandCallbackSpec)
,reply(String)
orreply()
which offer an immutable approach to build specs-
Methods inherited from class discord4j.core.event.domain.Event
getClient, getShardInfo
-
-
-
-
Constructor Detail
-
InteractionCreateEvent
public InteractionCreateEvent(GatewayDiscordClient gateway, ShardInfo shardInfo, Interaction interaction)
-
-
Method Detail
-
getInteraction
public Interaction getInteraction()
Gets theInteraction
associated with the event.- Returns:
- The
Interaction
associated with the event.
-
createInteractionResponse
protected Mono<Void> createInteractionResponse(InteractionResponseType responseType, @Nullable discord4j.discordjson.json.InteractionApplicationCommandCallbackData data)
-
acknowledge
public Mono<Void> acknowledge()
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, seeacknowledgeEphemeral()
, or to include a message,reply(String).withEphemeral(true)
- 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()
Acknowledges the interaction indicating a response will be edited later. Only the invoking user sees a loading state.- 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
.
-
reply
@Deprecated public Mono<Void> reply(Consumer<? super LegacyInteractionApplicationCommandCallbackSpec> spec)
Deprecated.usereply(InteractionApplicationCommandCallbackSpec)
,reply(String)
orreply()
which offer an immutable approach to build specsRequests to respond to the interaction with a message.- Parameters:
spec
- AConsumer
that provides a "blank"LegacyInteractionApplicationCommandCallbackSpec
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
.
-
reply
public discord4j.core.spec.InteractionApplicationCommandCallbackReplyMono reply()
Requests to respond to the interaction with a message. Properties specifying how to build the reply message to the interaction can be set via thewithXxx
methods of the returnedInteractionApplicationCommandCallbackReplyMono
.- Returns:
- A
InteractionApplicationCommandCallbackReplyMono
where, upon successful completion, emits nothing; indicating the interaction response has been sent. If an error is received, it is emitted through theInteractionApplicationCommandCallbackMono
.
-
reply
public discord4j.core.spec.InteractionApplicationCommandCallbackReplyMono reply(String content)
Requests to respond to the interaction with a message initialized with the specified content. Properties specifying how to build the reply message to the interaction can be set via thewithXxx
methods of the returnedInteractionApplicationCommandCallbackReplyMono
.- Parameters:
content
- a string to populate the message with- Returns:
- A
InteractionApplicationCommandCallbackReplyMono
where, upon successful completion, emits nothing; indicating the interaction response has been sent. If an error is received, it is emitted through theInteractionApplicationCommandCallbackMono
.
-
reply
public Mono<Void> reply(discord4j.core.spec.InteractionApplicationCommandCallbackSpec spec)
Requests to respond to the interaction with a message.- Parameters:
spec
- an immutable object that specifies how to build the reply message to the interaction- 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
.
-
getInteractionResponse
public InteractionResponse getInteractionResponse()
Gets a handler for common operations related to an interaction followup response associated with this event.- Returns:
- A handler for common operations related to an interaction followup response associated with this event.
-
-