mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-06-07 12:18:59 +00:00
Change Webhook.avatar to be consistent with User.avatar
This commit is contained in:
parent
19ad64adda
commit
40dc8d1d9d
@ -895,16 +895,35 @@ class BaseWebhook(Hashable):
|
||||
return utils.snowflake_time(self.id)
|
||||
|
||||
@property
|
||||
def avatar(self) -> Asset:
|
||||
""":class:`Asset`: Returns an :class:`Asset` for the avatar the webhook has.
|
||||
def avatar(self) -> Optional[Asset]:
|
||||
"""Optional[:class:`Asset`]: Returns an :class:`Asset` for the avatar the webhook has.
|
||||
|
||||
If the webhook does not have a traditional avatar, an asset for
|
||||
the default avatar is returned instead.
|
||||
If the webhook does not have a traditional avatar, ``None`` is returned.
|
||||
If you want the avatar that a webhook has displayed, consider :attr:`display_avatar`.
|
||||
"""
|
||||
if self._avatar is not None:
|
||||
return Asset._from_avatar(self._state, self.id, self._avatar)
|
||||
return None
|
||||
|
||||
@property
|
||||
def default_avatar(self) -> Asset:
|
||||
"""
|
||||
:class:`Asset`: Returns the default avatar. This is always the blurple avatar.
|
||||
|
||||
.. versionadded:: 2.0
|
||||
"""
|
||||
if self._avatar is None:
|
||||
# Default is always blurple apparently
|
||||
return Asset._from_default_avatar(self._state, 0)
|
||||
return Asset._from_avatar(self._state, self.id, self._avatar)
|
||||
|
||||
@property
|
||||
def display_avatar(self) -> Asset:
|
||||
""":class:`Asset`: Returns the webhook's display avatar.
|
||||
|
||||
This is either webhook's default avatar or uploaded avatar.
|
||||
|
||||
.. versionadded:: 2.0
|
||||
"""
|
||||
return self.avatar or self.default_avatar
|
||||
|
||||
|
||||
class Webhook(BaseWebhook):
|
||||
|
Loading…
x
Reference in New Issue
Block a user