dev into main #15

Merged
modulatingforce merged 40 commits from dev into main 2024-02-25 11:31:11 -05:00
Showing only changes of commit 8a93ef0469 - Show all commits

View file

@ -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<ChType, RateLimiter>,
client:TwitchIRCClient<TCPTransport<TLS>, 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<ServerMessage>,
pub chat : Chat,
// pub chat : Chat,
// pub botmodules : ModulesManager,
twitch_oauth : String,
pub bot_channels : Vec<ChType>,
@ -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,
_ => (),
}