This commit is contained in:
deathbybandaid 2022-02-23 15:04:38 -05:00
parent 3adf05b896
commit b1f96a494d
3 changed files with 23 additions and 26 deletions

View File

@ -2,9 +2,6 @@ import functools
from sopel_SpiceBot_Core_1 import sb
from .comrun import ComRun
from .pipe_split import rebuild_pipes
def prerun(rulematch=False):
"""This decorator is the hub of handling for all SpiceBot Commands"""
@ -66,3 +63,26 @@ def prerun(rulematch=False):
return internal_prerun
return actual_decorator
def rebuild_pipes(commands):
repipe_trigger_dict = commands[0]
for trigger_dict in commands[1:]:
if trigger_dict["trigger_type"] == "command":
repipe_trigger_dict["trigger_str"] += " | %s%s %s" % (trigger_dict["trigger_prefix"], trigger_dict["trigger_command"], trigger_dict["trigger_str"])
elif trigger_dict["trigger_type"] == "nickname_command":
repipe_trigger_dict["trigger_str"] += " | %s %s %s" % (trigger_dict["trigger_prefix"], trigger_dict["trigger_command"], trigger_dict["trigger_str"])
elif trigger_dict["trigger_type"] == "action_command":
repipe_trigger_dict["trigger_str"] += " | %s %s %s" % ("/me", trigger_dict["trigger_command"], trigger_dict["trigger_str"])
return repipe_trigger_dict
class ComRun():
def __init__(self, rulematch, trigger):
self.rulematch = rulematch
self.original_trigger = trigger
self.trigger_dict = {}

View File

@ -1,8 +0,0 @@
class ComRun():
def __init__(self, rulematch, trigger):
self.rulematch = rulematch
self.original_trigger = trigger
self.trigger_dict = {}

View File

@ -1,15 +0,0 @@
def rebuild_pipes(commands):
repipe_trigger_dict = commands[0]
for trigger_dict in commands[1:]:
if trigger_dict["trigger_type"] == "command":
repipe_trigger_dict["trigger_str"] += " | %s%s %s" % (trigger_dict["trigger_prefix"], trigger_dict["trigger_command"], trigger_dict["trigger_str"])
elif trigger_dict["trigger_type"] == "nickname_command":
repipe_trigger_dict["trigger_str"] += " | %s %s %s" % (trigger_dict["trigger_prefix"], trigger_dict["trigger_command"], trigger_dict["trigger_str"])
elif trigger_dict["trigger_type"] == "action_command":
repipe_trigger_dict["trigger_str"] += " | %s %s %s" % ("/me", trigger_dict["trigger_command"], trigger_dict["trigger_str"])
return repipe_trigger_dict