aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2016-05-12 21:35:17 -0400
committerRapptz <[email protected]>2016-05-12 22:12:33 -0400
commit9077b4e319807fd2791a28c55d41cf4fcd149365 (patch)
treeb0e6570a4191a9a6616e9ca8523ae5eecb33c3a9
parentFix Channel.permissions_for to work with the new permission system. (diff)
downloaddiscord.py-9077b4e319807fd2791a28c55d41cf4fcd149365.tar.xz
discord.py-9077b4e319807fd2791a28c55d41cf4fcd149365.zip
Fix Member.colour to use the new algorithm for determining colour.
-rw-r--r--discord/member.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/discord/member.py b/discord/member.py
index af8d8210..23763728 100644
--- a/discord/member.py
+++ b/discord/member.py
@@ -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