umbot
Version:
Universal bot(vk, telegram, viber) or skills for Yandex.Alisa, Маруся and sber
33 lines (32 loc) • 1.07 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.run = run;
const BotTest_1 = require("./core/BotTest");
const mmApp_1 = require("./mmApp");
const core_1 = require("./core");
function _initParam(bot, config) {
bot.initConfig(config.appConfig);
bot.initParams(config.appParam);
bot.initBotController(config.controller);
}
function run(config, mode = 'prod', hostname = 'localhost', port = 3000) {
let bot;
switch (mode) {
case 'dev':
bot = new BotTest_1.BotTest();
_initParam(bot, config);
mmApp_1.mmApp.setDevMode(true);
return bot.test(config.testParams);
case 'dev-online':
bot = new core_1.Bot();
bot.initTypeInGet();
_initParam(bot, config);
mmApp_1.mmApp.setDevMode(true);
return bot.start(hostname, port);
case 'prod':
bot = new core_1.Bot();
bot.initTypeInGet();
_initParam(bot, config);
return bot.start(hostname, port);
}
}