(cont) BotManagers

This commit is contained in:
ModulatingForce 2024-01-31 01:07:27 -05:00
parent 2e6d1bceac
commit 1c123a6ab0
2 changed files with 10 additions and 0 deletions

View file

@ -48,6 +48,14 @@ pub struct Chat {
impl Chat { impl Chat {
pub fn init(ratelimiters:HashMap<ChType, RateLimiter>,
client:TwitchIRCClient<TCPTransport<TLS>, StaticLoginCredentials>) -> Chat {
Chat{
ratelimiters : ratelimiters,
client : client,
}
}
pub fn init_channel(&mut self, chnl:ChType) -> () { pub fn init_channel(&mut self, chnl:ChType) -> () {
let n = RateLimiter::new(); let n = RateLimiter::new();
self.ratelimiters.insert(chnl,n); self.ratelimiters.insert(chnl,n);

View file

@ -129,7 +129,9 @@ pub mod bot_actions {
use twitch_irc::message::PrivmsgMessage; use twitch_irc::message::PrivmsgMessage;
pub type ExecBody = Box<dyn Fn(Chat,PrivmsgMessage) -> Pin<Box<dyn Future<Output=()> + Send>> + Send + Sync>; pub type ExecBody = Box<dyn Fn(Chat,PrivmsgMessage) -> Pin<Box<dyn Future<Output=()> + Send>> + Send + Sync>;
//pub type ExecBody<F> = Box<dyn Fn(Chat,PrivmsgMessage) -> Pin<Box<dyn Future<Output=F> + Send>> + Send + Sync>;
//pub fn asyncbox<T,F>(f: fn(Chat,PrivmsgMessage) -> T) -> ExecBody<F>
pub fn asyncbox<T>(f: fn(Chat,PrivmsgMessage) -> T) -> ExecBody pub fn asyncbox<T>(f: fn(Chat,PrivmsgMessage) -> T) -> ExecBody
where where
T: Future<Output=()> + Send + 'static, T: Future<Output=()> + Send + 'static,