Dmitry Anderson
e6ee3ee695
- Prod dockerfile changes + deno downgrade - Locale files added - Trying to make bot working with i18n
25 lines
679 B
TypeScript
25 lines
679 B
TypeScript
import { runBot } from "./bot/bot.ts";
|
|
import { init as initNormalMode } from "./bot/normal_mode/init.ts"
|
|
import { init as initSetupMode } from "./bot/setup_mode/init.ts"
|
|
import { setupDB } from "./repo/setup_db.ts";
|
|
import { loadConfig } from "./config.ts";
|
|
import { BotMode } from "./cfg/config.ts";
|
|
|
|
const main = async () => {
|
|
const cfg = loadConfig()
|
|
const { botCfg } = cfg
|
|
const { db } = await setupDB(cfg)
|
|
|
|
await runBot(botCfg, (bot) => {
|
|
switch (botCfg.mode) {
|
|
case BotMode.normal:
|
|
initNormalMode(bot, db, cfg)
|
|
break;
|
|
case BotMode.setup:
|
|
initSetupMode(bot, cfg)
|
|
break;
|
|
}
|
|
})
|
|
}
|
|
if (import.meta.main) { main() }
|