diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2020-06-08 15:40:16 +0200 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2020-06-16 23:03:01 +0200 |
commit | 55d96a7105e8a323b901ba087a036d70dc3840f5 (patch) | |
tree | 061ef6d72e67a404e9add2c504f572c771100025 /wee_slack.py | |
parent | e6446b84db52d9c5b6adf6c8869ab3d12e6f2ce4 (diff) | |
download | wee-slack-55d96a7105e8a323b901ba087a036d70dc3840f5.tar.gz |
Show blocks in attachments
Diffstat (limited to 'wee_slack.py')
-rw-r--r-- | wee_slack.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/wee_slack.py b/wee_slack.py index 1dc2bc9..b1f7a87 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -2714,7 +2714,7 @@ class SlackMessage(object): return self.message_json["_rendered_text"] blocks = self.message_json.get("blocks", []) - blocks_rendered = unfurl_blocks(blocks) + blocks_rendered = "\n".join(unfurl_blocks(blocks)) has_rich_text = any(block["type"] == "rich_text" for block in blocks) if has_rich_text: text = self.message_json.get("text", "") @@ -3671,7 +3671,7 @@ def unfurl_blocks(blocks): dbg('Unsupported block: "{}"'.format(json.dumps(block)), level=4) except Exception as e: dbg("Failed to unfurl block ({}): {}".format(repr(e), json.dumps(block)), level=4) - return "\n".join(block_text) + return block_text def unfurl_block_element(text): @@ -3777,6 +3777,9 @@ def unwrap_attachments(message_json, text_before): t.append(prepend_title_text + tx) prepend_title_text = '' + blocks = attachment.get("blocks", []) + t.extend(unfurl_blocks(blocks)) + image_url = attachment.get('image_url', '') if (image_url not in text_before and image_url not in text_before_unescaped and image_url != from_url and image_url != title_link): |