Class Command.Choice
- java.lang.Object
-
- net.dv8tion.jda.api.interactions.commands.Command.Choice
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)longgetAsLong()The value of this choice.StringgetAsString()The value of this choice.StringgetName()The readable name of this choice.inthashCode()StringtoString()
-
-
-
Constructor Detail
-
Choice
public Choice(@Nonnull 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 String name, @Nonnull 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:
IllegalArgumentException- If null is providedParsingException- If the data is not formatted correctly or missing required parameters
-
-
Method Detail
-
getName
@Nonnull public String getName()
The readable name of this choice.
This is shown to the user in the official client.- Returns:
- The choice name
-
getAsLong
public long getAsLong()
The value of this choice.- Returns:
- The long value
-
getAsString
@Nonnull public String getAsString()
The value of this choice.- Returns:
- The String value
-
-