diff options
| author | Alex Nørgaard <[email protected]> | 2021-07-29 00:41:43 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-07-28 19:41:43 -0400 |
| commit | b47133dfb28781495c74b3e4354ebe57cbbf0978 (patch) | |
| tree | d21fdae29d7bef3711c7da460b8d189ad50daa48 /discord/asset.py | |
| parent | Add a new view example for link buttons (diff) | |
| download | discord.py-b47133dfb28781495c74b3e4354ebe57cbbf0978.tar.xz discord.py-b47133dfb28781495c74b3e4354ebe57cbbf0978.zip | |
Add BaseUser.banner for all subclasses to access new banners
Diffstat (limited to 'discord/asset.py')
| -rw-r--r-- | discord/asset.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/discord/asset.py b/discord/asset.py index e8381189..eafff466 100644 --- a/discord/asset.py +++ b/discord/asset.py @@ -224,6 +224,17 @@ class Asset(AssetMixin): animated=False, ) + @classmethod + def _from_user_banner(cls, state, user_id: int, banner_hash: str) -> Asset: + animated = banner_hash.startswith('a_') + format = 'gif' if animated else 'png' + return cls( + state, + url=f'{cls.BASE}/banners/{user_id}/{banner_hash}.{format}?size=512', + key=banner_hash, + animated=animated + ) + def __str__(self) -> str: return self._url |