$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
Field | Type | Description | Required |
---|---|---|---|
index | number | In which actionRow the selectMenu appears, a selectMenu requires one whole row for it alone. | true |
type | string | The component type. 1. string 2. user 3. role 4. mentionable 5. channel | true |
customID | string | The component custom ID. | true |
placeHolder | string | SelectMenu Placeholder Text. | true |
minValues | number | SelectMenu minimal value of selectable options | true |
maxValues | number | SelectMenu maximal value of selectable options | true |
disabled | boolean | If the selectMenu will appear as disabled 1. true 2. false (default) | true |
options | string | Select menu options separated by each other with ; and : . | false |
Example(s)
This adds a select menu with two functions:
1client.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
10module.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 Interaction21 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 Interaction29 prototype: "selectMenu",30 code: `31 $interactionReply[Bye! :(;everyone;false]32 $onlyIf[$interactionData[values[0]]==andAnotherCustomID;]`33 }34];35
36/*37We use "$onlyIf[$interactionData[values[0]]==customID;]" to make sure this only will be triggered for the according select menu option.38
39Also ensure that you have the "onInteractionCreate" event in your index.js (or whatever your main entry file might be!)40*/