aboutsummaryrefslogtreecommitdiffstats
path: root/wee_slack.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2020-02-19 01:57:14 +0100
committerTrygve Aaberge <trygveaa@gmail.com>2020-02-19 02:02:57 +0100
commitbe74094d0bdc3e77668bf8582cb79bbf6c645b1c (patch)
tree121b3cac4f85121dbdfff7aa4349dfd14e523c9a /wee_slack.py
parentc61e15dbbfc09c520b944a63c97ba07c2261ee30 (diff)
downloadwee-slack-be74094d0bdc3e77668bf8582cb79bbf6c645b1c.tar.gz
Tweak formatting of blocks
Diffstat (limited to 'wee_slack.py')
-rw-r--r--wee_slack.py12
1 files 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(' {}<<Unsupported block type "{}">>{}'.format(w.color(config.color_deleted), block["type"], w.color("reset")))
+ block_text.append('{}<<Unsupported block type "{}">>{}'.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)