1
0
Fork 0
mirror of synced 2024-05-20 20:42:27 +12:00

Correct subcommands retrieving

This commit is contained in:
Phxntxm 2017-03-25 20:27:10 -05:00
parent 3edd9b64de
commit 93a245ffa5
2 changed files with 4 additions and 4 deletions

View file

@ -63,7 +63,7 @@ class Core:
example = None
result = None
# Also get the subcommands for this command, if they exist
subcommands = [x for x in utils.get_subcommands(cmd) if x != cmd.qualified_name]
subcommands = [x.qualified_name for x in utils.get_all_subcommands(cmd) if x.qualified_name != 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)

View file

@ -23,14 +23,14 @@ def get_all_commands(bot):
"""Returns a list of all command names for the bot"""
# First lets create a set of all the parent names
for cmd in bot.commands:
yield from _get_all_subcommands(cmd)
yield from get_all_subcommands(cmd)
def _get_all_subcommands(command):
def get_all_subcommands(command):
yield command
if type(command) is discord.ext.commands.core.Group:
for subcmd in command.commands:
yield from _get_all_subcommands(subcmd)
yield from get_all_subcommands(subcmd)
async def channel_is_nsfw(channel):