From 736299974cfb22f55230b17bfd9dba5361984d17 Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Sat, 12 Feb 2022 15:29:44 -0500 Subject: [PATCH] test --- .../__init__.py | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/sopel_SpiceBot_Runtime_Nickname_Commands/__init__.py b/sopel_SpiceBot_Runtime_Nickname_Commands/__init__.py index d31dcab..be1fe61 100644 --- a/sopel_SpiceBot_Runtime_Nickname_Commands/__init__.py +++ b/sopel_SpiceBot_Runtime_Nickname_Commands/__init__.py @@ -1,5 +1,5 @@ -import collections +import itertools from sopel import plugin @@ -17,13 +17,20 @@ def sb_test_commands(bot, trigger): @plugin.nickname_command('command_groups') def sb_test_command_groups(bot, trigger): - for plugin_name, cmds in collections.OrderedDict(sorted(bot.command_groups.items())).items(): - bot.say(plugin_name) - bot.say(str(cmds)) - cmds = set(cmds) # remove duplicates - bot.say(str(cmds)) - cmds = ' '.join(cmds) - bot.say(str(cmds)) + plugin_commands = itertools.chain( + bot._rules_manager.get_all_commands(), + bot._rules_manager.get_all_nick_commands(), + ) + result = {} + + for plugin_name, commands in plugin_commands: + if plugin_name not in result: + result[plugin_name] = list(sorted(commands.keys())) + else: + result[plugin_name].extend(commands.keys()) + result[plugin_name] = list(sorted(result[plugin_name])) + + bot.say(str(result)) # sb.osd(msgs, trigger.sender)