Skip to content

Commit 7b28e29

Browse files
authored
Merge pull request #628 from Soheab/animated_guild_banner
Add support for animated guild banners
2 parents af4a096 + 73d0728 commit 7b28e29

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

discord/asset.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,11 +209,17 @@ def _from_cover_image(cls, state, object_id: int, cover_image_hash: str) -> Asse
209209

210210
@classmethod
211211
def _from_guild_image(cls, state, guild_id: int, image: str, path: str) -> Asset:
212+
animated = False
213+
format = "png"
214+
if path == "banners":
215+
animated = image.startswith("a_")
216+
format = "gif" if animated else "png"
217+
212218
return cls(
213219
state,
214-
url=f'{cls.BASE}/{path}/{guild_id}/{image}.png?size=1024',
220+
url=f"{cls.BASE}/{path}/{guild_id}/{image}.{format}?size=1024",
215221
key=image,
216-
animated=False,
222+
animated=animated,
217223
)
218224

219225
@classmethod

0 commit comments

Comments
 (0)