use RunnerConfig in BotController

This commit is contained in:
Akulij 2025-05-20 00:42:32 +05:00
parent 5c8cadf7a0
commit 3d9a1c31b4

View File

@ -4,6 +4,7 @@ pub mod db;
pub mod mongodb_storage;
pub mod utils;
use botscript::{Runner, RunnerConfig};
use db::application::Application;
use db::callback_info::CallbackInfo;
use db::message_forward::MessageForward;
@ -98,6 +99,7 @@ type CallbackStore = CallbackInfo<Callback>;
pub struct BotController {
pub bot: Bot,
pub db: DB,
pub rc: RunnerConfig,
}
impl BotController {
@ -105,7 +107,9 @@ impl BotController {
let bot = Bot::new(&config.bot_token);
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 })
}
}