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