(cont) BotManagers

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

View file

@ -48,6 +48,14 @@ pub struct 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) -> () {
let n = RateLimiter::new();
self.ratelimiters.insert(chnl,n);

View file

@ -129,7 +129,9 @@ pub mod bot_actions {
use twitch_irc::message::PrivmsgMessage;
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
where
T: Future<Output=()> + Send + 'static,