From 014e3baea0f193339d80cdad7858a9eec939dc90 Mon Sep 17 00:00:00 2001 From: Michael H Date: Sun, 27 May 2018 21:35:57 -0400 Subject: [PATCH] pagification (#1722) --- redbot/core/help_formatter.py | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/redbot/core/help_formatter.py b/redbot/core/help_formatter.py index 14602e2a6..30923293a 100644 --- a/redbot/core/help_formatter.py +++ b/redbot/core/help_formatter.py @@ -36,6 +36,7 @@ import sys import traceback from . import commands +from redbot.core.utils.chat_formatting import pagify EMPTY_STRING = u"\u200b" @@ -184,15 +185,19 @@ class Help(formatter.HelpFormatter): # Get list of commands for category filtered = sorted(filtered) if filtered: - field = EmbedField( - "**__Commands:__**" - if not self.is_bot() and self.is_cog() - else "**__Subcommands:__**", - self._add_subcommands(filtered), # May need paginated - False, - ) - - emb["fields"].append(field) + for i, page in enumerate( + pagify(self._add_subcommands(filtered), page_length=1020) + ): + title = ( + "**__Commands:__**" + if not self.is_bot() and self.is_cog() + else "**__Subcommands:__**" + ) + if i > 0: + title += " (continued)" + field = EmbedField(title, page, False) + # This will still break at 6k total chars, hope that isnt an issue later + emb["fields"].append(field) return emb