SpiceBot/sopel_SpiceBot_Runtime_Nickname_Commands/__init__.py
deathbybandaid a1b577ff77 test
2022-02-12 16:03:13 -05:00

85 lines
2.0 KiB
Python

import itertools
from sopel import plugin
from sopel_SpiceBot_Core_1 import sb
from sopel_SpiceBot_Core_Prerun import prerun
@prerun()
@plugin.nickname_command('test')
def sb_test_commands(bot, trigger):
bot.say("%s" % trigger.raw)
@plugin.nickname_command('command_groups')
def sb_test_command_groups(bot, trigger):
plugin_commands = itertools.chain(
bot._rules_manager.get_all_commands(),
bot._rules_manager.get_all_action_commands(),
bot._rules_manager.get_all_nick_commands(),
)
for plugin_name, commands in plugin_commands:
for command in commands.values():
bot.say(str(command.name))
return
commands = (
(command, command.get_doc(), command.get_usages())
for plugin_name, commands in plugin_commands
for command in commands.values()
)
for command, doc, usages in commands:
bot.say(str(dir(command)))
return
realcommands = dict(
(name, (doc.splitlines(), [u['text'] for u in usages]))
for command, doc, usages in commands
for name in ((command.name,) + command.aliases)
)
sb.osd(str(realcommands), trigger.sender)
# sb.osd(msgs, trigger.sender)
@prerun()
@plugin.nickname_command('commands')
def sopel_commands(bot, trigger):
bot.say("testing commands")
for x in sb.commands.sopel_commands:
bot.say(str(x))
for y in x:
bot.say(str(y))
@prerun()
@plugin.nickname_command('nickname_commands')
def sopel_nickname_commands(bot, trigger):
bot.say("testing nickname_commands")
for x in sb.commands.sopel_nickname_commands:
bot.say(str(x))
for y in x:
bot.say(str(y))
@prerun()
@plugin.nickname_command('action_commands')
def sopel_action_commands(bot, trigger):
bot.say("testing action_commands")
for x in sb.commands.sopel_action_commands:
bot.say(str(x))
for y in x:
bot.say(str(y))