(cont) comments & cleanup
(cont) cont
This commit is contained in:
parent
d998e2f290
commit
a2747b1ad5
6 changed files with 89 additions and 169 deletions
src
89
src/main.rs
89
src/main.rs
|
@ -1,23 +1,14 @@
|
|||
// pub mod core;
|
||||
// pub mod modules;
|
||||
//use myLib;
|
||||
//pub mod lib;
|
||||
// use std::process::Output;
|
||||
|
||||
// use crate::core::botinstance::ArcBox;
|
||||
// use bot_lib::core::botinstance::ArcBox;
|
||||
|
||||
use bot_lib::core::botinstance::{self, BotInstance};
|
||||
// use core::botinstance::{self,BotInstance};
|
||||
|
||||
use casual_logger::Extension;
|
||||
use std::sync::Arc;
|
||||
use tokio::sync::RwLock;
|
||||
|
||||
use casual_logger::{Extension, Level, Log};
|
||||
|
||||
use bot_lib::core::botinstance::{BotInstance,botlog};
|
||||
use bot_lib::core::botmodules;
|
||||
|
||||
pub type BotAR = Arc<RwLock<BotInstance>>;
|
||||
|
||||
use casual_logger::{Level, Log};
|
||||
|
||||
// Cweamcat can cweam on me - Forcen
|
||||
// God I love anime girls
|
||||
|
||||
#[tokio::main]
|
||||
pub async fn main() {
|
||||
|
@ -27,59 +18,37 @@ pub async fn main() {
|
|||
|
||||
let bot = BotInstance::init().await;
|
||||
|
||||
// Log::debug("Checking bot actions");
|
||||
botinstance::botlog::debug("Checking bot actions", Some("main()".to_string()), None);
|
||||
let a = Arc::clone(&bot.botmodules.botactions);
|
||||
let a = a.read().await;
|
||||
// let a = *a;
|
||||
{
|
||||
botlog::debug("Reading bot actions", Some("main()".to_string()), None);
|
||||
|
||||
// for (_, acts) in &*a {
|
||||
for acts in (*a).values() {
|
||||
for act in acts {
|
||||
match act {
|
||||
bot_lib::core::botmodules::BotAction::C(b) => {
|
||||
// println!("bot actiions: {}",b.command)
|
||||
// Log::info(&format!("bot actions: {}",b.command));
|
||||
botinstance::botlog::info(
|
||||
&format!("bot actions: {}", b.command),
|
||||
Some("main()".to_string()),
|
||||
None,
|
||||
);
|
||||
}
|
||||
bot_lib::core::botmodules::BotAction::L(l) => {
|
||||
// println!("bot actiions: {}",l.name)
|
||||
// Log::info(&format!("bot actions: {}",l.name));
|
||||
botinstance::botlog::info(
|
||||
&format!("bot actions: {}", l.name),
|
||||
Some("main()".to_string()),
|
||||
None,
|
||||
);
|
||||
}
|
||||
_ => {
|
||||
// println!("Not a valid match??")
|
||||
// Log::info("Not a valid match??");
|
||||
botinstance::botlog::info(
|
||||
"Not a valid match??",
|
||||
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: {}", b.command)
|
||||
}
|
||||
botmodules::BotAction::L(l) => {
|
||||
format!("bot actions: {}", l.name)
|
||||
}
|
||||
_ => "Not a valid match??".to_string(),
|
||||
};
|
||||
|
||||
botlog::info(outstr.as_str(), Some("main()".to_string()), None);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// println!("Starting runner..");
|
||||
// Log::notice("Starting Bot Runner");
|
||||
botinstance::botlog::notice("Starting Bot Runner", Some("main()".to_string()), None);
|
||||
botlog::notice("Starting Bot Runner", Some("main()".to_string()), None);
|
||||
println!("Starting Bot Runner");
|
||||
|
||||
Log::flush();
|
||||
|
||||
bot.runner().await;
|
||||
|
||||
// println!("ERROR : EXIT Game loop");
|
||||
// let msg = Log::fatal("ERROR : EXIT Game loop");
|
||||
// panic!("{}",Log::fatal("ERROR : EXIT Game loop"));
|
||||
let a = botinstance::botlog::fatal("ERROR : EXIT Game loop", Some("main()".to_string()), None);
|
||||
panic!("{}", a);
|
||||
let pstr =
|
||||
botlog::fatal("ERROR : EXIT Game loop", Some("main()".to_string()), None);
|
||||
panic!("{}", pstr);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue