StringSelectMenuBuilder

export class StringSelectMenuBuilder extends BuilderStringSelectMenuComponent
export class StringSelectMenuBuilder extends BuilderStringSelectMenuComponent
Class used to build select menu components to be sent through the API
constructor(data?)
Constructs a new instance of the StringSelectMenuBuilder class
NameTypeOptionalDescription
dataPartial<StringSelectMenuComponentData | APIStringSelectComponent>YesNone
Readonly
data:Partial<DataType>
The API data associated with this component.
Inherited from ComponentBuilder
The options within this select menu.
addOptions(...options):this
Adds options to this select menu
NameTypeOptionalDescription
...optionsRestOrArray<BuildersSelectMenuOption | SelectMenuComponentOptionData | APISelectMenuOption>NoThe options to add to this select menu
Static
Creates a new select menu builder from json data
NameTypeOptionalDescription
otherJSONEncodable<APISelectMenuComponent> | APISelectMenuComponentNoThe other data
setCustomId(customId):this
Sets the custom id for this select menu.
NameTypeOptionalDescription
customIdstringNoThe custom id to use
Inherited from BaseSelectMenuBuilder
setDisabled(disabled?):this
Sets whether this select menu is disabled.
NameTypeOptionalDescription
disabledbooleanYesWhether this select menu is disabled
Inherited from BaseSelectMenuBuilder
setMaxValues(maxValues):this
Sets the maximum values that must be selected in the select menu.
NameTypeOptionalDescription
maxValuesnumberNoThe maximum values that must be selected
Inherited from BaseSelectMenuBuilder
setMinValues(minValues):this
Sets the minimum values that must be selected in the select menu.
NameTypeOptionalDescription
minValuesnumberNoThe minimum values that must be selected
Inherited from BaseSelectMenuBuilder
setOptions(...options):this
Sets the options on this select menu
NameTypeOptionalDescription
...optionsRestOrArray<BuildersSelectMenuOption | SelectMenuComponentOptionData | APISelectMenuOption>NoThe options to set on this select menu
setPlaceholder(placeholder):this
Sets the placeholder for this select menu.
NameTypeOptionalDescription
placeholderstringNoThe placeholder to use
Inherited from BaseSelectMenuBuilder
spliceOptions(index, deleteCount, ...options):this
Removes, replaces, or inserts options for this select menu.
Remarks
This method behaves similarly to Array.prototype.splice(). It's useful for modifying and adjusting the order of existing options.
Example
Remove the first option:
selectMenu.spliceOptions(0, 1);
selectMenu.spliceOptions(0, 1);
Example
Remove the first n option:
const n = 4;
selectMenu.spliceOptions(0, n);
const n = 4;
selectMenu.spliceOptions(0, n);
Example
Remove the last option:
selectMenu.spliceOptions(-1, 1);
selectMenu.spliceOptions(-1, 1);
NameTypeOptionalDescription
indexnumberNoThe index to start at
deleteCountnumberNoThe number of options to remove
...optionsRestOrArray<APISelectMenuOption | StringSelectMenuOptionBuilder>NoThe replacing option objects or builders
Serializes this builder to API-compatible JSON data.
Remarks
This method runs validations on the data before serializing it. As such, it may throw an error if the data is invalid.