Class AutoCompleteEvent
java.lang.Object
com.github.kaktushose.jda.commands.dispatching.events.Event<CommandAutoCompleteInteractionEvent>
com.github.kaktushose.jda.commands.dispatching.events.interactions.AutoCompleteEvent
- All Implemented Interfaces:
ISnowflake
,Interaction
This class is a subclass of
Event
.
It provides additional features for replying to a CommandAutoCompleteInteractionEvent
.- See Also:
-
Field Summary
-
Constructor Summary
ConstructorDescriptionAutoCompleteEvent
(@NotNull CommandAutoCompleteInteractionEvent event, @NotNull InteractionRegistry registry, @NotNull com.github.kaktushose.jda.commands.dispatching.Runtime runtime) Constructs a new AutoCompleteEvent. -
Method Summary
Modifier and TypeMethodDescription@NotNull String
getName()
The name of the input field, usually an option name inCommandAutoCompleteInteraction
.@NotNull OptionType
The expected option type for this query.@NotNull String
getValue()
The query value that the user is currently typing.void
replyChoice
(@NotNull String name, double value) Reply with up to 25 choices which can be picked from by the user.void
replyChoice
(@NotNull String name, long value) Reply with up to 25 choices which can be picked from by the user.void
replyChoice
(String name, String value) Reply with up to 25 choices which can be picked from by the user.void
replyChoiceDoubles
(double... choices) Reply with up to 25 choices which can be picked from by the user.void
replyChoiceDoubles
(@NotNull Collection<Double> choices) Reply with up to 25 choices which can be picked from by the user.void
replyChoiceLongs
(long... choices) Reply with up to 25 choices which can be picked from by the user.void
replyChoiceLongs
(@NotNull Collection<Long> choices) Reply with up to 25 choices which can be picked from by the user.void
replyChoices
(@NotNull Collection<Command.Choice> choices) Reply with up to 25 choices which can be picked from by the user.void
replyChoices
(Command.Choice... choices) Reply with up to 25 choices which can be picked from by the user.void
replyChoiceStrings
(@NotNull String... choices) Reply with up to 25 choices which can be picked from by the user.void
replyChoiceStrings
(@NotNull Collection<String> choices) Reply with up to 25 choices which can be picked from by the user.Methods inherited from class com.github.kaktushose.jda.commands.dispatching.events.Event
closeRuntime, getChannel, getChannelIdLong, getEntitlements, getGuild, getIdLong, getJDA, getMember, getToken, getTypeRaw, getUser, getUserLocale, isAcknowledged, jdaEvent, kv, runtimeId
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.dv8tion.jda.api.interactions.Interaction
getChannelId, getChannelType, getGuildChannel, getGuildLocale, getMessageChannel, getType, isFromGuild
Methods inherited from interface net.dv8tion.jda.api.entities.ISnowflake
getId, getTimeCreated
-
Constructor Details
-
AutoCompleteEvent
public AutoCompleteEvent(@NotNull @NotNull CommandAutoCompleteInteractionEvent event, @NotNull @NotNull InteractionRegistry registry, @NotNull @NotNull com.github.kaktushose.jda.commands.dispatching.Runtime runtime) Constructs a new AutoCompleteEvent.- Parameters:
event
- theCommandAutoCompleteInteractionEvent
this event holdsregistry
- the correspondingInteractionRegistry
runtime
- the correspondingRuntime
-
-
Method Details
-
replyChoices
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.- Parameters:
choices
- The choice suggestions to present to the user, 0-25 choices- Throws:
IllegalArgumentException
-- If
null
is provided - If more than 25 choices are added
- If any of the choice names are empty or longer than 100
- If the option type is incompatible with the choice type
- If the numeric value of any of the choices is not between -9.007199254740991E15 and 9.007199254740991E15
- If the string value of any of the choices is empty or longer than 100
- If
-
replyChoices
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.- Parameters:
choices
- The choice suggestions to present to the user, 0-25 choices- Throws:
IllegalArgumentException
-- If
null
is provided - If more than 25 choices are added
- If any of the choice names are empty or longer than 100
- If the option type is incompatible with the choice type
- If the numeric value of any of the choices is not between -9.007199254740991E15 and 9.007199254740991E15
- If the string value of any of the choices is empty or longer than 100
- If
-
replyChoice
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.- Parameters:
name
- The choice name to show to the user, 1-100 charactersvalue
- The choice value, 1-100 characters- Throws:
IllegalArgumentException
-- If
null
is provided - If more than 25 choices are added
- If the choice name is empty or longer than 100
- If the option type is not
OptionType.STRING
- If the string value of any of the choices is empty or longer than 100
- If
-
replyChoice
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.- Parameters:
name
- The choice name to show to the user, 1-100 charactersvalue
- The choice value, must be between -9.007199254740991E15 and 9.007199254740991E15- Throws:
IllegalArgumentException
-- If
null
is provided - If more than 25 choices are added
- If the choice name is empty or longer than 100
- If the option type is incompatible with the choice type
- If the value of is not between -9.007199254740991E15 and 9.007199254740991E15
- If
-
replyChoice
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.- Parameters:
name
- The choice name to show to the user, 1-100 charactersvalue
- The choice value, must be between -9.007199254740991E15 and 9.007199254740991E15- Throws:
IllegalArgumentException
-- If
null
is provided - If more than 25 choices are added
- If the choice name is empty or longer than 100
- If the option type is incompatible with the choice type
- If the value of is not between -9.007199254740991E15 and 9.007199254740991E15
- If
-
replyChoiceStrings
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.The provided strings will be used as value and name for the
Choices
.- Parameters:
choices
- The choice suggestions to present to the user, each limited to 100 characters- Throws:
IllegalArgumentException
-
-
replyChoiceStrings
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.The provided strings will be used as value and name for the
Choices
.- Parameters:
choices
- The choice suggestions to present to the user, each limited to 100 characters- Throws:
IllegalArgumentException
-
-
replyChoiceLongs
public void replyChoiceLongs(long... choices) 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.The string values of the provided longs will be used as value and name for the
Choices
.- Parameters:
choices
- The choice suggestions to present to the user- Throws:
IllegalArgumentException
-- If
null
is provided - If more than 25 choices are added
- If the option type is incompatible with the choice type
- If the numeric value of any of the choices is not between -9.007199254740991E15 and 9.007199254740991E15
- If
-
replyChoiceLongs
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.The string values of the provided longs will be used as value and name for the
Choices
.- Parameters:
choices
- The choice suggestions to present to the user- Throws:
IllegalArgumentException
-- If
null
is provided - If more than 25 choices are added
- If the option type is incompatible with the choice type
- If the numeric value of any of the choices is not between -9.007199254740991E15 and 9.007199254740991E15
- If
-
replyChoiceDoubles
public void replyChoiceDoubles(double... choices) 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.The string values of the provided doubles will be used as value and name for the
Choices
.- Parameters:
choices
- The choice suggestions to present to the user- Throws:
IllegalArgumentException
-- If
null
is provided - If more than 25 choices are added
- If the option type is incompatible with the choice type
- If the numeric value of any of the choices is not between -9.007199254740991E15 and 9.007199254740991E15
- If
-
replyChoiceDoubles
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.The string values of the provided doubles will be used as value and name for the
Choices
.- Parameters:
choices
- The choice suggestions to present to the user- Throws:
IllegalArgumentException
-- If
null
is provided - If more than 25 choices are added
- If the option type is incompatible with the choice type
- If the numeric value of any of the choices is not between -9.007199254740991E15 and 9.007199254740991E15
- If
-
getName
The name of the input field, usually an option name inCommandAutoCompleteInteraction
.- Returns:
- The option name
-
getValue
The query value that the user is currently typing.
This is not validated and may not be a valid value for an actual command. For instance, a user may input invalid numbers for
invalid reference
#NUMBER
- Returns:
- The current auto-completable query value
-
getOptionType
The expected option type for this query.- Returns:
- The option type expected from this auto-complete response
-