From e89501414983da736241dda5669f8b1ac15ea77e Mon Sep 17 00:00:00 2001 From: Trygve Aaberge Date: Tue, 4 Jun 2019 00:07:39 +0200 Subject: 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. --- wee_slack.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'wee_slack.py') 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" -- cgit