mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-22 00:34:06 +00:00
Fix Member.colour to use the new algorithm for determining colour.
This commit is contained in:
parent
9176caa355
commit
9077b4e319
@ -117,12 +117,19 @@ class Member(User):
|
||||
There is an alias for this under ``color``.
|
||||
"""
|
||||
|
||||
default_colour = Colour.default()
|
||||
# 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
|
||||
# is chosen instead
|
||||
if self.roles:
|
||||
role = max(self.roles, key=lambda r: r.position)
|
||||
return role.colour
|
||||
else:
|
||||
return Colour.default()
|
||||
roles = sorted(self.roles, key=lambda r: r.position, reverse=True)
|
||||
for role in roles:
|
||||
if role.colour == default_colour:
|
||||
continue
|
||||
else:
|
||||
return role.colour
|
||||
|
||||
return default_colour
|
||||
|
||||
color = colour
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user