mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 03:08:55 -05:00
[Downloader] Add more information to [p]repo info, [p]cog info and [p]findcog (#3225)
* Update downloader.py * Update downloader.py * Update downloader.py * Create 3225.enhance.1.rst * Create 3225.enhance.2.rst * Create 3225.enhance.3.rst * Update downloader.py * Style fix, ready for review
This commit is contained in:
parent
75c4bee8a3
commit
de229f63fe
1
changelog.d/downloader/3225.enhance.1.rst
Normal file
1
changelog.d/downloader/3225.enhance.1.rst
Normal file
@ -0,0 +1 @@
|
|||||||
|
``[p]repo info`` will now show repo's url, branch and authors.
|
||||||
1
changelog.d/downloader/3225.enhance.2.rst
Normal file
1
changelog.d/downloader/3225.enhance.2.rst
Normal file
@ -0,0 +1 @@
|
|||||||
|
``[p]cog info`` will now show cog authors.
|
||||||
1
changelog.d/downloader/3225.enhance.3.rst
Normal file
1
changelog.d/downloader/3225.enhance.3.rst
Normal file
@ -0,0 +1 @@
|
|||||||
|
``[p]findcog`` will now show repo's branch.
|
||||||
@ -506,10 +506,20 @@ class Downloader(commands.Cog):
|
|||||||
@repo.command(name="info", usage="<repo_name>")
|
@repo.command(name="info", usage="<repo_name>")
|
||||||
async def _repo_info(self, ctx: commands.Context, repo: Repo) -> None:
|
async def _repo_info(self, ctx: commands.Context, repo: Repo) -> None:
|
||||||
"""Show information about a repo."""
|
"""Show information about a repo."""
|
||||||
msg = _("Information on {repo.name}:\n{description}").format(
|
made_by = ", ".join(repo.author) or _("Missing from info.json")
|
||||||
repo=repo, description=repo.description or ""
|
|
||||||
|
information = _("Repo url: {repo_url}\n").format(repo_url=repo.clean_url)
|
||||||
|
if repo.branch:
|
||||||
|
information += _("Branch: {branch_name}\n").format(branch_name=repo.branch)
|
||||||
|
information += _("Made by: {author}\nDescription:\n{description}").format(
|
||||||
|
author=made_by, description=repo.description or ""
|
||||||
)
|
)
|
||||||
await ctx.send(box(msg))
|
|
||||||
|
msg = _("Information on {repo_name} repo:{information}").format(
|
||||||
|
repo_name=inline(repo.name), information=box(information)
|
||||||
|
)
|
||||||
|
|
||||||
|
await ctx.send(msg)
|
||||||
|
|
||||||
@repo.command(name="update")
|
@repo.command(name="update")
|
||||||
async def _repo_update(self, ctx: commands.Context, *repos: Repo) -> None:
|
async def _repo_update(self, ctx: commands.Context, *repos: Repo) -> None:
|
||||||
@ -944,10 +954,12 @@ class Downloader(commands.Cog):
|
|||||||
return
|
return
|
||||||
|
|
||||||
msg = _(
|
msg = _(
|
||||||
"Information on {cog_name}:\n{description}\n\nRequirements: {requirements}"
|
"Information on {cog_name}:\n{description}\n\n"
|
||||||
|
"Made by: {author}\nRequirements: {requirements}"
|
||||||
).format(
|
).format(
|
||||||
cog_name=cog.name,
|
cog_name=cog.name,
|
||||||
description=cog.description or "",
|
description=cog.description or "",
|
||||||
|
author=", ".join(cog.author) or _("Missing from info.json"),
|
||||||
requirements=", ".join(cog.requirements) or "None",
|
requirements=", ".join(cog.requirements) or "None",
|
||||||
)
|
)
|
||||||
await ctx.send(box(msg))
|
await ctx.send(box(msg))
|
||||||
@ -1221,9 +1233,15 @@ class Downloader(commands.Cog):
|
|||||||
repo_url = "https://github.com/Cog-Creators/Red-DiscordBot"
|
repo_url = "https://github.com/Cog-Creators/Red-DiscordBot"
|
||||||
cog_name = cog_installable.__class__.__name__
|
cog_name = cog_installable.__class__.__name__
|
||||||
|
|
||||||
msg = _("Command: {command}\nMade by: {author}\nRepo: {repo_url}\nCog name: {cog}")
|
msg = _(
|
||||||
|
"Command: {command}\nCog name: {cog}\nMade by: {author}\nRepo: {repo_url}\n"
|
||||||
|
).format(command=command_name, author=made_by, repo_url=repo_url, cog=cog_name)
|
||||||
|
if cog_installable.repo is not None and cog_installable.repo.branch:
|
||||||
|
msg += _("Repo branch: {branch_name}\n").format(
|
||||||
|
branch_name=cog_installable.repo.branch
|
||||||
|
)
|
||||||
|
|
||||||
return msg.format(command=command_name, author=made_by, repo_url=repo_url, cog=cog_name)
|
return msg
|
||||||
|
|
||||||
def cog_name_from_instance(self, instance: object) -> str:
|
def cog_name_from_instance(self, instance: object) -> str:
|
||||||
"""Determines the cog name that Downloader knows from the cog instance.
|
"""Determines the cog name that Downloader knows from the cog instance.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user