Allowed commands to work in the help command if no description exists
This commit is contained in:
parent
1447fea33b
commit
6f74bdac62
15
cogs/core.py
15
cogs/core.py
|
@ -167,17 +167,22 @@ class Core:
|
|||
else:
|
||||
# Get the description for a command
|
||||
description = cmd.help
|
||||
# Split into examples, results, and the description itself based on the string
|
||||
example = [x.replace('EXAMPLE: ', '') for x in description.split('\n') if 'EXAMPLE:' in x]
|
||||
result = [x.replace('RESULT: ', '') for x in description.split('\n') if 'RESULT:' in x]
|
||||
description = [x for x in description.split('\n') if x and 'EXAMPLE:' not in x and 'RESULT:' not in x]
|
||||
if description is not None:
|
||||
# Split into examples, results, and the description itself based on the string
|
||||
example = [x.replace('EXAMPLE: ', '') for x in description.split('\n') if 'EXAMPLE:' in x]
|
||||
result = [x.replace('RESULT: ', '') for x in description.split('\n') if 'RESULT:' in x]
|
||||
description = [x for x in description.split('\n') if x and 'EXAMPLE:' not in x and 'RESULT:' not in x]
|
||||
else:
|
||||
example = None
|
||||
result = None
|
||||
# Also get the subcommands for this command, if they exist
|
||||
subcommands = [x for x in utilities._get_all_commands(cmd) if x != cmd.qualified_name]
|
||||
|
||||
# The rest is simple, create the embed, set the thumbail to me, add all fields if they exist
|
||||
embed = discord.Embed(title=cmd.qualified_name)
|
||||
embed.set_thumbnail(url=self.bot.user.avatar_url)
|
||||
embed.add_field(name="Description", value="\n".join(description), inline=False)
|
||||
if description:
|
||||
embed.add_field(name="Description", value="\n".join(description), inline=False)
|
||||
if example:
|
||||
embed.add_field(name="Example", value="\n".join(example), inline=False)
|
||||
if result:
|
||||
|
|
Loading…
Reference in a new issue