Package discord4j.core.object.command
Class ApplicationCommandInteractionOption
- java.lang.Object
-
- discord4j.core.object.command.ApplicationCommandInteractionOption
-
- All Implemented Interfaces:
DiscordObject
@Experimental public class ApplicationCommandInteractionOption extends Object implements DiscordObject
A Discord application command interaction.- See Also:
- Application Command Interaction Object
-
-
Constructor Summary
Constructors Constructor Description ApplicationCommandInteractionOption(GatewayDiscordClient gateway, discord4j.discordjson.json.ApplicationCommandInteractionOptionData data, Long guildId)
Constructs anApplicationCommandInteractionOption
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.String
getName()
Gets the name of the option.Optional<ApplicationCommandInteractionOption>
getOption(String name)
Gets the option corresponding to the provided name, if present.List<ApplicationCommandInteractionOption>
getOptions()
Gets the options, present if this option is a group or subcommand.ApplicationCommandOption.Type
getType()
Gets the type of this option.Optional<ApplicationCommandInteractionOptionValue>
getValue()
boolean
isFocused()
Whether this option is currently focused or not.
-
-
-
Constructor Detail
-
ApplicationCommandInteractionOption
public ApplicationCommandInteractionOption(GatewayDiscordClient gateway, discord4j.discordjson.json.ApplicationCommandInteractionOptionData data, @Nullable Long guildId)
Constructs anApplicationCommandInteractionOption
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 the option.- Returns:
- The name of the option.
-
getValue
public Optional<ApplicationCommandInteractionOptionValue> getValue()
-
getType
public ApplicationCommandOption.Type getType()
Gets the type of this option.- Returns:
- The type of this option.
-
getOptions
public List<ApplicationCommandInteractionOption> getOptions()
Gets the options, present if this option is a group or subcommand.- Returns:
- The options, present if this option is a group or subcommand.
-
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.
-
isFocused
public boolean isFocused()
Whether this option is currently focused or not.This will always return false unless this option is from an autocomplete interaction.
- Returns:
- Whether this option is currently focused or not.
-
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.
-
-