[Downloader] Show repo name in findcog (#5383)

* show repo name in findcog

* how did i manage to overcomplicate this?

* for Kreusada

* I wanted to do that... but forgot
This commit is contained in:
Dav 2021-10-16 02:10:57 +02:00 committed by GitHub
parent 9aee8ce28f
commit 1d34e9e47b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1730,15 +1730,22 @@ class Downloader(commands.Cog):
if cog_installable.repo is None if cog_installable.repo is None
else cog_installable.repo.clean_url else cog_installable.repo.clean_url
) )
repo_name = (
_("Missing from installed repos")
if cog_installable.repo is None
else cog_installable.repo.name
)
cog_name = cog_installable.name cog_name = cog_installable.name
elif cog.__module__.startswith("redbot."): # core commands or core cog elif cog.__module__.startswith("redbot."): # core commands or core cog
made_by = "Cog Creators" made_by = "Cog Creators"
repo_url = "https://github.com/Cog-Creators/Red-DiscordBot" repo_url = "https://github.com/Cog-Creators/Red-DiscordBot"
cog_name = cog.__class__.__name__ cog_name = cog.__class__.__name__
repo_name = "Red-DiscordBot"
else: # assume not installed via downloader else: # assume not installed via downloader
made_by = _("Unknown") made_by = _("Unknown")
repo_url = _("None - this cog wasn't installed via downloader") repo_url = _("None - this cog wasn't installed via downloader")
cog_name = cog.__class__.__name__ cog_name = cog.__class__.__name__
repo_name = _("Unknown")
else: else:
msg = _("This command is not provided by a cog.") msg = _("This command is not provided by a cog.")
await ctx.send(msg) await ctx.send(msg)
@ -1747,8 +1754,9 @@ class Downloader(commands.Cog):
if await ctx.embed_requested(): if await ctx.embed_requested():
embed = discord.Embed(color=(await ctx.embed_colour())) embed = discord.Embed(color=(await ctx.embed_colour()))
embed.add_field(name=_("Command:"), value=command_name, inline=False) embed.add_field(name=_("Command:"), value=command_name, inline=False)
embed.add_field(name=_("Cog Name:"), value=cog_name, inline=False) embed.add_field(name=_("Cog name:"), value=cog_name, inline=False)
embed.add_field(name=_("Made by:"), value=made_by, inline=False) embed.add_field(name=_("Made by:"), value=made_by, inline=False)
embed.add_field(name=_("Repo name:"), value=repo_name, inline=False)
embed.add_field(name=_("Repo URL:"), value=repo_url, inline=False) embed.add_field(name=_("Repo URL:"), value=repo_url, inline=False)
if installed and cog_installable.repo is not None and cog_installable.repo.branch: if installed and cog_installable.repo is not None and cog_installable.repo.branch:
embed.add_field( embed.add_field(
@ -1758,8 +1766,14 @@ class Downloader(commands.Cog):
else: else:
msg = _( msg = _(
"Command: {command}\nCog name: {cog}\nMade by: {author}\nRepo URL: {repo_url}\n" "Command: {command}\nCog name: {cog}\nMade by: {author}\nRepo name: {repo_name}\nRepo URL: {repo_url}\n"
).format(command=command_name, author=made_by, repo_url=repo_url, cog=cog_name) ).format(
command=command_name,
author=made_by,
repo_url=repo_url,
cog=cog_name,
repo_name=repo_name,
)
if installed and cog_installable.repo is not None and cog_installable.repo.branch: if installed and cog_installable.repo is not None and cog_installable.repo.branch:
msg += _("Repo branch: {branch_name}\n").format( msg += _("Repo branch: {branch_name}\n").format(
branch_name=cog_installable.repo.branch branch_name=cog_installable.repo.branch