From 109b7f59734331f143bb0b60dc996b4ed79c38d6 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sun, 17 Dec 2023 06:19:26 +0100 Subject: [PATCH] fix what i have broken --- royalpack/commands/cat.py | 2 +- royalpack/commands/dog.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) 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()