3939
4040
4141class ModmailHelpCommand (commands .HelpCommand ):
42- async def format_cog_help (self , cog ):
42+ async def format_cog_help (self , cog , * , no_cog = False ):
4343 bot = self .context .bot
4444 prefix = self .clean_prefix
4545
4646 formats = ["" ]
4747 for cmd in await self .filter_commands (
48- cog .get_commands (), sort = True , key = get_perm_level
48+ cog .get_commands () if not no_cog else cog , sort = True , key = get_perm_level
4949 ):
5050 perm_level = get_perm_level (cmd )
5151 if perm_level is PermissionLevel .INVALID :
@@ -63,16 +63,19 @@ async def format_cog_help(self, cog):
6363
6464 embeds = []
6565 for format_ in formats :
66+ description = cog .description or "No description." \
67+ if not no_cog else "Miscellaneous commands without a category."
6668 embed = Embed (
67- description = f'*{ cog . description or "No description." } *' ,
69+ description = f'*{ description } *' ,
6870 color = bot .main_color ,
6971 )
7072
7173 embed .add_field (name = "Commands" , value = format_ or "No commands." )
7274
7375 continued = " (Continued)" if embeds else ""
76+ name = cog .qualified_name + " - Help" if not no_cog else "Miscellaneous Commands"
7477 embed .set_author (
75- name = cog . qualified_name + " - Help" + continued ,
78+ name = name + continued ,
7679 icon_url = bot .user .avatar_url ,
7780 )
7881
@@ -88,9 +91,8 @@ def process_help_msg(self, help_: str):
8891
8992 async def send_bot_help (self , mapping ):
9093 embeds = []
91- # TODO: Implement for no cog commands
92-
93- cogs = list (filter (None , mapping ))
94+ no_cog_commands = sorted (mapping .pop (None ), key = lambda c : c .qualified_name )
95+ cogs = sorted (mapping , key = lambda c : c .qualified_name )
9496
9597 bot = self .context .bot
9698
@@ -105,6 +107,8 @@ async def send_bot_help(self, mapping):
105107
106108 for cog in default_cogs :
107109 embeds .extend (await self .format_cog_help (cog ))
110+ if no_cog_commands :
111+ embeds .extend (await self .format_cog_help (no_cog_commands , no_cog = True ))
108112
109113 p_session = PaginatorSession (
110114 self .context , * embeds , destination = self .get_destination ()
0 commit comments