aboutsummaryrefslogtreecommitdiffstats
path: root/wee_slack.py
diff options
context:
space:
mode:
authorAidan Epstein <aidan@jmad.org>2020-02-17 19:12:22 -0800
committerAidan Epstein <aidan@jmad.org>2020-02-18 14:48:34 -0800
commit8a0b76c008c3272f1403eff31f79b8dd2398efbd (patch)
tree728733f5ef49ebd7d11c5cc1a44cf44e08234e41 /wee_slack.py
parentfd241cdf2200844d6995c62000571e3a3de7e159 (diff)
downloadwee-slack-8a0b76c008c3272f1403eff31f79b8dd2398efbd.tar.gz
Fix unfurl_blocks call placement and add a message about unsupported blocks inside the message.
Diffstat (limited to 'wee_slack.py')
-rw-r--r--wee_slack.py9
1 files changed, 5 insertions, 4 deletions
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(' {}<<Unsupported block type "{}">>{}'.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)