mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-08 12:18:54 -05:00
Include commit hash for each cog inside [p]cog listpinned (#5563)
* Initial commit * Necessary amendments/changes * style changes (i knew id have to do this...) * Use inline() Co-authored-by: Jakub Kuczys <6032823+jack1142@users.noreply.github.com>
This commit is contained in:
parent
5522f909bd
commit
9c11e85bb4
@ -1057,26 +1057,26 @@ class Downloader(commands.Cog):
|
|||||||
async def _cog_listpinned(self, ctx: commands.Context):
|
async def _cog_listpinned(self, ctx: commands.Context):
|
||||||
"""List currently pinned cogs."""
|
"""List currently pinned cogs."""
|
||||||
installed = await self.installed_cogs()
|
installed = await self.installed_cogs()
|
||||||
pinned_list = sorted([cog.name for cog in installed if cog.pinned], key=str.lower)
|
pinned_list = sorted(
|
||||||
|
[cog for cog in installed if cog.pinned], key=lambda cog: cog.name.lower()
|
||||||
|
)
|
||||||
if pinned_list:
|
if pinned_list:
|
||||||
message = humanize_list(pinned_list)
|
message = "\n".join(
|
||||||
|
f"({inline(cog.commit[:7] or _('unknown'))}) {cog.name}" for cog in pinned_list
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
message = _("None.")
|
message = _("None.")
|
||||||
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()))
|
||||||
for page in pagify(message, delims=[", "], page_length=900):
|
for page in pagify(message, page_length=900):
|
||||||
name = _("(continued)") if page.startswith(", ") else _("Pinned Cogs:")
|
name = _("(continued)") if page.startswith("\n") else _("Pinned Cogs:")
|
||||||
if page.startswith(", "):
|
|
||||||
page = page[2:]
|
|
||||||
embed.add_field(name=name, value=page, inline=False)
|
embed.add_field(name=name, value=page, inline=False)
|
||||||
await ctx.send(embed=embed)
|
await ctx.send(embed=embed)
|
||||||
else:
|
else:
|
||||||
for page in pagify(message, delims=[", "], page_length=1900):
|
for page in pagify(message, page_length=1900):
|
||||||
if page.startswith(", "):
|
if not page.startswith("\n"):
|
||||||
page = page[2:]
|
|
||||||
else:
|
|
||||||
page = _("Pinned Cogs: \n") + page
|
page = _("Pinned Cogs: \n") + page
|
||||||
await ctx.send(box(page))
|
await ctx.send(page)
|
||||||
|
|
||||||
@cog.command(name="checkforupdates")
|
@cog.command(name="checkforupdates")
|
||||||
async def _cog_checkforupdates(self, ctx: commands.Context) -> None:
|
async def _cog_checkforupdates(self, ctx: commands.Context) -> None:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user