diff options
| author | Rapptz <[email protected]> | 2018-09-24 21:05:41 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2018-09-24 21:08:48 -0400 |
| commit | 3d03dbc45179f645b59838729047e896cc387049 (patch) | |
| tree | 63592f4d631c33ee0b22b7f6bb57818ad48b2671 /discord/member.py | |
| parent | Take the default role property into account when comparing roles. (diff) | |
| download | discord.py-3d03dbc45179f645b59838729047e896cc387049.tar.xz discord.py-3d03dbc45179f645b59838729047e896cc387049.zip | |
Change internal role storage in Guild to a dict instead of a list.
This adds the following APIs:
* Guild.get_role
This removes the following APIs:
* Guild.role_hierarchy
To compensate for the removed APIs, Guild.roles is now a sorted list
based on hierarchy. The first element will always be the @everyone
role.
This speeds up access at the cost of some memory, theoretically.
Diffstat (limited to 'discord/member.py')
| -rw-r--r-- | discord/member.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/discord/member.py b/discord/member.py index bf461d88..e407546a 100644 --- a/discord/member.py +++ b/discord/member.py @@ -189,8 +189,8 @@ class Member(discord.abc.Messageable, _BaseUser): def _update_roles(self, data): # update the roles self.roles = [self.guild.default_role] - for roleid in map(int, data['roles']): - role = utils.find(lambda r: r.id == roleid, self.guild.roles) + for role_id in map(int, data['roles']): + role = self.guild.get_role(role_id) if role is not None: self.roles.append(role) |