Interface SlashCommandOption


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

      • getName

        java.lang.String getName()
        Gets the name of this option.
        Returns:
        The name of this option.
      • getNameLocalizations

        java.util.Map<DiscordLocale,​java.lang.String> getNameLocalizations()
        Gets the name localizations for this option.
        Returns:
        The name localizations for this option.
      • getDescription

        java.lang.String getDescription()
        Gets the description of this option.
        Returns:
        The description of this option.
      • getDescriptionLocalizations

        java.util.Map<DiscordLocale,​java.lang.String> getDescriptionLocalizations()
        Gets the description localizations for this option.
        Returns:
        The description localizations for this option.
      • isRequired

        boolean isRequired()
        Checks whether this option is required.
        Returns:
        Whether this option is required.
      • isAutocompletable

        boolean isAutocompletable()
        Checks whether this option can be autocompleted.
        Returns:
        Whether this option can be autocompleted.
      • isSubcommandOrGroup

        default boolean isSubcommandOrGroup()
        Gets whether this slash command option is a subcommand or subcommand group.
        Returns:
        Whether this slash command option is a subcommand or subcommand group.
      • getChoices

        java.util.List<SlashCommandOptionChoice> getChoices()
        Gets all choices for this option.

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

        Returns:
        All choices for this option.
      • getOptions

        java.util.List<SlashCommandOption> getOptions()
        If this option is a subcommand or subcommand group type, this nested options will be the parameters.
        Returns:
        The nested options.
      • getChannelTypes

        java.util.Set<ChannelType> getChannelTypes()
        If the option is of type SlashCommandOptionType.CHANNEL, the channels shown will be restricted to these types.
        Returns:
        The channel types that are shown.
      • getLongMinValue

        java.util.Optional<java.lang.Long> getLongMinValue()
        If the option is an SlashCommandOptionType.LONG type, the minimum value permitted.
        Returns:
        The minimum value permitted.
      • getLongMaxValue

        java.util.Optional<java.lang.Long> getLongMaxValue()
        If the option is an SlashCommandOptionType.LONG type, the maximum value permitted.
        Returns:
        The maximum value permitted.
      • getDecimalMinValue

        java.util.Optional<java.lang.Double> getDecimalMinValue()
        If the option is an SlashCommandOptionType.DECIMAL type, the minimum value permitted.
        Returns:
        The minimum value permitted.
      • getDecimalMaxValue

        java.util.Optional<java.lang.Double> getDecimalMaxValue()
        If the option is an SlashCommandOptionType.DECIMAL type, the maximum value permitted.
        Returns:
        The maximum value permitted.
      • getMinLength

        java.util.Optional<java.lang.Long> getMinLength()
        If the option is an SlashCommandOptionType.STRING type, the minimum allowed length.
        Returns:
        The minimum allowed length.
      • getMaxLength

        java.util.Optional<java.lang.Long> getMaxLength()
        If the option is an SlashCommandOptionType.STRING type, the maximum allowed length.
        Returns:
        The maximum allowed length.
      • create

        static SlashCommandOption create​(SlashCommandOptionType type,
                                         java.lang.String name,
                                         java.lang.String description,
                                         boolean required)
        Create a new slash command option to be used with a 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:
        A new slash command option instance.
      • create

        static SlashCommandOption create​(SlashCommandOptionType type,
                                         java.lang.String name,
                                         java.lang.String description)
        Create a new slash command option to be used with a 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:
        A new slash command option instance.
      • createWithOptions

        static SlashCommandOption createWithOptions​(SlashCommandOptionType type,
                                                    java.lang.String name,
                                                    java.lang.String description,
                                                    SlashCommandOptionBuilder... options)
        Create a new subcommand or subcommand group to be used with a 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:
        A new slash command option instance.
      • createWithOptions

        static SlashCommandOption createWithOptions​(SlashCommandOptionType type,
                                                    java.lang.String name,
                                                    java.lang.String description,
                                                    java.util.List<SlashCommandOption> options)
        Create a new subcommand or subcommand group to be used with a 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:
        A new slash command option instance.
      • createSubcommandGroup

        static SlashCommandOption createSubcommandGroup​(java.lang.String name,
                                                        java.lang.String description,
                                                        java.util.List<SlashCommandOption> options)
        Create a new subcommand group option to be used with a slash command builder. This is a convenience method.
        Parameters:
        name - The name of the subcommand group.
        description - The description of the subcommand group.
        options - The sub command options of this subcommand group.
        Returns:
        A new slash command option instance.
      • createSubcommand

        static SlashCommandOption createSubcommand​(java.lang.String name,
                                                   java.lang.String description)
        Create a new subcommand option to be used with a slash command builder. This is a convenience method.
        Parameters:
        name - The name of the subcommand.
        description - The description of the subcommand.
        Returns:
        A new slash command option instance.
      • createSubcommand

        static SlashCommandOption createSubcommand​(java.lang.String name,
                                                   java.lang.String description,
                                                   java.util.List<SlashCommandOption> options)
        Create a new subcommand option with options to be used with a slash command builder. This is a convenience method.
        Parameters:
        name - The name of the subcommand.
        description - The description of the subcommand.
        options - The options of this subcommand.
        Returns:
        A new slash command option instance.
      • createWithChoices

        static SlashCommandOption createWithChoices​(SlashCommandOptionType type,
                                                    java.lang.String name,
                                                    java.lang.String description,
                                                    boolean required,
                                                    SlashCommandOptionChoiceBuilder... choices)
        Create a new slash command option to be used with a 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:
        A new slash command option instance.
      • createWithChoices

        static SlashCommandOption createWithChoices​(SlashCommandOptionType type,
                                                    java.lang.String name,
                                                    java.lang.String description,
                                                    boolean required,
                                                    java.util.List<SlashCommandOptionChoice> choices)
        Create a new slash command option to be used with a 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:
        A new slash command option instance.
      • createChannelOption

        static SlashCommandOption createChannelOption​(java.lang.String name,
                                                      java.lang.String description,
                                                      boolean required,
                                                      java.util.Collection<ChannelType> channelTypes)
        Create a new slash command option to be used with a slash command builder. This is a convenience method.
        Parameters:
        name - The name of the option.
        description - The description of the option.
        required - Whether this option is required.
        channelTypes - Channel types that are shown.
        Returns:
        A new slash command option instance.
      • createDecimalOption

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

        static SlashCommandOption createDecimalOption​(java.lang.String name,
                                                      java.lang.String description,
                                                      boolean required,
                                                      boolean autocomplete)
        Create a new SlashCommandOptionType.DECIMAL slash command option to be used with a slash command builder. This is a convenience method.
        Parameters:
        name - The name of the option.
        description - The description of the option.
        required - Whether this option is required
        autocomplete - Whether this option can be autocompleted
        Returns:
        A new slash command option instance.
      • createDecimalOption

        static SlashCommandOption createDecimalOption​(java.lang.String name,
                                                      java.lang.String description,
                                                      boolean required,
                                                      double minValue,
                                                      double maxValue)
        Create a new SlashCommandOptionType.DECIMAL slash command option to be used with a slash command builder. This is a convenience method.
        Parameters:
        name - The name of the option.
        description - The description of the option.
        required - Whether this option is required
        minValue - The minimum value permitted.
        maxValue - The maximum value permitted.
        Returns:
        A new slash command option instance.
      • createAttachmentOption

        static SlashCommandOption createAttachmentOption​(java.lang.String name,
                                                         java.lang.String description,
                                                         boolean required)
        Create a new SlashCommandOptionType.ATTACHMENT slash command option to be used with a slash command builder. This is a convenience method.
        Parameters:
        name - The name of the option.
        description - The description of the option.
        required - Whether this option is required.
        Returns:
        A new slash command option instance.
      • createLongOption

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

        static SlashCommandOption createLongOption​(java.lang.String name,
                                                   java.lang.String description,
                                                   boolean required,
                                                   long minValue,
                                                   long maxValue)
        Create a new SlashCommandOptionType.LONG slash command option to be used with a slash command builder. This is a convenience method.
        Parameters:
        name - The name of the option.
        description - The description of the option.
        required - Whether this option is required
        minValue - The minimum value permitted.
        maxValue - The maximum value permitted.
        Returns:
        A new slash command option instance.
      • createLongOption

        static SlashCommandOption createLongOption​(java.lang.String name,
                                                   java.lang.String description,
                                                   boolean required,
                                                   boolean autocomplete)
        Create a new SlashCommandOptionType.LONG slash command option to be used with a slash command builder. This is a convenience method.
        Parameters:
        name - The name of the option.
        description - The description of the option.
        required - Whether this option is required
        autocomplete - Whether this option can be autocompleted
        Returns:
        A new slash command option instance.
      • createStringOption

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

        static SlashCommandOption createStringOption​(java.lang.String name,
                                                     java.lang.String description,
                                                     boolean required,
                                                     long minLength,
                                                     long maxLength)
        Create a new SlashCommandOptionType.STRING slash command option to be used with a slash command builder. This is a convenience method.
        Parameters:
        name - The name of the option.
        description - The description of the option.
        required - Whether this option is required
        minLength - The minimum allowed length.
        maxLength - The maximum allowed length.
        Returns:
        A new slash command option instance.
      • createStringOption

        static SlashCommandOption createStringOption​(java.lang.String name,
                                                     java.lang.String description,
                                                     boolean required,
                                                     boolean autocomplete)
        Create a new SlashCommandOptionType.STRING slash command option to be used with a slash command builder. This is a convenience method.
        Parameters:
        name - The name of the option.
        description - The description of the option.
        required - Whether this option is required
        autocomplete - Whether this option can be autocompleted
        Returns:
        A new slash command option instance.
      • createRoleOption

        static SlashCommandOption createRoleOption​(java.lang.String name,
                                                   java.lang.String description,
                                                   boolean required)
        Create a new SlashCommandOptionType.ROLE slash command option to be used with a slash command builder. This is a convenience method.
        Parameters:
        name - The name of the option.
        description - The description of the option.
        required - Whether this option is required
        Returns:
        A new slash command option instance.
      • createMentionableOption

        static SlashCommandOption createMentionableOption​(java.lang.String name,
                                                          java.lang.String description,
                                                          boolean required)
        Create a new SlashCommandOptionType.MENTIONABLE slash command option to be used with a slash command builder. This is a convenience method.
        Parameters:
        name - The name of the option.
        description - The description of the option.
        required - Whether this option is required
        Returns:
        A new slash command option instance.
      • createUserOption

        static SlashCommandOption createUserOption​(java.lang.String name,
                                                   java.lang.String description,
                                                   boolean required)
        Create a new SlashCommandOptionType.USER slash command option to be used with a slash command builder. This is a convenience method.
        Parameters:
        name - The name of the option.
        description - The description of the option.
        required - Whether this option is required
        Returns:
        A new slash command option instance.
      • createBooleanOption

        static SlashCommandOption createBooleanOption​(java.lang.String name,
                                                      java.lang.String description,
                                                      boolean required)
        Create a new SlashCommandOptionType.BOOLEAN slash command option to be used with a slash command builder. This is a convenience method.
        Parameters:
        name - The name of the option.
        description - The description of the option.
        required - Whether this option is required
        Returns:
        A new slash command option instance.