aboutsummaryrefslogtreecommitdiffstats
path: root/wee_slack.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2019-06-04 00:07:39 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2019-06-04 00:07:39 +0200
commite89501414983da736241dda5669f8b1ac15ea77e (patch)
tree7c54cc76f80bf8436f2c7a6f1dc94483e0503012 /wee_slack.py
parent79c825d359eed0256e8ba62a8d803eb4d9b74899 (diff)
downloadwee-slack-e89501414983da736241dda5669f8b1ac15ea77e.tar.gz
Prevent crash when having mpdm with an external user
Fallback to the id when the user isn't known, like we do for SlackDMChannels. As a next step, we should look up the missing users and update the name, like we do for SlackDMChannels.
Diffstat (limited to 'wee_slack.py')
-rw-r--r--wee_slack.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/wee_slack.py b/wee_slack.py
index f3c4083..3205eca 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -2073,7 +2073,10 @@ class SlackMPDMChannel(SlackChannel):
"""
def __init__(self, eventrouter, team_users, **kwargs):
- kwargs["name"] = ','.join(team_users[x].name for x in kwargs["members"])
+ kwargs["name"] = ','.join(
+ getattr(team_users.get(user_id), 'name', user_id)
+ for user_id in kwargs["members"]
+ )
super(SlackMPDMChannel, self).__init__(eventrouter, **kwargs)
self.type = "mpim"