Interface SlashCommandOption



  • public interface SlashCommandOption
    An slash command's option (i.e., a parameter for the command).
    • Method Detail

      • getName

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

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

        boolean isRequired​()
        Checks whether or not this option is required.
        Returns:
        Whether or not this option is required.
      • getChoices

        List<SlashCommandOptionChoice> getChoices​()
        Gets a list with all choices for this option.

        If this option has any choices, they are the only valid values for a user to pick.

        Returns:
        A list with all choices for this option.
      • getOptions

        List<SlashCommandOption> getOptions​()
        If this option is a subcommand or subcommand group type, this nested options will be the parameters.
        Returns:
        A list with the nested options.
      • create

        static SlashCommandOption create​(SlashCommandOptionType type,
                                         String name,
                                         String description,
                                         boolean required)
        Create a new slash command option to be used with an slash command builder. This is a convenience method.
        Parameters:
        type - The type of the option.
        name - The name of the option.
        description - The description of the option.
        required - Whether this option is required.
        Returns:
        The new slash command option builder.
      • create

        static SlashCommandOption create​(SlashCommandOptionType type,
                                         String name,
                                         String description)
        Create a new slash command option to be used with an slash command builder. This is a convenience method.
        Parameters:
        type - The type of the option.
        name - The name of the option.
        description - The description of the option.
        Returns:
        The new slash command option builder.
      • createWithOptions

        static SlashCommandOption createWithOptions​(SlashCommandOptionType type,
                                                    String name,
                                                    String description,
                                                    SlashCommandOptionBuilder... options)
        Create a new subcommand or subcommand group to be used with an slash command builder. This is a convenience method.
        Parameters:
        type - The type of the option. Must be either SUBCOMMAND or SUBCOMMAND_GROUP.
        name - The name of the option.
        description - The description of the option.
        options - The options of this subcommand or subcommand group.
        Returns:
        The new slash command option builder.
      • createWithOptions

        static SlashCommandOption createWithOptions​(SlashCommandOptionType type,
                                                    String name,
                                                    String description,
                                                    List<SlashCommandOption> options)
        Create a new subcommand or subcommand group to be used with an slash command builder. This is a convenience method.
        Parameters:
        type - The type of the option. Must be either SUBCOMMAND or SUBCOMMAND_GROUP.
        name - The name of the option.
        description - The description of the option.
        options - The options of this subcommand or subcommand group.
        Returns:
        The new slash command option builder.
      • createWithChoices

        static SlashCommandOption createWithChoices​(SlashCommandOptionType type,
                                                    String name,
                                                    String description,
                                                    boolean required,
                                                    SlashCommandOptionChoiceBuilder... choices)
        Create a new slash command option to be used with an slash command builder. This is a convenience method.
        Parameters:
        type - The type of the option.
        name - The name of the option.
        description - The description of the option.
        required - Whether this option is required.
        choices - The choices of the option.
        Returns:
        The new slash command option builder.
      • createWithChoices

        static SlashCommandOption createWithChoices​(SlashCommandOptionType type,
                                                    String name,
                                                    String description,
                                                    boolean required,
                                                    List<SlashCommandOptionChoice> choices)
        Create a new slash command option to be used with an slash command builder. This is a convenience method.
        Parameters:
        type - The type of the option.
        name - The name of the option.
        description - The description of the option.
        required - Whether this option is required.
        choices - The choices of the option.
        Returns:
        The new slash command option builder.