Exec Body Fn should be passed Parent BotAction #43

Merged
modulatingforce merged 19 commits from parent-botaction-to-child-fn into main 2024-03-25 16:29:44 -04:00
6 changed files with 31 additions and 13 deletions
Showing only changes of commit 616d1f564f - Show all commits

View file

@ -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<RwLock<BotInstance>>;
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<Mutex<BotInstance>>;
pub type BotAR = Arc<RwLock<BotInstance>>;
// pub type BotAM = Arc<Mutex<BotInstance>>;
pub type ExecBody = Box<
dyn Fn(BotAR, PrivmsgMessage) -> Pin<Box<dyn Future<Output = ()> + Send>> + Send + Sync,

View file

@ -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};

View file

@ -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;

View file

@ -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};

View file

@ -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::*;

View file

@ -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::*;