diff options
| author | Rapptz <[email protected]> | 2016-07-13 17:23:35 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2016-07-13 17:23:35 -0400 |
| commit | 69c506d7aeb9f1a0a6f711b7b8c144f8b554b0d7 (patch) | |
| tree | 5697945188b749ed9db565c7f469d05f0abb93f2 /discord/channel.py | |
| parent | Begin working on gateway v6 changes. (diff) | |
| download | discord.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.py | 14 |
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) |