From 3585c1ec9b4a6bb3a0343f433a60f23d67aced4b Mon Sep 17 00:00:00 2001 From: ModulatingForce <116608425+modulatingforce@users.noreply.github.com> Date: Mon, 29 Jan 2024 03:20:56 -0500 Subject: [PATCH] comments cleanup --- src/core/botinstance.rs | 150 ++-------------------- src/core/botmodules.rs | 257 +------------------------------------ src/main.rs | 19 --- src/modules/experiments.rs | 170 ------------------------ 4 files changed, 13 insertions(+), 583 deletions(-) diff --git a/src/core/botinstance.rs b/src/core/botinstance.rs index ae59b74..144c554 100644 --- a/src/core/botinstance.rs +++ b/src/core/botinstance.rs @@ -16,19 +16,9 @@ use std::collections::HashMap; use rand::Rng; -//mod sub::ratelimiter; use crate::core::ratelimiter::RateLimiter; use crate::core::ratelimiter; -// use crate::core::ratelimiter; - -// pub fn init() -> () -// { -// println!("I was here"); -// } - -// use crate::core::botmodules::BotAction - use crate::core::botmodules; use crate::core::botmodules::ModulesManager; @@ -47,20 +37,6 @@ pub enum ModType { pub use ModType::BotModule; -// pub enum EnType { -// Enabled(ChType), -// } - -// pub use EnType::Enabled; - -// pub enum ModStatusType { -// Enabled(EnType), -// Disabled(EnType), -// Enabled(ModType), -// Disabled(ModType), -// } - - #[derive(Clone)] pub struct Chat { pub ratelimiters : HashMap, // used to limit messages sent per channel @@ -78,10 +54,14 @@ impl Chat { pub async fn say_in_reply_to(&mut self, msg:& PrivmsgMessage , mut outmsg:String) -> () { - // envelops a message before sending a message - // [x] This could include additional formatting (e.g., add in random number of blank spaces) - // [x] Incrementing or checking with RateLimiters - // [ ] For BotActions of Enabled Modules , checking whether the caller is Permissible to run the command ? + /* + formats message before sending to TwitchIRC + + - [x] Custom String Formatting (e.g., adding random black spaces) + - [x] Ratelimiter Handling + - [ ] Checkf if BotActions is Enabled & Caller is Allowed to Run + + */ // self.client.say_in_reply_to(msg,outmsg).await.unwrap(); @@ -148,48 +128,23 @@ impl Chat { -// pub struct BotInstance -// where -// // F: std::future::Future + ?Sized, -// // F: std::future::Future, -// //F: std::future::Future + Send, -// F: Send + ?Sized, pub struct BotInstance { prefix : char, bot_channel : ChType, - //pub client : TwitchIRCClient,StaticLoginCredentials>, pub incoming_messages : UnboundedReceiver, - // pub ratelimiters : HashMap, // used to limit messages sent per channel pub chat : Chat, - // botmodules : HashMap>, - // pub botmodules : ModulesManager, pub botmodules : ModulesManager, - //pub botmodules : &'static mut ModulesManager, twitch_oauth : String, pub bot_channels : Vec, - /*bot_commands : Vec[BotCommand], - bot_listeners : Vec[Listener], - bot_routines : Vec[Routine],*/ - // botactionsdb : botactionsdb:botactions, - // identity : identitymodule, } -// impl BotInstance -// where -// // F: std::future::Future + 'static, -// //F: 'static, -// //F: std::future::Future + Send + ?Sized 'static, -// F: Send + ?Sized + 'static, impl BotInstance { - // pub fn init() -> BotInstance - // where - // F: std::future::Future + 'static, pub fn init() -> BotInstance { dotenv().ok(); @@ -245,17 +200,9 @@ impl BotInstance ratelimiters : ratelimiters, client : client, } , - // ratelimiters : ratelimiters, // used to limit messages sent per channel - // botmodules : HashMap::new(), botmodules : ModulesManager::init(), - //botmodules : bm, twitch_oauth : oauth_token, - bot_channels : botchannels, - /*bot_commands : Vec[BotCommand], - bot_listeners : Vec[Listener], - bot_routines : Vec[Routine],*/ - // botactionsdb : botactionsdb:botactions, - // identity : identitymodule, + bot_channels : botchannels, }; @@ -316,54 +263,6 @@ impl BotInstance } - - // pub async fn run(mut self) -> () { - - // let join_handle = tokio::spawn(async move { - - // while let Some(message) = self.incoming_messages.recv().await { - // // Below can be used to debug if I want to capture all messages - // // println!("Received message: {:?}", message); - - // match message { - // ServerMessage::Notice(msg) => { - // if let Some(chnl) = msg.channel_login { - // println!("NOTICE : (#{}) {}", chnl, msg.message_text); - // } - // } - // ServerMessage::Privmsg(msg) => { - // println!("(#{}) {}: {}", msg.channel_login, msg.sender.name, msg.message_text); - - // println!("Privmsg section"); - - // // b.listener_main_prvmsg(&msg); - // self.listener_main_prvmsg(&msg).await; - // // - BotCommand listener should likely need to be called within the above - - - // }, - // ServerMessage::Whisper(msg) => { - // println!("(w) {}: {}", msg.sender.name, msg.message_text); - // }, - // ServerMessage::Join(msg) => { - // println!("JOINED: {}", msg.channel_login); - // }, - // ServerMessage::Part(msg) => { - // println!("PARTED: {}", msg.channel_login); - // }, - // _ => {} - // } - // } - // }); - - - - - - // join_handle.await.unwrap(); - // } - - // ----------------- // PRIVATE FUNCTIONS @@ -372,37 +271,6 @@ impl BotInstance println!("(#{}) {}: {}", msg.channel_login, msg.sender.name, msg.message_text); - - // // // let contextratelimiter = ratelimiters.get_mut(&msg.channel_login).expect("ERROR: Issue with Rate limiters"); - // let contextratelimiter = self.ratelimiters - // .get_mut(&Channel(String::from(&msg.channel_login))) - // .expect("ERROR: Issue with Rate limiters"); - // // let contextratelimiter = self.ratelimiters.get(&msg.channel_login).expect("ERROR: Issue with Rate limiters"); - - // match contextratelimiter.check_limiter() { - // ratelimiter::LimiterResp::Allow => { - // let maxblanks = rand::thread_rng().gen_range(1..=20); - // //let mut outmsg = "GotTrolled ".to_owned(); - // let mut outmsg = "annytfLurk ".to_owned(); - - // for _i in 1..maxblanks { - // let blankspace: &str = "󠀀"; - // outmsg.push_str(blankspace); - // } - - // // client.say_in_reply_to(&msg,outmsg).await.unwrap(); - // self.client.say_in_reply_to(msg,outmsg).await.unwrap(); - // println!("(#{}) > {}", msg.channel_login, "rate limit counter increase"); - // contextratelimiter.increment_counter(); - // println!("{:?}",self.ratelimiters); - // }, - // ratelimiter::LimiterResp::Skip => { - // (); // do nothing otherwise - // } - - - // self.chat.say_in_reply_to(msg,String::from("annytfLurk")).await; - // // [ ] Need to run through all Listener Bodies for Enabled Modules for the context of the message (e.g., ModStatus is Enabled in the context for the channel) for (_m,acts) in &self.botmodules.botactions { diff --git a/src/core/botmodules.rs b/src/core/botmodules.rs index 3053f1c..0705eae 100644 --- a/src/core/botmodules.rs +++ b/src/core/botmodules.rs @@ -56,20 +56,9 @@ pub enum ModStatusType { Disabled(StatusLvl), } -// pub use EnType::Enabled; - -//#[derive(Debug)] -// pub enum BotAction -// where -// //F: std::future::Future + ?Sized, -// // F: std::future::Future, -// //F: std::future::Future + Send, -// // F: Send, -// F: Send + ?Sized, pub enum BotAction { //C(BotCommand), - // L(Listener), L(Listener), R(Routine), } @@ -81,26 +70,13 @@ impl BotAction { BotAction::L(a) => a.execute(m,n).await, _ => (), } - // (self.exec_body)(m,n).await; } } - -// pub trait BotActionTrait -// where -// // F: std::future::Future, -// //F: std::future::Future + ?Sized, -// //: std::future::Future + Send, -// // F: Send, -// F : Send + ?Sized pub trait BotActionTrait { - // async fn execute(&self,m:&mut BotInstance,n:&PrivmsgMessage); - // fn add_to_bot(self, bot:BotInstance) -> Result>; fn add_to_bot(self, bot:BotInstance); - //fn add_to_modmgr(self, modmgr:ModulesManager) -> ModulesManager; - //fn add_to_modmgr(self,modmgr:&mut ModulesManager) -> ModulesManager; fn add_to_modmgr(self,modmgr:&mut ModulesManager); } @@ -191,16 +167,6 @@ pub trait BotActionTrait pub mod bot_actions { - // use std::boxed::Box; - // use std::pin::Pin; - // use std::future::Future; - - // use crate::core::botinstance::Chat; - // use twitch_irc::message::PrivmsgMessage; - - - // type ExecBody = Box Pin>>>; - pub mod actions_util { use std::future::Future; @@ -210,27 +176,10 @@ pub mod bot_actions { use crate::core::botinstance::Chat; use twitch_irc::message::PrivmsgMessage; - // pub type ExecBody = Box Pin>>>; - - // pub type ExecBody = Box Pin + Send>> + Send + Sync>; - pub type ExecBody = Box Pin + Send>> + Send + Sync>; - //pub type ExecBody = Box Pin + Send>> + Send + Sync>; - - // pub fn asyncbox(f: fn(Chat,PrivmsgMessage) -> T) -> ExecBody - // where - // //T: Future + 'static, - // //T: Future , - // T: Future + Send + 'static, - // { - // Box::new(move |a,b| Box::pin(f(a,b))) - // } + pub type ExecBody = Box Pin + Send>> + Send + Sync>; pub fn asyncbox(f: fn(Chat,PrivmsgMessage) -> T) -> ExecBody - //pub fn asyncbox(f: fn(Chat,&PrivmsgMessage) -> T) -> ExecBody where - //T: Future + 'static, - //T: Future , - // T: Future + Send + 'static, T: Future + Send + 'static, { Box::new(move |a,b| Box::pin(f(a,b))) @@ -242,121 +191,34 @@ pub mod bot_actions { -// #[derive(Debug)] -// pub struct Listener { -// pub module : ModType, -// pub name : String, -// pub exec_body : fn(&mut BotInstance,&PrivmsgMessage) , -// pub help : String -// } - -// #[derive(Debug)] -// pub struct Listener pub struct Listener -// where -// // F: std::future::Future + ?Sized, -// //F: std::future::Future, -// //F: std::future::Future + ?Sized + Send, -// //F: Send, -// F: Send + ?Sized, { pub module : ModType, pub name : String, - //pub exec_body : fn(&mut BotInstance,&PrivmsgMessage) , - // pub exec_body : fn(&mut Box>,&PrivmsgMessage) -> F , - //pub exec_body : fn(&mut botinstance::Chat,&PrivmsgMessage) -> F , - // pub exec_body : fn(botinstance::Chat,PrivmsgMessage) -> F , - //pub exec_body : fn(String,&PrivmsgMessage) -> F , - //pub exec_body : bot_actions::actions_util::ExecBody, pub exec_body : bot_actions::actions_util::ExecBody, pub help : String } -// impl Listener -// where -// // F: std::future::Future, -// //F: std::future::Future + Sized, -// F: std::future::Future + Sized + Send, impl Listener { - - // async fn execute(&self,m:&mut Box>,n:&PrivmsgMessage){ - // async fn execute(&self,m:&mut botinstance::Chat,n:&PrivmsgMessage){ pub async fn execute(&self,m:botinstance::Chat,n:PrivmsgMessage){ - // => 12.23 - [ ] #todo requires field - // (&self.exec)(String::from("Hello from BotAction Trait")) - //self.exec_body(m,n) (self.exec_body)(m,n).await; - // (self.exec_body)(m,n); } } -// impl BotActionTrait for Listener -// where -// //F: std::future::Future, -// //F: std::future::Future + Sized, -// // F: std::future::Future + Send, -// // F : Send, -// F : Send + ?Sized, impl BotActionTrait for Listener { - // fn add_to_bot(&self) -> Result> { - // println!("Calling Add to Bot"); - // Ok(String::from("Hello")) - // } - - // fn add_to_bot(self, mut bot:BotInstance) { fn add_to_bot(self, mut bot:BotInstance) { - // let mut mgr = bot.botmodules; - // let nmod = self.module.clone(); - // mgr.add_botaction(nmod, BotAction::C(self)); - //let mgr = &mut bot.botmodules; - //let nmod = self.module.clone(); - // mgr.add_botaction(self.module.clone(), BotAction::C(self)); let mgr = &mut bot.botmodules; self.add_to_modmgr(mgr); } - //fn add_to_modmgr(self, modmgr:&mut ModulesManager) -> ModulesManager { fn add_to_modmgr(self, modmgr:&mut ModulesManager) { - //fn add_to_modmgr(self, mut modmgr:ModulesManager) -> ModulesManager { - // // let mut mgr = bot.botmodules; - // // let nmod = self.module.clone(); - // // mgr.add_botaction(nmod, BotAction::C(self)); - // let mut mgr = modmgr; - // //let nmod = self.module.clone(); - // mgr.add_botaction(self.module.clone(), BotAction::C(self)); - // let mut mgr = modmgr; - // //let nmod = self.module.clone(); - // modmgr.add_botaction(self.module.clone(), BotAction::L(self)); modmgr.add_botaction(self.module.clone(), BotAction::L(self)) } - // => 12.23 - MF: NOTE : The exec body is defined ad module level , not this core level - - // fn exec_body(&self,m:&BotInstance,n:&PrivmsgMessage){ - // // => 12.23 - [ ] #todo requires field - // // (&self.exec)(String::from("Hello from BotAction Trait")) - // //self.exec_body(m,n) - // } - - // fn execute(&self,m:&mut BotInstance,n:&PrivmsgMessage){ - // // => 12.23 - [ ] #todo requires field - // // (&self.exec)(String::from("Hello from BotAction Trait")) - // //self.exec_body(m,n) - // (self.exec_body)(m,n) - // } - - - // // => 12.23 - MF : There are issues trying to define async at trait level - // async fn execute(&self,m:&mut BotInstance,n:&PrivmsgMessage) -> Result<>{ - // // => 12.23 - [ ] #todo requires field - // // (&self.exec)(String::from("Hello from BotAction Trait")) - // //self.exec_body(m,n) - // (self.exec_body)(m,n) - // } } @@ -364,140 +226,35 @@ impl BotActionTrait for Listener #[derive(Debug)] struct Routine {} - -//#[derive(Debug)] -// pub struct ModulesManager -// where -// //F: std::future::Future + ?Sized, -// // F: std::future::Future, -// //F: std::future::Future + Send, -// // F: Send, -// // F: Send + ?Sized, pub struct ModulesManager { statusdb: HashMap>, pub botactions: HashMap>, } -// impl ModulesManager -// where -// // F: std::future::Future, -// //F: std::future::Future + Send, -// // F : Send, -// F : Send + ?Sized, impl ModulesManager { - // pub fn init() -> ModulesManager - // where - // F: std::future::Future , - // pub fn init() -> &'static mut ModulesManager pub fn init() -> ModulesManager { - // initializes the modulers manager - // Ideally, this should have added known modules based on - // directory structure and API user recommendations - let mut m = HashMap::new(); - let mut act = HashMap::new(); + let m = HashMap::new(); + let act = HashMap::new(); - // -- some processing including adding into the hashmap - - // let newmodule = BotModule(String::from("GambaCore")); - - // let newlistener = Listener { - // module : BotModule(String::from("experiments").to_owned()), - // name : String::from("socklistener"), - // help : String::from("This will listen and react to sock randomly"), - // }; - - - // // As a Demonstration, the listener's Module is added and Enabled at Instance level - // let statusvector = m - // .entry(BotModule(String::from("experiments"))) - // .or_insert(Vec::new()); - - // statusvector.push(ModStatusType::Enabled(StatusLvl::Instance)); - - // let modactions = act - // .entry( BotModule(String::from("experiments"))) - // .or_insert(Vec::new()); - - // modactions.push(BotAction::L(newlistener)); - - - // let mgr = &mut ModulesManager { - // statusdb : m, - // botactions : act, - // }; let mut mgr = ModulesManager { statusdb : m, botactions : act, }; - // // -- This area can be where bot actions are imported to the bot's module manager - // // -- Below can be used to validate what occurs when dup BotCommands are added - - // let bcmd = BotCommand { - // module : BotModule(String::from("experiments 001")), - // command : String::from("DUPCMD1"), // command call name - // alias : vec![String::from("DUPALIAS1A"),String::from("DUPALIAS1B")], // String of alternative names - // // bot_prefix : char, // although should be global? - // // exec_body : fn, - // help : String::from("DUPCMD1 tester"), - // }; - - // mgr.add_botaction(BotModule(String::from("experiments 001")), BotAction::C(bcmd)); - - - // let bcmd = BotCommand { - // module : BotModule(String::from("experiments 002")), - // command : String::from("DUPCMD2"), // command call name - // alias : vec![String::from("DUPALIAS2A"),String::from("DUPALIAS2B")], // String of alternative names - // // bot_prefix : char, // although should be global? - // // exec_body : fn, - // help : String::from("DUPCMD2 tester"), - // }; - - // mgr.add_botaction(BotModule(String::from("experiments 002")), BotAction::C(bcmd)); - - // -- Below working demonstration of BotCommand.add_to_modmgr() - - // BotCommand { - // module : BotModule(String::from("experiments 003")), - // command : String::from("DUPCMD3"), // command call name - // alias : vec![String::from("DUPALIAS3A"),String::from("DUPALIAS3B")], // String of alternative names - // // bot_prefix : char, // although should be global? - // // exec_body : fn, - // help : String::from("DUPCMD3 tester"), - // }.add_to_modmgr(&mut mgr); - - // crate::core::botmodules::BotCommand{ - // module : BotModule(String::from("experiments 003")), - // command : String::from("DUPCMD3"), // command call name - // alias : vec![String::from("DUPALIAS3A"),String::from("DUPALIAS3B")], // String of alternative names - // // bot_prefix : char, // although should be global? - // // exec_body : fn, - // help : String::from("DUPCMD3 tester"), - // }; - - // // => 2023.12.22 - [x] MF : How can I call submods:init() ? - // // => 2023.12.22 - this was answered - needed to pub modules in main.rs - // crate::core::botinstance::init(); // works - // crate::core::init(); // works - //crate::submods:: - //crate::arbfile; + // initialize custom crate modules crate::modules::init(&mut mgr); println!(">> Modules Manager : End of Init"); - //println!(">> Modules Manager : {:?}",mgr); - // let &mut mgr = mgr; - // &mgr mgr } @@ -556,12 +313,6 @@ impl ModulesManager // - If BotAction to Add is a BotCommand , In Module Manager DB (botactions), // Check All Other BotAction Command Names & Aliases to ensure they don't conflict - // fn find_conflict_module(mgr:& ModulesManager, act:& BotAction) -> Option - // where - // // F: std::future::Future, - // // F: std::future::Future + Send, - // // F : Send, - // F : Send + ?Sized, fn find_conflict_module(mgr:& ModulesManager, act:& BotAction) -> Option { diff --git a/src/main.rs b/src/main.rs index 0993cd0..cd71f0f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,20 +1,5 @@ -// use twitch_irc::login::StaticLoginCredentials; -// use twitch_irc::ClientConfig; -// use twitch_irc::SecureTCPTransport; -// use twitch_irc::TwitchIRCClient; -// use twitch_irc::message::ServerMessage; -// use std::env; -// // use std::time::Instant; -// use rand::Rng; -// use dotenv::dotenv; -// // mod helpers; - -// use std::collections::HashMap; - - - pub mod core; pub mod modules; use std::process::Output; @@ -24,10 +9,6 @@ use crate::core::botinstance::BotInstance; #[tokio::main] pub async fn main() { - //let bot:BotInstance> = BotInstance::init(); - - //let bot:BotInstance> = BotInstance::init(); - //let bot:BotInstance + Sized> = BotInstance::init(); let bot = BotInstance::init(); bot.runner().await; diff --git a/src/modules/experiments.rs b/src/modules/experiments.rs index c8ef785..a2d34a5 100644 --- a/src/modules/experiments.rs +++ b/src/modules/experiments.rs @@ -20,12 +20,6 @@ use crate::core::botmodules::bot_actions::actions_util; use crate::core::botinstance::{self}; use twitch_irc::message::PrivmsgMessage; -// pub fn init(mgr:ModulesManager) -> ModulesManager -// pub fn init(mgr:ModulesManager) -// where -// // F: std::future::Future + Send, -// // F : Send, -// F : Send + ?Sized, pub fn init(mgr:&mut ModulesManager) { @@ -40,170 +34,20 @@ pub fn init(mgr:&mut ModulesManager) // }.add_to_modmgr(mgr); - // let list1 = Listener::> { - // //let list1 = Listener { - // module : BotModule(String::from("experiments 004")), - // name : String::from("GoodGirl Listener"), - // // exec_body : good_girl::> , - // // exec_body : good_girl , - // exec_body : actions_util::asyncbox(good_girl), - // //exec_body : actions_util::asyncbox(good_girl::>) , - // //exec_body : actions_util::asyncbox(good_girl::>), - - // help : String::from("") - // }; - - // let list1 = Listener::> { - // //let list1 = Listener { - // module : BotModule(String::from("experiments 004")), - // name : String::from("GoodGirl Listener"), - // // exec_body : good_girl::> , - // // exec_body : good_girl , - // exec_body : actions_util::asyncbox(good_girl), - // //exec_body : actions_util::asyncbox(good_girl::>) , - // //exec_body : actions_util::asyncbox(good_girl::>), - - // help : String::from("") - // }; - - //let list1 = Listener::> { let list1 = Listener { module : BotModule(String::from("experiments 004")), name : String::from("GoodGirl Listener"), - // exec_body : good_girl::> , - //exec_body : good_girl , - //exec_body : actions_util::asyncbox(good_girl), exec_body : actions_util::asyncbox(good_girl) , - //exec_body : actions_util::asyncbox(good_girl::>), - //exec_body : actions_util::asyncbox(good_girl::>>), - help : String::from("") }; - - // let list1 = Listener::<> { - // //let list1 = Listener { - // module : BotModule(String::from("experiments 004")), - // name : String::from("GoodGirl Listener"), - // // exec_body : good_girl::> , - // //exec_body : good_girl , - // //exec_body : actions_util::asyncbox(good_girl), - // exec_body : actions_util::asyncbox(good_girl) , - // //exec_body : actions_util::asyncbox(good_girl::>), - - // help : String::from("") - // }; - list1.add_to_modmgr(mgr); - // let mgr = list1.add_to_modmgr(mgr); - - // Listener { - // module : BotModule(String::from("experiments 004")), - // name : String::from("GoodGirl Listener"), - // // exec_body : good_girl::> , - // exec_body : good_girl , - // help : String::from("") - // }.add_to_modmgr(mgr); - - - // let list1 = Listener2 { - // module : BotModule(String::from("experiments 004")), - // name : String::from("GoodGirl Listener"), - // // exec_body : good_girl::> , - // exec_body : good_girl , - // help : String::from("") - // }; - - // let list1 = Listener3 { - // module : BotModule(String::from("experiments 004")), - // name : String::from("GoodGirl Listener"), - // // exec_body : good_girl::> , - // // exec_body : testfn2 , - // help : String::from("") - // }; - - // println!("At Experiments module"); - - - // //(); - // mgr } -// pub struct Listener2 -// // where -// // F: std::future::Future + ?Sized, -// { -// pub module : botmodules::ModType, -// pub name : String, -// //pub exec_body : fn(&mut BotInstance,&PrivmsgMessage) , -// // pub exec_body : fn(&mut Box>,&PrivmsgMessage) -> F , -// //pub exec_body : fn(&mut botinstance::Chat,&PrivmsgMessage) -> dyn std::future::Future , -// pub exec_body : fn(&mut botinstance::Chat,&PrivmsgMessage) -> F , -// //pub exec_body : fn(String,&PrivmsgMessage) -> F , -// pub help : String -// } - - -// pub struct Listener3 -// // where -// // F: std::future::Future + ?Sized, -// { -// pub module : botmodules::ModType, -// pub name : String, -// //pub exec_body : fn(&mut BotInstance,&PrivmsgMessage) , -// // pub exec_body : fn(&mut Box>,&PrivmsgMessage) -> F , -// //pub exec_body : fn(&mut botinstance::Chat,&PrivmsgMessage) -> dyn std::future::Future , -// // pub exec_body : fn(botinstance::Chat) -> F , // this appears to work -// // pub exec_body : fn(botinstance::Chat,PrivmsgMessage) -> F , // this appears to work -// //pub exec_body : fn(String,&PrivmsgMessage) -> F , -// pub help : String -// } - - -// async fn testfn2(mut _chat:botinstance::Chat,_msg:PrivmsgMessage) -// // where -// // F : std::future::Future + ?Sized, -// { -// println!("testfn2"); -// } - -// async fn good_girl(bot:&mut BotInstance,msg:&PrivmsgMessage) { -// println!("In GoodGirl()"); -// println!("(#{}) {}: {}", msg.channel_login, msg.sender.name, msg.message_text); - -// if msg.sender.name == "ModulatingForce" && msg.message_text.contains("GoodGirl") { -// bot.chat.say_in_reply_to(msg,String::from("GoodGirl")); -// } - -// () -// } - -// async fn good_girl(bot:&mut BotInstance,msg:&PrivmsgMessage) -// where -// F: std::future::Future, -// { -// println!("In GoodGirl()"); -// println!("(#{}) {}: {}", msg.channel_login, msg.sender.name, msg.message_text); - -// if msg.sender.name == "ModulatingForce" && msg.message_text.contains("GoodGirl") { -// bot.chat.say_in_reply_to(msg,String::from("GoodGirl")).await; -// } - - -// } - -//async fn good_girl(bot:&mut Box>,msg:&PrivmsgMessage) -//async fn good_girl(chat:&mut botinstance::Chat,msg:&PrivmsgMessage) -// async fn good_girl(chat:&mut botinstance::Chat,msg:&PrivmsgMessage) async fn good_girl(mut chat:botinstance::Chat,msg:PrivmsgMessage) -//async fn good_girl(mut chat:botinstance::Chat,msg:PrivmsgMessage) -// where -// //F: std::future::Future + ?Sized, -// //F: std::future::Future, -// F: std::future::Future + Sized + Send, { println!("In GoodGirl()"); println!("(#{}) {}: {}", msg.channel_login, msg.sender.name, msg.message_text); @@ -214,17 +58,3 @@ async fn good_girl(mut chat:botinstance::Chat,msg:PrivmsgMessage) } - -// async fn good_girl(chat:String,msg:&PrivmsgMessage) -// // where -// // F: std::future::Future + ?Sized, -// { -// println!("In GoodGirl()"); -// println!("(#{}) {}: {}", msg.channel_login, msg.sender.name, msg.message_text); - -// if msg.sender.name == "ModulatingForce" && msg.message_text.contains("GoodGirl") { -// println!("Testing from goodgirl"); -// } - - -// } \ No newline at end of file