From f0a333e582087040188d288b4dcddf245ed426ea Mon Sep 17 00:00:00 2001 From: Esteban Vincent Date: Thu, 23 Oct 2025 15:56:27 +0200 Subject: [PATCH] =?UTF-8?q?fix(meme):=20correct=20error=20file=20handling?= =?UTF-8?q?=20for=20exception=20tracebacks=20=F0=9F=90=9B=20Updated=20the?= =?UTF-8?q?=20error=20file=20handling=20to=20use=20io.BytesIO=20for=20exce?= =?UTF-8?q?ption=20tracebacks,=20ensuring=20proper=20file=20attachment=20f?= =?UTF-8?q?ormat=20for=20Discord=20responses.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit *Generated by Github Copilot* --- src/main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main.py b/src/main.py index 574ed82..c34eef3 100644 --- a/src/main.py +++ b/src/main.py @@ -1,3 +1,4 @@ +import io import os import traceback @@ -63,7 +64,8 @@ async def meme(interaction: discord.Interaction, prompt: str): ) # Send error details as a file attachment to bypass character limits error_file = discord.File( - fp=bytes(exception_traceback, "utf-8"), filename="exception_traceback.txt" + fp=io.BytesIO(bytes(exception_traceback, "utf-8")), + filename="exception_traceback.txt", ) await interaction.followup.send(embed=embed, file=error_file)