Skip to content

Commit 77b7c5a

Browse files
committed
Add avatar_decoration to more places
1 parent 7044d4d commit 77b7c5a

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

discord/abc.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,14 @@ def avatar(self) -> Optional[Asset]:
347347
"""Optional[:class:`~discord.Asset`]: Returns an Asset that represents the user's avatar, if present."""
348348
raise NotImplementedError
349349

350+
@property
351+
def avatar_decoration(self) -> Optional[Asset]:
352+
"""Optional[:class:`~discord.Asset`]: Returns an Asset that represents the user's avatar decoration, if present.
353+
354+
.. versionadded:: 2.0
355+
"""
356+
raise NotImplementedError
357+
350358
@property
351359
def default_avatar(self) -> Asset:
352360
""":class:`~discord.Asset`: Returns the default avatar for a given user. This is calculated by the user's discriminator."""

discord/member.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ class Member(discord.abc.Messageable, discord.abc.Connectable, _UserTag):
289289
created_at: datetime.datetime
290290
default_avatar: Asset
291291
avatar: Optional[Asset]
292+
avatar_decoration: Optional[Asset]
292293
dm_channel: Optional[DMChannel]
293294
create_dm: Callable[[], Awaitable[DMChannel]]
294295
mutual_guilds: List[Guild]

discord/user.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -887,12 +887,18 @@ def _update_self(self, user: Union[PartialUserPayload, Tuple[()]]) -> Optional[T
887887
if len(user) == 0 or len(user) <= 1: # Done because of typing
888888
return
889889

890-
original = (self.name, self._avatar, self.discriminator, self._public_flags)
890+
original = (self.name, self._avatar, self.discriminator, self._public_flags, self._avatar_decoration)
891891
# These keys seem to always be available
892-
modified = (user['username'], user.get('avatar'), user['discriminator'], user.get('public_flags', 0))
892+
modified = (
893+
user['username'],
894+
user.get('avatar'),
895+
user['discriminator'],
896+
user.get('public_flags', 0),
897+
user.get('avatar_decoration'),
898+
)
893899
if original != modified:
894900
to_return = User._copy(self)
895-
self.name, self._avatar, self.discriminator, self._public_flags = modified
901+
self.name, self._avatar, self.discriminator, self._public_flags, self._avatar_decoration = modified
896902
# Signal to dispatch user_update
897903
return to_return, self
898904

0 commit comments

Comments
 (0)