aboutsummaryrefslogtreecommitdiffstats
path: root/wee_slack.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2020-03-02 20:56:44 +0100
committerTrygve Aaberge <trygveaa@gmail.com>2020-03-02 21:37:22 +0100
commit9d0a55d706879c6c038c15156e568cd7cb04b8db (patch)
tree310c8979ade4215b333bc8bb66658acd4a9c6d9f /wee_slack.py
parentec783344a9bb079eb51ebc98a9b0390cab20558f (diff)
downloadwee-slack-9d0a55d706879c6c038c15156e568cd7cb04b8db.tar.gz
Handle manual presence change properly
The manual_presence_change event is just for your own user and doesn't include any user ids. This adds a field on the team with your manual presence so we can show if the user is automatically away or manually away.
Diffstat (limited to 'wee_slack.py')
-rw-r--r--wee_slack.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/wee_slack.py b/wee_slack.py
index c30a6d9..db3aa82 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -1238,7 +1238,7 @@ class SlackTeam(object):
Team object under which users and channels live.. Does lots.
"""
- def __init__(self, eventrouter, token, websocket_url, team_info, subteams, nick, myidentifier, users, bots, channels, **kwargs):
+ def __init__(self, eventrouter, token, websocket_url, team_info, subteams, nick, myidentifier, my_manual_presence, users, bots, channels, **kwargs):
self.identifier = team_info["id"]
self.active = True
self.ws_url = websocket_url
@@ -1260,6 +1260,7 @@ class SlackTeam(object):
self.preferred_name = self.domain
self.nick = nick
self.myidentifier = myidentifier
+ self.my_manual_presence = my_manual_presence
try:
if self.channels:
for c in channels.keys():
@@ -2677,6 +2678,7 @@ def handle_rtmstart(login_data, eventrouter, team, channel, metadata):
subteams,
self_nick,
login_data["self"]["id"],
+ login_data["self"]["manual_presence"],
users,
bots,
channels,
@@ -2834,7 +2836,8 @@ def process_presence_change(message_json, eventrouter, team, channel, metadata):
w.bar_item_update("slack_away")
-process_manual_presence_change = process_presence_change
+def process_manual_presence_change(message_json, eventrouter, team, channel, metadata):
+ team.my_manual_presence = message_json["presence"]
def process_pref_change(message_json, eventrouter, team, channel, metadata):