Skip to content

Commit d39cdd3

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

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed
18.4 KB
Loading

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,34 @@ 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+
[channel types]: https://discord.com/developers/docs/resources/channel#channel-object-channel-types
105+
106+
```yag
107+
{{ $issuesChannel := "1210135699135926312" }}
108+
{{ $updatesChannel := "1210135938722693151" }}
109+
110+
{{ $menu := cmenu
111+
"type" "channel"
112+
"placeholder" "Choose channels which are secretly duck hideouts"
113+
"custom_id" "menus-duck-channels"
114+
"default_values" ( cslice
115+
( sdict "type" "channel" "id" $issuesChannel )
116+
( sdict "type" "channel" "id" $updatesChannel ))
117+
"max_values" 3
118+
"channel_types" (cslice 5 15) }}
119+
120+
{{ sendMessage nil (complexMessage "menus" $menu) }}
121+
```
122+
123+
This gives us a select menu that allows us to select only guild announcement and guild form channels.
124+
125+
![A screenshot of the above channel select menu.](channel_menu_with_filters.png)
126+
99127
## Modals
100128

101129
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)