2023-11-29 22:11:12 -05:00
|
|
|
|
|
|
|
|
2023-12-19 20:38:20 -05:00
|
|
|
pub mod core;
|
2023-12-22 09:21:49 -05:00
|
|
|
pub mod modules;
|
2023-12-28 06:02:55 -05:00
|
|
|
use std::process::Output;
|
|
|
|
|
2024-02-04 14:28:37 -05:00
|
|
|
use crate::core::botinstance::ArcBox;
|
|
|
|
|
2023-12-19 20:38:20 -05:00
|
|
|
use crate::core::botinstance::BotInstance;
|
2024-02-13 07:54:35 -05:00
|
|
|
use casual_logger::Extension;
|
2024-02-12 01:25:12 -05:00
|
|
|
use tokio::sync::RwLock;
|
|
|
|
use std::sync::Arc;
|
|
|
|
pub type BotAR = Arc<RwLock<BotInstance>>;
|
2023-12-19 20:38:20 -05:00
|
|
|
|
2024-02-13 07:54:35 -05:00
|
|
|
use casual_logger::{Level,Log};
|
|
|
|
|
2023-10-22 08:35:09 -04:00
|
|
|
#[tokio::main]
|
|
|
|
pub async fn main() {
|
2023-12-02 02:00:51 -05:00
|
|
|
|
2024-02-13 07:54:35 -05:00
|
|
|
Log::set_file_ext(Extension::Log);
|
|
|
|
Log::set_level(Level::Trace);
|
|
|
|
// Log::set_level(Level::Notice);
|
|
|
|
|
2024-02-12 02:34:32 -05:00
|
|
|
let bot = BotInstance::init().await;
|
|
|
|
|
2024-02-13 07:54:35 -05:00
|
|
|
Log::debug("Checking bot actions");
|
2024-02-12 02:34:32 -05:00
|
|
|
let a = Arc::clone(&bot.botmodules.botactions);
|
|
|
|
let a = a.read().await;
|
|
|
|
// let a = *a;
|
|
|
|
|
|
|
|
for (_,acts) in &*a {
|
|
|
|
for act in acts {
|
|
|
|
match act {
|
2024-02-13 07:54:35 -05:00
|
|
|
crate::core::botmodules::BotAction::C(b) => {
|
|
|
|
// println!("bot actiions: {}",b.command)
|
|
|
|
Log::info(&format!("bot actions: {}",b.command));
|
|
|
|
},
|
|
|
|
crate::core::botmodules::BotAction::L(l) => {
|
|
|
|
// println!("bot actiions: {}",l.name)
|
|
|
|
Log::info(&format!("bot actions: {}",l.name));
|
|
|
|
},
|
|
|
|
_ => {
|
|
|
|
// println!("Not a valid match??")
|
|
|
|
Log::info("Not a valid match??");
|
|
|
|
},
|
2024-02-12 02:34:32 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2024-02-13 07:54:35 -05:00
|
|
|
// println!("Starting runner..");
|
|
|
|
Log::notice("Starting Bot Runner");
|
|
|
|
|
|
|
|
Log::flush();
|
2023-12-19 20:38:20 -05:00
|
|
|
|
2024-02-12 01:25:12 -05:00
|
|
|
bot.runner().await;
|
2024-02-04 14:28:37 -05:00
|
|
|
|
2024-02-13 07:54:35 -05:00
|
|
|
// println!("ERROR : EXIT Game loop");
|
|
|
|
// let msg = Log::fatal("ERROR : EXIT Game loop");
|
|
|
|
panic!("{}",Log::fatal("ERROR : EXIT Game loop"));
|
2023-12-19 21:43:03 -05:00
|
|
|
|
2023-10-22 08:35:09 -04:00
|
|
|
}
|