Interface IAutoCompleteCallback
- All Superinterfaces:
Interaction
,ISnowflake
- All Known Subinterfaces:
CommandAutoCompleteInteraction
- All Known Implementing Classes:
CommandAutoCompleteInteractionEvent
,GenericAutoCompleteInteractionEvent
Auto-complete must be enabled on options
via OptionData.setAutoComplete(boolean)
.
When a user inputs auto-complete options, you will receive these interactions and can provide up to 25 suggestions for the user to pick from.
You can also use replyChoices(Command.Choice...)
without parameters to acknowledge the interaction with 0 choices.
-
Method Summary
Modifier and TypeMethodDescriptiondefault AutoCompleteCallbackAction
replyChoice
(String name, double value) Reply with up to 25 choices which can be picked from by the user.default AutoCompleteCallbackAction
replyChoice
(String name, long value) Reply with up to 25 choices which can be picked from by the user.default AutoCompleteCallbackAction
replyChoice
(String name, String value) Reply with up to 25 choices which can be picked from by the user.default AutoCompleteCallbackAction
replyChoiceDoubles
(double... choices) Reply with up to 25 choices which can be picked from by the user.default AutoCompleteCallbackAction
replyChoiceDoubles
(Collection<Double> choices) Reply with up to 25 choices which can be picked from by the user.default AutoCompleteCallbackAction
replyChoiceLongs
(long... choices) Reply with up to 25 choices which can be picked from by the user.default AutoCompleteCallbackAction
replyChoiceLongs
(Collection<Long> choices) Reply with up to 25 choices which can be picked from by the user.replyChoices
(Collection<Command.Choice> choices) Reply with up to 25 choices which can be picked from by the user.default AutoCompleteCallbackAction
replyChoices
(Command.Choice... choices) Reply with up to 25 choices which can be picked from by the user.default AutoCompleteCallbackAction
replyChoiceStrings
(String... choices) Reply with up to 25 choices which can be picked from by the user.default AutoCompleteCallbackAction
replyChoiceStrings
(Collection<String> choices) Reply with up to 25 choices which can be picked from by the user.Methods inherited from interface net.dv8tion.jda.api.interactions.Interaction
getChannel, getChannelType, getGuild, getGuildChannel, getGuildLocale, getJDA, getMember, getMessageChannel, getNewsChannel, getPrivateChannel, getTextChannel, getThreadChannel, getToken, getType, getTypeRaw, getUser, getUserLocale, getVoiceChannel, isAcknowledged, isFromGuild
Methods inherited from interface net.dv8tion.jda.api.entities.ISnowflake
getId, getIdLong, getTimeCreated
-
Method Details
-
replyChoices
@Nonnull @CheckReturnValue AutoCompleteCallbackAction replyChoices(@Nonnull Collection<Command.Choice> 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.- Parameters:
choices
- The choice suggestions to present to the user, 0-OptionData.MAX_CHOICES
choices- Returns:
AutoCompleteCallbackAction
- Throws:
IllegalArgumentException
- If any of the following is true:null
is provided- More than 25 are added
- Any of the choice names is empty or longer than 100
- The option type is incompatible with the choice type
- The numeric value of any of the choices is not between -9.007199254740991E15 and 9.007199254740991E15
- The string value of any of the choices is empty or longer than 100
-
replyChoices
@Nonnull @CheckReturnValue default AutoCompleteCallbackAction replyChoices(@Nonnull Command.Choice... 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.- Parameters:
choices
- The choice suggestions to present to the user, 0-OptionData.MAX_CHOICES
choices- Returns:
AutoCompleteCallbackAction
- Throws:
IllegalArgumentException
- If any of the following is true:null
is provided- More than 25 are added
- Any of the choice names is empty or longer than 100
- The option type is incompatible with the choice type
- The numeric value of any of the choices is not between -9.007199254740991E15 and 9.007199254740991E15
- The string value of any of the choices is empty or longer than 100
-
replyChoice
@Nonnull @CheckReturnValue default AutoCompleteCallbackAction replyChoice(@Nonnull String name, @Nonnull String value) 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- Returns:
AutoCompleteCallbackAction
- Throws:
IllegalArgumentException
- If any of the following is true:null
is provided- More than 25 are added
- The choice name is empty or longer than 100
- The option type is not
OptionType.STRING
- The string value of any of the choices is empty or longer than 100
-
replyChoice
@Nonnull @CheckReturnValue default AutoCompleteCallbackAction replyChoice(@Nonnull String name, long value) 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- Returns:
AutoCompleteCallbackAction
- Throws:
IllegalArgumentException
- If any of the following is true:null
is provided- More than 25 are added
- The choice name is empty or longer than 100
- The option type is incompatible with the choice type
- The value of is not between -9.007199254740991E15 and 9.007199254740991E15
-
replyChoice
@Nonnull @CheckReturnValue default AutoCompleteCallbackAction replyChoice(@Nonnull String name, double value) 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- Returns:
AutoCompleteCallbackAction
- Throws:
IllegalArgumentException
- If any of the following is true:null
is provided- More than 25 are added
- The choice name is empty or longer than 100
- The option type is incompatible with the choice type
- The value of is not between -9.007199254740991E15 and 9.007199254740991E15
-
replyChoiceStrings
@Nonnull @CheckReturnValue default AutoCompleteCallbackAction replyChoiceStrings(@Nonnull String... 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 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- Returns:
AutoCompleteCallbackAction
- Throws:
IllegalArgumentException
- If any of the following is true:
-
replyChoiceStrings
@Nonnull @CheckReturnValue default AutoCompleteCallbackAction replyChoiceStrings(@Nonnull Collection<String> 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 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- Returns:
AutoCompleteCallbackAction
- Throws:
IllegalArgumentException
- If any of the following is true:
-
replyChoiceLongs
@Nonnull @CheckReturnValue default AutoCompleteCallbackAction replyChoiceLongs(@Nonnull 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- Returns:
AutoCompleteCallbackAction
- Throws:
IllegalArgumentException
- If any of the following is true:null
is provided- More than 25 are added
- The option type is incompatible with the choice type
- The numeric value of any of the choices is not between -9.007199254740991E15 and 9.007199254740991E15
-
replyChoiceLongs
@Nonnull @CheckReturnValue default AutoCompleteCallbackAction replyChoiceLongs(@Nonnull Collection<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- Returns:
AutoCompleteCallbackAction
- Throws:
IllegalArgumentException
- If any of the following is true:null
is provided- More than 25 are added
- The option type is incompatible with the choice type
- The numeric value of any of the choices is not between -9.007199254740991E15 and 9.007199254740991E15
-
replyChoiceDoubles
@Nonnull @CheckReturnValue default AutoCompleteCallbackAction replyChoiceDoubles(@Nonnull 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- Returns:
AutoCompleteCallbackAction
- Throws:
IllegalArgumentException
- If any of the following is true:null
is provided- More than 25 are added
- The option type is incompatible with the choice type
- The numeric value of any of the choices is not between -9.007199254740991E15 and 9.007199254740991E15
-
replyChoiceDoubles
@Nonnull @CheckReturnValue default AutoCompleteCallbackAction replyChoiceDoubles(@Nonnull Collection<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- Returns:
AutoCompleteCallbackAction
- Throws:
IllegalArgumentException
- If any of the following is true:null
is provided- More than 25 are added
- The option type is incompatible with the choice type
- The numeric value of any of the choices is not between -9.007199254740991E15 and 9.007199254740991E15
-