From fe3929c43c1152479cd61bcaae4e1c1982c7c1cc Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Sat, 12 Feb 2022 13:15:07 -0500 Subject: [PATCH] test --- sopel_SpiceBot_Core_Prerun/__init__.py | 41 ++----------------- .../__init__.py | 4 +- sopel_SpiceBot_Runtime_Commands/__init__.py | 8 ++-- .../__init__.py | 10 ++--- 4 files changed, 14 insertions(+), 49 deletions(-) diff --git a/sopel_SpiceBot_Core_Prerun/__init__.py b/sopel_SpiceBot_Core_Prerun/__init__.py index df0e647..c8132de 100644 --- a/sopel_SpiceBot_Core_Prerun/__init__.py +++ b/sopel_SpiceBot_Core_Prerun/__init__.py @@ -6,9 +6,6 @@ from sopel_SpiceBot_Core_1 import sb def get_commands(bot, trigger): commands = [] - # bot.say(str(sb.config.prefix_list)) - # bot.nick - # Get && split for multiple commands if "&&" in trigger.args[1]: triggers = [x.strip() for x in trigger.args[1].split("&&")] @@ -62,49 +59,17 @@ def get_commands(bot, trigger): "trigger_str": trigger_str }) - bot.say(str(commands)) - - return + return commands -def prerun_command(): +def prerun(): def actual_decorator(function): @functools.wraps(function) def internal_prerun(bot, trigger, *args, **kwargs): - get_commands(bot, trigger) - - function(bot, trigger, *args, **kwargs) - - return internal_prerun - return actual_decorator - - -def prerun_nickname_command(): - - def actual_decorator(function): - - @functools.wraps(function) - def internal_prerun(bot, trigger, *args, **kwargs): - - get_commands(bot, trigger) - - function(bot, trigger, *args, **kwargs) - - return internal_prerun - return actual_decorator - - -def prerun_action_command(): - - def actual_decorator(function): - - @functools.wraps(function) - def internal_prerun(bot, trigger, *args, **kwargs): - - get_commands(bot, trigger) + commands = get_commands(bot, trigger) function(bot, trigger, *args, **kwargs) diff --git a/sopel_SpiceBot_Runtime_Action_Commands/__init__.py b/sopel_SpiceBot_Runtime_Action_Commands/__init__.py index 51ec093..e0db123 100644 --- a/sopel_SpiceBot_Runtime_Action_Commands/__init__.py +++ b/sopel_SpiceBot_Runtime_Action_Commands/__init__.py @@ -4,10 +4,10 @@ from sopel import plugin from sopel_SpiceBot_Core_1 import sb -from sopel_SpiceBot_Core_Prerun import prerun_action_command +from sopel_SpiceBot_Core_Prerun import prerun -@prerun_action_command() +@prerun() @plugin.action_command('test') def sb_test_commands(bot, trigger): bot.say("%s" % trigger.raw) diff --git a/sopel_SpiceBot_Runtime_Commands/__init__.py b/sopel_SpiceBot_Runtime_Commands/__init__.py index 9503ce0..eccdea5 100644 --- a/sopel_SpiceBot_Runtime_Commands/__init__.py +++ b/sopel_SpiceBot_Runtime_Commands/__init__.py @@ -4,10 +4,10 @@ from sopel import plugin from sopel_SpiceBot_Core_1 import sb -from sopel_SpiceBot_Core_Prerun import prerun_command +from sopel_SpiceBot_Core_Prerun import prerun -@prerun_command() +@prerun() @plugin.command('test') def commands_test(bot, trigger): bot.say("%s" % trigger.raw) @@ -15,7 +15,7 @@ def commands_test(bot, trigger): bot.say("%s" % trigger.args[1]) -@prerun_command() +@prerun() @plugin.command('testa') def commands_test_a(bot, trigger): bot.say("test a") @@ -25,7 +25,7 @@ def commands_test_a(bot, trigger): bot.say("test a: %s" % trigger.raw) -@prerun_command() +@prerun() @plugin.command('testb') def commands_test_b(bot, trigger): diff --git a/sopel_SpiceBot_Runtime_Nickname_Commands/__init__.py b/sopel_SpiceBot_Runtime_Nickname_Commands/__init__.py index 98be7f6..4ed5bc9 100644 --- a/sopel_SpiceBot_Runtime_Nickname_Commands/__init__.py +++ b/sopel_SpiceBot_Runtime_Nickname_Commands/__init__.py @@ -4,10 +4,10 @@ from sopel import plugin from sopel_SpiceBot_Core_1 import sb -from sopel_SpiceBot_Core_Prerun import prerun_nickname_command +from sopel_SpiceBot_Core_Prerun import prerun -@prerun_nickname_command() +@prerun() @plugin.nickname_command('test') def sb_test_commands(bot, trigger): bot.say("%s" % trigger.raw) @@ -15,7 +15,7 @@ def sb_test_commands(bot, trigger): bot.say("%s" % trigger.args[1]) -@prerun_nickname_command() +@prerun() @plugin.nickname_command('commands') def sopel_commands(bot, trigger): @@ -24,7 +24,7 @@ def sopel_commands(bot, trigger): bot.say(str(bot.rules._rules.values())) -@prerun_nickname_command() +@prerun() @plugin.nickname_command('nickname_commands') def sopel_nickname_commands(bot, trigger): bot.say("testing nickname_commands") @@ -34,7 +34,7 @@ def sopel_nickname_commands(bot, trigger): bot.say(str(y)) -@prerun_nickname_command() +@prerun() @plugin.nickname_command('action_commands') def sopel_action_commands(bot, trigger):