mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
[Downloader] Add command to list pinned cogs (#3974)
This commit is contained in:
parent
9594284f6c
commit
35365a7154
@ -861,6 +861,31 @@ class Downloader(commands.Cog):
|
||||
message += _("\nThese cogs weren't pinned: ") + humanize_list(not_pinned)
|
||||
await self.send_pagified(ctx, message)
|
||||
|
||||
@cog.command(name="listpinned")
|
||||
async def _cog_listpinned(self, ctx: commands.Context):
|
||||
"""List currently pinned cogs."""
|
||||
installed = await self.installed_cogs()
|
||||
pinned_list = sorted([cog.name for cog in installed if cog.pinned], key=str.lower)
|
||||
if pinned_list:
|
||||
message = humanize_list(pinned_list)
|
||||
else:
|
||||
message = _("None.")
|
||||
if await ctx.embed_requested():
|
||||
embed = discord.Embed(color=(await ctx.embed_colour()))
|
||||
for page in pagify(message, delims=[", "], page_length=900):
|
||||
name = _("(continued)") if page.startswith(", ") else _("Pinned Cogs:")
|
||||
if page.startswith(", "):
|
||||
page = page[2:]
|
||||
embed.add_field(name=name, value=page, inline=False)
|
||||
await ctx.send(embed=embed)
|
||||
else:
|
||||
for page in pagify(message, delims=[", "], page_length=1900):
|
||||
if page.startswith(", "):
|
||||
page = page[2:]
|
||||
else:
|
||||
page = _("Pinned Cogs: \n") + page
|
||||
await ctx.send(box(page))
|
||||
|
||||
@cog.command(name="checkforupdates")
|
||||
async def _cog_checkforupdates(self, ctx: commands.Context) -> None:
|
||||
"""
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user