diff --git a/src/core/botinstance.rs b/src/core/botinstance.rs index 37ce4db..80bfb06 100644 --- a/src/core/botinstance.rs +++ b/src/core/botinstance.rs @@ -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, pub chat : Chat, - pub botmodules : ModulesManager, + // pub botmodules : ModulesManager, twitch_oauth : String, pub bot_channels : Vec, - 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"); diff --git a/src/core/botmodules.rs b/src/core/botmodules.rs index 7186730..4035a35 100644 --- a/src/core/botmodules.rs +++ b/src/core/botmodules.rs @@ -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); }