mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-12-06 09:22:31 -05:00
* [3.4] 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()
(cherry picked from commit 9c11e85bb4)
Co-authored-by: Kreusada <67752638+Kreusada@users.noreply.github.com>
Co-authored-by: Jakub Kuczys <6032823+jack1142@users.noreply.github.com>
* Don't use _() inside f-strings in 3.4 as it uses older redgettext
* style
Co-authored-by: Kreusada <67752638+Kreusada@users.noreply.github.com>
Co-authored-by: Jakub Kuczys <6032823+jack1142@users.noreply.github.com>
This commit is contained in:
@@ -1056,26 +1056,27 @@ 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(
|
||||||
|
"({}) {}".format(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:
|
||||||
|
|||||||
Reference in New Issue
Block a user