예제 #1
0
파일: bot.py 프로젝트: Reggi3/jkent-pybot
    def __init__(self, core):
        self.core = core
        Client.__init__(self, config.host, config.ssl)
        self.hooks = Hooks()
        self.plugins = Plugins(self)

        self.max_trigger = 0
        self.install_hooks(self)

        for name in config.autoload_plugins:
            self.plugins.load(name)

        self.nick = None
        self.channels = []

        self.connect()
예제 #2
0
if log_file != '-':
    handler = logging.handlers.RotatingFileHandler(
        log_file,
        maxBytes=int(master_config.get('log_file_size')),
        backupCount=int(master_config.get('log_file_count')))
    handler.setFormatter(
        logging.Formatter(fmt=master_config.get('log_format')))
    logging.getLogger().addHandler(handler)

handler_syslog = logging.handlers.SysLogHandler(address=('localhost', 514))
handler_syslog.setFormatter(
    logging.Formatter(fmt=master_config.get('syslog_format')))
logging.getLogger().addHandler(handler_syslog)

loaded_plugins = {}
plugins = Plugins()
for (plugin, config) in master_config.plugins().items():
    (modulename, classname) = plugin.rsplit('.', 1)
    module = importlib.import_module(modulename)
    constructor = getattr(module, classname)
    loaded_plugins[plugin] = constructor(plugins, config)
    logging.info('Loaded plugin %s from %s', loaded_plugins[plugin].name(),
                 plugin)
# Some configuration, to load the port from?
endpoint = UNIXServerEndpoint(reactor, './collect-master.sock')

socat = None


class Socat(protocol.ProcessProtocol):
    def connectionMade(self):