-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathimage.py
More file actions
62 lines (55 loc) · 1.72 KB
/
Copy pathimage.py
File metadata and controls
62 lines (55 loc) · 1.72 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
from slack_sdk.models.blocks import SectionBlock
from slack_sdk.models.blocks.basic_components import (
MarkdownTextObject,
SlackFile,
)
from slack_sdk.models.blocks.block_elements import ImageElement
def example01() -> SectionBlock:
"""
Displays an image as part of a larger block of content.
https://docs.slack.dev/reference/block-kit/block-elements/image-element/
A section block with an image accessory using image_url.
"""
block = SectionBlock(
block_id="section567",
text=MarkdownTextObject(
text="This is a section block with an accessory image."
),
accessory=ImageElement(
image_url="https://pbs.twimg.com/profile_images/625633822235693056/lNGUneLX_400x400.jpg",
alt_text="cute cat",
),
)
return block
def example02() -> SectionBlock:
"""
An image block using slack_file with a url.
"""
block = SectionBlock(
block_id="section567",
text=MarkdownTextObject(
text="This is a section block with an accessory image."
),
accessory=ImageElement(
slack_file=SlackFile(
url="https://files.slack.com/files-pri/T0123456-F0123456/xyz.png"
),
alt_text="Slack file object.",
),
)
return block
def example03() -> SectionBlock:
"""
An image block using slack_file with a id.
"""
block = SectionBlock(
block_id="section567",
text=MarkdownTextObject(
text="This is a section block with an accessory image."
),
accessory=ImageElement(
slack_file=SlackFile(id="F01234567"),
alt_text="Slack file object.",
),
)
return block