Skip to content

Display the Generated Images on Discord #2

@KarahanS

Description

@KarahanS

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

s

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.

  • Find a way to send the image to Discord without saving it in local.

Sometimes it's not able to display the image and sends a meaningless file whose size is 0 KB.

  • Find out why this happens and solve it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions