Search...

StringSelectMenuOptionBuilder

declare class StringSelectMenuOptionBuilder implements JSONEncodable<APISelectMenuOption> 
declare class StringSelectMenuOptionBuilder implements JSONEncodable<APISelectMenuOption> 
Represents an option within a string select menu component

Implements

JSONEncodable<APISelectMenuOption>

constructor(data?)

Creates a new string select menu option from API data
Example
Creating a string select menu option from an API data object
const selectMenuOption = new SelectMenuOptionBuilder({
	label: 'catchy label',
	value: '1',
});
const selectMenuOption = new SelectMenuOptionBuilder({
	label: 'catchy label',
	value: '1',
});
Example
Creating a string select menu option using setters and API data
const selectMenuOption = new SelectMenuOptionBuilder({
	default: true,
	value: '1',
})
	.setLabel('woah')
const selectMenuOption = new SelectMenuOptionBuilder({
	default: true,
	value: '1',
})
	.setLabel('woah')
NameTypeOptionalDescription
dataPartial<APISelectMenuOption>YesThe API data to create this string select menu option with

data

:

Partial<APISelectMenuOption>

setDefault(isDefault?)

:

this

Sets whether this option is selected by default
NameTypeOptionalDescription
isDefaultbooleanYesWhether this option is selected by default

setDescription(description)

:

this

Sets the description of this option
NameTypeOptionalDescription
descriptionstringNoThe description of this option

setEmoji(emoji)

:

this

Sets the emoji to display on this option
NameTypeOptionalDescription
emojiAPIMessageComponentEmojiNoThe emoji to display on this option

setLabel(label)

:

this

Sets the label of this option
NameTypeOptionalDescription
labelstringNoThe label to show on this option

setValue(value)

:

this

Sets the value of this option
NameTypeOptionalDescription
valuestringNoThe value of this option

toJSON()

:

APISelectMenuOption

Serializes this component to an API-compatible JSON object
Remarks
This method runs validations on the data before serializing it. As such, it may throw an error if the data is invalid.