|
1 | 1 | # $selectMenu |
2 | 2 | Creates a Menu with options. |
3 | 3 |
|
4 | | -#### Usage: `$selectMenu[id;placeholder;min value(optional);max value;(optional);label;desc;value;value]` works only for one option |
5 | | -##### Creating SelectMenu |
6 | | -Code: |
| 4 | +#### Usage: `$selectMenu[{menu structure]` works only for one option |
| 5 | + |
| 6 | +#### Menu Structure |
| 7 | +to construct a menu inside $selectMenu, it needs to follow this structure |
7 | 8 | ``` |
8 | | -$selectMenu[ |
9 | | -{id=id} |
10 | | -{placeholder=Pls select your answer!} |
11 | | -{min=1} |
12 | | -{max=2} |
13 | | -{label=Option one } |
14 | | -{desc=txt for one} |
15 | | -{value=one} |
16 | | -{emoji=$customEmoji[accept]} |
17 | | -{label=Option two } |
18 | | -{desc=txt for two} |
19 | | -{value=two} |
20 | | -{emoji=$customEmoji[reject]} |
21 | | -] |
| 9 | +{id=menu id} |
| 10 | +{placeholder/ph=A placeholder for the menu} |
| 11 | +{min=minimum options to be selected (i.e 1)} |
| 12 | +{max=maximum options to be selected (i.e 5)} |
| 13 | +{type=the menu type (i.e text/user/role/mention/channel)} |
| 14 | +
|
| 15 | +
|
| 16 | +// Each option can be structured like this |
| 17 | +{option=Option name} |
| 18 | +{value=option id} |
| 19 | +{desc=description of the option (optional)} |
| 20 | +{emoji=an emoji of the option (optional)} |
| 21 | +
|
22 | 22 | ``` |
| 23 | +* `type` the menu type, can be `text` (default), `user` (to select a user), `role` (role select), `mention` (role or user select), `channel` (channel select) |
23 | 24 | * `id` the id of menu must be unique on multiple menus |
24 | | -* `placeholder` |
| 25 | +* `placeholder` |
25 | 26 | * `min` minimum to select (optional) |
26 | 27 | * `max` maximum to select (optional) |
27 | | -* `label` label of option |
| 28 | +* `option` label of option |
28 | 29 | * `desc` description of option |
29 | | -* `value` value of option ,which [$eventSelected](./eventSelected.md) returns on usage |
| 30 | +* `value` id of option ,which [$eventSelected](./eventSelected.md) returns when the user selects the option |
30 | 31 | * `emoji` emoji for option (optional) |
31 | 32 |
|
32 | 33 | Info: |
33 | | -* You can have up to 5 menus on a message |
34 | | -* You can add maximal 20 options to a menu |
35 | | -* Id of multiple menus can't be same |
| 34 | +* You can have up to 5 menu in a message |
| 35 | +* You can add maximal 20 options for each menu |
| 36 | + |
| 37 | +## Examples |
| 38 | +### Sending a menu with some options with $selectMenu |
| 39 | +``` |
| 40 | +$selectMenu[ |
| 41 | + {id=my_menu} |
| 42 | + {ph=Select the option} |
| 43 | + {type=text} |
| 44 | + {min=1} |
| 45 | + {max=2} |
| 46 | +
|
| 47 | + {option=Option 1} |
| 48 | + {value=option_1} |
| 49 | +
|
| 50 | + {option=Option 2} |
| 51 | + {value=option_2} |
| 52 | +
|
| 53 | + {option=Option 3} |
| 54 | + {value=option_3} |
| 55 | +] |
| 56 | +``` |
| 57 | + |
| 58 | + |
| 59 | +### Sending a menu with some options and selected some of them |
| 60 | +``` |
| 61 | +$selectMenu[ |
| 62 | + {id=my_menu} |
| 63 | + {ph=Select the option} |
| 64 | + {type=text} |
| 65 | + {min=1} |
| 66 | + {max=2} |
| 67 | +
|
| 68 | + {option=Option 1} |
| 69 | + {value=option_1} |
| 70 | +
|
| 71 | + {option=Option 2} |
| 72 | + {value=option_2} |
| 73 | +
|
| 74 | + {option=Option 3} |
| 75 | + {value=option_3} |
| 76 | +
|
| 77 | + {selected=option_1} |
| 78 | + {selected=option_3} |
| 79 | +] |
| 80 | +``` |
| 81 | + |
| 82 | + |
| 83 | + |
| 84 | +### Sending a menu to select user with $selectMenu |
| 85 | +``` |
| 86 | +$selectMenu[ |
| 87 | + {id=my_menu} |
| 88 | + {ph=Select the user} |
| 89 | + {type=user} |
| 90 | + {min=1} |
| 91 | + {max=2} |
| 92 | +] |
| 93 | +``` |
| 94 | + |
| 95 | + |
| 96 | +### Sending a menu to select user with $sendMessage |
| 97 | +``` |
| 98 | +$sendMessage[ |
| 99 | + {menu: |
| 100 | + {id=my_menu} |
| 101 | + {ph=Select the user} |
| 102 | + {type=user} |
| 103 | + {min=1} |
| 104 | + {max=2} |
| 105 | + } |
| 106 | +] |
| 107 | +``` |
| 108 | + |
| 109 | + |
| 110 | +### Sending a menu with selected user |
| 111 | +``` |
| 112 | +$selectMenu[ |
| 113 | + {id=my_menu} |
| 114 | + {ph=Select the user} |
| 115 | + {type=user} |
| 116 | + {min=1} |
| 117 | + {max=2} |
| 118 | + {selected_user=$userID} |
| 119 | +] |
| 120 | +``` |
| 121 | + |
| 122 | + |
| 123 | +### Sending a menu with selected role |
| 124 | +``` |
| 125 | +$selectMenu[ |
| 126 | + {id=my_menu} |
| 127 | + {ph=Select the role} |
| 128 | + {type=role} |
| 129 | + {min=1} |
| 130 | + {max=2} |
| 131 | + {selected_role=$roleID[Test1]} |
| 132 | +] |
| 133 | +``` |
| 134 | + |
| 135 | + |
| 136 | +### Sending a menu with selected channel |
| 137 | +``` |
| 138 | +$selectMenu[ |
| 139 | + {id=my_menu} |
| 140 | + {ph=Select the channel} |
| 141 | + {type=channel} |
| 142 | + {min=1} |
| 143 | + {max=2} |
| 144 | + {selected_channel=$channelID} |
| 145 | +] |
| 146 | +``` |
| 147 | + |
| 148 | + |
| 149 | +### Sending a menu with selected mentionable (user / role) |
| 150 | +``` |
| 151 | +$selectMenu[ |
| 152 | + {id=my_menu} |
| 153 | + {ph=Select user or role} |
| 154 | + {type=mention} |
| 155 | + {min=1} |
| 156 | + {max=2} |
| 157 | + {selected_role=$roleID[Test1]} |
| 158 | + {selected_user=$userID} |
| 159 | +] |
| 160 | +``` |
| 161 | + |
36 | 162 |
|
37 | 163 | ::: tip {key=value} what is this for a syntax? |
38 | 164 | This syntax is called curl args.It is really similar to curl message.Especially new Functions support it ,you can use !!func `function name` to check if it supports curl arguments. |
39 | 165 | [Learn more](../guide/curl.md) |
40 | 166 | ::: |
41 | 167 |
|
42 | | -Example: |
43 | | - |
44 | | - |
45 | | - |
46 | 168 | ::: tip Do you want to add a menu inside a Function as a parameter, like `$sendMessage[text]`? |
47 | 169 |
|
48 | 170 | Use: |
|
52 | 174 | {placeholder=Pls select your answer!} |
53 | 175 | {min=1} |
54 | 176 | {max=2} |
55 | | -{label=Option one } |
| 177 | +{option=Option one } |
56 | 178 | {desc=txt for one} |
57 | 179 | {value=one} |
58 | 180 | {emoji=$customEmoji[accept]} |
|
0 commit comments