diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2019-06-12 23:50:19 +0200 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2019-06-12 23:50:19 +0200 |
commit | 19d33073c1f493c7f61b6a38e4f0868cfec63dd6 (patch) | |
tree | 401349bbb3f0990beab95e23e0662ff0a93ce40e /wee_slack.py | |
parent | 849ffc6bf123242cc20846d913768c7690e9fc5f (diff) | |
download | wee-slack-19d33073c1f493c7f61b6a38e4f0868cfec63dd6.tar.gz |
Don't include own nick in mpdm names
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 1ac07a7..64bf9e1 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -2080,10 +2080,11 @@ class SlackMPDMChannel(SlackChannel): We change the name to look less terrible in weechat. """ - def __init__(self, eventrouter, team_users, **kwargs): + def __init__(self, eventrouter, team_users, myidentifier, **kwargs): kwargs["name"] = ','.join( getattr(team_users.get(user_id), 'name', user_id) for user_id in kwargs["members"] + if user_id != myidentifier ) super(SlackMPDMChannel, self).__init__(eventrouter, **kwargs) self.type = "mpim" @@ -2627,7 +2628,7 @@ def handle_rtmstart(login_data, eventrouter): for item in login_data["groups"]: if item["is_mpim"]: - channels[item["id"]] = SlackMPDMChannel(eventrouter, users, **item) + channels[item["id"]] = SlackMPDMChannel(eventrouter, users, login_data["self"]["id"], **item) else: channels[item["id"]] = SlackGroupChannel(eventrouter, **item) @@ -3107,7 +3108,7 @@ def process_im_close(message_json, eventrouter, **kwargs): def process_group_joined(message_json, eventrouter, **kwargs): item = message_json["channel"] if item["name"].startswith("mpdm-"): - c = SlackMPDMChannel(eventrouter, kwargs["team"].users, team=kwargs["team"], **item) + c = SlackMPDMChannel(eventrouter, kwargs["team"].users, kwargs["team"].myidentifier, team=kwargs["team"], **item) else: c = SlackGroupChannel(eventrouter, team=kwargs["team"], **item) kwargs['team'].channels[item["id"]] = c |