mirror of
https://github.com/SpiceBot/SpiceBot.git
synced 2026-11-13 15:09:54 -05:00
prerun without && split
This commit is contained in:
parent
af8ee26625
commit
3983666517
@ -21,6 +21,27 @@ class BotPrerun():
|
|||||||
self.dict = {}
|
self.dict = {}
|
||||||
|
|
||||||
def prerun(self, trigger_command_type='module'):
|
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):
|
def actual_decorator(function):
|
||||||
|
|
||||||
@functools.wraps(function)
|
@functools.wraps(function)
|
||||||
@ -46,14 +67,7 @@ class BotPrerun():
|
|||||||
# Run the function for all splits
|
# Run the function for all splits
|
||||||
for argsdict in argsdict_list:
|
for argsdict in argsdict_list:
|
||||||
trigger.sb = copy.deepcopy(argsdict)
|
trigger.sb = copy.deepcopy(argsdict)
|
||||||
trigger.sb["args"], trigger.sb["hyphen_arg"] = self.trigger_hyphen_args(trigger.sb["args"])
|
function(bot, trigger, *args, **kwargs)
|
||||||
|
|
||||||
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 internal_prerun
|
||||||
return actual_decorator
|
return actual_decorator
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user