diff options
author | 2023-02-22 15:59:18 -0500 | |
---|---|---|
committer | 2023-02-22 15:59:18 -0500 | |
commit | 4fed4410ea9f0087f5c60c66c1291adffa7cd896 (patch) | |
tree | 8a36ae66f21c4a0a3e885c6fb69e2b379d66533a | |
parent | Fix budget lines comparison (diff) |
Update budget lines and chars for text to be shared with stdout
-rw-r--r-- | bot/exts/utils/snekbox/_cog.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/bot/exts/utils/snekbox/_cog.py b/bot/exts/utils/snekbox/_cog.py index a569541c8..f4032e4a1 100644 --- a/bot/exts/utils/snekbox/_cog.py +++ b/bot/exts/utils/snekbox/_cog.py @@ -385,8 +385,9 @@ class Snekbox(Cog): # Split text files text_files = [f for f in allowed if f.suffix in TXT_LIKE_FILES] # Inline until budget, then upload to paste service - budget_lines = MAX_OUTPUT_BLOCK_LINES - budget_chars = MAX_OUTPUT_BLOCK_CHARS + # Budget is shared with stdout, so subtract what we've already used + budget_lines = MAX_OUTPUT_BLOCK_LINES - (output.count("\n") + 1) + budget_chars = MAX_OUTPUT_BLOCK_CHARS - len(output) for file in text_files: file_text = file.content.decode("utf-8", errors="replace") or "[Empty]" # Override to always allow 1 line and <= 50 chars, since this is less than a link |