aboutsummaryrefslogtreecommitdiffstats
path: root/wee_slack.py
diff options
context:
space:
mode:
Diffstat (limited to 'wee_slack.py')
-rw-r--r--wee_slack.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/wee_slack.py b/wee_slack.py
index cd51444..6e2990b 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -1167,6 +1167,28 @@ def process_error(message_json):
# def process_message_changed(message_json):
# process_message(message_json)
+def process_reaction_added(message_json):
+ do_reaction(message_json)
+
+def process_reaction_removed(message_json):
+ do_reaction(message_json)
+
+def do_reaction(message_json):
+ message = message_json["item"]["message"]
+ if "reactions" in message:
+ append = create_reaction_string(message["reactions"])
+ else:
+ append = ""
+ channel = channels.find(message_json["item"]["channel"])
+ user = users.find(message_json["item"]["message"]["user"])
+ channel.buffer_prnt_changed(user, message["text"], message["ts"], append)
+
+def create_reaction_string(reactions):
+ reaction_string = ' *** '
+ for r in reactions:
+ reaction_string += ":{}:{} ".format(r["name"], r["count"])
+ return reaction_string
+
def cache_message(message_json, from_me=False):
global message_cache
if from_me: