Skip to content

$addSelectMenu

$addSelectMenu will add a select menu to the bot’s message.

Usage

$addSelectMenu[index;type;customId;placeHolder;minValues;maxValues;disabled?;label:description:value:default?:emoji?;...]

Parameters

FieldTypeDescriptionRequired
indexnumberIn which actionRow the selectMenu appears, a selectMenu requires one whole row for it alone.true
typestringThe component type.
1. string
2. user
3. role
4. mentionable
5. channel
true
customIDstringThe component custom ID.true
placeHolderstringSelectMenu Placeholder Text.true
minValuesnumberSelectMenu minimal value of selectable optionstrue
maxValuesnumberSelectMenu maximal value of selectable optionstrue
disabledbooleanIf the selectMenu will appear as disabled
1. true
2. false (default)
true
optionsstringSelect menu options separated by each other with ; and :.false

Example(s)

This adds a select menu with two functions:

1
client.command({
2
name: "add-select-menu",
3
code: `
4
Select an option.
5
6
$addSelectMenu[1;string;yourCustomID;This is a placeholder!;1;1;false;A Option:Description of option A:anotherCustomID:false;B Option:Description of option B:andAnotherCustomID:true]
7
`
8
});
9
10
module.exports = [
11
{
12
name: "add-select-menu",
13
code: `
14
Select an option.
15
$addSelectMenu[1;string;yourCustomID;This is a placeholder!;1;1;false;A Option:Description of option A:anotherCustomID:false;B Option:Description of option B:andAnotherCustomID:true]
16
`
17
},
18
{
19
name: "yourCustomID",
20
type: "interaction", // clarifying that this command is an Interaction
21
prototype: "selectMenu",
22
code: `
23
$interactionReply[Hello! :);everyone;false]
24
$onlyIf[$interactionData[values[0]]==anotherCustomID;]`
25
},
26
{
27
name: "yourCustomID",
28
type: "interaction", // clarifying that this command is an Interaction
29
prototype: "selectMenu",
30
code: `
31
$interactionReply[Bye! :(;everyone;false]
32
$onlyIf[$interactionData[values[0]]==andAnotherCustomID;]`
33
}
34
];
35
36
/*
37
We use "$onlyIf[$interactionData[values[0]]==customID;]" to make sure this only will be triggered for the according select menu option.
38
39
Also ensure that you have the "onInteractionCreate" event in your index.js (or whatever your main entry file might be!)
40
*/