mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-06-06 03:47:29 +00:00
Fix default_avatar for team user and webhook
This commit is contained in:
parent
a6d1dc0455
commit
0a2faa6f5d
@ -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
|
||||
|
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user