aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bot/exts/utils/snekbox/_cog.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/bot/exts/utils/snekbox/_cog.py b/bot/exts/utils/snekbox/_cog.py
index 63f45dd23..d448898f3 100644
--- a/bot/exts/utils/snekbox/_cog.py
+++ b/bot/exts/utils/snekbox/_cog.py
@@ -29,6 +29,7 @@ if TYPE_CHECKING:
log = get_logger(__name__)
+ANSI_REGEX = re.compile(r"\N{ESC}\[[0-9;:]*m")
ESCAPE_REGEX = re.compile("[`\u202E\u200B]{3,}")
# The timeit command should only output the very last line, so all other output should be suppressed.
@@ -281,7 +282,10 @@ class Snekbox(Cog):
output = f"{output[:max_chars]}\n... (truncated - too long)"
if truncated:
- paste_link = await self.upload_output(original_output)
+ # ANSI colors are quite nice, but don't render in pinwand,
+ # thus mangling the output
+ ansiless_output = ANSI_REGEX.sub("", original_output)
+ paste_link = await self.upload_output(ansiless_output)
if output_default and not output:
output = output_default