mirror of
https://github.com/SpiceBot/SpiceBot.git
synced 2026-11-13 06:59:53 -05:00
test new prerun class
This commit is contained in:
parent
820d0ef3a3
commit
0f62718ae0
31
sopel_modules/SpiceBot/Prerun.py
Normal file
31
sopel_modules/SpiceBot/Prerun.py
Normal 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()
|
||||||
@ -12,6 +12,7 @@ from .Commands import *
|
|||||||
from .Events import *
|
from .Events import *
|
||||||
from .Channels import *
|
from .Channels import *
|
||||||
from .Database import *
|
from .Database import *
|
||||||
|
from .Prerun import *
|
||||||
|
|
||||||
__author__ = 'Sam Zick'
|
__author__ = 'Sam Zick'
|
||||||
__email__ = 'sam@deathbybandaid.net'
|
__email__ = 'sam@deathbybandaid.net'
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user