aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIo Mintz <[email protected]>2019-10-17 03:12:02 +0000
committerRapptz <[email protected]>2019-10-17 05:56:01 -0400
commit2a0766795f99f6e2b1e93c57ef2bc6aaae95d637 (patch)
treed5146d680328af889397bfcf9c27f4c743ff2a0c
parentAdd MEMBER_LIST_DISABLED to docs for Guild.features (diff)
downloaddiscord.py-2a0766795f99f6e2b1e93c57ef2bc6aaae95d637.tar.xz
discord.py-2a0766795f99f6e2b1e93c57ef2bc6aaae95d637.zip
Make Guild.default_role use get_role.
Prevents some stale caching by using the new O(1) Guild.get_role.
-rw-r--r--discord/guild.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/discord/guild.py b/discord/guild.py
index 138a046d..6948470a 100644
--- a/discord/guild.py
+++ b/discord/guild.py
@@ -261,7 +261,7 @@ class Guild(Hashable):
__slots__ = ('afk_timeout', 'afk_channel', '_members', '_channels', 'icon',
'name', 'id', 'unavailable', 'banner', 'region', '_state',
- '_default_role', '_roles', '_member_count', '_large',
+ '_roles', '_member_count', '_large',
'owner_id', 'mfa_level', 'emojis', 'features',
'verification_level', 'explicit_content_filter', 'splash',
'_voice_states', '_system_channel_id', 'default_notifications',
@@ -617,10 +617,10 @@ class Guild(Hashable):
"""
return self._roles.get(role_id)
- @utils.cached_slot_property('_default_role')
+ @property
def default_role(self):
"""Gets the @everyone role that all members have by default."""
- return utils.find(lambda r: r.is_default(), self._roles.values())
+ return self.get_role(self.id)
@property
def owner(self):