Custom Exec Bodies for BotCommand and Listeners #9
2 changed files with 16 additions and 3 deletions
|
@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue