-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathselect_menu.py
More file actions
106 lines (95 loc) · 3.06 KB
/
Copy pathselect_menu.py
File metadata and controls
106 lines (95 loc) · 3.06 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 (
ChannelSelectElement,
ConversationSelectElement,
ExternalDataSelectElement,
StaticSelectElement,
UserSelectElement,
)
def example01() -> SectionBlock:
"""
Allows users to choose an option from a drop down menu.
https://docs.slack.dev/reference/block-kit/block-elements/select-menu-element/
A section block with a static select menu accessory.
"""
block = SectionBlock(
block_id="section678",
text=MarkdownTextObject(text="Pick an item from the dropdown list"),
accessory=StaticSelectElement(
action_id="text1234",
placeholder=PlainTextObject(text="Select an item"),
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 section block with an external select menu accessory.
"""
block = SectionBlock(
block_id="section678",
text=MarkdownTextObject(text="Pick an item from the dropdown list"),
accessory=ExternalDataSelectElement(
action_id="text1234",
placeholder=PlainTextObject(text="Select an item"),
min_query_length=3,
),
)
return block
def example03() -> SectionBlock:
"""
A section block with a users select menu accessory.
"""
block = SectionBlock(
block_id="section678",
text=MarkdownTextObject(text="Pick a user from the dropdown list"),
accessory=UserSelectElement(
action_id="text1234",
placeholder=PlainTextObject(text="Select an item"),
),
)
return block
def example04() -> SectionBlock:
"""
A section block with a conversations select menu accessory.
"""
block = SectionBlock(
block_id="section678",
text=MarkdownTextObject(text="Pick a conversation from the dropdown list"),
accessory=ConversationSelectElement(
action_id="text1234",
placeholder=PlainTextObject(text="Select an item"),
),
)
return block
def example05() -> SectionBlock:
"""
A section block with a channels select menu accessory.
"""
block = SectionBlock(
block_id="section678",
text=MarkdownTextObject(text="Pick a channel from the dropdown list"),
accessory=ChannelSelectElement(
action_id="text1234",
placeholder=PlainTextObject(text="Select an item"),
),
)
return block