parent
221df0ab02
commit
62df23633a
@ -139,7 +139,8 @@ class Member(discord.abc.Messageable, _BaseUser):
|
|||||||
----------
|
----------
|
||||||
roles
|
roles
|
||||||
A list of :class:`Role` that the member belongs to. Note that the first element of this
|
A list of :class:`Role` that the member belongs to. Note that the first element of this
|
||||||
list is always the default '@everyone' role.
|
list is always the default '@everyone' role. These roles are sorted by their position
|
||||||
|
in the role hierarchy.
|
||||||
joined_at : `datetime.datetime`
|
joined_at : `datetime.datetime`
|
||||||
A datetime object that specifies the date and time in UTC that the member joined the guild for
|
A datetime object that specifies the date and time in UTC that the member joined the guild for
|
||||||
the first time.
|
the first time.
|
||||||
@ -196,8 +197,8 @@ class Member(discord.abc.Messageable, _BaseUser):
|
|||||||
if role is not None:
|
if role is not None:
|
||||||
self.roles.append(role)
|
self.roles.append(role)
|
||||||
|
|
||||||
# sort the roles by ID since they can be "randomised"
|
# sort the roles by hierarchy since they can be "randomised"
|
||||||
self.roles.sort(key=lambda r: r.id)
|
self.roles.sort()
|
||||||
|
|
||||||
def _update(self, data, user=None):
|
def _update(self, data, user=None):
|
||||||
if user:
|
if user:
|
||||||
@ -238,21 +239,15 @@ class Member(discord.abc.Messageable, _BaseUser):
|
|||||||
There is an alias for this under ``color``.
|
There is an alias for this under ``color``.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
default_colour = Colour.default()
|
|
||||||
roles = self.roles[1:] # remove @everyone
|
roles = self.roles[1:] # remove @everyone
|
||||||
|
|
||||||
# highest order of the colour is the one that gets rendered.
|
# highest order of the colour is the one that gets rendered.
|
||||||
# if the highest is the default colour then the next one with a colour
|
# if the highest is the default colour then the next one with a colour
|
||||||
# is chosen instead
|
# is chosen instead
|
||||||
if roles:
|
for role in reversed(roles):
|
||||||
roles = sorted(roles, reverse=True)
|
if role.colour.value:
|
||||||
for role in roles:
|
return role.colour
|
||||||
if role.colour == default_colour:
|
return Colour.default()
|
||||||
continue
|
|
||||||
else:
|
|
||||||
return role.colour
|
|
||||||
|
|
||||||
return default_colour
|
|
||||||
|
|
||||||
color = colour
|
color = colour
|
||||||
|
|
||||||
@ -314,11 +309,7 @@ class Member(discord.abc.Messageable, _BaseUser):
|
|||||||
This is useful for figuring where a member stands in the role
|
This is useful for figuring where a member stands in the role
|
||||||
hierarchy chain.
|
hierarchy chain.
|
||||||
"""
|
"""
|
||||||
|
return self.roles[-1]
|
||||||
if self.roles:
|
|
||||||
roles = sorted(self.roles, reverse=True)
|
|
||||||
return roles[0]
|
|
||||||
return None
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def guild_permissions(self):
|
def guild_permissions(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user