test new prerun class

This commit is contained in:
deathbybandaid 2019-05-23 08:52:16 -04:00
parent 820d0ef3a3
commit 0f62718ae0
2 changed files with 32 additions and 0 deletions

View File

@ -0,0 +1,31 @@
# coding=utf8
from __future__ import unicode_literals, absolute_import, division, print_function
"""
This is the SpiceBot Prerun system.
"""
import functools
import spicemanip
class BotPrerun():
def __init__(self):
self.dict = {}
def args(level, message=None, reply=False):
def actual_decorator(function):
@functools.wraps(function)
def argsbuilder(bot, trigger, *args, **kwargs):
triggerargs = spicemanip.main(trigger.args[1], 'create')
if triggerargs[0].lower() == bot.nick.lower():
trigger.command = spicemanip.main(triggerargs, 2).lower()
trigger.arglist = spicemanip.main(triggerargs, '3+', 'list')
else:
trigger.command = spicemanip.main(triggerargs, 1).lower()[1:]
trigger.arglist = spicemanip.main(triggerargs, '2+', 'list')
return function(bot, trigger, *args, **kwargs)
return argsbuilder
return actual_decorator
prerun = BotPrerun()

View File

@ -12,6 +12,7 @@ from .Commands import *
from .Events import *
from .Channels import *
from .Database import *
from .Prerun import *
__author__ = 'Sam Zick'
__email__ = 'sam@deathbybandaid.net'