Class Command.Choice
java.lang.Object
net.dv8tion.jda.api.interactions.commands.Command.Choice
- Enclosing interface:
- Command
Predefined choice used for options.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
double
The value of this choice.long
The value of this choice.The value of this choice.getName()
The readable name of this choice.getType()
TheOptionType
this choice is forint
hashCode()
toString()
-
Constructor Details
-
Choice
Create a Choice tuple- Parameters:
name
- The display name of this choicevalue
- The integer value you receive in a command option
-
Choice
Create a Choice tuple- Parameters:
name
- The display name of this choicevalue
- The double value you receive in a command option
-
Choice
Create a Choice tuple- Parameters:
name
- The display name of this choicevalue
- The string value you receive in a command option
-
Choice
Create a Choice tuple- Parameters:
json
- The serialized choice instance with name and value mapping- Throws:
IllegalArgumentException
- If null is providedParsingException
- If the data is not formatted correctly or missing required parameters
-
-
Method Details
-
getName
The readable name of this choice.
This is shown to the user in the official client.- Returns:
- The choice name
-
getAsDouble
public double getAsDouble()The value of this choice.- Returns:
- The double value, or NaN if this is not a numeric choice value
-
getAsLong
public long getAsLong()The value of this choice.- Returns:
- The long value
-
getAsString
The value of this choice.- Returns:
- The String value
-
getType
TheOptionType
this choice is for- Returns:
- The option type of this choice
-
hashCode
public int hashCode() -
equals
-
toString
-