Add support for animated guild banners

https://github.com/discord/discord-api-docs/pull/3948
This commit is contained in:
Maya
2022-02-19 14:28:36 +13:00
committed by GitHub
parent 338c960c5f
commit 0b77b52da2
2 changed files with 5 additions and 2 deletions

View File

@ -208,11 +208,13 @@ class Asset(AssetMixin):
@classmethod
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(
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,
animated=False,
animated=animated,
)
@classmethod