1
0
Fork 0
mirror of synced 2024-06-24 01:00:29 +12:00

Added subcommands to the output of command specific commands

This commit is contained in:
Phxntxm 2016-12-19 10:52:00 -06:00
parent ae0a6d974d
commit 518671335a

View file

@ -165,11 +165,16 @@ class Core:
# The only thing we need to record about this message, is the page number, starting at 1
self.help_embeds[msg.id] = page
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]
# Also get the subcommands for this command, if they exist
subcommands = [x for x in utilities._get_all_commands(cmd) if x != cmd]
# 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=ctx.message.server.me.avatar_url)
embed.add_field(name="Description", value="\n".join(description), inline=False)
@ -177,6 +182,8 @@ class Core:
embed.add_field(name="Example", value="\n".join(example), inline=False)
if result:
embed.add_field(name="Result", value="\n".join(result), inline=False)
if _subcommands:
embed.add_field(name='Subcommands', "\n".join(subcommands), inline=False)
await self.bot.say(embed=embed)