From 8c4bf03234a4f0e0e34b5d1783b03a8eddca6bc4 Mon Sep 17 00:00:00 2001 From: ModulatingForce <116608425+modulatingforce@users.noreply.github.com> Date: Wed, 31 Jan 2024 01:11:45 -0500 Subject: [PATCH] (cont) BotManagers compile --- src/core/botinstance.rs | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/core/botinstance.rs b/src/core/botinstance.rs index 6b3903f..5e94c56 100644 --- a/src/core/botinstance.rs +++ b/src/core/botinstance.rs @@ -141,14 +141,18 @@ impl Chat { pub struct BotManagers { pub botmodules : ModulesManager, pub identity : IdentityManager, + pub chat : Chat, } impl BotManagers { - pub fn init() -> BotManagers { + pub fn init(ratelimiters:HashMap, + client:TwitchIRCClient, StaticLoginCredentials>) + -> BotManagers { BotManagers { botmodules : ModulesManager::init(), identity : IdentityManager::init(), + chat : Chat::init(ratelimiters,client), } } } @@ -158,7 +162,7 @@ pub struct BotInstance prefix : char, bot_channel : ChType, pub incoming_messages : UnboundedReceiver, - pub chat : Chat, + // pub chat : Chat, // pub botmodules : ModulesManager, twitch_oauth : String, pub bot_channels : Vec, @@ -223,19 +227,19 @@ impl BotInstance bot_channel : Channel(login_name) , incoming_messages : incoming_messages, //client : client, - chat : Chat { - ratelimiters : ratelimiters, - client : client, - } , + // chat : Chat { + // ratelimiters : ratelimiters, + // client : client, + // } , // botmodules : ModulesManager::init(), twitch_oauth : oauth_token, bot_channels : botchannels, // identity : IdentityManager::init(), - botmgrs : BotManagers::init(), + botmgrs : BotManagers::init(ratelimiters,client), }; - println!("{:?}",b.chat.ratelimiters); + println!("{:?}",b.botmgrs.chat.ratelimiters); b @@ -351,7 +355,7 @@ impl BotInstance // Ok(Permissible::Allow) => (), Permissible::Allow => { println!("Executed as permissible"); - c.execute(self.chat.clone(), msg.clone()).await; + c.execute(self.botmgrs.chat.clone(), msg.clone()).await; } Permissible::Block => println!("User Not allowed to run command"), // _ => (), @@ -361,7 +365,7 @@ impl BotInstance } }, - crate::core::botmodules::BotAction::L(l) => l.execute(self.chat.clone(), msg.clone()).await, + crate::core::botmodules::BotAction::L(l) => l.execute(self.botmgrs.chat.clone(), msg.clone()).await, _ => (), }