Currently, our bot seems to be able to display the generated image on Discord as can be seen:

However, on the background I save each image in memory first and then send to the Discord.
images = re.search('\[(.*)\]', req.content.decode("utf-8") ).group(0)
encodings = [e.replace("\\n", "") for e in re.findall('"([^"]*)"', images)]
for encoded in encodings:
with open("image.png", "wb") as fh:
fh.write(b64decode(encoded)) # get rid of this
await message.channel.send(file = discord.File("image.png"))
This approach is not favorable given the fact that it requires lots of I/O operations.
Sometimes it's not able to display the image and sends a meaningless file whose size is 0 KB.
Currently, our bot seems to be able to display the generated image on Discord as can be seen:
However, on the background I save each image in memory first and then send to the Discord.
This approach is not favorable given the fact that it requires lots of I/O operations.
Sometimes it's not able to display the image and sends a meaningless file whose size is 0 KB.