Fix jimmy converter

This commit is contained in:
Nexus 2023-05-23 17:27:58 +01:00
parent d4358db5d1
commit 7b5cd0e8c2
Signed by: nex
GPG key ID: 0FA334385D0B689F

View file

@ -1455,10 +1455,11 @@ class OtherCog(commands.Cog):
await image.save(f)
f.seek(0)
img = await self.bot.loop.run_in_executor(None, Image.open, f)
if img.format not in ("PNG", "JPEG", "WEBP", "HEIF", "BMP", "TIFF"):
if img.format.upper() not in ("PNG", "JPEG", "WEBP", "HEIF", "BMP", "TIFF"):
return await ctx.respond("Image must be PNG or JPEG")
with tempfile.TemporaryFile("wb+") as f2:
await self.bot.loop.run_in_executor(None, img.save, f2, format="GIF")
caller = partial(img.save, f2, format="GIF")
await self.bot.loop.run_in_executor(None, caller)
f2.seek(0)
try:
await ctx.respond(file=discord.File(f2, filename="image.gif"))