Class ApplicationCommand

    • Field Detail

      • MAX_NAME_LENGTH

        public static final int MAX_NAME_LENGTH
        The maximum amount of characters that can be in an application command name.
        See Also:
        Constant Field Values
      • MAX_DESCRIPTION_LENGTH

        public static final int MAX_DESCRIPTION_LENGTH
        The maximum amount of characters that can be in an application command description.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ApplicationCommand

        public ApplicationCommand​(GatewayDiscordClient gateway,
                                  discord4j.discordjson.json.ApplicationCommandData data)
        Constructs an ApplicationCommand 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 Snowflake getId()
        Gets unique id of the command.
        Returns:
        The unique id of the command.
      • getType

        public ApplicationCommand.Type getType()
        Gets the type of the command.
        Returns:
        The type of the command.
      • getApplicationId

        public Snowflake getApplicationId()
        Gets the unique id of the parent application.
        Returns:
        The unique id of the parent application.
      • getName

        public String getName()
        Gets the name of the command.
        Returns:
        The name of the command.
      • getDescription

        public String getDescription()
        Gets description of the command.
        Returns:
        The description of the command.
      • getOption

        public Optional<ApplicationCommandOption> 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.