diff --git a/src/core/botmodules.rs b/src/core/botmodules.rs index aab2cf2..b06858a 100644 --- a/src/core/botmodules.rs +++ b/src/core/botmodules.rs @@ -276,70 +276,70 @@ impl ModulesManager // BotAction::R(r) => None, // } - // if let BotAction::C(incmd) = act { + if let BotAction::C(incmd) = act { - // // let n = & mgr.botactions; + // let n = & mgr.botactions; - // let d = &mgr.botactions; + let d = &mgr.botactions; - // for (module,moduleactions) in d { + for (module,moduleactions) in d { - // for modact in moduleactions.iter() { - // if let BotAction::C(dbcmd) = &modact { - // // At this point, there is an command incmd and looked up dbcmd + for modact in moduleactions.iter() { + if let BotAction::C(dbcmd) = &modact { + // At this point, there is an command incmd and looked up dbcmd - // // [x] check if given botcommand c.command:String conflicts with any in botactions + // [x] check if given botcommand c.command:String conflicts with any in botactions - // if incmd.command.to_lowercase() == dbcmd.command.to_lowercase() { - // // Returning State - with the identified module - // // return Some((module.clone(),BotAction::C(*dbcmd.clone()))); - // // return Some(incmd); // for some reason I keep getting issues - // //return Some(BotModule(String::from("GambaCore"))); // works - // return Some(module.clone()); // works - // // return Some(dbcmd.clone()); - // } + if incmd.command.to_lowercase() == dbcmd.command.to_lowercase() { + // Returning State - with the identified module + // return Some((module.clone(),BotAction::C(*dbcmd.clone()))); + // return Some(incmd); // for some reason I keep getting issues + //return Some(BotModule(String::from("GambaCore"))); // works + return Some(module.clone()); // works + // return Some(dbcmd.clone()); + } - // for a in &dbcmd.alias { - // if incmd.command.to_lowercase() == a.to_lowercase() { - // // Returning State - with the identified module - // // return Some((module.clone(),BotAction::C(dbcmd))); - // return Some(module.clone()); // works + for a in &dbcmd.alias { + if incmd.command.to_lowercase() == a.to_lowercase() { + // Returning State - with the identified module + // return Some((module.clone(),BotAction::C(dbcmd))); + return Some(module.clone()); // works - // } - // } + } + } - // // [x] Then do the same check except for each c.alias + // [x] Then do the same check except for each c.alias - // for inalias in &incmd.alias { + for inalias in &incmd.alias { - // if inalias.to_lowercase() == dbcmd.command.to_lowercase() { - // // Returning State - with the identified module - // // return Some((module.clone(),BotAction::C(dbcmd))); - // return Some(module.clone()); // works + if inalias.to_lowercase() == dbcmd.command.to_lowercase() { + // Returning State - with the identified module + // return Some((module.clone(),BotAction::C(dbcmd))); + return Some(module.clone()); // works - // } + } - // for a in &dbcmd.alias { - // if inalias.to_lowercase() == a.to_lowercase() { - // // Returning State - with the identified module - // // return Some((module.clone(),BotAction::C(dbcmd))); - // return Some(module.clone()); // works + for a in &dbcmd.alias { + if inalias.to_lowercase() == a.to_lowercase() { + // Returning State - with the identified module + // return Some((module.clone(),BotAction::C(dbcmd))); + return Some(module.clone()); // works - // } - // } + } + } - // } + } - // } - // } + } + } - // } + } - // // return Some(BotModule(String::from("GambaCore"))) - // } + // return Some(BotModule(String::from("GambaCore"))) + } // for all other scenarios (e.g., Listener, Routine), find no conflicts diff --git a/src/modules/experiments.rs b/src/modules/experiments.rs index 11f1b94..2d761d3 100644 --- a/src/modules/experiments.rs +++ b/src/modules/experiments.rs @@ -24,13 +24,23 @@ pub fn init(mgr:&mut ModulesManager) { - BotCommand { - module : BotModule(String::from("experiments 004")), - command : String::from("test"), // command call name - alias : vec![String::from("tester"),String::from("testy")], // String of alternative names - exec_body : actions_util::asyncbox(testy) , - help : String::from("DUPCMD4 tester"), - }.add_to_modmgr(mgr); + BotCommand { + module : BotModule(String::from("experiments 004")), + command : String::from("test1"), // command call name + alias : vec![String::from("tester1"),String::from("testy1")], // String of alternative names + exec_body : actions_util::asyncbox(testy) , + help : String::from("DUPCMD4 tester"), + }.add_to_modmgr(mgr); + + + BotCommand { + module : BotModule(String::from("experiments 004")), + command : String::from("test2"), // command call name + alias : vec![String::from("tester2"),String::from("testy2")], // String of alternative names + exec_body : actions_util::asyncbox(testy) , + help : String::from("DUPCMD4 tester"), + }.add_to_modmgr(mgr); + let list1 = Listener {