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

public final class AutoCompleteEvent extends Event<CommandAutoCompleteInteractionEvent>
This class is a subclass of Event. It provides additional features for replying to a CommandAutoCompleteInteractionEvent.
See Also:
  • Constructor Details

  • Method Details

    • replyChoices

      public void replyChoices(@NotNull @NotNull 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-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
    • replyChoices

      public void replyChoices(@NotNull 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-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
    • replyChoice

      public void 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 characters
      value - 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
    • replyChoice

      public void replyChoice(@NotNull @NotNull 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 characters
      value - 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
    • replyChoice

      public void replyChoice(@NotNull @NotNull 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 characters
      value - 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
    • replyChoiceStrings

      public void replyChoiceStrings(@NotNull @NotNull 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
      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 string value of any of the choices is empty or longer than 100
    • replyChoiceStrings

      public void replyChoiceStrings(@NotNull @NotNull 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
      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 string value of any of the choices is empty or longer than 100
    • 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
    • replyChoiceLongs

      public void replyChoiceLongs(@NotNull @NotNull 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
      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
    • 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
    • replyChoiceDoubles

      public void replyChoiceDoubles(@NotNull @NotNull 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
      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
    • getName

      @NotNull public @NotNull String getName()
      The name of the input field, usually an option name in CommandAutoCompleteInteraction.
      Returns:
      The option name
    • getValue

      @NotNull public @NotNull String 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

      @NotNull public @NotNull OptionType getOptionType()
      The expected option type for this query.
      Returns:
      The option type expected from this auto-complete response