[V3 Downloader] Split available and installed cogs (#1826)

This commit is contained in:
palmtree5 2018-06-08 15:58:20 -08:00 committed by Will
parent fd7088de1a
commit 94a64d8fae

View File

@ -380,11 +380,21 @@ class Downloader:
"""
Lists all available cogs from a single repo.
"""
installed = await self.installed_cogs()
installed_str = ""
if installed:
installed_str = _("Installed Cogs:\n") + "\n".join(
[
"- {}{}".format(i.name, ": {}".format(i.short) if i.short else "")
for i in installed
if i.repo_name == repo_name.name
]
)
cogs = repo_name.available_cogs
cogs = _("Available Cogs:\n") + "\n".join(
["+ {}: {}".format(c.name, c.short or "") for c in cogs]
["+ {}: {}".format(c.name, c.short or "") for c in cogs if c not in installed]
)
cogs = cogs + "\n\n" + installed_str
for page in pagify(cogs, ["\n"], shorten_by=16):
await ctx.send(box(page.lstrip(" "), lang="diff"))