Class ChatInputAutoCompleteEvent
- java.lang.Object
-
- discord4j.core.event.domain.Event
-
- discord4j.core.event.domain.interaction.InteractionCreateEvent
-
- discord4j.core.event.domain.interaction.AutoCompleteInteractionEvent
-
- discord4j.core.event.domain.interaction.ChatInputAutoCompleteEvent
-
@Experimental public class ChatInputAutoCompleteEvent extends AutoCompleteInteractionEvent
Dispatched when a user is typing an application command option that has auto-complete enabled.You are required to respond to this interaction within a three-second window by using the following:
respondWithSuggestions(Iterable)respond with up to 25 choices to suggest
This is not directly dispatched by Discord, but is a utility specialization of
AutoCompleteInteractionEvent.
-
-
Constructor Summary
Constructors Constructor Description ChatInputAutoCompleteEvent(GatewayDiscordClient gateway, ShardInfo shardInfo, Interaction interaction)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SnowflakegetCommandId()Gets the ID of the invoked command.StringgetCommandName()Gets the name of the invoked command.ApplicationCommand.TypegetCommandType()Gets the type of the invoked command.ApplicationCommandInteractionOptiongetFocusedOption()Gets the currently focused option for auto-complete.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.Mono<Void>respondWithSuggestions(Iterable<discord4j.discordjson.json.ApplicationCommandOptionChoiceData> choices)Requests to respond to the interaction with a list of suggested choices.-
Methods inherited from class discord4j.core.event.domain.interaction.InteractionCreateEvent
createInteractionResponse, getInteraction
-
Methods inherited from class discord4j.core.event.domain.Event
getClient, getShardInfo
-
-
-
-
Constructor Detail
-
ChatInputAutoCompleteEvent
public ChatInputAutoCompleteEvent(GatewayDiscordClient gateway, ShardInfo shardInfo, Interaction interaction)
-
-
Method Detail
-
respondWithSuggestions
public Mono<Void> respondWithSuggestions(Iterable<discord4j.discordjson.json.ApplicationCommandOptionChoiceData> choices)
Requests to respond to the interaction with a list of suggested choices.- Parameters:
choices- The list of suggested choices.- Returns:
- A
Monowhere, upon successful completion, emits nothing; indicating the interaction response has been sent. If an error is received, it is emitted through theMono.
-
getCommandId
public Snowflake getCommandId()
Gets the ID of the invoked command.- Returns:
- The ID of the invoked command.
-
getCommandName
public String getCommandName()
Gets the name of the invoked command.- Returns:
- The name of the invoked command.
-
getCommandType
public ApplicationCommand.Type getCommandType()
Gets the type of the invoked command.- Returns:
- The type of the invoked command.
-
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.
-
getFocusedOption
public ApplicationCommandInteractionOption getFocusedOption()
Gets the currently focused option for auto-complete.- Returns:
- The currently focused option for auto-complete.
-
-