Class ApplicationCommandOption

    • Field Detail

      • MAX_NAME_LENGTH

        public static final int MAX_NAME_LENGTH
        The maximum amount of characters that can be in an application command option 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 option description.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ApplicationCommandOption

        public ApplicationCommandOption​(GatewayDiscordClient gateway,
                                        discord4j.discordjson.json.ApplicationCommandOptionData data)
        Constructs an ApplicationCommandOption 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

      • getName

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

        public String getDescription()
        Gets the description of the option.
        Returns:
        The description of the option.
      • isRequired

        public boolean isRequired()
        Gets whether this option is required.
        Returns:
        Whether this option is required.
      • getChoices

        public List<ApplicationCommandOptionChoice> getChoices()
        Gets the choices for string and int types for the user to pick from.
        Returns:
        The choices for string and int types for the user to pick from.
      • getChoice

        public Optional<ApplicationCommandOptionChoice> getChoice​(String name)
        Gets the choice corresponding to the provided name, if present.
        Parameters:
        name - The name of the choice.
        Returns:
        The choice corresponding to the provided name, if present.
      • getOptions

        public List<ApplicationCommandOption> getOptions()
        Gets the options, if the option is a subcommand or subcommand group type.
        Returns:
        The options, if the option is a subcommand or subcommand group type.
      • getOption

        public Optional<ApplicationCommandOption> getOption​(String name)
        Gets the option corresponding to the provided name, if present and if this option is a subcommand or subcommand group type.
        Parameters:
        name - The name of the option.
        Returns:
        The option corresponding to the provided name, if present and if this option is a subcommand or subcommand group type.