-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsection.py
More file actions
51 lines (44 loc) · 1.4 KB
/
section.py
File metadata and controls
51 lines (44 loc) · 1.4 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 SectionBlock
from slack_sdk.models.blocks.basic_components import MarkdownTextObject, PlainTextObject
from slack_sdk.models.blocks.block_elements import DatePickerElement
def example01() -> SectionBlock:
"""
Displays text, possibly alongside elements.
https://docs.slack.dev/reference/block-kit/blocks/section-block/
A text section block.
"""
block = SectionBlock(
text=MarkdownTextObject(
text="A message *with some bold text* and _some italicized text_."
)
)
return block
def example02() -> SectionBlock:
"""
A section block containing text fields.
"""
block = SectionBlock(
text=MarkdownTextObject(
text="A message *with some bold text* and _some italicized text_."
),
fields=[
MarkdownTextObject(text="High"),
PlainTextObject(text="Silly", emoji=True),
],
)
return block
def example03() -> SectionBlock:
"""
A section block containing a datepicker element.
"""
block = SectionBlock(
text=MarkdownTextObject(
text="*Haley* has requested you set a deadline for finding a house"
),
accessory=DatePickerElement(
action_id="datepicker123",
initial_date="1990-04-28",
placeholder=PlainTextObject(text="Select a date"),
),
)
return block