-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmulti_select_menu.py
More file actions
106 lines (95 loc) · 3.12 KB
/
Copy pathmulti_select_menu.py
File metadata and controls
106 lines (95 loc) · 3.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
from slack_sdk.models.blocks import SectionBlock
from slack_sdk.models.blocks.basic_components import (
MarkdownTextObject,
Option,
PlainTextObject,
)
from slack_sdk.models.blocks.block_elements import (
ChannelMultiSelectElement,
ConversationMultiSelectElement,
ExternalDataMultiSelectElement,
StaticMultiSelectElement,
UserMultiSelectElement,
)
def example01() -> SectionBlock:
"""
Allows users to select multiple items from a list of options.
https://docs.slack.dev/reference/block-kit/block-elements/multi-select-menu-element/
A section block containing a static multi-select menu.
"""
block = SectionBlock(
block_id="section678",
text=MarkdownTextObject(text="Pick items from the list"),
accessory=StaticMultiSelectElement(
action_id="text1234",
placeholder=PlainTextObject(text="Select items"),
options=[
Option(
text=PlainTextObject(text="*this is plain_text text*"),
value="value-0",
),
Option(
text=PlainTextObject(text="*this is plain_text text*"),
value="value-1",
),
Option(
text=PlainTextObject(text="*this is plain_text text*"),
value="value-2",
),
],
),
)
return block
def example02() -> SectionBlock:
"""
A multi-select menu in a section block with an external data source.
"""
block = SectionBlock(
block_id="section678",
text=MarkdownTextObject(text="Pick items from the list"),
accessory=ExternalDataMultiSelectElement(
action_id="text1234",
placeholder=PlainTextObject(text="Select items"),
min_query_length=3,
),
)
return block
def example03() -> SectionBlock:
"""
A multi-select menu in a section block showing a list of users.
"""
block = SectionBlock(
block_id="section678",
text=MarkdownTextObject(text="Pick users from the list"),
accessory=UserMultiSelectElement(
action_id="text1234",
placeholder=PlainTextObject(text="Select users"),
),
)
return block
def example04() -> SectionBlock:
"""
A multi-select menu in a section block showing a list of conversations.
"""
block = SectionBlock(
block_id="section678",
text=MarkdownTextObject(text="Pick conversations from the list"),
accessory=ConversationMultiSelectElement(
action_id="text1234",
placeholder=PlainTextObject(text="Select conversations"),
),
)
return block
def example05() -> SectionBlock:
"""
A multi-select menu in a section block showing a list of channels.
"""
block = SectionBlock(
block_id="section678",
text=MarkdownTextObject(text="Pick channels from the list"),
accessory=ChannelMultiSelectElement(
action_id="text1234",
placeholder=PlainTextObject(text="Select channels"),
),
)
return block