mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-09-05 17:36:15 +00:00
Change User.avatar to be Optional[Asset] instead of Asset
This change was needed to allow users to more easily check if an uploaded avatar was set using `if user.avatar:` rather than the admittedly clunky `if user.avatar != user.default_avatar. The old behaviour with a fallback is still useful for actual display purposes, so it has been moved over to the new `User.display_avatar` attribute. This also has symmetry with the newly added `Member.display_avatar` attribute.
This commit is contained in:
@ -275,7 +275,7 @@ class Member(discord.abc.Messageable, _UserTag):
|
||||
system: bool
|
||||
created_at: datetime.datetime
|
||||
default_avatar: Asset
|
||||
avatar: Asset
|
||||
avatar: Optional[Asset]
|
||||
dm_channel: Optional[DMChannel]
|
||||
create_dm = User.create_dm
|
||||
mutual_guilds: List[Guild]
|
||||
@ -513,7 +513,7 @@ class Member(discord.abc.Messageable, _UserTag):
|
||||
|
||||
.. versionadded:: 2.0
|
||||
"""
|
||||
return self.guild_avatar or self.avatar
|
||||
return self.guild_avatar or self._user.avatar or self._user.default_avatar
|
||||
|
||||
@property
|
||||
def guild_avatar(self) -> Optional[Asset]:
|
||||
|
Reference in New Issue
Block a user