diff options
Diffstat (limited to 'wee_slack.py')
-rw-r--r-- | wee_slack.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/wee_slack.py b/wee_slack.py index b969ef5..fd200b6 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -3379,7 +3379,7 @@ def unfurl_blocks(message_json): for block in message_json["blocks"]: try: if block["type"] == "section": - if "text" in block: block_text.append(block["text"]["text"]) + 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"])) @@ -3389,7 +3389,7 @@ def unfurl_blocks(message_json): block_text.append("|".join(i["text"] for i in block["elements"])) else: block_text.append(json.dumps(block)) - except KeyError as e: + except Exception as e: block_text.append(json.dumps(block) + repr(e)) return "\n".join(block_text) @@ -3397,7 +3397,11 @@ def unfurl_blocks(message_json): def unfurl_texts(texts): texts_ret = [] for text in texts: - texts_ret.append(text["text"]) #TODO: markdown, etc. parse? + if text["type"] == "mrkdwn": + ftext = render_formatting(text["text"]) + else: + ftext = text["text"] + texts_ret.append(ftext) return texts_ret |