From 79183846dcd13e03cd65c1da26d25106ebee046a Mon Sep 17 00:00:00 2001 From: Rapptz Date: Sat, 6 Apr 2019 19:33:31 -0400 Subject: [PATCH] Make abc.GuildChannel.overwrites return a dictionary Fix #2016 --- discord/abc.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/discord/abc.py b/discord/abc.py index 3dd4156b3..4b34e566b 100644 --- a/discord/abc.py +++ b/discord/abc.py @@ -346,16 +346,16 @@ class GuildChannel: def overwrites(self): """Returns all of the channel's overwrites. - This is returned as a list of two-element tuples containing the target, - which can be either a :class:`Role` or a :class:`Member` and the overwrite - as the second element as a :class:`PermissionOverwrite`. + This is returned as a dictionary where the key contains the target which + can be either a :class:`Role` or a :class:`Member` and the key is the + overwrite as a :class:`PermissionOverwrite`. Returns -------- - List[Tuple[Union[:class:`Role`, :class:`Member`], :class:`PermissionOverwrite`]]: + Mapping[Union[:class:`Role`, :class:`Member`], :class:`PermissionOverwrite`]: The channel's permission overwrites. """ - ret = [] + ret = {} for ow in self._overwrites: allow = Permissions(ow.allow) deny = Permissions(ow.deny) @@ -365,8 +365,7 @@ class GuildChannel: target = self.guild.get_role(ow.id) elif ow.type == 'member': target = self.guild.get_member(ow.id) - - ret.append((target, overwrite)) + ret[target] = overwrite return ret @property