From 484b2508247ad3b69091f9699c83533e4ec62611 Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Fri, 24 May 2019 10:13:47 -0400 Subject: [PATCH] no hyphenargs --- sopel_modules/SpiceBot/Prerun.py | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/sopel_modules/SpiceBot/Prerun.py b/sopel_modules/SpiceBot/Prerun.py index 3a7acf5..f164949 100644 --- a/sopel_modules/SpiceBot/Prerun.py +++ b/sopel_modules/SpiceBot/Prerun.py @@ -21,27 +21,6 @@ class BotPrerun(): self.dict = {} def prerun(self, trigger_command_type='module'): - def actual_decorator(function): - - @functools.wraps(function) - def internal_prerun(bot, trigger, *args, **kwargs): - trigger.sb = {} - # Primary command used for trigger, and a list of all words - trigger.sb["args"], trigger.sb["com"] = self.trigger_args(trigger.args[1], trigger_command_type) - trigger.sb["type"] = trigger_command_type - realcom = commands.get_realcom(trigger.sb["com"], trigger_command_type) - trigger.sb["realcom"] = realcom - 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) - return internal_prerun - return actual_decorator - - def prerun_old(self, trigger_command_type='module'): def actual_decorator(function): @functools.wraps(function) @@ -67,7 +46,10 @@ class BotPrerun(): # Run the function for all splits for argsdict in argsdict_list: trigger.sb = copy.deepcopy(argsdict) - function(bot, trigger, *args, **kwargs) + + # check if anything prohibits the nick from running the command + if self.trigger_runstatus(bot, trigger): + function(bot, trigger, *args, **kwargs) return internal_prerun return actual_decorator