mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-18 23:15:48 +00:00
Add Member.display_icon to get the rendered member icon
This commit is contained in:
parent
c885aa0b99
commit
2b3cc8fe10
@ -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…
x
Reference in New Issue
Block a user