diff options
Diffstat (limited to 'discord/team.py')
| -rw-r--r-- | discord/team.py | 47 |
1 files changed, 8 insertions, 39 deletions
diff --git a/discord/team.py b/discord/team.py index 3278433a..5e47770b 100644 --- a/discord/team.py +++ b/discord/team.py @@ -42,8 +42,6 @@ class Team: The team ID. name: :class:`str` The team name - icon: Optional[:class:`str`] - The icon hash, if it exists. owner_id: :class:`int` The team's owner ID. members: List[:class:`TeamMember`] @@ -52,14 +50,14 @@ class Team: .. versionadded:: 1.3 """ - __slots__ = ('_state', 'id', 'name', 'icon', 'owner_id', 'members') + __slots__ = ('_state', 'id', 'name', '_icon', 'owner_id', 'members') def __init__(self, state, data): self._state = state - self.id = utils._get_as_snowflake(data, 'id') + self.id = int(data['id']) self.name = data['name'] - self.icon = data['icon'] + self._icon = data['icon'] self.owner_id = utils._get_as_snowflake(data, 'owner_user_id') self.members = [TeamMember(self, self._state, member) for member in data['members']] @@ -67,40 +65,11 @@ class Team: return f'<{self.__class__.__name__} id={self.id} name={self.name}>' @property - def icon_url(self): - """: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='webp', 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) + def icon(self): + """Optional[:class:`.Asset`]: Retrieves the team's icon asset, if any.""" + if self._icon is None: + return None + return Asset._from_icon(self._state, self.id, self._icon, path='team') @property def owner(self): |