aboutsummaryrefslogtreecommitdiffstats
path: root/wee_slack.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2018-06-07 13:33:52 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2018-06-07 14:45:55 +0200
commit164443ab9de3033aa3738dd34ea068053d6bf7fa (patch)
tree512acf86fd0efc71dbfcec52380dfdca0d7a1cb0 /wee_slack.py
parentbee8c87e680795b953ea6bfaee5740ad99833b1a (diff)
downloadwee-slack-164443ab9de3033aa3738dd34ea068053d6bf7fa.tar.gz
Ensure presence is always set on SlackUser
The presence attribute is missing in the response for external users, so we just set it to unknown.
Diffstat (limited to 'wee_slack.py')
-rw-r--r--wee_slack.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/wee_slack.py b/wee_slack.py
index f4e3786..edc33ec 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -1970,10 +1970,11 @@ class SlackUser(object):
"""
def __init__(self, **kwargs):
- # We require these two things for a valid object,
- # the rest we can just learn from slack
self.identifier = kwargs["id"]
- self.profile = {} # in case it's not in kwargs
+ # These attributes may be missing in the response, so we have to make
+ # sure they're set
+ self.profile = {}
+ self.presence = kwargs.get("presence", "unknown")
self.is_external = False
for key, value in kwargs.items():
setattr(self, key, value)