From 0472e5685688c5b361f7505ec773839d41e8464b Mon Sep 17 00:00:00 2001 From: ModulatingForce <116608425+modulatingforce@users.noreply.github.com> Date: Mon, 29 Jan 2024 02:27:11 -0500 Subject: [PATCH] BotAction can execute --- src/core/botinstance.rs | 7 ++++--- src/core/botmodules.rs | 12 ++++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/core/botinstance.rs b/src/core/botinstance.rs index 0f1ce9a..ae59b74 100644 --- a/src/core/botinstance.rs +++ b/src/core/botinstance.rs @@ -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; } }; diff --git a/src/core/botmodules.rs b/src/core/botmodules.rs index e2f0647..3053f1c 100644 --- a/src/core/botmodules.rs +++ b/src/core/botmodules.rs @@ -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 // where