From be74094d0bdc3e77668bf8582cb79bbf6c645b1c Mon Sep 17 00:00:00 2001 From: Trygve Aaberge Date: Wed, 19 Feb 2020 01:57:14 +0100 Subject: Tweak formatting of blocks --- wee_slack.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/wee_slack.py b/wee_slack.py index 4841890..e639ca9 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -3375,24 +3375,24 @@ def linkify_text(message, team, only_users=False): def unfurl_blocks(message_json): - block_text = [] + block_text = [""] for block in message_json["blocks"]: try: if block["type"] == "section": if "text" in block: block_text += unfurl_texts([block["text"]]) if "fields" in block: block_text += unfurl_texts(block["fields"]) elif block["type"] == "actions": - block_text.append("|".join(i["text"]["text"] for i in block["elements"])) + block_text.append(" | ".join(i["text"]["text"] for i in block["elements"])) elif block["type"] == "call": - block_text.append(". Join via " + block["call"]["v1"]["join_url"]) + block_text.append("Join via " + block["call"]["v1"]["join_url"]) elif block["type"] == "divider": - block_text.append("\n") + block_text.append("---") elif block["type"] == "context": - block_text.append("|".join(i["text"] for i in block["elements"])) + block_text.append(" | ".join(i["text"] for i in block["elements"])) elif block["type"] == "rich_text": continue else: - block_text.append(' {}<>{}'.format(w.color(config.color_deleted), block["type"], w.color("reset"))) + block_text.append('{}<>{}'.format(w.color(config.color_deleted), block["type"], w.color("reset"))) 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) -- cgit