Package discord4j.core.object.command
Class ApplicationCommand
- java.lang.Object
-
- discord4j.core.object.command.ApplicationCommand
-
- All Implemented Interfaces:
DiscordObject
@Experimental public class ApplicationCommand extends Object implements DiscordObject
A Discord application command.- See Also:
- Application Command Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classApplicationCommand.Type
-
Field Summary
Fields Modifier and Type Field Description static intMAX_DESCRIPTION_LENGTHThe maximum amount of characters that can be in an application command description.static intMAX_NAME_LENGTHThe maximum amount of characters that can be in an application command name.
-
Constructor Summary
Constructors Constructor Description ApplicationCommand(GatewayDiscordClient gateway, discord4j.discordjson.json.ApplicationCommandData data)Constructs anApplicationCommandwith an associatedGatewayDiscordClientand Discord data.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SnowflakegetApplicationId()Gets the unique id of the parent application.GatewayDiscordClientgetClient()Returns theGatewayDiscordClientthat created this object.StringgetDescription()Gets description of the command.SnowflakegetId()Gets unique id of the command.StringgetName()Gets the name of the command.Optional<ApplicationCommandOption>getOption(String name)Gets the option corresponding to the provided name, if present.List<ApplicationCommandOption>getOptions()Gets the options of the command.ApplicationCommand.TypegetType()Gets the type of the command.
-
-
-
Field Detail
-
MAX_NAME_LENGTH
public static final int MAX_NAME_LENGTH
The maximum amount of characters that can be in an application command name.- See Also:
- Constant Field Values
-
MAX_DESCRIPTION_LENGTH
public static final int MAX_DESCRIPTION_LENGTH
The maximum amount of characters that can be in an application command description.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ApplicationCommand
public ApplicationCommand(GatewayDiscordClient gateway, discord4j.discordjson.json.ApplicationCommandData data)
Constructs anApplicationCommandwith an associatedGatewayDiscordClientand Discord data.- Parameters:
gateway- TheGatewayDiscordClientassociated to this object, must be non-null.data- The raw data as represented by Discord, must be non-null.
-
-
Method Detail
-
getId
public Snowflake getId()
Gets unique id of the command.- Returns:
- The unique id of the command.
-
getType
public ApplicationCommand.Type getType()
Gets the type of the command.- Returns:
- The type of the command.
-
getApplicationId
public Snowflake getApplicationId()
Gets the unique id of the parent application.- Returns:
- The unique id of the parent application.
-
getName
public String getName()
Gets the name of the command.- Returns:
- The name of the command.
-
getDescription
public String getDescription()
Gets description of the command.- Returns:
- The description of the command.
-
getOptions
public List<ApplicationCommandOption> getOptions()
Gets the options of the command.- Returns:
- The options of the command.
-
getOption
public Optional<ApplicationCommandOption> getOption(String name)
Gets the option corresponding to the provided name, if present.- Parameters:
name- The name of the option.- Returns:
- The option corresponding to the provided name, if present.
-
getClient
public GatewayDiscordClient getClient()
Description copied from interface:DiscordObjectReturns theGatewayDiscordClientthat created this object. Methods in it are exclusively based on the entity cache orStorein use. Refer to callinggetClient().rest()to access aDiscordClientthat is capable of requesting entities directly from the REST API.- Specified by:
getClientin interfaceDiscordObject- Returns:
- The
GatewayDiscordClientassociated to this object.
-
-