Class Command.Choice
- java.lang.Object
-
- net.dv8tion.jda.api.interactions.commands.Command.Choice
-
- Enclosing class:
- Command
public static class Command.Choice extends java.lang.ObjectPredefined choice used for options.
-
-
Constructor Summary
Constructors Constructor Description Choice(java.lang.String name, double value)Create a Choice tupleChoice(java.lang.String name, long value)Create a Choice tupleChoice(java.lang.String name, java.lang.String value)Create a Choice tupleChoice(DataObject json)Create a Choice tuple
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)doublegetAsDouble()The value of this choice.longgetAsLong()The value of this choice.java.lang.StringgetAsString()The value of this choice.java.lang.StringgetName()The readable name of this choice.inthashCode()java.lang.StringtoString()
-
-
-
Constructor Detail
-
Choice
public Choice(@Nonnull java.lang.String name, long value)Create a Choice tuple- Parameters:
name- The display name of this choicevalue- The integer value you receive in a command option
-
Choice
public Choice(@Nonnull java.lang.String name, double value)Create a Choice tuple- Parameters:
name- The display name of this choicevalue- The double value you receive in a command option
-
Choice
public Choice(@Nonnull java.lang.String name, @Nonnull java.lang.String value)Create a Choice tuple- Parameters:
name- The display name of this choicevalue- The string value you receive in a command option
-
Choice
public Choice(@Nonnull DataObject json)Create a Choice tuple- Parameters:
json- The serialized choice instance with name and value mapping- Throws:
java.lang.IllegalArgumentException- If null is providedParsingException- If the data is not formatted correctly or missing required parameters
-
-
Method Detail
-
getName
@Nonnull public java.lang.String 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
@Nonnull public java.lang.String getAsString()
The value of this choice.- Returns:
- The String value
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-