aboutsummaryrefslogtreecommitdiffstats
path: root/slack/slack_workspace.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2023-10-13 00:24:01 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2024-02-18 11:32:54 +0100
commit0cd9168d99b673ee0adf6528c1ac5afc4de7eff0 (patch)
tree76b7fb6e6ad799eba88e07ee5c7574ca0cbd850e /slack/slack_workspace.py
parent01c1a010f9d03f69aab27c40f2773147a0fb6bd5 (diff)
downloadwee-slack-0cd9168d99b673ee0adf6528c1ac5afc4de7eff0.tar.gz
Update message when subscribed/unsubscribed
Pyright doesn't allow me to set subscribed/last_read in _message_json since some of the _message_json types don't have them, so had to use separate attributes.
Diffstat (limited to 'slack/slack_workspace.py')
-rw-r--r--slack/slack_workspace.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/slack/slack_workspace.py b/slack/slack_workspace.py
index 992e025..1b60013 100644
--- a/slack/slack_workspace.py
+++ b/slack/slack_workspace.py
@@ -336,8 +336,9 @@ class SlackWorkspace:
channel_id = data["item"]["channel"]
elif (
data["type"] == "thread_marked"
- and data["subscription"]["type"] == "thread"
- ):
+ or data["type"] == "thread_subscribed"
+ or data["type"] == "thread_unsubscribed"
+ ) and data["subscription"]["type"] == "thread":
channel_id = data["subscription"]["channel"]
elif data["type"] == "sh_room_join" or data["type"] == "sh_room_update":
channel_id = data["huddle"]["channel_id"]
@@ -391,6 +392,16 @@ class SlackWorkspace:
)
if message:
message.last_read = SlackTs(data["subscription"]["last_read"])
+ elif (
+ data["type"] == "thread_subscribed"
+ or data["type"] == "thread_unsubscribed"
+ ) and data["subscription"]["type"] == "thread":
+ message = channel.messages.get(
+ SlackTs(data["subscription"]["thread_ts"])
+ )
+ if message:
+ subscribed = data["type"] == "thread_subscribed"
+ await message.update_subscribed(subscribed, data["subscription"])
elif data["type"] == "sh_room_join" or data["type"] == "sh_room_update":
await channel.update_message_room(data)
elif data["type"] == "user_typing":