Made get_all_commands available
This commit is contained in:
parent
31ed6b32fb
commit
e90bab4a84
2 changed files with 4 additions and 4 deletions
|
@ -90,7 +90,7 @@ class Core:
|
||||||
example = None
|
example = None
|
||||||
result = 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 utils.get_all_commands(cmd) if x != cmd.qualified_name]
|
subcommands = [x for x in utils.get_subcommands(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)
|
||||||
|
|
|
@ -14,17 +14,17 @@ def get_all_commands(bot):
|
||||||
# Only the command itself will be yielded if there are no children
|
# Only the command itself will be yielded if there are no children
|
||||||
for cmd_name in parent_command_names:
|
for cmd_name in parent_command_names:
|
||||||
cmd = bot.commands.get(cmd_name)
|
cmd = bot.commands.get(cmd_name)
|
||||||
for child_cmd in _get_all_commands(cmd):
|
for child_cmd in get_subcommands(cmd):
|
||||||
all_commands.append(child_cmd)
|
all_commands.append(child_cmd)
|
||||||
|
|
||||||
return all_commands
|
return all_commands
|
||||||
|
|
||||||
def get_all_commands(command):
|
def get_subcommands(command):
|
||||||
yield command.qualified_name
|
yield command.qualified_name
|
||||||
try:
|
try:
|
||||||
non_aliases = set(cmd.name for cmd in command.commands.values())
|
non_aliases = set(cmd.name for cmd in command.commands.values())
|
||||||
for cmd_name in non_aliases:
|
for cmd_name in non_aliases:
|
||||||
yield from _get_all_commands(command.commands[cmd_name])
|
yield from get_subcommands(command.commands[cmd_name])
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue