diff options
Diffstat (limited to 'wee_slack.py')
-rw-r--r-- | wee_slack.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/wee_slack.py b/wee_slack.py index 67a8635..6815ed1 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -1945,8 +1945,10 @@ def process_reaction_added(message_json, eventrouter, **kwargs): if message_json["item"].get("type") == "message": ts = SlackTS(message_json['item']["ts"]) - channel.messages[ts].add_reaction(message_json["reaction"], message_json["user"]) - channel.change_message(ts) + message = channel.messages.get(ts, None) + if message: + message.add_reaction(message_json["reaction"], message_json["user"]) + channel.change_message(ts) else: dbg("reaction to item type not supported: " + str(message_json)) @@ -1955,8 +1957,10 @@ def process_reaction_removed(message_json, eventrouter, **kwargs): if message_json["item"].get("type") == "message": ts = SlackTS(message_json['item']["ts"]) - channel.messages[ts].remove_reaction(message_json["reaction"], message_json["user"]) - channel.change_message(ts) + message = channel.messages.get(ts, None) + if message: + message.remove_reaction(message_json["reaction"], message_json["user"]) + channel.change_message(ts) else: dbg("Reaction to item type not supported: " + str(message_json)) |