addSelectMenu method

void addSelectMenu(
  1. SelectMenu menu
)

Adds a select menu (dropdown) to the message.

Select menus allow users to choose from a list of options. Discord supports various types of select menus including text, user, role, channel, and mentionable.

Example:

// Channel select menu
builder.addSelectMenu(
  SelectMenu.channel(
    'channel_select',
    channelTypes: [ChannelType.guildText, ChannelType.guildVoice],
    placeholder: 'Choose a channel',
  ),
);

// String select menu
builder.addSelectMenu(
  SelectMenu.string(
    'color_select',
    options: [
      SelectMenuOption('Red', 'red'),
      SelectMenuOption('Blue', 'blue'),
      SelectMenuOption('Green', 'green'),
    ],
  ),
);

See also:

  • SelectMenu for select menu types and configuration

Implementation

void addSelectMenu(SelectMenu menu) {
  final row = ActionRow(components: [menu]);
  _components.add(row);
}