aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTollef Fog Heen <tfheen@err.no>2018-03-10 11:27:44 +0100
committerTollef Fog Heen <tfheen@err.no>2018-03-10 11:27:44 +0100
commitd5af7d8362580eb9ae4564ef52694087d427bbab (patch)
treea6f5dafe3b4afaaf1c79fa4729e567220187946a
parentf3b8fa7867c6b2807efb4120e64c0bcdcbde54e6 (diff)
downloadwee-slack-d5af7d8362580eb9ae4564ef52694087d427bbab.tar.gz
Avoid erroring for reactions on files
If somebody adds a reaction on a file, there will be no channel associated with it. Handle that gracefully. (Reaction will still be missing, but at least there's no traceback.) Related to #316.
-rw-r--r--wee_slack.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/wee_slack.py b/wee_slack.py
index a8819d7..efa4df9 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -2568,7 +2568,7 @@ def process_group_joined(message_json, eventrouter, **kwargs):
def process_reaction_added(message_json, eventrouter, **kwargs):
- channel = kwargs['team'].channels[message_json["item"]["channel"]]
+ channel = kwargs['team'].channels.get(message_json["item"].get("channel"))
if message_json["item"].get("type") == "message":
ts = SlackTS(message_json['item']["ts"])
@@ -2581,7 +2581,7 @@ def process_reaction_added(message_json, eventrouter, **kwargs):
def process_reaction_removed(message_json, eventrouter, **kwargs):
- channel = kwargs['team'].channels[message_json["item"]["channel"]]
+ channel = kwargs['team'].channels.get(message_json["item"].get("channel"))
if message_json["item"].get("type") == "message":
ts = SlackTS(message_json['item']["ts"])