SelectMenuBuilder class
constructor
The constructor provides one optional argument which is an object which provides the data for the SelectMenuBuilder class.
The object may contain the following information:
custom_id
: An id so you can recognize the select menu when an option is selected by a member. The id must be unique and a string between 1-100 characters.options
: An array of the options members can choose from in the select menu. The options must be a valid object for the Discord API.placeholder
: A string which is shown when no options were selected by the member.min_values
: A number which defines the minimum amount of options a member should choose between.max_values
: A number which defines the maximum amount of options a member may choose between.disabled
: A boolean which defines whether the select menu can be used or not.type
: A number which defines the type of component of the seelct menu. (3
means it's a select menu)
Properties
data
An object which makes it a valid object for the Discord API.
Functions
setCustomId
Sets a custom id for the select menu which will be returned to the bot once the an option was selected in the select menu by a member and makes you able to recognize the select menu. The function returns the same SelectMenuBuilder class so you don't have to declare it everytime again.
setPlaceholder
Sets a placeholder for the select menu which is visible for the members when no options were selected. The function returns the same SelectMenuBuilder class so you don't have to declare it everytime again.
setDisabled
Defines whether the options in the select menu may be selected by a member or not. The function returns the same SelectMenuBuilder class so you don't have to declare it everytime again.
setMinValues
Sets the minimum amount of options which a member should select from the select menu builder. The function returns the same SelectMenuBuilder class so you don't have to declare it everytime again.
setMaxValues
Sets the maximum amount of options which a member may select from the select menu builder. The function returns the same SelectMenuBuilder class so you don't have to declare it everytime again.
setOptions
Adds the options which the member can choose between. The options have to be an instance of the SelectMenuOptionBuilder class. The function returns the same SelectMenuBuilder class so you don't have to declare it everytime again.
toJSON
Converts the SelectMenuBuilder class to an object to make it a valid object for the Discord API. The function returns the same data as the data property.
Last updated