ChannelSelectMenuBuilder

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.
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);
NameTypeOptionalDescription
dataPartial<APIChannelSelectComponent>Yes
The API data to create this select menu with
ProtectedReadonly
addChannelTypes(...types):this
Adds channel types to this select menu.
NameTypeOptionalDescription
...typesRestOrArray<ChannelType>No
The channel types to use
addDefaultChannels(...channels):this
Adds default channels to this auto populated select menu.
NameTypeOptionalDescription
...channelsRestOrArray<Snowflake>No
The channels to add
clearPlaceholder():this
Clears the placeholder for this select menu.
Inherited from BaseSelectMenuBuilder
setChannelTypes(...types):this
Sets channel types for this select menu.
NameTypeOptionalDescription
...typesRestOrArray<ChannelType>No
The channel types to use
setCustomId(customId):this
Sets the custom id for this select menu.
NameTypeOptionalDescription
customIdstringNo
The custom id to use
Inherited from BaseSelectMenuBuilder
setDefaultChannels(...channels):this
Sets default channels for this auto populated select menu.
NameTypeOptionalDescription
...channelsRestOrArray<Snowflake>No
The channels to set
setDisabled(disabled?):this
Sets whether this select menu is disabled.
NameTypeOptionalDescription
disabledbooleanYes
Whether this select menu is disabled
Inherited from BaseSelectMenuBuilder
setMaxValues(maxValues):this
Sets the maximum values that must be selected in the select menu.
NameTypeOptionalDescription
maxValuesnumberNo
The 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
minValuesnumberNo
The minimum values that must be selected
Inherited from BaseSelectMenuBuilder
setPlaceholder(placeholder):this
Sets the placeholder for this select menu.
NameTypeOptionalDescription
placeholderstringNo
The placeholder to use
Inherited from BaseSelectMenuBuilder
toJSON(validationOverride?):APIChannelSelectComponent
Serializes this builder to API-compatible JSON data.
Note that by disabling validation, there is no guarantee that the resulting object will be valid.
NameTypeOptionalDescription
validationOverridebooleanYes
Force validation to run/not run regardless of your global preference