mic-bot/main.ts

23 lines
572 B
TypeScript
Raw Normal View History

2024-10-19 10:00:35 +00:00
import { runBot } from "./bot/bot.ts";
import { init as initNormalMode } from "./bot/normal_mode/init.ts"
import { setupDB } from "./repo/exports.ts";
2024-10-19 10:47:33 +00:00
import { loadConfig } from "./config.ts";
2024-10-19 10:00:35 +00:00
import { BotMode } from "./cfg/bot.ts";
const main = async () => {
2024-10-19 10:47:33 +00:00
const cfg = loadConfig()
2024-10-19 10:00:35 +00:00
const { botCfg } = cfg
const { db } = await setupDB(cfg)
runBot(botCfg, (bot) => {
switch (botCfg.mode) {
2024-10-19 10:47:33 +00:00
case BotMode.normal:
2024-10-19 10:00:35 +00:00
initNormalMode(bot, db, cfg)
break;
2024-10-19 10:47:33 +00:00
case BotMode.setup:
2024-10-19 10:00:35 +00:00
break;
}
})
}
if (import.meta.main) { main() }