export declare class ChannelSelectMenuBuilder extends BaseSelectMenuBuilder<APIChannelSelectComponent>
export declare class ChannelSelectMenuBuilder extends BaseSelectMenuBuilder<APIChannelSelectComponent>
A builder that creates API-compatible JSON data for channel select menus.
Extends
BaseSelectMenuBuilder<APIChannelSelectComponent>constructor(data?)
Creates a new select menu from API data.
Example
Creating a select menu from an API data object:const selectMenu = new ChannelSelectMenuBuilder({
custom_id: 'a cool select menu',
placeholder: 'select an option',
max_values: 2,
});
const selectMenu = new ChannelSelectMenuBuilder({
custom_id: 'a cool select menu',
placeholder: 'select an option',
max_values: 2,
});
Example
Creating a select menu using setters and API data:const selectMenu = new ChannelSelectMenuBuilder({
custom_id: 'a cool select menu',
})
.addChannelTypes(ChannelType.GuildText, ChannelType.GuildAnnouncement)
.setMinValues(2);
const selectMenu = new ChannelSelectMenuBuilder({
custom_id: 'a cool select menu',
})
.addChannelTypes(ChannelType.GuildText, ChannelType.GuildAnnouncement)
.setMinValues(2);
Name | Type | Optional | Description |
---|---|---|---|
data | Partial<APIChannelSelectComponent> | Yes | The API data to create this select menu with |
Readonly
data
:
Partial<DataType>
The API data associated with this component.
Inherited from ComponentBuilderaddChannelTypes(types)
:
this
Adds channel types to this select menu.
Name | Type | Optional | Description |
---|---|---|---|
types | RestOrArray<ChannelType> | No | The channel types to use |
setChannelTypes(types)
:
this
Sets channel types for this select menu.
Name | Type | Optional | Description |
---|---|---|---|
types | RestOrArray<ChannelType> | No | The channel types to use |
setCustomId(customId)
:
this
Sets the custom id for this select menu.
Name | Type | Optional | Description |
---|---|---|---|
customId | string | No | The custom id to use |
setDisabled(disabled?)
:
this
Sets whether this select menu is disabled.
Name | Type | Optional | Description |
---|---|---|---|
disabled | boolean | Yes | Whether this select menu is disabled |
setMaxValues(maxValues)
:
this
Sets the maximum values that must be selected in the select menu.
Name | Type | Optional | Description |
---|---|---|---|
maxValues | number | No | The maximum values that must be selected |
setMinValues(minValues)
:
this
Sets the minimum values that must be selected in the select menu.
Name | Type | Optional | Description |
---|---|---|---|
minValues | number | No | The minimum values that must be selected |
setPlaceholder(placeholder)
:
this
Sets the placeholder for this select menu.
Name | Type | Optional | Description |
---|---|---|---|
placeholder | string | No | The placeholder to use |
toJSON()
:
APIChannelSelectComponent
Serializes this builder to API-compatible JSON data.