Fix help breaking when removing a command without removing its cog (#6104)

This commit is contained in:
Flame442 2023-04-27 20:01:46 -04:00 committed by GitHub
parent 2abafbcc10
commit 6cef8408e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -274,10 +274,7 @@ 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
): ):
if obj is None: iterator = filter(lambda c: c.parent is None and c.cog is obj, ctx.bot.commands)
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)