try with tmpfile
@@ -3,6 +3,7 @@ from bs4 import BeautifulSoup as bs
import util.mosaic as mosaic
import concurrent.futures
import functools
+import tempfile
import aiohttp
import discord
import random
@@ -75,7 +76,9 @@ class Minecraft(commands.Cog):
mosaic_gen_partial = functools.partial(mosaic.generate, await img.read(use_cached=True), 1600)
_, img_bytes = await self.bot.loop.run_in_executor(pool, mosaic_gen_partial)
- await ctx.send(file=discord.File(img_bytes))
+ with tempfile.SpooledTemporaryFile() as tmp:
+ tmp.write(img_bytes)
+ await ctx.send(file=discord.File(tmp))
@commands.command(name='mcping', aliases=['mcstatus'])
