From 83c94d6d7ed4b23735799746651c7269b57eada1 Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Tue, 22 Feb 2022 16:23:36 -0500 Subject: [PATCH] test --- sopel_SpiceBot_Core_Prerun/rule_match.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/sopel_SpiceBot_Core_Prerun/rule_match.py b/sopel_SpiceBot_Core_Prerun/rule_match.py index eaa1d67..4decbf2 100644 --- a/sopel_SpiceBot_Core_Prerun/rule_match.py +++ b/sopel_SpiceBot_Core_Prerun/rule_match.py @@ -1,5 +1,7 @@ import functools +from sopel_SpiceBot_Core_1 import sb + def rule_match(): """This Detects --arguments to commands.""" @@ -9,8 +11,23 @@ def rule_match(): @functools.wraps(function) def internal_command_args(bot, trigger, comrun, *args, **kwargs): - function(bot, trigger, comrun, *args, **kwargs) - bot.say(str(comrun.rulematch)) + returnfunc = True + + if comrun.rulematch: + comrun.trigger.dict["trigger_type"] + + if comrun.trigger.dict["trigger_type"] == "command": + commands_list = sb.commands.valid_sopel_commands + elif comrun.trigger.dict["trigger_type"] == "nickname_command": + commands_list = sb.commands.valid_sopel_nickname_commands + elif comrun.trigger.dict["trigger_type"] == "action_command": + commands_list = sb.commands.valid_sopel_action_commands + + if comrun.trigger.dict["trigger_command"] in commands_list: + returnfunc = False + + if returnfunc: + function(bot, trigger, comrun, *args, **kwargs) return internal_command_args return actual_decorator