StringSelectMenuOptionBuilder
declare class StringSelectMenuOptionBuilder implements JSONEncodable<APISelectMenuOption>
declare class StringSelectMenuOptionBuilder implements JSONEncodable<APISelectMenuOption>
A builder that creates API-compatible JSON data for string select menu options.
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');
Name | Type | Optional | Description |
---|---|---|---|
data | Partial<APISelectMenuOption> | Yes | The API data to create this string select menu option with |
data
:
Partial<APISelectMenuOption>
setDefault(isDefault?)
:
this
Sets whether this option is selected by default.
Name | Type | Optional | Description |
---|---|---|---|
isDefault | boolean | Yes | Whether this option is selected by default |
setDescription(description)
:
this
Sets the description for this option.
Name | Type | Optional | Description |
---|---|---|---|
description | string | No | The description to use |
setEmoji(emoji)
:
this
Sets the emoji to display for this option.
Name | Type | Optional | Description |
---|---|---|---|
emoji | APIMessageComponentEmoji | No | The emoji to use |
setLabel(label)
:
this
Sets the label for this option.
Name | Type | Optional | Description |
---|---|---|---|
label | string | No | The label to use |
setValue(value)
:
this
Sets the value for this option.
Name | Type | Optional | Description |
---|---|---|---|
value | string | No | The value to use |
toJSON()
:
APISelectMenuOption
Serializes this builder to API-compatible JSON data.