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

* show repo name in findcog

* how did i manage to overcomplicate this?

* for Kreusada

* I wanted to do that... but forgot
(cherry picked from commit 1d34e9e47b)

Co-authored-by: Dav <dav@mail.stopdavabuse.de>

Co-authored-by: Dav <dav@mail.stopdavabuse.de>
This commit is contained in:
Red-GitHubBot
2021-10-16 02:12:37 +02:00
committed by GitHub
parent 33ed1085ab
commit bd010fdae5

View File

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