From 8a0b76c008c3272f1403eff31f79b8dd2398efbd Mon Sep 17 00:00:00 2001 From: Aidan Epstein Date: Mon, 17 Feb 2020 19:12:22 -0800 Subject: Fix unfurl_blocks call placement and add a message about unsupported blocks inside the message. --- wee_slack.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'wee_slack.py') diff --git a/wee_slack.py b/wee_slack.py index 92dfdae..27b2ccf 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -2474,12 +2474,12 @@ class SlackMessage(object): else: text = "" - if "blocks" in self.message_json: - text += unfurl_blocks(self.message_json) - if self.message_json.get('mrkdwn', True): text = render_formatting(text) + if "blocks" in self.message_json: + text += unfurl_blocks(self.message_json) + text = unfurl_refs(text) if (self.message_json.get('subtype') == 'me_message' and @@ -3390,7 +3390,8 @@ def unfurl_blocks(message_json): elif block["type"] == "context": block_text.append("|".join(i["text"] for i in block["elements"])) else: - raise NotImplementedError("Block type not implemented", block["type"]) + block_text.append(' {}<>{}'.format(w.color(config.color_reaction_suffix), 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) return "\n".join(block_text) -- cgit