Package discord4j.core.object.command
Class ApplicationCommandInteraction
- java.lang.Object
-
- discord4j.core.object.command.ApplicationCommandInteraction
-
- All Implemented Interfaces:
DiscordObject
@Experimental public class ApplicationCommandInteraction extends Object implements DiscordObject
A Discord application command interaction.- See Also:
- Application Command Interaction Object
-
-
Constructor Summary
Constructors Constructor Description ApplicationCommandInteraction(GatewayDiscordClient gateway, discord4j.discordjson.json.ApplicationCommandInteractionData data, Long guildId)
Constructs anApplicationCommandInteraction
with an associatedGatewayDiscordClient
and Discord data.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GatewayDiscordClient
getClient()
Returns theGatewayDiscordClient
that created this object.Optional<MessageComponent.Type>
getComponentType()
Gets the type of the component.Optional<String>
getCustomId()
Gets the developer-defined custom id of the component.Optional<Snowflake>
getId()
Gets the id of the invoked command.Optional<String>
getName()
Gets the name of the invoked command.Optional<ApplicationCommandInteractionOption>
getOption(String name)
Gets the option corresponding to the provided name, if present.List<ApplicationCommandInteractionOption>
getOptions()
Gets the options of the invoked command.Optional<List<String>>
getValues()
Gets the values selected if this is a select menu interaction.
-
-
-
Constructor Detail
-
ApplicationCommandInteraction
public ApplicationCommandInteraction(GatewayDiscordClient gateway, discord4j.discordjson.json.ApplicationCommandInteractionData data, @Nullable Long guildId)
Constructs anApplicationCommandInteraction
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
-
getId
public Optional<Snowflake> getId()
Gets the id of the invoked command.- Returns:
- The id of the invoked command.
-
getName
public Optional<String> getName()
Gets the name of the invoked command.- Returns:
- The name of the invoked command.
-
getCustomId
public Optional<String> getCustomId()
Gets the developer-defined custom id of the component.- Returns:
- The custom id of the component.
-
getComponentType
public Optional<MessageComponent.Type> getComponentType()
Gets the type of the component.- Returns:
- The type of the component.
-
getOptions
public List<ApplicationCommandInteractionOption> getOptions()
Gets the options of the invoked command.- Returns:
- The options of the invoked command.
-
getOption
public Optional<ApplicationCommandInteractionOption> 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.
-
getValues
public Optional<List<String>> getValues()
Gets the values selected if this is a select menu interaction.- Returns:
- The select menu values selected.
-
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.
-
-