(cont) BotManagers compile
This commit is contained in:
parent
1c123a6ab0
commit
8c4bf03234
1 changed files with 14 additions and 10 deletions
|
@ -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,
|
||||
|
||||
_ => (),
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue