mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-09-08 10:53:10 +00:00
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.
This commit is contained in:
@ -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)
|
||||
|
||||
|
Reference in New Issue
Block a user