Class ApplicationCommandInteraction

    • Constructor Detail

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