@ -161,7 +161,7 @@ class Member(discord.abc.Messageable, _BaseUser):
Nitro boost on the guild , if available . This could be ` ` None ` ` .
"""
__slots__ = ( ' _roles ' , ' _cs_roles ' , ' joined_at' , ' premium_since ' , ' _client_status ' ,
__slots__ = ( ' _roles ' , ' joined_at ' , ' premium_since ' , ' _client_status ' ,
' activities ' , ' guild ' , ' nick ' , ' _user ' , ' _state ' )
def __init__ ( self , * , data , guild , state ) :
@ -234,11 +234,6 @@ class Member(discord.abc.Messageable, _BaseUser):
self . activities = member . activities
self . _state = member . _state
try :
del self . _cs_roles
except AttributeError :
pass
# Reference will not be copied unless necessary by PRESENCE_UPDATE
# See below
self . _user = member . _user
@ -250,10 +245,6 @@ class Member(discord.abc.Messageable, _BaseUser):
def _update_roles ( self , data ) :
self . _roles = utils . SnowflakeList ( map ( int , data [ ' roles ' ] ) )
try :
del self . _cs_roles
except AttributeError :
pass
def _update ( self , data ) :
# the nickname change is optional,
@ -344,7 +335,7 @@ class Member(discord.abc.Messageable, _BaseUser):
"""
return self . colour
@utils . cached_slot_ property ( ' _cs_roles ' )
@property
def roles ( self ) :
""" List[:class:`Role`]: A :class:`list` of :class:`Role` that the member belongs to. Note
that the first element of this list is always the default ' @everyone '
@ -434,7 +425,11 @@ class Member(discord.abc.Messageable, _BaseUser):
This is useful for figuring where a member stands in the role
hierarchy chain .
"""
return self . roles [ - 1 ]
guild = self . guild
if len ( self . _roles ) == 0 :
return guild . default_role
return max ( guild . get_role ( rid ) or guild . default_role for rid in self . _roles )
@property
def guild_permissions ( self ) :