aboutsummaryrefslogtreecommitdiffstats
path: root/wee_slack.py
diff options
context:
space:
mode:
authorAidan Epstein <aidan@jmad.org>2020-03-27 14:12:53 -0700
committerAidan Epstein <aidan@jmad.org>2020-03-27 14:12:53 -0700
commit7a2372b3c07f933726d388bab9a274f4d4f0a695 (patch)
treee2bd86a8c744490af167770c00e2df8854cadc70 /wee_slack.py
parent9a7d5a9298cc95335910391caa732e0c5eecc904 (diff)
downloadwee-slack-7a2372b3c07f933726d388bab9a274f4d4f0a695.tar.gz
Process thread_marked events, to mark threads as read when the API tells us to.
Diffstat (limited to 'wee_slack.py')
-rw-r--r--wee_slack.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/wee_slack.py b/wee_slack.py
index 3a650e3..bcb7f3e 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -3155,6 +3155,18 @@ process_im_marked = process_channel_marked
process_mpim_marked = process_channel_marked
+def process_thread_marked(message_json, eventrouter, team, channel, metadata):
+ subscription = message_json.get("subscription", {})
+ ts = subscription.get("last_read")
+ thread_ts = subscription.get("thread_ts")
+ channel = team.channels.get(subscription.get("channel"))
+ if ts and thread_ts and channel:
+ thread_channel = channel.thread_channels.get(thread_ts)
+ if thread_channel: thread_channel.mark_read(ts=ts, force=True, update_remote=False)
+ else:
+ dbg("tried to mark something weird {}".format(message_json))
+
+
def process_channel_joined(message_json, eventrouter, team, channel, metadata):
channel.update_from_message_json(message_json["channel"])
channel.open()