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 anApplicationCommandInteractionOptionwith an associatedGatewayDiscordClientand Discord data.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GatewayDiscordClientgetClient()Returns theGatewayDiscordClientthat created this object.StringgetName()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.TypegetType()Gets the type of this option.Optional<ApplicationCommandInteractionOptionValue>getValue()booleanisFocused()Whether this option is currently focused or not.
-
-
-
Constructor Detail
-
ApplicationCommandInteractionOption
public ApplicationCommandInteractionOption(GatewayDiscordClient gateway, discord4j.discordjson.json.ApplicationCommandInteractionOptionData data, @Nullable Long guildId)
Constructs anApplicationCommandInteractionOptionwith 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
-
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: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.
-
-