Class ChatInputInteractionEvent
- java.lang.Object
-
- discord4j.core.event.domain.Event
-
- discord4j.core.event.domain.interaction.InteractionCreateEvent
-
- discord4j.core.event.domain.interaction.ApplicationCommandInteractionEvent
-
- discord4j.core.event.domain.interaction.ChatInputInteractionEvent
-
@Experimental public class ChatInputInteractionEvent extends ApplicationCommandInteractionEvent
Dispatched when a user uses a chat input command (formerly "slash command").You are required to respond to this interaction within a three-second window by using one of the following:
InteractionCreateEvent.reply()
to directly include a messageInteractionCreateEvent.deferReply()
to acknowledge without a message, typically to perform a background task and give the user a loading state until it is edited
InteractionCreateEvent
for more details about valid operations.This is not directly dispatched by Discord, but is a utility specialization of
ApplicationCommandInteractionEvent
.
-
-
Constructor Summary
Constructors Constructor Description ChatInputInteractionEvent(GatewayDiscordClient gateway, ShardInfo shardInfo, Interaction interaction)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<ApplicationCommandInteractionOption>
getOption(String name)
Gets the option corresponding to the provided name, if present.List<ApplicationCommandInteractionOption>
getOptions()
Gets the options of the invoked command.-
Methods inherited from class discord4j.core.event.domain.interaction.ApplicationCommandInteractionEvent
getCommandId, getCommandName, getCommandType
-
Methods inherited from class discord4j.core.event.domain.interaction.InteractionCreateEvent
acknowledge, acknowledgeEphemeral, createFollowup, createFollowup, createFollowup, createInteractionResponse, deferReply, deferReply, deleteFollowup, deleteReply, editFollowup, editFollowup, editReply, editReply, editReply, getInteraction, getInteractionResponse, getReply, reply, reply, reply, reply
-
Methods inherited from class discord4j.core.event.domain.Event
getClient, getShardInfo
-
-
-
-
Constructor Detail
-
ChatInputInteractionEvent
public ChatInputInteractionEvent(GatewayDiscordClient gateway, ShardInfo shardInfo, Interaction interaction)
-
-
Method Detail
-
getOptions
public List<ApplicationCommandInteractionOption> getOptions()
Gets the options of the invoked command.- Returns:
- The options of the invoked command.
-
getOption
public Optional<ApplicationCommandInteractionOption> getOption(String name)
Gets the option corresponding to the provided name, if present.- Parameters:
name
- The name of the option.- Returns:
- The option corresponding to the provided name, if present.
-
-