dev into main #15

Merged
modulatingforce merged 40 commits from dev into main 2024-02-25 11:31:11 -05:00
2 changed files with 25 additions and 8 deletions
Showing only changes of commit a6aedb291f - Show all commits

View file

@ -130,16 +130,32 @@ impl Chat {
pub struct BotManagers {
pub botmodules : ModulesManager,
pub identity : IdentityManager,
}
impl BotManagers {
pub fn init() -> BotManagers {
BotManagers {
botmodules : ModulesManager::init(),
identity : IdentityManager::init(),
}
}
}
pub struct BotInstance
{
prefix : char,
bot_channel : ChType,
pub incoming_messages : UnboundedReceiver<ServerMessage>,
pub chat : Chat,
pub botmodules : ModulesManager,
// pub botmodules : ModulesManager,
twitch_oauth : String,
pub bot_channels : Vec<ChType>,
pub identity : IdentityManager,
// pub identity : IdentityManager,
pub botmgrs : BotManagers,
}
@ -203,10 +219,11 @@ impl BotInstance
ratelimiters : ratelimiters,
client : client,
} ,
botmodules : ModulesManager::init(),
// botmodules : ModulesManager::init(),
twitch_oauth : oauth_token,
bot_channels : botchannels,
identity : IdentityManager::init(),
// identity : IdentityManager::init(),
botmgrs : BotManagers::init(),
};
@ -278,7 +295,7 @@ impl BotInstance
// // [ ] 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 {
for (_m,acts) in &self.botmgrs.botmodules.botactions {
for a in acts {
match a {
@ -322,7 +339,7 @@ impl BotInstance
// _ => (),
// }
match self.identity.to_owned().can_user_run_PRVMSG(&msg, c.required_roles.clone()) {
match self.botmgrs.identity.to_owned().can_user_run_PRVMSG(&msg, c.required_roles.clone()) {
// Ok(Permissible::Allow) => (),
Permissible::Allow => {
println!("Executed as permissible");

View file

@ -105,7 +105,7 @@ impl BotCommand
impl BotActionTrait for BotCommand
{
fn add_to_bot(self, mut bot:BotInstance) {
let mgr = &mut bot.botmodules;
let mgr = &mut bot.botmgrs.botmodules;
self.add_to_modmgr(mgr);
}
@ -162,7 +162,7 @@ impl BotActionTrait for Listener
{
fn add_to_bot(self, mut bot:BotInstance) {
let mgr = &mut bot.botmodules;
let mgr = &mut bot.botmgrs.botmodules;
self.add_to_modmgr(mgr);
}