Skip to content

Commit af62d84

Browse files
committed
Merge from "master" and removed fieldinator(?) from help
2 parents ae7abcb + fa2925b commit af62d84

File tree

2 files changed

+20
-42
lines changed

2 files changed

+20
-42
lines changed

cogs/utility.py

Lines changed: 16 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -27,47 +27,29 @@ def __init__(self, bot):
2727

2828
def format_cog_help(self, ctx, cog):
2929
"""Formats the text for a cog help"""
30-
sigs = []
30+
31+
maxlen = 0
3132
prefix = self.bot.prefix
3233

3334
for cmd in self.bot.commands:
3435
if cmd.hidden:
3536
continue
3637
if cmd.instance is cog:
37-
sigs.append(len(cmd.qualified_name) + len(prefix))
38-
if hasattr(cmd, 'all_commands'):
39-
for c in cmd.all_commands.values():
40-
sigs.append(len('\u200b └─ ' + c.name) + 1)
38+
len_ = len(cmd.qualified_name) + len(prefix)
39+
if len_ > maxlen:
40+
maxlen = len_
4141

42-
if not sigs:
42+
if maxlen == 0:
4343
return
4444

45-
maxlen = max(sigs)
46-
47-
fmt = ['']
48-
index = 0
45+
fmt = ''
4946
for cmd in self.bot.commands:
5047
if cmd.instance is cog:
5148
if cmd.hidden:
5249
continue
53-
if len(f'{fmt[index]}`{prefix+cmd.qualified_name:<{maxlen}}` '
54-
f'- {cmd.short_doc:<{maxlen}}\n') > 1024:
55-
index += 1
56-
fmt.append('')
57-
fmt[index] += f'`{prefix+cmd.qualified_name:<{maxlen}}` - '
58-
fmt[index] += f'{cmd.short_doc:<{maxlen}}\n'
59-
if hasattr(cmd, 'commands'):
60-
for i, c in enumerate(cmd.commands):
61-
if len(cmd.commands) == i + 1: # last
62-
branch = '\u200b └─ ' + c.name
63-
else:
64-
branch = '\u200b ├─ ' + c.name
65-
if len(f'{fmt[index]}`{branch:<{maxlen+1}}` - '
66-
f'{c.short_doc:<{maxlen}}\n') > 1024:
67-
index += 1
68-
fmt.append('')
69-
fmt[index] += f'`{branch:<{maxlen+1}}` - '
70-
fmt[index] += f'{c.short_doc:<{maxlen}}\n'
50+
51+
fmt += f'`{prefix+cmd.qualified_name:<{maxlen}}` - '
52+
fmt += f'{cmd.short_doc:<{maxlen}}\n'
7153

7254
em = Embed(
7355
description='*' + inspect.getdoc(cog) + '*',
@@ -76,13 +58,10 @@ def format_cog_help(self, ctx, cog):
7658
em.set_author(name=cog.__class__.__name__ + ' - Help',
7759
icon_url=ctx.bot.user.avatar_url)
7860

79-
for n, i in enumerate(fmt):
80-
if n == 0:
81-
em.add_field(name='Commands', value=i)
82-
else:
83-
em.add_field(name=u'\u200b', value=i)
61+
em.add_field(name='Commands', value=fmt)
8462

85-
em.set_footer(text=f'Type {prefix}command for more info on a command.')
63+
em.set_footer(text=f'Type "{prefix}command" '
64+
'for more info on a command.')
8665
return em
8766

8867
def format_command_help(self, ctx, cmd):
@@ -115,7 +94,7 @@ def format_command_help(self, ctx, cmd):
11594

11695
em.add_field(name='Sub-commands', value=fmt)
11796
em.set_footer(
118-
text=f'Type {prefix}help {cmd} command for more info on a command.'
97+
text=f'Type "{prefix}help {cmd}" for more info on a command.'
11998
)
12099
return em
121100

@@ -125,7 +104,7 @@ def format_not_found(self, ctx, command):
125104
title='Could not find a cog or command by that name.',
126105
color=Color.red()
127106
)
128-
em.set_footer(text=f'Type {prefix}help to get '
107+
em.set_footer(text=f'Type "{prefix}help" to get '
129108
'a full list of commands.')
130109
cogs = get_close_matches(command, self.bot.cogs.keys())
131110
cmds = get_close_matches(command, self.bot.all_commands.keys())
@@ -140,11 +119,10 @@ def format_not_found(self, ctx, command):
140119
return em
141120

142121
@commands.command()
122+
@trigger_typing
143123
async def help(self, ctx, *, command: str = None):
144124
"""Shows the help message."""
145125

146-
await ctx.trigger_typing()
147-
148126
if command is not None:
149127
cog = self.bot.cogs.get(command)
150128
cmd = self.bot.get_command(command)

config.json.example

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"TOKEN": "XXX.XXX.XXX",
3-
"MODMAIL_API_TOKEN": "XXX.XXX.XXX",
4-
"GUILD_ID": 6969696969,
5-
"OWNERS": "comma,separated,user_ids"
2+
"TOKEN": "MyBotToken",
3+
"MODMAIL_API_TOKEN": "MyApiToken",
4+
"GUILD_ID": 1234567890,
5+
"OWNERS": "Owner1ID,Owner2ID,Owner3ID",
66
}

0 commit comments

Comments
 (0)