mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-05-10 15:59:50 +00:00
Properly sort roles and discard everyone role in Member.colour.
This commit is contained in:
parent
4ee90cd6e4
commit
723e392c95
@ -238,11 +238,13 @@ class Member(discord.abc.Messageable, _BaseUser):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
default_colour = Colour.default()
|
default_colour = Colour.default()
|
||||||
|
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 self.roles:
|
if roles:
|
||||||
roles = sorted(self.roles, key=lambda r: r.position, reverse=True)
|
roles = sorted(roles, reverse=True)
|
||||||
for role in roles:
|
for role in roles:
|
||||||
if role.colour == default_colour:
|
if role.colour == default_colour:
|
||||||
continue
|
continue
|
||||||
|
Loading…
x
Reference in New Issue
Block a user