-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathimage.py
More file actions
46 lines (39 loc) · 1.27 KB
/
image.py
File metadata and controls
46 lines (39 loc) · 1.27 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
from slack_sdk.models.blocks import ImageBlock
from slack_sdk.models.blocks.basic_components import PlainTextObject, SlackFile
def example01() -> ImageBlock:
"""
Displays an image.
https://docs.slack.dev/reference/block-kit/blocks/image-block/
An image block using image_url.
"""
block = ImageBlock(
title=PlainTextObject(text="Please enjoy this photo of a kitten"),
block_id="image4",
image_url="http://placekitten.com/500/500",
alt_text="An incredibly cute kitten.",
)
return block
def example02() -> ImageBlock:
"""
An image block using slack_file with a url.
"""
block = ImageBlock(
title=PlainTextObject(text="Please enjoy this photo of a kitten"),
block_id="image4",
slack_file=SlackFile(
url="https://files.slack.com/files-pri/T0123456-F0123456/xyz.png"
),
alt_text="An incredibly cute kitten.",
)
return block
def example03() -> ImageBlock:
"""
An image block using slack_file with an id.
"""
block = ImageBlock(
title=PlainTextObject(text="Please enjoy this photo of a kitten"),
block_id="image4",
slack_file=SlackFile(id="F0123456"),
alt_text="An incredibly cute kitten.",
)
return block