Fix Jack's syntax, remove numbers & fix bad calculated cogs

This commit is contained in:
Predeactor
2021-03-29 14:10:06 +02:00
parent 1e0472ea9f
commit e1228db7fc

View File

@@ -947,7 +947,7 @@ class Downloader(commands.Cog):
"\nIt was most likely removed without using `{prefix}cog uninstall`.\n" "\nIt was most likely removed without using `{prefix}cog uninstall`.\n"
"You may need to remove those files manually if the cog is still usable." "You may need to remove those files manually if the cog is still usable."
" If so, ensure the cog has been unloaded with {command}." " If so, ensure the cog has been unloaded with {command}."
).format(command=inline(f"{ctx.clean_prefix}unload {failed_cogs[0]}")) ).format(command=inline(f"{ctx.clean_prefix}unload {failed_cogs[0]}")
) )
await self.send_pagified(ctx, message) await self.send_pagified(ctx, message)
@@ -1269,48 +1269,47 @@ class Downloader(commands.Cog):
- `<repo>` The repo to list cogs from. - `<repo>` The repo to list cogs from.
""" """
available_cogs = 0 all_installed_cogs = await self.installed_cogs()
installed = await self.installed_cogs() installed_cogs_in_repo = [
cog
for cog in all_installed_cogs
if cog.repo_name == repo.name
]
installed_str = "\n".join( installed_str = "\n".join(
[ "- {}{}".format(i.name, ": {}".format(i.short) if i.short else "")
"- {}{}".format(i.name, ": {}".format(i.short) if i.short else "") for i in installed_cogs_in_repo
for i in installed
if i.repo_name == repo.name
]
) )
if not installed_str: if not installed_str:
installed_str = _("No cogs installed.") installed_str = _("No cogs installed.")
elif len(installed) > 1: elif len(installed_cogs_in_repo) > 1:
installed_str = ( installed_str = (
_("Installed Cogs: ({installed_number})\n").format(installed_number=len(installed)) _("Installed Cogs:\n{text}").format(text=installed_str)
+ installed_str
) )
else: else:
installed_str = ( installed_str = (
_("Installed Cog: ({installed_number})\n").format(installed_number=len(installed)) _("Installed Cog:\n{text}").format(text=installed_str)
+ installed_str
) )
available_str = "\n".join( available_str = "\n".join(
[ "+ {}{}".format(cog.name, ": {}".format(cog.short) if cog.short else "")
"+ {}: {}".format(cog.name, cog.short or "") for cog in repo.available_cogs
for cog in repo.available_cogs if not (cog.hidden or cog in installed_cogs_in_repo)
if not (cog.hidden or cog in installed)
]
) )
for cog in repo.available_cogs:
if not (cog.hidden or cog in installed):
available_cogs += 1 available_cogs = sum(
not cog.hidden and cog not in installed_cogs_in_repo for cog in repo.available_cogs
)
if not available_str: if not available_str:
cogs = _("No cogs available.") cogs = _("No cogs available.")
elif available_cogs > 1: elif available_cogs > 1:
cogs = ( cogs = (
_("Available Cogs: ({available_number})\n").format(available_number=available_cogs) _("Available Cogs:\n{text}").format(text=available_str)
+ available_str
) )
else: else:
cogs = ( cogs = (
_("Available Cog: ({available_number})\n").format(available_number=available_cogs) _("Available Cog:\n{text}").format(text=available_str)
+ available_str
) )
cogs = cogs + "\n\n" + installed_str cogs = cogs + "\n\n" + installed_str
for page in pagify(cogs, ["\n"], shorten_by=16): for page in pagify(cogs, ["\n"], shorten_by=16):