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 d10acc992a - Show all commits

View File

@ -8,9 +8,11 @@ pub mod message_answerer;
pub mod mongodb_storage; pub mod mongodb_storage;
pub mod utils; pub mod utils;
use bot_manager::start_bot;
use botscript::{BotMessage, Runner, RunnerConfig, ScriptError, ScriptResult}; use botscript::{BotMessage, Runner, RunnerConfig, ScriptError, ScriptResult};
use commands::BotCommand; use commands::BotCommand;
use db::application::Application; use db::application::Application;
use db::bots::BotInstance;
use db::callback_info::CallbackInfo; use db::callback_info::CallbackInfo;
use db::message_forward::MessageForward; use db::message_forward::MessageForward;
use itertools::Itertools; use itertools::Itertools;
@ -180,6 +182,11 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut bc = BotController::new(&config).await?; let mut bc = BotController::new(&config).await?;
let state_mgr = MongodbStorage::open(config.db_url.clone().as_ref(), "gongbot", Json).await?; let state_mgr = MongodbStorage::open(config.db_url.clone().as_ref(), "gongbot", Json).await?;
for bi in BotInstance::get_all(&mut bc.db).await? {
let info = start_bot(bi, &mut bc.db).await?;
println!("Started bot: {}", info.name);
}
// TODO: delete this in production // TODO: delete this in production
// allow because values are hardcoded and if they will be unparsable // allow because values are hardcoded and if they will be unparsable
// we should panic anyway // we should panic anyway