Red-DiscordBot icon indicating copy to clipboard operation
Red-DiscordBot copied to clipboard

[Help] Optimisation on getting commands in Cog-help

Open npc203 opened this issue 4 years ago • 0 comments

Description of the changes

Now this PR might be nitpicky, but getting every command from the bot and filtering the cog commands when a cog help is requested is slower compared to using a default method (get_commands) provided by the cog.

This further saves a lot of overhead in get_bot_help_mapping which requests the get_cog_help_mapping with every loaded cog.
In short, the bot used to get every command present in the bot again and again (and then filter it) for every cog loaded to display help. Now it's faster but simply getting the commands of the cog requested.

One possible downside (though I haven't tested it) is, This prevents monkey-patched/Commands created dynamically and the cog object injected into it, to not show up in the help. Tho such are forbidden methods to make commands I assume.

npc203 avatar Oct 01 '21 08:10 npc203