Package discord4j.core.object.command
Class ApplicationCommandOptionChoice
- java.lang.Object
-
- discord4j.core.object.command.ApplicationCommandOptionChoice
-
- All Implemented Interfaces:
DiscordObject
@Experimental public class ApplicationCommandOptionChoice extends Object implements DiscordObject
A Discord application command option choice.- See Also:
- Application Command Option Choice Object
-
-
Field Summary
Fields Modifier and Type Field Description static int
MAX_NAME_LENGTH
The maximum amount of characters that can be in an application command option choice name.static int
MAX_VALUE_LENGTH
The maximum amount of characters that can be in an application command option choice value.
-
Constructor Summary
Constructors Constructor Description ApplicationCommandOptionChoice(GatewayDiscordClient gateway, discord4j.discordjson.json.ApplicationCommandOptionChoiceData data)
Constructs anApplicationCommandOptionChoice
with an associatedGatewayDiscordClient
and Discord data.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
asLong()
Gets the value of this choice as a long.String
asString()
Gets the value of this choice as a string.GatewayDiscordClient
getClient()
Returns theGatewayDiscordClient
that created this object.String
getName()
Gets the name of this choice.Object
getValue()
Gets the value of this choice.
-
-
-
Field Detail
-
MAX_NAME_LENGTH
public static final int MAX_NAME_LENGTH
The maximum amount of characters that can be in an application command option choice name.- See Also:
- Constant Field Values
-
MAX_VALUE_LENGTH
public static final int MAX_VALUE_LENGTH
The maximum amount of characters that can be in an application command option choice value.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ApplicationCommandOptionChoice
public ApplicationCommandOptionChoice(GatewayDiscordClient gateway, discord4j.discordjson.json.ApplicationCommandOptionChoiceData data)
Constructs anApplicationCommandOptionChoice
with an associatedGatewayDiscordClient
and Discord data.- Parameters:
gateway
- TheGatewayDiscordClient
associated to this object, must be non-null.data
- The raw data as represented by Discord, must be non-null.
-
-
Method Detail
-
getName
public String getName()
Gets the name of this choice.- Returns:
- The name of this choice.
-
getValue
public Object getValue()
Gets the value of this choice.- Returns:
- The name of this choice.
-
asString
public String asString()
Gets the value of this choice as a string.- Returns:
- The value of this choice as a string.
-
asLong
public long asLong()
Gets the value of this choice as a long.- Returns:
- The value of this choice as a long.
-
getClient
public GatewayDiscordClient getClient()
Description copied from interface:DiscordObject
Returns theGatewayDiscordClient
that created this object. Methods in it are exclusively based on the entity cache orStore
in use. Refer to callinggetClient().rest()
to access aDiscordClient
that is capable of requesting entities directly from the REST API.- Specified by:
getClient
in interfaceDiscordObject
- Returns:
- The
GatewayDiscordClient
associated to this object.
-
-