Select Menu

In this section you'll learn how to use the select menu component.

Preview 1 Preview 2

Creating a Select Menu

$newSelectMenu[Menu ID;Min;Max;(Placeholder;Message ID)]
  • Menu ID - it's used for $onInteraction[ID] callback. It works the same way as buttons.
  • Min - minimum amount of values that can be selected.
  • Max - maximum amount of values that can be selected.
  • Placeholder - it's a text that appears if no option is selected.
  • Message ID - ID of a message that should have select menu added to it. By default it's the bot's response.

Adding an Option

$addSelectMenuOption[Menu option ID;Label;Value;Description;(Default;Emoji;Message ID)]
  • Menu option ID - it has to be the same as the ID used in $newSelectMenu[].
  • Label - the name of the option.
  • Value - it's the data that gets passed to $onInteraction[] callback. The value has to be unique in the select menu!
  • Description - it shows up under the label.
  • Default - should the option be selected by default. There can be only one default option!
  • Emoji - it shows up next to the label.
  • Message ID - same as in $newSelectMenu[].

Example

Select Menu Code

$newSelectMenu[Example;1;1;Choose some option]
$addSelectMenuOption[Example;First;first-option;The first option]
$addSelectMenuOption[Example;Second;second-option;The second option]
$addSelectMenuOption[Example;Third;third-option;The third option]

Interaction Code

$onInteraction[Example]

$if[$message==first-option]
You have chosen the first option
$elseif[$message==second-option]
You have chosen the second option
$elseif[$message==third-option]
You have chosen the third option
$endif

Usage

Usage 1

Multi-Select Menu

In the Select Menu you can choose not only one option, but several at once. You could understand this by the presence of arguments Min and Max.

Example

Select Menu Code

Here we will change the argument Max to 3.

$newSelectMenu[Example;1;3;Choose some option]
$addSelectMenuOption[Example;First;first-option;The first option]
$addSelectMenuOption[Example;Second;second-option;The second option]
$addSelectMenuOption[Example;Third;third-option;The third option]

Interaction Code

$if[$checkContains[$message;first-option]==true]
$addCmdReactions[1️⃣]
$endif

$if[$checkContains[$message;second-option]==true]
$addCmdReactions[2️⃣]
$endif

$if[$checkContains[$message;third-option]==true]
$addCmdReactions[3️⃣]
$endif

If we choose several options, several reactions will be added.

Usage

Usage 2.1 Usage 2.2

Editing a Select Menu

You can edit Select Menu, as well as options in this menu.

$editSelectMenu

Usage

$editSelectMenu[Menu ID;Min;Max;(Placeholder;Message ID)]

$editSelectMenuOption

Usage

$editSelectMenuOption[Menu option ID;Label;Value;Description;(Default;Emoji;Message ID)]

As you can notice, the arguments are exactly the same.

Example

Select Menu Code

$newSelectMenu[Example;1;1;Choose some option]
$addSelectMenuOption[Example;First;first-option;The first option]
$addSelectMenuOption[Example;Second;second-option;The second option]
$addSelectMenuOption[Example;Third;third-option;The third option]

Interaction Code

Example 1

$editSelectMenuOption[Example;First;first-option;The first option;no;1️⃣]
$editSelectMenuOption[Example;Second;second-option;The second option;no;2️⃣]
$editSelectMenuOption[Example;Third;third-option;The third option;no;3️⃣]

Example 1 Example 1 Example 1

We just added emoji to our options after choosing (any) option.

Example 2

$editSelectMenu[Example;1;1;Choose some option 😀]
$addSelectMenuOption[Example;First;first-option;The first option]
$addSelectMenuOption[Example;Second;second-option;The second option]
$addSelectMenuOption[Example;Third;third-option;The third option]

Example 2 Example 2

We just changed the placeholder of our Select Menu after choosing (any) option.