Implement icon_rl_as and cover_image_url_as for AppInfo

This commit is contained in:
SebbyLaw
2020-10-04 05:41:29 -07:00
committed by Rapptz
parent abe54f5bdc
commit 2e2560126f
4 changed files with 144 additions and 10 deletions

View File

@ -68,8 +68,39 @@ class Team:
@property
def icon_url(self):
""":class:`.Asset`: Retrieves the team's icon asset."""
return Asset._from_icon(self._state, self, 'team')
""":class:`.Asset`: Retrieves the team's icon asset.
This is equivalent to calling :meth:`icon_url_as` with
the default parameters ('webp' format and a size of 1024).
"""
return self.icon_url_as()
def icon_url_as(self, *, format='None', size=1024):
"""Returns an :class:`Asset` for the icon the team has.
The format must be one of 'webp', 'jpeg', 'jpg' or 'png'.
The size must be a power of 2 between 16 and 4096.
.. versionadded:: 2.0
Parameters
-----------
format: :class:`str`
The format to attempt to convert the icon to. Defaults to 'webp'.
size: :class:`int`
The size of the image to display.
Raises
------
InvalidArgument
Bad image format passed to ``format`` or invalid ``size``.
Returns
--------
:class:`Asset`
The resulting CDN asset.
"""
return Asset._from_icon(self._state, self, 'team', format=format, size=size)
@property
def owner(self):