BotAction can execute

This commit is contained in:
ModulatingForce 2024-01-29 02:27:11 -05:00
parent 853557af08
commit 0472e56856
2 changed files with 16 additions and 3 deletions

View file

@ -407,9 +407,10 @@ impl BotInstance
for (_m,acts) in &self.botmodules.botactions { for (_m,acts) in &self.botmodules.botactions {
for a in acts { for a in acts {
if let crate::core::botmodules::BotAction::L(lsnr) = a { // if let crate::core::botmodules::BotAction::L(lsnr) = a {
lsnr.execute(self.chat.clone(),msg.clone()).await; // lsnr.execute(self.chat.clone(),msg.clone()).await;
} // }
a.execute(self.chat.clone(), msg.clone()).await;
} }
}; };

View file

@ -74,6 +74,18 @@ pub enum BotAction
R(Routine), R(Routine),
} }
impl BotAction {
pub async fn execute(&self,m:botinstance::Chat,n:PrivmsgMessage){
match self {
BotAction::L(a) => a.execute(m,n).await,
_ => (),
}
// (self.exec_body)(m,n).await;
}
}
// pub trait BotActionTrait<F> // pub trait BotActionTrait<F>
// where // where