diff options
author | Aidan Epstein <aidan@jmad.org> | 2019-11-08 08:56:37 -0800 |
---|---|---|
committer | Aidan Epstein <aidan@jmad.org> | 2020-02-18 14:48:34 -0800 |
commit | 2350a89bbfef7f1a528405e2feaed833c8baa546 (patch) | |
tree | 671eadc31d001ced98adb8bdef103252fa8e78ca /wee_slack.py | |
parent | 2cfbd67f817f2dc3c48dfda51eb7bc81aa732ab2 (diff) | |
download | wee-slack-2350a89bbfef7f1a528405e2feaed833c8baa546.tar.gz |
Fix message formatting by calling render_formatting.
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 |