SpiceBot/sopel_SpiceBot/SBCore/__init__.py
deathbybandaid 94c094764a test
2022-02-10 09:09:11 -05:00

53 lines
1.8 KiB
Python

from .interface.config import Config
from .interface.versions import Versions
from .interface.logger import Logger
from .interface.database import Database
from .interface.comms import Comms
from .interface.events import Events
class SpiceBotCore_OBJ():
def __init__(self, script_dir):
# Set directory for the plugin
self.script_dir = script_dir
# Allow SpiceBot to interact with Sopel Logger
self.logger = Logger()
self.logger.info("SpiceBot Logging Interface Setup Complete.")
# Allow Spicebot to mimic Sopel Config
self.config = Config(script_dir)
self.logger.info("SpiceBot Config Interface Setup Complete.")
# Parse Version Information for the ENV
self.versions = Versions(self.config, self.logger)
self.logger.info("SpiceBot Versions Interface Setup Complete.")
# Mimic Sopel DB, with enhancements
self.database = Database(self.config)
self.logger.info("SpiceBot Database Interface Setup Complete.")
# SpiceBots manual event system
self.events = Events(self.logger)
self.logger.info("SpiceBot Events Interface Setup Complete.")
# Bypass Sopel's method for writing to IRC
self.comms = Comms(self.config)
self.logger.info("SpiceBot Comms Interface Setup Complete.")
def setup(self, bot):
"""This runs with the plugin setup routine"""
# store an access interface to sopel.bot
self.bot = bot
# Re-initialize the bot config properly during plugin setup routine
self.config.config = bot.config
# OSD shortcut
def osd(self, messages, recipients=None, text_method='PRIVMSG', max_messages=-1):
return self.comms.osd(messages, recipients, text_method, max_messages)