Skip to content

Commit f082785

Browse files
committed
support selected_user selected_role and menu type
1 parent 24ba4e6 commit f082785

4 files changed

Lines changed: 160 additions & 33 deletions

File tree

guide/Interaction/modal.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,5 +67,10 @@ it can be multiple but max of 5 inputs
6767
::: tip
6868
This can only be used inside the [modal trigger](../Trigger/modal.md)
6969
:::
70+
71+
::: tip
72+
Read more about the menu structure in [selectMenu](../Text/Components/selectMenu.md)
73+
:::
74+
7075
##### Function difficulty: <Badge type="tip" text="Easy" vertical="middle" />
7176
###### Tags: <Badge type="tip" text="modal" vertical="middle" /> <Badge type="tip" text="sending modal" vertical="middle" />

guide/Text/Components/addMenu.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ $addMenu[
99
{id=Menu ID}
1010
{ph=Placeholder}
1111

12-
{label=Option 1 Label}
12+
{option=Option 1}
1313
{desc=Option 1 Description}
1414
{value=Option 1 ID}
1515
{emoji=Option 1 Emoji}
1616

17-
{label=Option 2 Label}
17+
{option=Option 2}
1818
{desc=Option 2 Description}
1919
{value=Option 2 ID}
2020
{emoji=Option 2 Emoji}
@@ -28,10 +28,10 @@ $addMenu[
2828
{chid=$channelID}
2929
{mid=1151607052007907449}
3030
{id=mymenu}
31-
{label=Rake}
31+
{option=Rake}
3232
{value=rake}
3333

34-
{label=Mido}
34+
{option=Mido}
3535
{value=mido}]
3636
```
3737

guide/Text/Components/awaitMenu.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ The max time is `60 x bot tier` seconds, for example for tier 3 it would be `180
1717
### Example:
1818
<discord-messages>
1919
<discord-message :bot="false" role-color="#ffcc9a" author="Member">
20-
!!exec You selected: $awaitMenu[<br>{title: Test}<br>{menu:<br> {id=test}<br> {placeholder=Select}<br> {min=1}<br> {max=1}<br> {label=Mido}<br> {desc=A guy}<br> {value=mido}<br> {label=Rake}<br> {desc=Another guy}<br> {value=rake}<br>}<br>;$authorID;;test]<br><br>
20+
!!exec You selected: $awaitMenu[<br>{title: Test}<br>{menu:<br> {id=test}<br> {placeholder=Select}<br> {min=1}<br> {max=1}<br> {option=Mido}<br> {desc=A guy}<br> {value=mido}<br> {option=Rake}<br> {desc=Another guy}<br> {value=rake}<br>}<br>;$authorID;;test]<br><br>
2121
</discord-message>
2222
</discord-messages>
2323

guide/Text/Components/selectMenu.md

Lines changed: 150 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,170 @@
11
# $selectMenu
22
Creates a Menu with options.
33

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
78
```
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+
2222
```
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)
2324
* `id` the id of menu must be unique on multiple menus
24-
* `placeholder`
25+
* `placeholder`
2526
* `min` minimum to select (optional)
2627
* `max` maximum to select (optional)
27-
* `label` label of option
28+
* `option` label of option
2829
* `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
3031
* `emoji` emoji for option (optional)
3132

3233
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+
![](https://i.imgur.com/pSIYauj.png)
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+
![](https://i.imgur.com/gAe2sP0.png)
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+
![](https://i.imgur.com/TuXQ5nN.png)
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+
![](https://i.imgur.com/EXOYY1k.png)
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+
![](https://i.imgur.com/UmFu9Of.png)
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+
![](https://i.imgur.com/XldvSKC.png)
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+
![](https://i.imgur.com/gNDtTWP.png)
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+
![](https://i.imgur.com/ZkamUGb.png)
36162

37163
::: tip {key=value} what is this for a syntax?
38164
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.
39165
[Learn more](../guide/curl.md)
40166
:::
41167

42-
Example:
43-
44-
![](https://i.imgur.com/XbRhFaZ.png)
45-
46168
::: tip Do you want to add a menu inside a Function as a parameter, like `$sendMessage[text]`?
47169

48170
Use:
@@ -52,7 +174,7 @@ Use:
52174
{placeholder=Pls select your answer!}
53175
{min=1}
54176
{max=2}
55-
{label=Option one }
177+
{option=Option one }
56178
{desc=txt for one}
57179
{value=one}
58180
{emoji=$customEmoji[accept]}

0 commit comments

Comments
 (0)