Skip to content

Commit 205e76b

Browse files
committed
learn/advanced: channel type filtering
Signed-off-by: Luca Zeuch <[email protected]>
1 parent 18a40d4 commit 205e76b

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed
18.4 KB
Loading

content/learn/advanced/custom-interactions/creating-interactive-elements.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,32 @@ automatically populates the options, you need not---nor can you---define these o
9696

9797
![A screenshot of the above role select menu.](role_select_menu_example.png)
9898

99+
##### Channel Select Menus
100+
101+
Channel select menus are a bit different from the other types, as they allow you to specify which channel types you
102+
want to include in the menu. You do this by using the `channel_types` field, which accepts a slice of [channel types].
103+
104+
```yag
105+
{{ $issuesChannel := "1210135699135926312" }}
106+
{{ $updatesChannel := "1210135938722693151" }}
107+
108+
{{ $menu := cmenu
109+
"type" "channel"
110+
"placeholder" "Choose channels which are secretly duck hideouts"
111+
"custom_id" "menus-duck-channels"
112+
"default_values" ( cslice
113+
( sdict "type" "channel" "id" $issuesChannel )
114+
( sdict "type" "channel" "id" $updatesChannel ))
115+
"max_values" 3
116+
"channel_types" (cslice 5 15) }}
117+
118+
{{ sendMessage nil (complexMessage "menus" $menu) }}
119+
```
120+
121+
This gives us a select menu that allows us to select only guild announcement and guild form channels.
122+
123+
![A screenshot of the above channel select menu.](channel_menu_with_filters.png)
124+
99125
## Modals
100126

101127
Modals are a pop-up form that YAGPDB can send in response to an interaction. It allows users to privately input text

0 commit comments

Comments
 (0)