Class Command.Choice

java.lang.Object
net.dv8tion.jda.api.interactions.commands.Command.Choice
Enclosing interface:
Command

public static class Command.Choice extends Object
Predefined choice used for options.
See Also:
  • Field Details

    • MAX_NAME_LENGTH

      public static final int MAX_NAME_LENGTH
      The maximum length the name of a choice can be.
      See Also:
    • MAX_STRING_VALUE_LENGTH

      public static final int MAX_STRING_VALUE_LENGTH
      The maximum length the STRING value of a choice can be.
      See Also:
  • Constructor Details

    • Choice

      public Choice(@Nonnull String name, long value)
      Create a Choice tuple
      Parameters:
      name - The display name of this choice, must be less than 100 characters
      value - The integer value you receive in a command option
      Throws:
      IllegalArgumentException - If the name is null, empty, or not between 1-100 characters long, as defined by MAX_NAME_LENGTH
    • Choice

      public Choice(@Nonnull String name, double value)
      Create a Choice tuple
      Parameters:
      name - The display name of this choice, must be less than 100 characters
      value - The double value you receive in a command option
      Throws:
      IllegalArgumentException - If the name is null, empty, or not between 1-100 characters long, as defined by MAX_NAME_LENGTH
    • Choice

      public Choice(@Nonnull String name, @Nonnull String value)
      Create a Choice tuple
      Parameters:
      name - The display name of this choice, must be less than 100 characters
      value - The string value you receive in a command option
      Throws:
      IllegalArgumentException -
    • Choice

      public Choice(@Nonnull DataObject json)
      Create a Choice tuple
      Parameters:
      json - The serialized choice instance with name and value mapping
      Throws:
      IllegalArgumentException - If null is provided
      ParsingException - If the data is not formatted correctly or missing required parameters
  • Method Details