From fa305cb060c95ce83bb6781ebae5008ddd2a212b Mon Sep 17 00:00:00 2001 From: Samuel <50765275+npc203@users.noreply.github.com> Date: Mon, 17 Apr 2023 02:47:10 +0530 Subject: [PATCH] [Help] Optimisation on getting commands in Cog-help (#5354) Co-authored-by: npc203 Co-authored-by: Flame442 <34169552+Flame442@users.noreply.github.com> --- redbot/core/commands/help.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/redbot/core/commands/help.py b/redbot/core/commands/help.py index ebf15ff04..ec3377849 100644 --- a/redbot/core/commands/help.py +++ b/redbot/core/commands/help.py @@ -274,7 +274,10 @@ class RedHelpFormatter(HelpFormatterABC): async def get_cog_help_mapping( 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 { com.name: com async for com in self.help_filter_func(ctx, iterator, help_settings=help_settings)