ModulatingForce
e86b051ff3
All checks were successful
ci/woodpecker/pr/cargo-checks Pipeline was successful
(cont) (cont) (cont)
54 lines
1.5 KiB
Rust
54 lines
1.5 KiB
Rust
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<RwLock<BotInstance>>;
|
|
|
|
// God I love anime girls
|
|
|
|
#[tokio::main]
|
|
pub async fn main() {
|
|
Log::set_file_ext(Extension::Log);
|
|
Log::set_level(Level::Trace);
|
|
// 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);
|
|
}
|