diff --git a/royalpack/commands/cat.py b/royalpack/commands/cat.py index 4aea352e..da4c68ce 100644 --- a/royalpack/commands/cat.py +++ b/royalpack/commands/cat.py @@ -86,8 +86,8 @@ async def cat(*, _msg: engi.Message, **__): log.debug("Reading image bytes into memory") while img_data := await response.content.read(8192): img.write(img_data) - img.seek(0) + with path.open("rb") as img: log.debug("Sending image in the chat") await _msg.reply(files=[img]) diff --git a/royalpack/commands/dog.py b/royalpack/commands/dog.py index 0fe94350..a85cf74c 100644 --- a/royalpack/commands/dog.py +++ b/royalpack/commands/dog.py @@ -36,7 +36,8 @@ async def dog_any(*, _msg: engi.Message, **__): with path.open("wb") as img: img.write(await response.content.read()) - await _msg.reply(files=[img]) + with path.open("rb") as img: + await _msg.reply(files=[img]) path.unlink()