test
This commit is contained in:
parent
f32d710974
commit
fd73177035
@ -15,10 +15,10 @@ class SpiceBotCore_OBJ():
|
||||
self.versions = None
|
||||
self.logger = None
|
||||
|
||||
def setup(self, script_dir, bot, logger):
|
||||
def setup(self, script_dir, bot):
|
||||
self.script_dir = script_dir
|
||||
self.bot = bot
|
||||
|
||||
self.config = Config(script_dir, bot)
|
||||
self.logger = Logger(logger)
|
||||
self.logger = Logger(self.config)
|
||||
self.versions = Versions(self.config, self.logger)
|
||||
|
||||
@ -15,3 +15,11 @@ class Config():
|
||||
self.internal["paths"] = {
|
||||
"script_dir": self.script_dir
|
||||
}
|
||||
|
||||
def __getattr__(self, name):
|
||||
"""
|
||||
Quick and dirty shortcuts. Will only get called for undefined attributes.
|
||||
"""
|
||||
|
||||
if hasattr(self.bot.config, name):
|
||||
return eval("self.bot.config.%s" % name)
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
from sopel import tools
|
||||
|
||||
|
||||
class Logger():
|
||||
|
||||
def __init__(self, logger):
|
||||
self.logger = logger
|
||||
def __init__(self, config):
|
||||
self.config = config
|
||||
self.logger = tools.get_logger('SpiceBot')
|
||||
|
||||
def __getattr__(self, name):
|
||||
"""
|
||||
|
||||
@ -7,7 +7,7 @@ from __future__ import unicode_literals, absolute_import, division, print_functi
|
||||
import os
|
||||
import pathlib
|
||||
|
||||
from sopel import plugin, logger
|
||||
from sopel import plugin
|
||||
|
||||
from .SpiceBotCore import SpiceBotCore_OBJ
|
||||
sbcore = SpiceBotCore_OBJ()
|
||||
@ -16,7 +16,7 @@ SCRIPT_DIR = pathlib.Path(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
|
||||
def setup(bot):
|
||||
sbcore.setup(SCRIPT_DIR, bot, logger)
|
||||
sbcore.setup(SCRIPT_DIR, bot)
|
||||
|
||||
|
||||
@plugin.nickname_command('test')
|
||||
|
||||
Loading…
Reference in New Issue
Block a user