Class Command.Option

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

public static class Command.Option extends Object
An Option for a command.
  • Constructor Details

  • Method Details

    • getName

      @Nonnull public String getName()
      The name of this option, subcommand, or subcommand group.
      Returns:
      The name
    • getNameLocalizations

      @Nonnull public LocalizationMap getNameLocalizations()
      The localizations of this option's name for various languages.
      Returns:
      The LocalizationMap containing the mapping from DiscordLocale to the localized name
    • getDescription

      @Nonnull public String getDescription()
      The description of this option, subcommand, or subcommand group.
      Returns:
      The description
    • getDescriptionLocalizations

      @Nonnull public LocalizationMap getDescriptionLocalizations()
      The localizations of this option's description for various languages.
      Returns:
      The LocalizationMap containing the mapping from DiscordLocale to the localized description
    • getTypeRaw

      public int getTypeRaw()
      The raw option type.
      Returns:
      The type
    • isRequired

      public boolean isRequired()
      Whether this option is required
      Returns:
      True if this option is required
    • isAutoComplete

      public boolean isAutoComplete()
      Whether this option supports auto-complete
      Returns:
      True if this option supports auto-complete
    • getType

      @Nonnull public OptionType getType()
      Returns:
      The type
    • getChannelTypes

      @Nonnull public @Unmodifiable Set<ChannelType> getChannelTypes()
      The ChannelTypes this option is restricted to.
      This is empty if the option is not of type CHANNEL or not restricted to specific types.
      Returns:
      Immutable Set of ChannelType
    • getMinValue

      @Nullable public Number getMinValue()
      The minimum value which can be provided for this option.
      This returns null if the value is not set or if the option is not of type INTEGER or NUMBER.
      Returns:
      The minimum value for this option or null
    • getMaxValue

      @Nullable public Number getMaxValue()
      The maximum value which can be provided for this option.
      This returns null if the value is not set or if the option is not of type INTEGER or NUMBER.
      Returns:
      The maximum value for this option or null
    • getMinLength

      @Nullable public Integer getMinLength()
      The minimum length for strings which can be provided for this option.
      This returns null if the value is not set or if the option is not of type STRING.
      Returns:
      The minimum length for strings for this option or null
    • getMaxLength

      @Nullable public Integer getMaxLength()
      The maximum length for strings which can be provided for this option.
      This returns null if the value is not set or if the option is not of type STRING.
      Returns:
      The maximum length for strings for this option or null
    • getChoices

      @Nonnull public @Unmodifiable List<Command.Choice> getChoices()
      The predefined choices available for this option.
      If no choices are defined, this returns an empty list.
      Returns:
      Immutable List of Command.Choice
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object