Allowed commands to work in the help command if no description exists
This commit is contained in:
parent
1447fea33b
commit
6f74bdac62
1 changed files with 10 additions and 5 deletions
15
cogs/core.py
15
cogs/core.py
|
@ -167,17 +167,22 @@ class Core:
|
||||||
else:
|
else:
|
||||||
# Get the description for a command
|
# Get the description for a command
|
||||||
description = cmd.help
|
description = cmd.help
|
||||||
# Split into examples, results, and the description itself based on the string
|
if description is not None:
|
||||||
example = [x.replace('EXAMPLE: ', '') for x in description.split('\n') if 'EXAMPLE:' in x]
|
# Split into examples, results, and the description itself based on the string
|
||||||
result = [x.replace('RESULT: ', '') for x in description.split('\n') if 'RESULT:' in x]
|
example = [x.replace('EXAMPLE: ', '') for x in description.split('\n') if 'EXAMPLE:' in x]
|
||||||
description = [x for x in description.split('\n') if x and 'EXAMPLE:' not in x and 'RESULT:' not 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
|
# 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]
|
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
|
# 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 = discord.Embed(title=cmd.qualified_name)
|
||||||
embed.set_thumbnail(url=self.bot.user.avatar_url)
|
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:
|
if example:
|
||||||
embed.add_field(name="Example", value="\n".join(example), inline=False)
|
embed.add_field(name="Example", value="\n".join(example), inline=False)
|
||||||
if result:
|
if result:
|
||||||
|
|
Loading…
Reference in a new issue