-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontext_actions.py
More file actions
51 lines (46 loc) · 1.42 KB
/
context_actions.py
File metadata and controls
51 lines (46 loc) · 1.42 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
from slack_sdk.models.blocks import ContextActionsBlock
from slack_sdk.models.blocks.basic_components import (
FeedbackButtonObject,
PlainTextObject,
)
from slack_sdk.models.blocks.block_elements import (
FeedbackButtonsElement,
IconButtonElement,
)
def example01() -> ContextActionsBlock:
"""
Holds interactive elements like feedback buttons and icon buttons.
https://docs.slack.dev/reference/block-kit/blocks/context-actions-block/
Context actions block with feedback buttons.
"""
block = ContextActionsBlock(
elements=[
FeedbackButtonsElement(
action_id="feedback_buttons_1",
positive_button=FeedbackButtonObject(
text=PlainTextObject(text="👍"),
value="positive_feedback",
),
negative_button=FeedbackButtonObject(
text=PlainTextObject(text="👎"),
value="negative_feedback",
),
),
],
)
return block
def example02() -> ContextActionsBlock:
"""
Context actions block with an icon button.
"""
block = ContextActionsBlock(
elements=[
IconButtonElement(
icon="trash",
text=PlainTextObject(text="Delete"),
action_id="delete_button_1",
value="delete_item",
),
],
)
return block