use std::sync::Arc; use tokio::sync::RwLock; use casual_logger::{Extension, Level, Log}; use bot_lib::core::botinstance::BotInstance; use bot_lib::core::botlog; use bot_lib::core::botmodules; pub type BotAR = Arc>; // God I love anime girls // fr fr #[tokio::main] pub async fn main() { Log::set_file_ext(Extension::Log); Log::set_level(Level::Trace); Log::set_retention_days(2); // Log::set_level(Level::Notice); let bot = BotInstance::init().await; { botlog::trace("Reading bot actions", Some("main()".to_string()), None); let actsdb = Arc::clone(&bot.botmodules.botactions); let actsdb_lock = actsdb.read().await; for acts in (*actsdb_lock).values() { for act in acts { let outstr = match act { botmodules::BotAction::C(b) => { format!("bot actions > Command : {}", b.command) } botmodules::BotAction::L(l) => { format!("bot actions > Listener : {}", l.name) } _ => "Not a valid match??".to_string(), }; botlog::info(outstr.as_str(), Some("main()".to_string()), None); } } } botlog::notice("Starting Bot Runner", Some("main()".to_string()), None); println!("Starting Bot Runner"); Log::flush(); bot.runner().await; let pstr = botlog::fatal("ERROR : EXIT Game loop", Some("main()".to_string()), None); panic!("{}", pstr); }