Make Guild.default_role use get_role.
Prevents some stale caching by using the new O(1) Guild.get_role.
This commit is contained in:
parent
b63f4f7032
commit
2a0766795f
@ -261,7 +261,7 @@ class Guild(Hashable):
|
|||||||
|
|
||||||
__slots__ = ('afk_timeout', 'afk_channel', '_members', '_channels', 'icon',
|
__slots__ = ('afk_timeout', 'afk_channel', '_members', '_channels', 'icon',
|
||||||
'name', 'id', 'unavailable', 'banner', 'region', '_state',
|
'name', 'id', 'unavailable', 'banner', 'region', '_state',
|
||||||
'_default_role', '_roles', '_member_count', '_large',
|
'_roles', '_member_count', '_large',
|
||||||
'owner_id', 'mfa_level', 'emojis', 'features',
|
'owner_id', 'mfa_level', 'emojis', 'features',
|
||||||
'verification_level', 'explicit_content_filter', 'splash',
|
'verification_level', 'explicit_content_filter', 'splash',
|
||||||
'_voice_states', '_system_channel_id', 'default_notifications',
|
'_voice_states', '_system_channel_id', 'default_notifications',
|
||||||
@ -617,10 +617,10 @@ class Guild(Hashable):
|
|||||||
"""
|
"""
|
||||||
return self._roles.get(role_id)
|
return self._roles.get(role_id)
|
||||||
|
|
||||||
@utils.cached_slot_property('_default_role')
|
@property
|
||||||
def default_role(self):
|
def default_role(self):
|
||||||
"""Gets the @everyone role that all members have by default."""
|
"""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
|
@property
|
||||||
def owner(self):
|
def owner(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user