From 0a2faa6f5dce2a06973d22c7193040d8127cfae7 Mon Sep 17 00:00:00 2001 From: owocado <24418520+owocado@users.noreply.github.com> Date: Thu, 29 Aug 2024 01:04:33 +0530 Subject: [PATCH] Fix default_avatar for team user and webhook --- discord/user.py | 2 +- discord/webhook/async_.py | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/discord/user.py b/discord/user.py index 5151957dc..c5391372a 100644 --- a/discord/user.py +++ b/discord/user.py @@ -171,7 +171,7 @@ class BaseUser(_UserTag): @property def default_avatar(self) -> Asset: """:class:`Asset`: Returns the default avatar for a given user.""" - if self.discriminator == '0': + if self.discriminator in ('0', '0000'): avatar_id = (self.id >> 22) % len(DefaultAvatar) else: avatar_id = int(self.discriminator) % 5 diff --git a/discord/webhook/async_.py b/discord/webhook/async_.py index 3b0416f9a..91b021a5e 100644 --- a/discord/webhook/async_.py +++ b/discord/webhook/async_.py @@ -38,7 +38,7 @@ import aiohttp from .. import utils from ..errors import HTTPException, Forbidden, NotFound, DiscordServerError from ..message import Message -from ..enums import try_enum, WebhookType, ChannelType +from ..enums import try_enum, WebhookType, ChannelType, DefaultAvatar from ..user import BaseUser, User from ..flags import MessageFlags from ..asset import Asset @@ -360,7 +360,7 @@ class AsyncWebhookAdapter: multipart: Optional[List[Dict[str, Any]]] = None, files: Optional[Sequence[File]] = None, thread_id: Optional[int] = None, - ) -> Response[Message]: + ) -> Response[MessagePayload]: route = Route( 'PATCH', '/webhooks/{webhook_id}/{webhook_token}/messages/{message_id}', @@ -1049,12 +1049,11 @@ class BaseWebhook(Hashable): @property def default_avatar(self) -> Asset: """ - :class:`Asset`: Returns the default avatar. This is always the blurple avatar. + :class:`Asset`: Returns the default avatar. .. versionadded:: 2.0 """ - # Default is always blurple apparently - return Asset._from_default_avatar(self._state, 0) + return Asset._from_default_avatar(self._state, (self.id >> 22) % len(DefaultAvatar)) @property def display_avatar(self) -> Asset: