1
0
Fork 0
mirror of https://github.com/uhIgnacio/EmoteManager.git synced 2024-08-15 02:23:13 +00:00

only resize in subprocess when necessary

This commit is contained in:
io 2021-07-11 02:55:22 +00:00
parent 28359eac50
commit 22466322d8

View file

@ -441,7 +441,8 @@ class Emotes(commands.Cog):
return await validate(self.http.get(url))
async def create_emote_from_bytes(self, context, name, image_data: bytes, *, reason=None):
image_data = await utils.image.resize_in_subprocess(image_data)
if len(image_data) > 256 * 1024:
image_data = await utils.image.resize_in_subprocess(image_data)
if reason is None:
reason = 'Created by ' + utils.format_user(context.author)
return await self.emote_client.create(guild=context.guild, name=name, image=image_data, reason=reason)