aboutsummaryrefslogtreecommitdiffstats
path: root/wee_slack.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2020-02-19 02:05:00 +0100
committerTrygve Aaberge <trygveaa@gmail.com>2020-02-19 02:05:00 +0100
commit7e3c66e30bdd6a88e9957f73e022bb8f9062e0b0 (patch)
tree81ae8560027c51e55c8d34f53956facb1b84ce72 /wee_slack.py
parentbe74094d0bdc3e77668bf8582cb79bbf6c645b1c (diff)
downloadwee-slack-7e3c66e30bdd6a88e9957f73e022bb8f9062e0b0.tar.gz
Don't crash when getting block action types other than button
Diffstat (limited to 'wee_slack.py')
-rw-r--r--wee_slack.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/wee_slack.py b/wee_slack.py
index e639ca9..4806a93 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -3382,7 +3382,14 @@ def unfurl_blocks(message_json):
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"]))
+ elements = []
+ for element in block["elements"]:
+ if element["type"] == "button":
+ elements.append(element["text"]["text"])
+ else:
+ elements.append('{}<<Unsupported block action type "{}">>{}'.format(
+ w.color(config.color_deleted), element["type"], w.color("reset")))
+ block_text.append(" | ".join(elements))
elif block["type"] == "call":
block_text.append("Join via " + block["call"]["v1"]["join_url"])
elif block["type"] == "divider":