SelectMenu

Create a select menu

Constructor

new SelectMenu()

Example
const { SelectMenu, SelectMenuTypes, SelectMenuOption } = require("interactions.js");

const select = new SelectMenu()
 .setType(SelectMenuTypes.Text) // Set the type of the select menu
 .setCustomId('customId') // Set the custom id of the select menu
 .setPlaceholder('Cool Placeholder') // Set the placeholder of the select menu
 .setMinValues(1) // Set the minimum values of the select menu
 .setMaxValues(1) // Set the maximum values of the select menu
 .addOptions([
     new SelectMenuOption()
         .setLabel('Option 1')
         .setValue('option1')
         .setDescription('Option 1 Description')
         .setEmoji('👍')
         .setDefault(true),
 ]) // Add options to the select menu
 .setDisabled() // Set the disabled state of the select menu

Methods

addOption(option) → {SelectMenu}

add a single option to the select menu

Parameters:
NameTypeDescription
optionobject
Returns:
Type: 
SelectMenu

addOptions(options) → {SelectMenu}

add options to the select menu

Parameters:
NameTypeDescription
optionsarray
Returns:
Type: 
SelectMenu

setChannelTypes(channelTypes) → {SelectMenu}

set the channel types that select menu is available in (only available for channel select menu)

Parameters:
NameTypeDescription
channelTypesarray
Returns:
Type: 
SelectMenu

setCustomId(customId) → {SelectMenu}

Set the custom id of the select menu

Parameters:
NameTypeDescription
customIdstring
Returns:
Type: 
SelectMenu

setDefaultValues(defaultValues) → {SelectMenu}

set the default values of the select menu

Parameters:
NameTypeDescription
defaultValuesarray
Returns:
Type: 
SelectMenu

setDisabled(disabled) → {SelectMenu}

set the disabled state of the select menu

Parameters:
NameTypeDescription
disabledboolean
Returns:
Type: 
SelectMenu

setMaxValues(maxValues) → {SelectMenu}

set the maximum number of options that can be selected

Parameters:
NameTypeDescription
maxValuesnumber
Returns:
Type: 
SelectMenu

setMinValues(minValues) → {SelectMenu}

set the minimum number of options that must be selected

Parameters:
NameTypeDescription
minValuesnumber
Returns:
Type: 
SelectMenu

setOptions(options) → {SelectMenu}

set the options of the select menu

Parameters:
NameTypeDescription
optionsarray
Returns:
Type: 
SelectMenu

setPlaceholder(placeholder) → {SelectMenu}

set the placeholder of the select menu

Parameters:
NameTypeDescription
placeholderstring
Returns:
Type: 
SelectMenu

setType(type) → {SelectMenu}

Set the type of the select menu

Parameters:
NameTypeDescription
typenumber
Returns:
Type: 
SelectMenu