Skip to content
This repository has been archived by the owner on Mar 13, 2023. It is now read-only.

fix: body-length can't be exceeded anymore #744

Merged
merged 2 commits into from
Jan 5, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions naff/ext/debug_extension/debug_exec.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,9 @@ async def debug_exec(self, ctx: InteractionContext) -> Optional[Message]:
return await self.handle_exec_result(m_ctx, ret, stdout.getvalue(), body)

async def handle_exec_result(self, ctx: ModalContext, result: Any, value: Any, body: str) -> Optional[Message]:
if len(body) <= 2000:
await ctx.send(f"```py\n{body}```")
# body can be of length 2000 and exceed the limit after formatting
if len(cmd_body := f"```py\n{body}```") <= 2000:
await ctx.send(cmd_body)

else:
paginator = Paginator.create_from_string(self.bot, body, prefix="```py", suffix="```", page_size=4000)
Expand Down