test
This commit is contained in:
parent
0935383552
commit
101dc129f9
@ -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):
|
||||
|
||||
|
||||
@ -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)
|
||||
|
||||
|
||||
16
sopel_SpiceBot_Core_Prerun/rule_match.py
Normal file
16
sopel_SpiceBot_Core_Prerun/rule_match.py
Normal 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
|
||||
@ -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)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user