From ec94327b15c43bde9557b729f65831c942dab59b Mon Sep 17 00:00:00 2001 From: aikaterna <20862007+aikaterna@users.noreply.github.com> Date: Sun, 11 Oct 2020 08:43:12 -0700 Subject: [PATCH] [Core] Pagify cog unload output properly (#4469) * [Core] Pagify cog unload output properly When you unload a large amount of cogs (close to message limit on characters), the character count is easily pushed over 2k characters on the command response with the cog names each being wrapped in 2x backticks. The current implementation breaks in the middle of cog names or wherever else it feels like it. 1600 might have been a safe value for splitting but at 1500 I don't see how multiple short cog names could make it break at least. * Address review --- redbot/core/core_commands.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/redbot/core/core_commands.py b/redbot/core/core_commands.py index bb263ac24..8064f29a7 100644 --- a/redbot/core/core_commands.py +++ b/redbot/core/core_commands.py @@ -1386,7 +1386,11 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic): if output: total_message = "\n\n".join(output) - for page in pagify(total_message): + for page in pagify( + total_message, delims=["\n", ", "], priority=True, page_length=1500 + ): + if page.startswith(", "): + page = page[2:] await ctx.send(page) @commands.command()