Class Command.Option
- java.lang.Object
-
- net.dv8tion.jda.api.interactions.commands.Command.Option
-
- Enclosing class:
- Command
public static class Command.Option extends java.lang.Object
An Option for a command.
-
-
Constructor Summary
Constructors Constructor Description Option(DataObject json)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
java.util.Set<ChannelType>
getChannelTypes()
TheChannelTypes
this option is restricted to.java.util.List<Command.Choice>
getChoices()
The predefined choices available for this option.java.lang.String
getDescription()
The description of this option, subcommand, or subcommand group.java.lang.Number
getMaxValue()
The maximum value which can be provided for this option.java.lang.Number
getMinValue()
The minimum value which can be provided for this option.java.lang.String
getName()
The name of this option, subcommand, or subcommand group.OptionType
getType()
TheOptionType
.int
getTypeRaw()
The raw option type.int
hashCode()
boolean
isRequired()
Whether this option is requiredjava.lang.String
toString()
-
-
-
Constructor Detail
-
Option
public Option(@Nonnull DataObject json)
-
-
Method Detail
-
getName
@Nonnull public java.lang.String getName()
The name of this option, subcommand, or subcommand group.- Returns:
- The name
-
getDescription
@Nonnull public java.lang.String getDescription()
The description of this option, subcommand, or subcommand group.- Returns:
- The 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
-
getType
@Nonnull public OptionType getType()
TheOptionType
.- Returns:
- The type
-
getChannelTypes
@Nonnull public java.util.Set<ChannelType> getChannelTypes()
TheChannelTypes
this option is restricted to.
This is empty if the option is not of typeCHANNEL
or not restricted to specific types.- Returns:
- Immutable
Set
ofChannelType
-
getMinValue
@Nullable public java.lang.Number getMinValue()
The minimum value which can be provided for this option.
This returnsnull
if the value is not set or if the option is not of typeINTEGER
orNUMBER
.- Returns:
- The minimum value for this option or
null
-
getMaxValue
@Nullable public java.lang.Number getMaxValue()
The maximum value which can be provided for this option.
This returnsnull
if the value is not set or if the option is not of typeINTEGER
orNUMBER
.- Returns:
- The maximum value for this option or
null
-
getChoices
@Nonnull public java.util.List<Command.Choice> getChoices()
The predefined choices available for this option.
If no choices are defined, this returns an empty list.- Returns:
- Immutable
List
ofCommand.Choice
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-