migration to JS engine #1

Merged
akulij merged 131 commits from dev into main 2025-05-31 08:49:52 +00:00
Showing only changes of commit 3d9a1c31b4 - Show all commits

View File

@ -4,6 +4,7 @@ pub mod db;
pub mod mongodb_storage; pub mod mongodb_storage;
pub mod utils; pub mod utils;
use botscript::{Runner, RunnerConfig};
use db::application::Application; use db::application::Application;
use db::callback_info::CallbackInfo; use db::callback_info::CallbackInfo;
use db::message_forward::MessageForward; use db::message_forward::MessageForward;
@ -98,6 +99,7 @@ type CallbackStore = CallbackInfo<Callback>;
pub struct BotController { pub struct BotController {
pub bot: Bot, pub bot: Bot,
pub db: DB, pub db: DB,
pub rc: RunnerConfig,
} }
impl BotController { impl BotController {
@ -105,7 +107,9 @@ impl BotController {
let bot = Bot::new(&config.bot_token); let bot = Bot::new(&config.bot_token);
let db = DB::init(&config.db_url).await?; let db = DB::init(&config.db_url).await?;
Ok(Self { bot, db }) let rc = Runner::init()?.init_config(include_str!("../mainbot.js"))?;
Ok(Self { bot, db, rc })
} }
} }