fix(meme): correct error file handling for exception tracebacks 🐛
Updated the error file handling to use io.BytesIO for exception tracebacks, ensuring proper file attachment format for Discord responses. *Generated by Github Copilot*
This commit is contained in:
+3
-1
@@ -1,3 +1,4 @@
|
|||||||
|
import io
|
||||||
import os
|
import os
|
||||||
import traceback
|
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
|
# Send error details as a file attachment to bypass character limits
|
||||||
error_file = discord.File(
|
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)
|
await interaction.followup.send(embed=embed, file=error_file)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user