From 37acdd9254b3049412cfc89cbdab251f30f06101 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20N=C3=B8rgaard?= Date: Sun, 6 Oct 2024 14:41:42 +0100 Subject: [PATCH] handle potentially abuse eval lengths --- modules/eval.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/eval.py b/modules/eval.py index f0d36e5..0f915d6 100644 --- a/modules/eval.py +++ b/modules/eval.py @@ -106,7 +106,13 @@ async def eval( await ctx.message.add_reaction("\U00002705") if len(output) > 1000: - codeblock = await self.bot.mb_client.create_paste(files=[mystbin.File(content=output, filename="eval.py")]) + try: + codeblock = await self.bot.mb_client.create_paste( + files=[mystbin.File(content=output, filename="eval.py")] + ) + except mystbin.APIException: + await ctx.send("Your output was too long to provide in any sensible manner.") + return elif output: codeblock = formatters.to_codeblock(output, escape_md=False)