This commit is contained in:
deathbybandaid 2022-02-22 15:59:20 -05:00
parent 0935383552
commit 101dc129f9
4 changed files with 25 additions and 5 deletions

View File

@ -4,17 +4,19 @@ from .comrun import comrun_create
from .dispatch_multi import dispatch_multi
from .pipe_split import pipe_split
from .command_args import command_args
from .rule_match import rule_match
def prerun():
def prerun(rulematch=False):
"""This decorator is the hub of handling for all SpiceBot Commands"""
def actual_decorator(function):
@comrun_create()
@comrun_create(rulematch)
@dispatch_multi()
@pipe_split()
@command_args()
@rule_match()
@functools.wraps(function)
def internal_prerun(bot, trigger, comrun, *args, **kwargs):

View File

@ -3,8 +3,9 @@ import functools
class ComRun():
def __init__(self):
def __init__(self, rulematch):
self.piped = False
self.rulematch = rulematch
self.say = ""
self.trigger_dict = {
"trigger_type": None,
@ -16,7 +17,7 @@ class ComRun():
}
def comrun_create():
def comrun_create(rulematch):
"""This Detects --arguments to commands."""
def actual_decorator(function):
@ -25,6 +26,7 @@ def comrun_create():
def internal_comrun_create(bot, trigger, *args, **kwargs):
comrun = ComRun()
comrun.rulematch = rulematch
function(bot, trigger, comrun, *args, **kwargs)

View File

@ -0,0 +1,16 @@
import functools
def rule_match():
"""This Detects --arguments to commands."""
def actual_decorator(function):
@functools.wraps(function)
def internal_command_args(bot, trigger, comrun, *args, **kwargs):
function(bot, trigger, comrun, *args, **kwargs)
bot.say(str(comrun.rulematch))
return internal_command_args
return actual_decorator

View File

@ -4,7 +4,7 @@ from sopel import plugin
from sopel_SpiceBot_Core_Prerun import prerun
@prerun()
@prerun(rulematch=True)
@plugin.command('(.*)')
def rule_command(bot, trigger, comrun):
bot.say("%s" % trigger.raw)