SelectMenuOptionBuilder
declare class SelectMenuOptionBuilder implements JSONEncodable<APISelectMenuOption>
declare class SelectMenuOptionBuilder implements JSONEncodable<APISelectMenuOption>
Represents a option within a select menu component
Implements
JSONEncodable<APISelectMenuOption>constructor(data?)
Creates a new select menu option from API data
Example
Creating a select menu option from an API data objectconst selectMenuOption = new SelectMenuOptionBuilder({
label: 'catchy label',
value: '1',
});
const selectMenuOption = new SelectMenuOptionBuilder({
label: 'catchy label',
value: '1',
});
Example
Creating a select menu option using setters and API dataconst 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 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 of this option
Name | Type | Optional | Description |
---|---|---|---|
description | string | No | The description of this option |
setEmoji(emoji)
:
this
Sets the emoji to display on this option
Name | Type | Optional | Description |
---|---|---|---|
emoji | APIMessageComponentEmoji | No | The emoji to display on this option |
setLabel(label)
:
this
Sets the label of this option
Name | Type | Optional | Description |
---|---|---|---|
label | string | No | The label to show on this option |
setValue(value)
:
this
Sets the value of this option
Name | Type | Optional | Description |
---|---|---|---|
value | string | No | The value of this option |
toJSON()
:
APISelectMenuOption
Serializes this component to an API-compatible JSON object