diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2024-04-18 22:12:29 +0200 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2024-04-18 22:12:29 +0200 |
commit | 12908fe6cfe53210dfea127a840dd3e6e74b2499 (patch) | |
tree | 16ad4b0f063f9a4969ca452231133f9a5a5dde66 /typings | |
parent | 4415a318372954a171024c9fd15a429addccc5f8 (diff) | |
download | wee-slack-12908fe6cfe53210dfea127a840dd3e6e74b2499.tar.gz |
Update user info for open IM conversations when using session tokens
When using session tokens we apparently don't get any
user_status_changed events, so when a user updated their status the
title in an IM with them wasn't updated.
If we specify the query param slack_client=desktop when connecting to
the websocket we at least get a user_invalidated event when the user
info changes. This doesn't include any info though, so we have to make a
request to get the updated user info.
On workspaces with a lot of users, we may get user_invalidated very
often, so we can't fetch new user info every time we get it, otherwise
we would make a lot of requests. So at least for now, only update the
user info if we have an open IM with the user. This ensures the status
in the IM title is kept up to date at least.
In other words, nick changes are not picked up and updated. This is also
the case when using OAuth tokens, as we only listen for
user_status_changed events, and not the other user updated events.
Handling nick changes is also a bit more complex, so I'll leave that for
later.
Diffstat (limited to 'typings')
-rw-r--r-- | typings/slack_rtm/slack_rtm_message.pyi | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/typings/slack_rtm/slack_rtm_message.pyi b/typings/slack_rtm/slack_rtm_message.pyi index 5f78cbb..6310352 100644 --- a/typings/slack_rtm/slack_rtm_message.pyi +++ b/typings/slack_rtm/slack_rtm_message.pyi @@ -303,6 +303,15 @@ class SlackUserStatusChanged(TypedDict): cache_ts: str event_ts: str +class SlackUserInvalidatedUser(TypedDict): + id: str + +@final +class SlackUserInvalidated(TypedDict): + type: Literal["user_invalidated"] + user: SlackUserInvalidatedUser + event_ts: str + SlackMessageRtm = ( SlackMessageStandardRtm | SlackMessageMeRtm @@ -346,4 +355,5 @@ SlackRtmMessage = ( | SlackUserTyping | SlackPrefChange | SlackUserStatusChanged + | SlackUserInvalidated ) |