diff options
| author | Zomatree <[email protected]> | 2020-11-23 10:09:20 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-11-23 05:09:20 -0500 |
| commit | 344cb96c5dbdae438be8d99cf8dbd65b166db93f (patch) | |
| tree | 5a4a5a854a0daffbbf81267454f0d2a24cf25125 /discord/asset.py | |
| parent | Suppress the creation of a command window from ffmpeg on Windows (diff) | |
| download | discord.py-344cb96c5dbdae438be8d99cf8dbd65b166db93f.tar.xz discord.py-344cb96c5dbdae438be8d99cf8dbd65b166db93f.zip | |
Add sticker support
Diffstat (limited to 'discord/asset.py')
| -rw-r--r-- | discord/asset.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/discord/asset.py b/discord/asset.py index f5c5eddc..bf8d8f9d 100644 --- a/discord/asset.py +++ b/discord/asset.py @@ -146,6 +146,12 @@ class Asset: return cls(state, '/icons/{0.id}/{0.icon}.{1}?size={2}'.format(guild, format, size)) + @classmethod + def _from_sticker_url(cls, state, sticker, *, size=1024): + if not utils.valid_icon_size(size): + raise InvalidArgument("size must be a power of 2 between 16 and 4096") + + return cls(state, '/stickers/{0.id}/{0.image}.png?size={2}'.format(sticker, format, size)) def __str__(self): return self.BASE + self._url if self._url is not None else '' |