aboutsummaryrefslogtreecommitdiff
path: root/discord/channel.py
diff options
context:
space:
mode:
authorRapptz <[email protected]>2016-07-13 17:23:35 -0400
committerRapptz <[email protected]>2016-07-13 17:23:35 -0400
commit69c506d7aeb9f1a0a6f711b7b8c144f8b554b0d7 (patch)
tree5697945188b749ed9db565c7f469d05f0abb93f2 /discord/channel.py
parentBegin working on gateway v6 changes. (diff)
downloaddiscord.py-69c506d7aeb9f1a0a6f711b7b8c144f8b554b0d7.tar.xz
discord.py-69c506d7aeb9f1a0a6f711b7b8c144f8b554b0d7.zip
Handle CHANNEL_UPDATE for group direct messages.
Diffstat (limited to 'discord/channel.py')
-rw-r--r--discord/channel.py14
1 files changed, 3 insertions, 11 deletions
diff --git a/discord/channel.py b/discord/channel.py
index c53a96cf..ecccb24a 100644
--- a/discord/channel.py
+++ b/discord/channel.py
@@ -325,21 +325,13 @@ class PrivateChannel(Hashable):
self.id = kwargs['id']
self.is_private = True
self.type = ChannelType(kwargs['type'])
+ self._update_group(**kwargs)
+ def _update_group(self, **kwargs):
owner_id = kwargs.get('owner_id')
- self.owner = None
self.icon = kwargs.get('icon')
self.name = kwargs.get('name')
-
- self.recipients = []
- for data in kwargs['recipients']:
- to_add = User(**data)
- if to_add.id == owner_id:
- self.owner = to_add
- self.recipients.append(to_add)
-
- if owner_id == me.id:
- self.owner = me
+ self.owner = utils.find(lambda u: u.id == owner_id, self.recipients)
def __str__(self):
return 'Direct Message with {0.name}'.format(self.user)