From 93a245ffa515cfc9810bf61dfc3908655b40bdbb Mon Sep 17 00:00:00 2001 From: Phxntxm Date: Sat, 25 Mar 2017 20:27:10 -0500 Subject: [PATCH] Correct subcommands retrieving --- cogs/core.py | 2 +- cogs/utils/utilities.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cogs/core.py b/cogs/core.py index 420eb42..27c716f 100644 --- a/cogs/core.py +++ b/cogs/core.py @@ -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) diff --git a/cogs/utils/utilities.py b/cogs/utils/utilities.py index e50cb89..e087992 100644 --- a/cogs/utils/utilities.py +++ b/cogs/utils/utilities.py @@ -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):