[V3 Help] Fix formatter field pagination (#1813)

* fix prefix

* help formatter pagination fix

* index comp fix
This commit is contained in:
Michael H 2018-06-08 21:02:28 -04:00 committed by Will
parent 17c7dd658d
commit d5f5ddbec5

View File

@ -190,7 +190,11 @@ class Help(formatter.HelpFormatter):
for category, commands_ in itertools.groupby(data, key=category): for category, commands_ in itertools.groupby(data, key=category):
commands_ = sorted(commands_) commands_ = sorted(commands_)
if len(commands_) > 0: if len(commands_) > 0:
field = EmbedField(category, self._add_subcommands(commands_), False) for i, page in enumerate(
pagify(self._add_subcommands(commands_), page_length=1000)
):
title = category if i < 1 else f"{category} (continued)"
field = EmbedField(title, page, False)
emb["fields"].append(field) emb["fields"].append(field)
else: else:
@ -198,7 +202,7 @@ class Help(formatter.HelpFormatter):
filtered = sorted(filtered) filtered = sorted(filtered)
if filtered: if filtered:
for i, page in enumerate( for i, page in enumerate(
pagify(self._add_subcommands(filtered), page_length=1020) pagify(self._add_subcommands(filtered), page_length=1000)
): ):
title = ( title = (
"**__Commands:__**" "**__Commands:__**"
@ -208,7 +212,6 @@ class Help(formatter.HelpFormatter):
if i > 0: if i > 0:
title += " (continued)" title += " (continued)"
field = EmbedField(title, page, False) field = EmbedField(title, page, False)
# This will still break at 6k total chars, hope that isnt an issue later
emb["fields"].append(field) emb["fields"].append(field)
return emb return emb