Custom Exec Bodies for BotCommand and Listeners #9

Merged
modulatingforce merged 14 commits from dev into main 2024-01-29 05:46:43 -05:00
2 changed files with 16 additions and 3 deletions
Showing only changes of commit 0472e56856 - Show all commits

View file

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