From 58b2bd14c68a532c9ed9ea5bbb43a0bd1f40870a Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Fri, 24 May 2019 08:06:09 -0400 Subject: [PATCH] prolly wont work --- sopel_modules/SpiceBot/Prerun.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/sopel_modules/SpiceBot/Prerun.py b/sopel_modules/SpiceBot/Prerun.py index 8728a55..c240727 100644 --- a/sopel_modules/SpiceBot/Prerun.py +++ b/sopel_modules/SpiceBot/Prerun.py @@ -48,14 +48,17 @@ class BotPrerun(): # Run the function for all splits for argsdict in argsdict_list: - trigger.sb = copy.deepcopy(argsdict) - trigger.sb["args"], trigger.sb["hyphen_arg"] = self.trigger_hyphen_args(trigger.sb["args"]) - if not trigger.sb["hyphen_arg"]: - # check if anything prohibits the nick from running the command - if self.trigger_runstatus(bot, trigger): - function(bot, trigger, *args, **kwargs) - else: - self.trigger_hyphen_arg_handler(bot, trigger) + @functools.partial(function) + def internal_split(bot, trigger, *args, **kwargs): + trigger.sb = copy.deepcopy(argsdict) + trigger.sb["args"], trigger.sb["hyphen_arg"] = self.trigger_hyphen_args(trigger.sb["args"]) + if not trigger.sb["hyphen_arg"]: + # check if anything prohibits the nick from running the command + if self.trigger_runstatus(bot, trigger): + function(bot, trigger, *args, **kwargs) + else: + self.trigger_hyphen_arg_handler(bot, trigger) + internal_split(bot, trigger, *args, **kwargs) return internal_prerun return actual_decorator