From 1c123a6ab0ff22694636a45ce31c3fc39ae6ecc2 Mon Sep 17 00:00:00 2001 From: ModulatingForce <116608425+modulatingforce@users.noreply.github.com> Date: Wed, 31 Jan 2024 01:07:27 -0500 Subject: [PATCH] (cont) BotManagers --- src/core/botinstance.rs | 8 ++++++++ src/core/botmodules.rs | 2 ++ 2 files changed, 10 insertions(+) diff --git a/src/core/botinstance.rs b/src/core/botinstance.rs index 80bfb06..6b3903f 100644 --- a/src/core/botinstance.rs +++ b/src/core/botinstance.rs @@ -48,6 +48,14 @@ pub struct Chat { impl Chat { + pub fn init(ratelimiters:HashMap, + client:TwitchIRCClient, StaticLoginCredentials>) -> Chat { + Chat{ + ratelimiters : ratelimiters, + client : client, + } + } + pub fn init_channel(&mut self, chnl:ChType) -> () { let n = RateLimiter::new(); self.ratelimiters.insert(chnl,n); diff --git a/src/core/botmodules.rs b/src/core/botmodules.rs index 4035a35..bdaba67 100644 --- a/src/core/botmodules.rs +++ b/src/core/botmodules.rs @@ -129,7 +129,9 @@ pub mod bot_actions { use twitch_irc::message::PrivmsgMessage; pub type ExecBody = Box Pin + Send>> + Send + Sync>; + //pub type ExecBody = Box Pin + Send>> + Send + Sync>; + //pub fn asyncbox(f: fn(Chat,PrivmsgMessage) -> T) -> ExecBody pub fn asyncbox(f: fn(Chat,PrivmsgMessage) -> T) -> ExecBody where T: Future + Send + 'static,