Class SelectMenu

    • Method Detail

      • of

        public static SelectMenu of​(String customId,
                                    SelectMenu.Option... options)
        Creates a string select menu.
        Parameters:
        customId - A developer-defined identifier for the select menu.
        options - The options that can be selected in the menu.
        Returns:
        A select menu with the given data.
      • of

        public static SelectMenu of​(String customId,
                                    List<SelectMenu.Option> options)
        Creates a string select menu.
        Parameters:
        customId - A developer-defined identifier for the select menu.
        options - The options that can be selected in the menu.
        Returns:
        A select menu with the given data.
      • ofRole

        public static SelectMenu ofRole​(String customId)
        Creates a role select menu.
        Parameters:
        customId - A developer-defined identifier for the select menu.
        Returns:
        A select menu with the given data.
      • ofUser

        public static SelectMenu ofUser​(String customId)
        Creates a user select menu.
        Parameters:
        customId - A developer-defined identifier for the select menu.
        Returns:
        A select menu with the given data.
      • ofMentionable

        public static SelectMenu ofMentionable​(String customId)
        Creates a mentionable select menu.
        Parameters:
        customId - A developer-defined identifier for the select menu.
        Returns:
        A select menu with the given data.
      • ofChannel

        public static SelectMenu ofChannel​(String customId,
                                           Channel.Type... channelTypes)
        Creates a channel select menu.
        Parameters:
        customId - A developer-defined identifier for the select menu.
        channelTypes - The allowed channel types.
        Returns:
        A select menu with the given data.
      • ofChannel

        public static SelectMenu ofChannel​(String customId,
                                           List<Channel.Type> channelTypes)
        Creates a channel select menu.
        Parameters:
        customId - A developer-defined identifier for the select menu.
        channelTypes - The allowed channel types.
        Returns:
        A select menu with the given data.
      • getCustomId

        public String getCustomId()
        Gets the select menu's custom id.
        Returns:
        The select menu's custom id.
      • getValues

        public Optional<List<String>> getValues()
        Gets the select menu values, if any. Can be present with an empty list if no value was selected.
        Returns:
        the select menu's value
      • getAllowedChannelTypes

        public Set<Channel.Type> getAllowedChannelTypes()
        Returns a set of acceptable channel types the user may select. Only applies to MessageComponent.Type.SELECT_MENU_CHANNEL type menus, if empty, no restriction on channel types is placed.
        Returns:
        A set of channel types a user may select. Empty set means no restriction is applied.
      • getPlaceholder

        public Optional<String> getPlaceholder()
        Gets the text displayed if no option is selected.
        Returns:
        The text displayed if no option is selected.
      • getMinValues

        public int getMinValues()
        Gets the minimum number of options that must be chosen.
        Returns:
        The minimum number of options that must be chosen.
      • getMaxValues

        public int getMaxValues()
        Gets the maximum number of options that must be chosen.
        Returns:
        The maximum number of options that must be chosen.
      • isDisabled

        public boolean isDisabled()
        Gets whether the select menu is disabled (i.e., the user is prevented from selecting any options).
        Returns:
        Whether the select menu is disabled.
      • disabled

        public SelectMenu disabled()
        Creates a new select menu with the same data as this one, but disabled.
        Returns:
        A new disabled select menu with the same data as this one.
      • disabled

        public SelectMenu disabled​(boolean value)
        Creates a new select menu with the same data as this one, but depending on the value param it may be disabled or not.
        Parameters:
        value - True if the select menu should be disabled otherwise False.
        Returns:
        A new possibly disabled select menu with the same data as this one.
      • withPlaceholder

        public SelectMenu withPlaceholder​(String placeholder)
        Creates a new select menu with the same data as this one, but with the given placeholder text.
        Parameters:
        placeholder - The new placeholder text.
        Returns:
        A new select menu with the given placeholder text.
      • withMinValues

        public SelectMenu withMinValues​(int minValues)
        Creates a new select menu with the same data as this one, but with the given minimum values.
        Parameters:
        minValues - The new minimum values.
        Returns:
        A new select menu with the given minimum values.
      • withMaxValues

        public SelectMenu withMaxValues​(int maxValues)
        Creates a new select menu with the same data as this one, but with the given maximum values.
        Parameters:
        maxValues - The new maximum values.
        Returns:
        A new select menu with the given maximum values.
      • withAllowedChannelTypes

        public SelectMenu withAllowedChannelTypes​(Iterable<Channel.Type> types)
        Creates a new select menu with the same data as this one, but with the given allowed channel types.
        Parameters:
        types - The new allowed channel types.
        Returns:
        A new select menu with the given allowed channel types.
      • withAllowedChannelTypes

        public SelectMenu withAllowedChannelTypes​(Channel.Type... types)
        Creates a new select menu with the same data as this one, but with the given allowed channel types.
        Parameters:
        types - The new allowed channel types.
        Returns:
        A new select menu with the given allowed channel types.