Properly sort roles and discard everyone role in Member.colour.

This commit is contained in:
Rapptz 2017-06-24 20:55:47 -04:00
parent 4ee90cd6e4
commit 723e392c95

View File

@ -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