From 6be4065f2cbe39f9ab9ea88cbd166c77319a9f70 Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Thu, 24 Feb 2022 08:40:06 -0500 Subject: [PATCH] atest --- sopel_SpiceBot_Core_Prerun/__init__.py | 12 +++++++----- .../__init__.py | 16 ++++++++-------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/sopel_SpiceBot_Core_Prerun/__init__.py b/sopel_SpiceBot_Core_Prerun/__init__.py index a60c2fb..1d1ea73 100644 --- a/sopel_SpiceBot_Core_Prerun/__init__.py +++ b/sopel_SpiceBot_Core_Prerun/__init__.py @@ -11,6 +11,8 @@ def prerun(rulematch=False): @functools.wraps(function) def internal_prerun(bot, trigger, *args, **kwargs): + print([x for x in dir(function) if not x.startswith("__")]) + # Get list of trigger command(s) by && split commands = sb.commands.get_commands_split(trigger, "&&") @@ -19,19 +21,19 @@ def prerun(rulematch=False): # Since there was more than one command, # we are going to redispatch commands # This will give sopel the appearance of recieving individual commands - sb.osd(str(commands), trigger.sender) if len(commands) > 1: for trigger_dict in commands: - sb.osd("multi - dispatching %s %s" % (trigger_dict["trigger_command"], trigger_dict["trigger_str"]), trigger.sender) - sb.osd(str(trigger_dict), trigger.sender) - sb.commands.dispatch(trigger_dict) + if rulematch: + if not sb.commands.is_real_command(trigger_dict): + sb.commands.dispatch(trigger_dict) + else: + sb.commands.dispatch(trigger_dict) return # If the original trigger is not the same after && split # so we will now redispatch to help get the correct function passed trigger_command = sb.commands.get_command_from_trigger(trigger) if trigger_command != commands[0]["trigger_command"]: - sb.osd("command changes - dispatching %s %s" % (commands[0]["trigger_command"], commands[0]["trigger_str"]), trigger.sender) sb.commands.dispatch(commands[0]) return diff --git a/sopel_SpiceBot_Runtime_Unmatched_Commands/__init__.py b/sopel_SpiceBot_Runtime_Unmatched_Commands/__init__.py index d73135e..9d8f6f6 100644 --- a/sopel_SpiceBot_Runtime_Unmatched_Commands/__init__.py +++ b/sopel_SpiceBot_Runtime_Unmatched_Commands/__init__.py @@ -4,11 +4,11 @@ from sopel import plugin from sopel_SpiceBot_Core_Prerun import prerun -# @prerun(rulematch=True) -# @plugin.command('(.*)') -# def rule_command(bot, trigger, comrun): -# bot.say("%s" % trigger.raw) -# bot.say("now") -# bot.say(str(comrun.trigger_dict)) -# comrun.say = "nothing" -# bot.say(str(trigger.match)) +@prerun(rulematch=True) +@plugin.command('(.*)') +def rule_command(bot, trigger, comrun): + bot.say("%s" % trigger.raw) + bot.say("now") + bot.say(str(comrun.trigger_dict)) + comrun.say = "nothing" + bot.say(str(trigger.match))