Browse Source

support animated guild images

pull/10109/head
dolfies 3 years ago
parent
commit
09b6614c0e
  1. 6
      discord/asset.py

6
discord/asset.py

@ -208,11 +208,13 @@ class Asset(AssetMixin):
@classmethod @classmethod
def _from_guild_image(cls, state, guild_id: int, image: str, path: str) -> Asset: def _from_guild_image(cls, state, guild_id: int, image: str, path: str) -> Asset:
animated = image.startswith('a_')
format = 'gif' if animated else 'png'
return cls( return cls(
state, state,
url=f'{cls.BASE}/{path}/{guild_id}/{image}.png?size=1024', url=f'{cls.BASE}/{path}/{guild_id}/{image}.{format}?size=1024',
key=image, key=image,
animated=False, animated=animated,
) )
@classmethod @classmethod

Loading…
Cancel
Save