Class CommandAutoCompleteInteractionEvent
- All Implemented Interfaces:
ISnowflake
,GenericEvent
,IAutoCompleteCallback
,CommandAutoCompleteInteraction
,CommandInteractionPayload
,Interaction
option
which
supports auto-complete
.
Requirements
To receive these events, you must unset the Interactions Endpoint URL in your application dashboard.
You can simply remove the URL for this endpoint in your settings at the Discord Developers Portal.
-
Constructor Summary
ConstructorDescriptionCommandAutoCompleteInteractionEvent
(JDA api, long responseNumber, CommandAutoCompleteInteraction interaction) -
Method Summary
Modifier and TypeMethodDescriptionThe channel this interaction happened in.long
The command id.TheType
of command this interaction is for.The focused option which the user is typing.TheInteraction
instance.getName()
The command name.The options provided by the user when this command was executed.The subcommand group name.The subcommand name.boolean
Whether the used command is a guild command.replyChoices
(Collection<Command.Choice> choices) Reply with up to 25 choices which can be picked from by the user.Methods inherited from class net.dv8tion.jda.api.events.interaction.GenericInteractionCreateEvent
getChannelIdLong, getEntitlements, getGuild, getGuildLocale, getIdLong, getMember, getToken, getTypeRaw, getUser, getUserLocale, isAcknowledged
Methods inherited from class net.dv8tion.jda.api.events.Event
getJDA, getRawData, getResponseNumber, toString
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.dv8tion.jda.api.interactions.commands.CommandAutoCompleteInteraction
getGuildChannel
Methods inherited from interface net.dv8tion.jda.api.interactions.commands.CommandInteractionPayload
getCommandId, getCommandString, getFullCommandName, getOption, getOption, getOption, getOption, getOptionsByName, getOptionsByType, isGlobalCommand
Methods inherited from interface net.dv8tion.jda.api.interactions.callbacks.IAutoCompleteCallback
replyChoice, replyChoice, replyChoice, replyChoiceDoubles, replyChoiceDoubles, replyChoiceLongs, replyChoiceLongs, replyChoices, replyChoiceStrings, replyChoiceStrings
Methods inherited from interface net.dv8tion.jda.api.interactions.Interaction
getChannelId, getChannelIdLong, getChannelType, getEntitlements, getGuild, getGuildLocale, getJDA, getMember, getMessageChannel, getToken, getType, getTypeRaw, getUser, getUserLocale, isAcknowledged, isFromGuild
Methods inherited from interface net.dv8tion.jda.api.entities.ISnowflake
getId, getIdLong, getTimeCreated
-
Constructor Details
-
CommandAutoCompleteInteractionEvent
public CommandAutoCompleteInteractionEvent(@Nonnull JDA api, long responseNumber, @Nonnull CommandAutoCompleteInteraction interaction)
-
-
Method Details
-
getInteraction
Description copied from class:GenericInteractionCreateEvent
TheInteraction
instance.
Note that this event is a delegate which implements the same interface.- Overrides:
getInteraction
in classGenericAutoCompleteInteractionEvent
- Returns:
- The
Interaction
-
getFocusedOption
Description copied from interface:CommandAutoCompleteInteraction
The focused option which the user is typing.This is not validated by the Discord API and may contain invalid/incomplete inputs.
- Specified by:
getFocusedOption
in interfaceCommandAutoCompleteInteraction
- Returns:
- The focused
AutoCompleteQuery
-
getCommandType
Description copied from interface:CommandInteractionPayload
TheType
of command this interaction is for.- Specified by:
getCommandType
in interfaceCommandInteractionPayload
- Returns:
- The command type
-
getName
Description copied from interface:CommandInteractionPayload
The command name.
This can be useful for abstractions.Note that commands can have these following structures:
/name subcommandGroup subcommandName
/name subcommandName
/name
CommandInteractionPayload.getFullCommandName()
to simplify your checks.- Specified by:
getName
in interfaceCommandInteractionPayload
- Returns:
- The command name
-
getSubcommandName
Description copied from interface:CommandInteractionPayload
The subcommand name.
This can be useful for abstractions.Note that commands can have these following structures:
/name subcommandGroup subcommandName
/name subcommandName
/name
CommandInteractionPayload.getFullCommandName()
to simplify your checks.- Specified by:
getSubcommandName
in interfaceCommandInteractionPayload
- Returns:
- The subcommand name, or null if this is not a subcommand
-
getSubcommandGroup
Description copied from interface:CommandInteractionPayload
The subcommand group name.
This can be useful for abstractions.Note that commands can have these following structures:
/name subcommandGroup subcommandName
/name subcommandName
/name
CommandInteractionPayload.getFullCommandName()
to simplify your checks.- Specified by:
getSubcommandGroup
in interfaceCommandInteractionPayload
- Returns:
- The subcommand group name, or null if this is not a subcommand group
-
getCommandIdLong
public long getCommandIdLong()Description copied from interface:CommandInteractionPayload
The command id.
This is the id generated when a command is created viaGuild.updateCommands()
or similar.It is usually preferred to discriminate commands by the
command names
instead.- Specified by:
getCommandIdLong
in interfaceCommandInteractionPayload
- Returns:
- The command id
-
isGuildCommand
public boolean isGuildCommand()Description copied from interface:CommandInteractionPayload
Whether the used command is a guild command.Guild commands can be created with
Guild.upsertCommand(CommandData)
.- Specified by:
isGuildCommand
in interfaceCommandInteractionPayload
- Returns:
- True, if the used command is a guild command
-
getOptions
Description copied from interface:CommandInteractionPayload
The options provided by the user when this command was executed.
Each option has a name and value.For
CommandAutoCompleteInteraction
, this might be incomplete and unvalidated. Auto-complete interactions happen on incomplete command inputs and are not validated.- Specified by:
getOptions
in interfaceCommandInteractionPayload
- Returns:
- The options passed for this command
- See Also:
-
replyChoices
@Nonnull @CheckReturnValue public AutoCompleteCallbackAction replyChoices(@Nonnull Collection<Command.Choice> choices) Description copied from interface:IAutoCompleteCallback
Reply with up to 25 choices which can be picked from by the user.
The user may continue writing inputs instead of using one of your choices.- Specified by:
replyChoices
in interfaceIAutoCompleteCallback
- Overrides:
replyChoices
in classGenericAutoCompleteInteractionEvent
- Parameters:
choices
- The choice suggestions to present to the user, 0-25 choices- Returns:
AutoCompleteCallbackAction
-
getChannel
Description copied from interface:Interaction
The channel this interaction happened in.- Specified by:
getChannel
in interfaceCommandAutoCompleteInteraction
- Specified by:
getChannel
in interfaceInteraction
- Overrides:
getChannel
in classGenericInteractionCreateEvent
- Returns:
- The channel or null if the channel is not provided
-