aboutsummaryrefslogtreecommitdiffstats
path: root/wee_slack.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2020-10-05 22:45:27 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2020-10-05 22:50:59 +0200
commit3be133d473a1a3965efb1bfcb2927325f6bdfd67 (patch)
treef8942da11fb7983030e76d5d0eb544b9f63dc0d1 /wee_slack.py
parentaacf64e617a4f82f95fd5199f3e5528e846aede5 (diff)
downloadwee-slack-3be133d473a1a3965efb1bfcb2927325f6bdfd67.tar.gz
Print error message when sending message fails
Relates to #797
Diffstat (limited to 'wee_slack.py')
-rw-r--r--wee_slack.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/wee_slack.py b/wee_slack.py
index 9f09f7e..e0ad9bf 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -3474,10 +3474,13 @@ def process_reply(message_json, eventrouter, team, channel, metadata):
reply_to = int(message_json["reply_to"])
original_message_json = team.ws_replies.pop(reply_to, None)
if original_message_json:
- original_message_json.update(message_json)
- channel = team.channels[original_message_json.get('channel')]
- process_message(original_message_json, eventrouter, team=team, channel=channel, metadata={})
dbg("REPLY {}".format(message_json))
+ channel = team.channels[original_message_json.get('channel')]
+ if message_json["ok"]:
+ original_message_json.update(message_json)
+ process_message(original_message_json, eventrouter, team=team, channel=channel, metadata={})
+ else:
+ print_error("Couldn't send message to channel {}: {}".format(channel.name, message_json["error"]))
else:
dbg("Unexpected reply {}".format(message_json))