diff options
| author | 2018-07-22 07:56:55 +0000 | |
|---|---|---|
| committer | 2018-07-22 07:56:55 +0000 | |
| commit | d31a4b6ea95ac89269a5f7ad9410d67c2c141299 (patch) | |
| tree | a49564ea8b294d1193cd4e2f174085b8cb1c3ebc | |
| parent | Remove unnecessary f-strings. (diff) | |
| parent | Paginate and sort `bot.docs.get` output. (diff) | |
Merge branch 'enhancement/paginate-and-sort-inventory-list' into 'master'
Paginate and sort `bot.docs.get` output.
See merge request python-discord/projects/bot!15
| -rw-r--r-- | bot/cogs/doc.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/bot/cogs/doc.py b/bot/cogs/doc.py index 26079e3ec..e6d108720 100644 --- a/bot/cogs/doc.py +++ b/bot/cogs/doc.py @@ -17,6 +17,7 @@ from sphinx.ext import intersphinx from bot.constants import ERROR_REPLIES, Keys, Roles, URLs from bot.converters import ValidPythonIdentifier, ValidURL from bot.decorators import with_role +from bot.pagination import LinePaginator log = logging.getLogger(__name__) @@ -371,15 +372,13 @@ class Doc: """ if symbol is None: - all_inventories = "\n".join( - f"• [`{name}`]({url})" for name, url in self.base_urls.items() - ) inventory_embed = discord.Embed( - title="All inventories", - description=all_inventories or "*Seems like there's nothing here yet.*", + title=f"All inventories (`{len(self.base_urls)}` total)", colour=discord.Colour.blue() ) - await ctx.send(embed=inventory_embed) + + lines = sorted(f"• [`{name}`]({url})" for name, url in self.base_urls.items()) + await LinePaginator.paginate(lines, ctx, inventory_embed, max_size=400, empty=False) else: # Fetching documentation for a symbol (at least for the first time, since |