@@ -23,23 +23,19 @@ def __init__(self, bot):
2323
2424 def format_cog_help (self , ctx , cog ):
2525 """Formats the text for a cog help"""
26- sigs = []
26+ maxlen = 0
2727 prefix = self .bot .prefix
28-
2928 for cmd in self .bot .commands :
3029 if cmd .hidden :
3130 continue
3231 if cmd .instance is cog :
33- sigs .append (len (cmd .qualified_name ) + len (prefix ))
34- if hasattr (cmd , 'all_commands' ):
35- for c in cmd .all_commands .values ():
36- sigs .append (len ('\u200b └─ ' + c .name ) + 1 )
32+ len_ = len (cmd .qualified_name ) + len (prefix )
33+ if len_ > maxlen :
34+ maxlen = len_
3735
38- if not sigs :
36+ if maxlen == 0 :
3937 return
4038
41- maxlen = max (sigs )
42-
4339 fmt = ['' ]
4440 index = 0
4541 for cmd in self .bot .commands :
@@ -51,17 +47,6 @@ def format_cog_help(self, ctx, cog):
5147 fmt .append ('' )
5248 fmt [index ] += f'`{ prefix + cmd .qualified_name :<{maxlen }} ` - '
5349 fmt [index ] += f'{ cmd .short_doc :<{maxlen }} \n '
54- if hasattr (cmd , 'commands' ):
55- for i , c in enumerate (cmd .commands ):
56- if len (cmd .commands ) == i + 1 : # last
57- branch = '\u200b └─ ' + c .name
58- else :
59- branch = '\u200b ├─ ' + c .name
60- if len (fmt [index ] + f"`{ branch :<{maxlen + 1 }} ` - " + f"{ c .short_doc :<{maxlen }} \n " ) > 1024 :
61- index += 1
62- fmt .append ('' )
63- fmt [index ] += f"`{ branch :<{maxlen + 1 }} ` - "
64- fmt [index ] += f"{ c .short_doc :<{maxlen }} \n "
6550
6651 em = discord .Embed (
6752 description = '*' + inspect .getdoc (cog ) + '*' ,
@@ -75,7 +60,7 @@ def format_cog_help(self, ctx, cog):
7560 else :
7661 em .add_field (name = u'\u200b ' , value = i )
7762
78- em .set_footer (text = f'Type { prefix } command for more info on a command.' )
63+ em .set_footer (text = f'Type " { prefix } command" for more info on a command.' )
7964 return em
8065
8166 def format_command_help (self , ctx , cmd ):
@@ -106,7 +91,7 @@ def format_command_help(self, ctx, cmd):
10691 fmt += f"{ c .short_doc :<{maxlen }} \n "
10792
10893 em .add_field (name = 'Subcommands' , value = fmt )
109- em .set_footer (text = f'Type { prefix } help { cmd } command for more info on a command.' )
94+ em .set_footer (text = f'Type " { prefix } help { cmd } " command for more info on a command.' )
11095
11196 return em
11297
@@ -115,7 +100,7 @@ def format_not_found(self, ctx, command):
115100 em = discord .Embed ()
116101 em .title = 'Could not find a cog or command by that name.'
117102 em .color = discord .Color .red ()
118- em .set_footer (text = f'Type { prefix } help to get a full list of commands.' )
103+ em .set_footer (text = f'Type " { prefix } help" to get a full list of commands.' )
119104 cogs = get_close_matches (command , self .bot .cogs .keys ())
120105 cmds = get_close_matches (command , self .bot .all_commands .keys ())
121106 if cogs or cmds :
@@ -127,11 +112,10 @@ def format_not_found(self, ctx, command):
127112 return em
128113
129114 @commands .command ()
115+ @trigger_typing
130116 async def help (self , ctx , * , command : str = None ):
131117 """Shows the help message."""
132118
133- await ctx .trigger_typing ()
134-
135119 if command is not None :
136120 cog = self .bot .cogs .get (command )
137121 cmd = self .bot .get_command (command )
0 commit comments