[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,15 +190,19 @@ class Help(formatter.HelpFormatter):
for category, commands_ in itertools.groupby(data, key=category):
commands_ = sorted(commands_)
if len(commands_) > 0:
field = EmbedField(category, self._add_subcommands(commands_), False)
emb["fields"].append(field)
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)
else:
# Get list of commands for category
filtered = sorted(filtered)
if filtered:
for i, page in enumerate(
pagify(self._add_subcommands(filtered), page_length=1020)
pagify(self._add_subcommands(filtered), page_length=1000)
):
title = (
"**__Commands:__**"
@ -208,7 +212,6 @@ class Help(formatter.HelpFormatter):
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