aboutsummaryrefslogtreecommitdiffstats
path: root/wee_slack.py
diff options
context:
space:
mode:
authorRyan Huber <rhuber@gmail.com>2015-05-27 07:21:26 -0700
committerRyan Huber <rhuber@gmail.com>2015-05-27 07:21:26 -0700
commit192414233e03e4dd1a36c2a05f8612e247aefbdc (patch)
tree3f4c1a951530266d11ec9321cd048efc1855df04 /wee_slack.py
parentbc737d85a79208e8d5af7362a6dbc35ef99dcdcf (diff)
downloadwee-slack-192414233e03e4dd1a36c2a05f8612e247aefbdc.tar.gz
fix up alpha reactions stuff due to backend changes
Diffstat (limited to 'wee_slack.py')
-rw-r--r--wee_slack.py36
1 files changed, 20 insertions, 16 deletions
diff --git a/wee_slack.py b/wee_slack.py
index 7a8fcdf..58b93b5 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -1176,25 +1176,27 @@ def process_reaction_added(message_json):
do_reaction(message_json)
def process_reaction_removed(message_json):
- do_reaction(message_json)
+ pass
+ #do_reaction(message_json)
def do_reaction(message_json):
- message = message_json["item"]["message"]
- text = message["text"].encode('utf-8')
- if "reactions" in message:
- append = create_reaction_string(message["reactions"])
- else:
- append = ""
+ #message = message_json["item"]["message"]
+ #text = message["text"].encode('utf-8')
+ #if "reactions" in message:
+ append = create_reaction_string(message_json["reaction"])
+ #else:
+ # append = ""
channel = channels.find(message_json["item"]["channel"])
- user = users.find(message_json["item"]["message"]["user"])
- text = message["text"].encode('utf-8')
- channel.buffer_prnt_changed(user, text, message["ts"], append)
-
-def create_reaction_string(reactions):
- reaction_string = ' ['
- for r in reactions:
- reaction_string += ":{}:{} ".format(r["name"], r["count"])
- reaction_string = reaction_string[:-1] + ']'
+ #user = users.find(message_json["item"]["user"])
+ #text = message["text"].encode('utf-8')
+ channel.buffer_prnt_changed(None, "", message_json["item"]["ts"], append)
+
+def create_reaction_string(reaction):
+ reaction_string = " [{}]".format(reaction)
+# reaction_string = ' ['
+# for r in reactions:
+# reaction_string += ":{}:{} ".format(r["name"], r["count"])
+# reaction_string = reaction_string[:-1] + ']'
return reaction_string
def cache_message(message_json, from_me=False):
@@ -1224,6 +1226,8 @@ def modify_buffer_line(buffer, user, new_message, time, append):
if data:
date = w.hdata_time(hdata_line_data, data, 'date')
prefix = w.hdata_string(hdata_line_data, data, 'prefix')
+ if new_message == "":
+ new_message = w.hdata_string(hdata_line_data, data, 'message')
if user and (int(date) == int(time) and user == prefix):
# w.prnt("", "found matching time date is {}, time is {} ".format(date, time))
w.hdata_update(hdata_line_data, data, {"message": "{}{}".format(new_message, append)})