diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2018-06-07 13:33:52 +0200 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2018-06-07 14:45:55 +0200 |
commit | 164443ab9de3033aa3738dd34ea068053d6bf7fa (patch) | |
tree | 512acf86fd0efc71dbfcec52380dfdca0d7a1cb0 /wee_slack.py | |
parent | bee8c87e680795b953ea6bfaee5740ad99833b1a (diff) | |
download | wee-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.py | 7 |
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) |