aboutsummaryrefslogtreecommitdiff
path: root/discord/abc.py
diff options
context:
space:
mode:
Diffstat (limited to 'discord/abc.py')
-rw-r--r--discord/abc.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/discord/abc.py b/discord/abc.py
index 8482104a..02dc765f 100644
--- a/discord/abc.py
+++ b/discord/abc.py
@@ -415,9 +415,10 @@ class GuildChannel:
default = self.guild.default_role
base = Permissions(default.permissions.value)
+ roles = member.roles
# Apply guild roles that the member has.
- for role in member.roles:
+ for role in roles:
base.value |= role.permissions.value
# Guild-wide Administrator -> True for everything
@@ -436,7 +437,13 @@ class GuildChannel:
except IndexError:
remaining_overwrites = self._overwrites
- member_role_ids = set(map(lambda r: r.id, member.roles))
+ # not sure if doing member._roles.get(...) is better than the
+ # set approach. While this is O(N) to re-create into a set for O(1)
+ # the direct approach would just be O(log n) for searching with no
+ # extra memory overhead. For now, I'll keep the set cast
+ # Note that the member.roles accessor up top also creates a
+ # temporary list
+ member_role_ids = {r.id for r in roles}
denies = 0
allows = 0