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:
  • Constructor Details

    • ApplicationCommandInteraction

      public ApplicationCommandInteraction(GatewayDiscordClient gateway, discord4j.discordjson.json.ApplicationCommandInteractionData data, @Nullable Long guildId)
      Constructs an ApplicationCommandInteraction with an associated GatewayDiscordClient and Discord data.
      Parameters:
      gateway - The GatewayDiscordClient associated to this object, must be non-null.
      data - The raw data as represented by Discord, must be non-null.
  • Method Details

    • 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.
    • getApplicationCommandType

      public Optional<ApplicationCommand.Type> getApplicationCommandType()
      Gets the type of the invoked command.
      Returns:
      The type 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

      Gets the options of the invoked command.
      Returns:
      The options of the invoked command.
    • getOption

      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.
    • getResolved

      Gets the converted users + roles + channels + attachments.
      Returns:
      The converted users + roles + channels + attachments.
    • getTargetId

      public Optional<Snowflake> getTargetId()
      Gets the ID of the user or message targeted by a user or message command.
      Returns:
      The id of the user or message targeted.
    • getComponents

      public List<MessageComponent> getComponents()
      Gets the components of the submitted modal.
      Returns:
      The components of the submitted modal.
    • getClient

      public GatewayDiscordClient getClient()
      Description copied from interface: DiscordObject
      Returns the GatewayDiscordClient that created this object. Methods in it are exclusively based on the entity cache or Store in use. Refer to calling getClient().rest() to access a DiscordClient that is capable of requesting entities directly from the REST API.
      Specified by:
      getClient in interface DiscordObject
      Returns:
      The GatewayDiscordClient associated to this object.
    • toString

      public String toString()
      Overrides:
      toString in class Object