mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 03:08:55 -05:00
[Help] Optimisation on getting commands in Cog-help (#5354)
Co-authored-by: npc203 <npc203@users.noreply.github.com> Co-authored-by: Flame442 <34169552+Flame442@users.noreply.github.com>
This commit is contained in:
parent
64c72e79b5
commit
fa305cb060
@ -274,7 +274,10 @@ class RedHelpFormatter(HelpFormatterABC):
|
|||||||
async def get_cog_help_mapping(
|
async def get_cog_help_mapping(
|
||||||
self, ctx: Context, obj: commands.Cog, help_settings: HelpSettings
|
self, ctx: Context, obj: commands.Cog, help_settings: HelpSettings
|
||||||
):
|
):
|
||||||
iterator = filter(lambda c: c.parent is None and c.cog is obj, ctx.bot.commands)
|
if obj is None:
|
||||||
|
iterator = filter(lambda c: c.parent is None and c.cog is None, ctx.bot.commands)
|
||||||
|
else:
|
||||||
|
iterator = obj.get_commands()
|
||||||
return {
|
return {
|
||||||
com.name: com
|
com.name: com
|
||||||
async for com in self.help_filter_func(ctx, iterator, help_settings=help_settings)
|
async for com in self.help_filter_func(ctx, iterator, help_settings=help_settings)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user