aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2020-02-19 02:09:37 +0100
committerTrygve Aaberge <trygveaa@gmail.com>2020-02-19 02:09:37 +0100
commit1fe556f16751889d6ca92d7ecea408eea6d3d4fa (patch)
treed16b2a835e2486acc6c988f6160d3d3e02da1529
parent97f2b0eceff49d9821b3790b0eaafc266ba6e60b (diff)
downloadwee-slack-1fe556f16751889d6ca92d7ecea408eea6d3d4fa.tar.gz
Support blocks of type image
-rw-r--r--wee_slack.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/wee_slack.py b/wee_slack.py
index 3a94974..5837171 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -3398,6 +3398,10 @@ def unfurl_blocks(message_json):
block_text.append("---")
elif block["type"] == "context":
block_text.append(" | ".join(unfurl_block_element(el) for el in block["elements"]))
+ elif block["type"] == "image":
+ if "title" in block:
+ block_text.append(unfurl_block_element(block["title"]))
+ block_text.append(unfurl_block_element(block))
elif block["type"] == "rich_text":
continue
else:
@@ -3413,6 +3417,8 @@ def unfurl_block_element(text):
return render_formatting(text["text"])
elif text["type"] == "plain_text":
return text["text"]
+ elif text["type"] == "image":
+ return "{} ({})".format(text["image_url"], text["alt_text"])
def unfurl_refs(text, ignore_alt_text=None, auto_link_display=None):