Browse Source

Add Member.display_icon to get the rendered member icon

pull/7903/head
Rapptz 3 years ago
parent
commit
2b3cc8fe10
  1. 16
      discord/member.py

16
discord/member.py

@ -548,6 +548,22 @@ class Member(discord.abc.Messageable, _UserTag):
result.sort()
return result
@property
def display_icon(self) -> Optional[Union[str, Asset]]:
"""Optional[Union[:class:`str`, :class:`Asset`]]: A property that returns the role icon that is rendered for
this member. If no icon is shown then ``None`` is returned.
.. versionadded:: 2.0
"""
roles = self.roles[1:] # remove @everyone
for role in reversed(roles):
icon = role.display_icon
if icon:
return icon
return None
@property
def mention(self) -> str:
""":class:`str`: Returns a string that allows you to mention the member."""

Loading…
Cancel
Save