Browse Source

Correct the documentation for methods and properties that return Assets

pull/2161/head
Vexs 6 years ago
committed by Rapptz
parent
commit
bf5b267c55
  1. 2
      discord/channel.py
  2. 12
      discord/guild.py
  3. 6
      discord/invite.py
  4. 12
      discord/user.py
  5. 12
      discord/webhook.py

2
discord/channel.py

@ -1030,7 +1030,7 @@ class GroupChannel(discord.abc.Messageable, Hashable):
@property @property
def icon_url(self): def icon_url(self):
""":class:`Asset`: Returns the channel's icon asset if available.""" """:class:`Asset`: Returns the channel's icon asset."""
return Asset._from_icon(self._state, self, 'channel') return Asset._from_icon(self._state, self, 'channel')
@property @property

12
discord/guild.py

@ -418,11 +418,11 @@ class Guild(Hashable):
@property @property
def icon_url(self): def icon_url(self):
"""Returns the URL version of the guild's icon. Returns an empty string if it has no icon.""" """:class:`Asset`: Returns the guild's icon asset."""
return self.icon_url_as() return self.icon_url_as()
def icon_url_as(self, *, format='webp', size=1024): def icon_url_as(self, *, format='webp', size=1024):
"""Returns a friendly URL version of the guild's icon. Returns an empty string if it has no icon. """Returns a :class:`Asset`: for the guild's icon.
The format must be one of 'webp', 'jpeg', 'jpg', or 'png'. The The format must be one of 'webp', 'jpeg', 'jpg', or 'png'. The
size must be a power of 2 between 16 and 4096. size must be a power of 2 between 16 and 4096.
@ -448,11 +448,11 @@ class Guild(Hashable):
@property @property
def banner_url(self): def banner_url(self):
"""Returns the URL version of the guild's banner. Returns an empty string if it has no banner.""" """:class:`Asset`: Returns the guild's banner asset."""
return self.banner_url_as() return self.banner_url_as()
def banner_url_as(self, *, format='webp', size=2048): def banner_url_as(self, *, format='webp', size=2048):
"""Returns a friendly URL version of the guild's banner. Returns an empty string if it has no banner. """Returns a :class:`Asset`: for the guild's banner.
The format must be one of 'webp', 'jpeg', or 'png'. The The format must be one of 'webp', 'jpeg', or 'png'. The
size must be a power of 2 between 16 and 4096. size must be a power of 2 between 16 and 4096.
@ -478,11 +478,11 @@ class Guild(Hashable):
@property @property
def splash_url(self): def splash_url(self):
"""Returns the URL version of the guild's invite splash. Returns an empty string if it has no splash.""" """:class:`Asset`: Returns the guild's invite splash asset."""
return self.splash_url_as() return self.splash_url_as()
def splash_url_as(self, *, format='webp', size=2048): def splash_url_as(self, *, format='webp', size=2048):
"""Returns a friendly URL version of the guild's invite splash. Returns an empty string if it has no splash. """Returns a :class:`Asset`: for the guild's invite splash.
The format must be one of 'webp', 'jpeg', 'jpg', or 'png'. The The format must be one of 'webp', 'jpeg', 'jpg', or 'png'. The
size must be a power of 2 between 16 and 4096. size must be a power of 2 between 16 and 4096.

6
discord/invite.py

@ -151,7 +151,7 @@ class PartialInviteGuild:
@property @property
def icon_url(self): def icon_url(self):
"""Returns the URL version of the guild's icon. Returns an empty string if it has no icon.""" """:class:`Asset`: Returns the guild's icon asset."""
return self.icon_url_as() return self.icon_url_as()
def icon_url_as(self, *, format='webp', size=1024): def icon_url_as(self, *, format='webp', size=1024):
@ -160,7 +160,7 @@ class PartialInviteGuild:
@property @property
def banner_url(self): def banner_url(self):
"""Returns the URL version of the guild's banner. Returns an empty string if it has no banner.""" """:class:`Asset`: Returns the guild's banner asset."""
return self.banner_url_as() return self.banner_url_as()
def banner_url_as(self, *, format='webp', size=2048): def banner_url_as(self, *, format='webp', size=2048):
@ -169,7 +169,7 @@ class PartialInviteGuild:
@property @property
def splash_url(self): def splash_url(self):
"""Returns the URL version of the guild's invite splash. Returns an empty string if it has no splash.""" """:class:`Asset`: Returns the guild's invite splash asset."""
return self.splash_url_as() return self.splash_url_as()
def splash_url_as(self, *, format='webp', size=2048): def splash_url_as(self, *, format='webp', size=2048):

12
discord/user.py

@ -114,10 +114,10 @@ class BaseUser(_BaseUser):
@property @property
def avatar_url(self): def avatar_url(self):
"""Returns a friendly URL version of the avatar the user has. """Returns a :class:`Asset`: for the avatar the user has.
If the user does not have a traditional avatar, their default If the user does not have a traditional avatar, an asset for
avatar URL is returned instead. the default avatar is returned instead.
This is equivalent to calling :meth:`avatar_url_as` with This is equivalent to calling :meth:`avatar_url_as` with
the default parameters (i.e. webp/gif detection and a size of 1024). the default parameters (i.e. webp/gif detection and a size of 1024).
@ -129,10 +129,10 @@ class BaseUser(_BaseUser):
return bool(self.avatar and self.avatar.startswith('a_')) return bool(self.avatar and self.avatar.startswith('a_'))
def avatar_url_as(self, *, format=None, static_format='webp', size=1024): def avatar_url_as(self, *, format=None, static_format='webp', size=1024):
"""Returns a friendly URL version of the avatar the user has. """Returns a :class:`Asset`: for the avatar the user has.
If the user does not have a traditional avatar, their default If the user does not have a traditional avatar, an asset for
avatar URL is returned instead. the default avatar is returned instead.
The format must be one of 'webp', 'jpeg', 'jpg', 'png' or 'gif', and The format must be one of 'webp', 'jpeg', 'jpg', 'png' or 'gif', and
'gif' is only valid for animated avatars. The size must be a power of 2 'gif' is only valid for animated avatars. The size must be a power of 2

12
discord/webhook.py

@ -523,10 +523,10 @@ class Webhook:
@property @property
def avatar_url(self): def avatar_url(self):
"""Returns a friendly URL version of the avatar the webhook has. """Returns a :class:`Asset`: for the avatar the webhook has.
If the webhook does not have a traditional avatar, their default If the webhook does not have a traditional avatar, an asset for
avatar URL is returned instead. the default avatar is returned instead.
This is equivalent to calling :meth:`avatar_url_as` with the This is equivalent to calling :meth:`avatar_url_as` with the
default parameters. default parameters.
@ -534,10 +534,10 @@ class Webhook:
return self.avatar_url_as() return self.avatar_url_as()
def avatar_url_as(self, *, format=None, size=1024): def avatar_url_as(self, *, format=None, size=1024):
"""Returns a friendly URL version of the avatar the webhook has. """Returns a :class:`Asset`: for the avatar the webhook has.
If the webhook does not have a traditional avatar, their default If the webhook does not have a traditional avatar, an asset for
avatar URL is returned instead. the default avatar is returned instead.
The format must be one of 'jpeg', 'jpg', or 'png'. The format must be one of 'jpeg', 'jpg', or 'png'.
The size must be a power of 2 between 16 and 1024. The size must be a power of 2 between 16 and 1024.

Loading…
Cancel
Save