-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathactions.py
More file actions
88 lines (83 loc) · 2.93 KB
/
actions.py
File metadata and controls
88 lines (83 loc) · 2.93 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
from slack_sdk.models.blocks import ActionsBlock
from slack_sdk.models.blocks.basic_components import Option, PlainTextObject
from slack_sdk.models.blocks.block_elements import (
ButtonElement,
DatePickerElement,
OverflowMenuElement,
StaticSelectElement,
)
def example01() -> ActionsBlock:
"""
Holds multiple interactive elements.
https://docs.slack.dev/reference/block-kit/blocks/actions-block/
An actions block with a select menu and a button.
"""
block = ActionsBlock(
block_id="actions1",
elements=[
StaticSelectElement(
action_id="select_2",
placeholder=PlainTextObject(text="Which witch is the witchiest witch?"),
options=[
Option(text=PlainTextObject(text="Matilda"), value="matilda"),
Option(text=PlainTextObject(text="Glinda"), value="glinda"),
Option(
text=PlainTextObject(text="Granny Weatherwax"),
value="grannyWeatherwax",
),
Option(text=PlainTextObject(text="Hermione"), value="hermione"),
],
),
ButtonElement(
text=PlainTextObject(text="Cancel"),
value="cancel",
action_id="button_1",
),
],
)
return block
def example02() -> ActionsBlock:
"""
An actions block with a datepicker, an overflow, and a button.
"""
block = ActionsBlock(
block_id="actionblock789",
elements=[
DatePickerElement(
action_id="datepicker123",
initial_date="1990-04-28",
placeholder=PlainTextObject(text="Select a date"),
),
OverflowMenuElement(
action_id="overflow",
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",
),
Option(
text=PlainTextObject(text="*this is plain_text text*"),
value="value-3",
),
Option(
text=PlainTextObject(text="*this is plain_text text*"),
value="value-4",
),
],
),
ButtonElement(
text=PlainTextObject(text="Click Me"),
value="click_me_123",
action_id="button",
),
],
)
return block