Enum OptionType
- java.lang.Object
-
- java.lang.Enum<OptionType>
-
- net.dv8tion.jda.api.interactions.commands.OptionType
-
- All Implemented Interfaces:
Serializable
,Comparable<OptionType>
public enum OptionType extends Enum<OptionType>
The available types forCommand
options.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description ATTACHMENT
Options which accept a file attachmentBOOLEAN
Options which accept boolean true or false inputsCHANNEL
Options which accept a singleGuildChannel
INTEGER
Options which acceptLong
integer inputsMENTIONABLE
NUMBER
ROLE
Options which accept a singleRole
STRING
Options which accept text inputs.SUB_COMMAND
Option which is serialized as subcommand, this is only used for internals and should be ignored by users.SUB_COMMAND_GROUP
Option which is serialized as subcommand groups, this is only used for internals and should be ignored by users.UNKNOWN
Placeholder for future option typesUSER
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canSupportChoices()
Whether options of this type support predefined choices.static OptionType
fromKey(int key)
Converts the provided raw type to the enum constant.int
getKey()
The raw value for this type or -1 forUNKNOWN
static OptionType
valueOf(String name)
Returns the enum constant of this type with the specified name.static OptionType[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
UNKNOWN
public static final OptionType UNKNOWN
Placeholder for future option types
-
SUB_COMMAND
public static final OptionType SUB_COMMAND
Option which is serialized as subcommand, this is only used for internals and should be ignored by users.
-
SUB_COMMAND_GROUP
public static final OptionType SUB_COMMAND_GROUP
Option which is serialized as subcommand groups, this is only used for internals and should be ignored by users.
-
STRING
public static final OptionType STRING
Options which accept text inputs. This also supports role/channel/user mentions.
-
INTEGER
public static final OptionType INTEGER
Options which acceptLong
integer inputs- See Also:
OptionMapping.getAsLong()
-
BOOLEAN
public static final OptionType BOOLEAN
Options which accept boolean true or false inputs- See Also:
OptionMapping.getAsBoolean()
-
USER
public static final OptionType USER
-
CHANNEL
public static final OptionType CHANNEL
Options which accept a singleGuildChannel
- See Also:
OptionMapping.getAsGuildChannel()
-
ROLE
public static final OptionType ROLE
Options which accept a singleRole
- See Also:
OptionMapping.getAsRole()
-
MENTIONABLE
public static final OptionType MENTIONABLE
- See Also:
OptionMapping.getAsMentionable()
-
NUMBER
public static final OptionType NUMBER
-
ATTACHMENT
public static final OptionType ATTACHMENT
Options which accept a file attachment- See Also:
OptionMapping.getAsAttachment()
-
-
Method Detail
-
values
public static OptionType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (OptionType c : OptionType.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static OptionType valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
getKey
public int getKey()
The raw value for this type or -1 forUNKNOWN
- Returns:
- The raw value
-
canSupportChoices
public boolean canSupportChoices()
Whether options of this type support predefined choices.- Returns:
- True, if you can use choices for this type.
-
fromKey
@Nonnull public static OptionType fromKey(int key)
Converts the provided raw type to the enum constant.- Parameters:
key
- The raw type- Returns:
- The OptionType constant or
UNKNOWN
-
-