import { cfg, read } from './cfg.js'; //import { loadEvents } from './lib.js'; const irclib = require('./clients/irc.js'); const tglib = require('./clients/tg.js') const util = require('util'); const EventEmitter = require('events').EventEmitter; const clients = []; const wrapper = function () { for (let srv in cfg.client) { switch (cfg.client[srv].type) { case "irc": clients.push({ name: cfg.client[srv].network, type: "irc", client: new irclib(cfg.client[srv]) }); break; case "tg": clients.push({ name: "tg", type: "tg", client: new tglib(cfg.client[srv]) }); break; } } clients.forEach(client => { client.client.on("data", e => { this.emit(e[0], e[1]); }); }); }; util.inherits(wrapper, EventEmitter); export default { wrapper, clients };