From 616d1f564fe5ecd33e532ecc7a84775599d41b5c Mon Sep 17 00:00:00 2001 From: ModulatingForce <116608425+modulatingforce@users.noreply.github.com> Date: Sun, 24 Mar 2024 14:09:08 -0400 Subject: [PATCH] reorg botactions.rs --- src/core/bot_actions.rs | 29 +++++++++++++++++------- src/core/botinstance.rs | 3 ++- src/core/botmodules.rs | 3 ++- src/core/identity.rs | 3 ++- src/custom/experimental/experiment001.rs | 3 ++- src/custom/experimental/experiment002.rs | 3 ++- 6 files changed, 31 insertions(+), 13 deletions(-) diff --git a/src/core/bot_actions.rs b/src/core/bot_actions.rs index 2e6b456..474291c 100644 --- a/src/core/bot_actions.rs +++ b/src/core/bot_actions.rs @@ -1,18 +1,31 @@ + +use twitch_irc::message::PrivmsgMessage; +use std::sync::Arc; +// use tokio::sync::{Mutex, RwLock}; +use tokio::sync::RwLock; + +use crate::core::botinstance::BotInstance; + + +pub type BotAR = Arc>; + + +pub struct ExecBodyParams { + bot : BotAR, + msg : PrivmsgMessage, + // parent_act : BotAction , +} + pub mod actions_util { + use super::*; + use std::boxed::Box; use std::future::Future; use std::pin::Pin; - use std::sync::Arc; - use tokio::sync::{Mutex, RwLock}; - use twitch_irc::message::PrivmsgMessage; - - use crate::core::botinstance::BotInstance; - - pub type BotAM = Arc>; - pub type BotAR = Arc>; + // pub type BotAM = Arc>; pub type ExecBody = Box< dyn Fn(BotAR, PrivmsgMessage) -> Pin + Send>> + Send + Sync, diff --git a/src/core/botinstance.rs b/src/core/botinstance.rs index c5b6dca..15f16a1 100644 --- a/src/core/botinstance.rs +++ b/src/core/botinstance.rs @@ -17,7 +17,8 @@ use casual_logger::Log; use crate::core::ratelimiter::RateLimiter; -use crate::core::bot_actions::actions_util::BotAR; +// use crate::core::bot_actions::actions_util::BotAR; +use crate::core::bot_actions::BotAR; use crate::core::botmodules::ModulesManager; use crate::core::identity::{IdentityManager, Permissible,self}; diff --git a/src/core/botmodules.rs b/src/core/botmodules.rs index f9d7ff0..d0028e3 100644 --- a/src/core/botmodules.rs +++ b/src/core/botmodules.rs @@ -32,7 +32,8 @@ use tokio::sync::RwLock; use async_trait::async_trait; -use self::bot_actions::actions_util::BotAR; +// use self::bot_actions::actions_util::BotAR; +use crate::core::bot_actions::BotAR; use crate::core::bot_actions::actions_util; use crate::core::botinstance::{BotInstance, Channel,ChangeResult}; use crate::core::botlog; diff --git a/src/core/identity.rs b/src/core/identity.rs index e816e9f..4243d26 100644 --- a/src/core/identity.rs +++ b/src/core/identity.rs @@ -7,7 +7,8 @@ use twitch_irc::message::PrivmsgMessage; use casual_logger::Log; -use crate::core::bot_actions::actions_util::{self, BotAR}; +use crate::core::bot_actions::actions_util; +use crate::core::bot_actions::BotAR; use crate::core::botinstance::{Channel,ChangeResult}; use crate::core::botlog; use crate::core::botmodules::{BotActionTrait, BotCommand, BotModule, ModulesManager}; diff --git a/src/custom/experimental/experiment001.rs b/src/custom/experimental/experiment001.rs index f83693a..9b2c174 100644 --- a/src/custom/experimental/experiment001.rs +++ b/src/custom/experimental/experiment001.rs @@ -19,7 +19,8 @@ use twitch_irc::message::PrivmsgMessage; use crate::core::botinstance::Channel; use crate::core::botlog; -use crate::core::bot_actions::actions_util::{self, BotAR}; +use crate::core::bot_actions::actions_util; +use crate::core::bot_actions::BotAR; use crate::core::botmodules::{BotActionTrait, BotCommand, BotModule, Listener, ModulesManager}; use crate::core::identity::UserRole::*; diff --git a/src/custom/experimental/experiment002.rs b/src/custom/experimental/experiment002.rs index 2a97b30..2dd63f4 100644 --- a/src/custom/experimental/experiment002.rs +++ b/src/custom/experimental/experiment002.rs @@ -24,7 +24,8 @@ use crate::core::botlog; use casual_logger::Log; -use crate::core::bot_actions::actions_util::{self, BotAR}; +use crate::core::bot_actions::actions_util; +use crate::core::bot_actions::BotAR; use crate::core::botmodules::{BotActionTrait, BotCommand, BotModule, ModulesManager}; use crate::core::identity::UserRole::*;