diff --git a/sopel_SpiceBot_Core_Prerun/rule_match.py b/sopel_SpiceBot_Core_Prerun/rule_match.py index 3d1289a..4fd987a 100644 --- a/sopel_SpiceBot_Core_Prerun/rule_match.py +++ b/sopel_SpiceBot_Core_Prerun/rule_match.py @@ -13,17 +13,33 @@ def rule_match(): returnfunc = True + # Applies to non-command rule matching if comrun.rulematch: + first_full_trigger_str = trigger.args[1] + if comrun.trigger_dict["trigger_type"] == "command": commands_list = sb.commands.valid_sopel_commands + first_trigger_noprefix = first_full_trigger_str[1:] + first_trigger_command = first_trigger_noprefix.split(" ")[0] + elif comrun.trigger_dict["trigger_type"] == "nickname_command": commands_list = sb.commands.valid_sopel_nickname_commands + first_trigger_noprefix = " ".join(first_full_trigger_str.split(" ")[1:]) + first_trigger_command = first_trigger_noprefix.split(" ")[0] + elif comrun.trigger_dict["trigger_type"] == "action_command": commands_list = sb.commands.valid_sopel_action_commands + first_trigger_noprefix = first_full_trigger_str + first_trigger_command = first_trigger_noprefix.split(" ")[0] + # Ignore if the command was caught + # handle if the command was triggered with && or | too close to the command if comrun.trigger_dict["trigger_command"] in commands_list: - returnfunc = False + if first_trigger_command != comrun.trigger_dict["trigger_command"]: + sb.commands.dispatch(comrun.trigger_dict) + else: + returnfunc = False if returnfunc: function(bot, trigger, comrun, *args, **kwargs)