Exec Body Fn should be passed Parent BotAction
#43
7 changed files with 44 additions and 32 deletions
|
@ -27,7 +27,19 @@ impl ExecBodyParams {
|
|||
let parent_act = Arc::clone(&self.parent_act);
|
||||
let parent_act_lock = parent_act.read().await;
|
||||
let act = &(*parent_act_lock);
|
||||
let parent_module = match act {
|
||||
// let parent_module = match act {
|
||||
// BotAction::C(c) => {
|
||||
// let temp = c.module.clone();
|
||||
// Some(temp)
|
||||
// },
|
||||
// BotAction::L(l) => {
|
||||
// let temp = l.module.clone();
|
||||
// Some(temp)
|
||||
// },
|
||||
// _ => None
|
||||
// };
|
||||
// parent_module
|
||||
match act {
|
||||
BotAction::C(c) => {
|
||||
let temp = c.module.clone();
|
||||
Some(temp)
|
||||
|
@ -37,8 +49,7 @@ impl ExecBodyParams {
|
|||
Some(temp)
|
||||
},
|
||||
_ => None
|
||||
};
|
||||
parent_module
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_sender(&self) -> String {
|
||||
|
@ -57,9 +68,10 @@ impl ExecBodyParams {
|
|||
}
|
||||
}
|
||||
|
||||
let requestor_badge = requestor_badge_mut;
|
||||
// let requestor_badge = requestor_badge_mut;
|
||||
|
||||
requestor_badge
|
||||
// requestor_badge
|
||||
requestor_badge_mut
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ use crate::core::ratelimiter::RateLimiter;
|
|||
// 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};
|
||||
use crate::core::identity::{IdentityManager, Permissible};
|
||||
|
||||
use crate::core::botlog;
|
||||
use crate::core::chat::Chat;
|
||||
|
@ -47,7 +47,7 @@ pub enum ChangeResult {
|
|||
pub struct Channel(pub String);
|
||||
|
||||
use super::bot_actions::ExecBodyParams;
|
||||
use super::botmodules::{BotAction, StatusType};
|
||||
use super::botmodules::StatusType;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct BotManagers {
|
||||
|
|
|
@ -24,7 +24,7 @@ use core::panic;
|
|||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
|
||||
use twitch_irc::message::PrivmsgMessage;
|
||||
// use twitch_irc::message::PrivmsgMessage;
|
||||
|
||||
use casual_logger::Log;
|
||||
|
||||
|
@ -33,7 +33,7 @@ use tokio::sync::RwLock;
|
|||
use async_trait::async_trait;
|
||||
|
||||
// use self::bot_actions::actions_util::BotAR;
|
||||
use crate::core::bot_actions::BotAR;
|
||||
// use crate::core::bot_actions::BotAR;
|
||||
use crate::core::bot_actions::actions_util;
|
||||
use crate::core::bot_actions::ExecBodyParams;
|
||||
use crate::core::botinstance::{BotInstance, Channel,ChangeResult};
|
||||
|
@ -181,7 +181,7 @@ pub async fn init(mgr: Arc<ModulesManager>) {
|
|||
// if let None = trg_module {
|
||||
if trg_module.is_none() {
|
||||
|
||||
let botlock = params.bot.read().await;
|
||||
// let botlock = params.bot.read().await;
|
||||
|
||||
let outmsg = "uuh You need to pass a module";
|
||||
|
||||
|
@ -197,13 +197,13 @@ pub async fn init(mgr: Arc<ModulesManager>) {
|
|||
|
||||
let botclone = Arc::clone(&bot);
|
||||
let botlock = botclone.read().await;
|
||||
let id = botlock.get_identity();
|
||||
let id = Arc::clone(&id);
|
||||
let idlock = id.read().await; // <-- [ ] 03.24 - seems to work
|
||||
let user_roles = idlock.getspecialuserroles(
|
||||
params.msg.sender.name.clone(),
|
||||
Some(Channel(params.msg.channel_login.clone()))
|
||||
).await;
|
||||
// let id = botlock.get_identity();
|
||||
// let id = Arc::clone(&id);
|
||||
// let idlock = id.read().await; // <-- [ ] 03.24 - seems to work
|
||||
// let user_roles = idlock.getspecialuserroles(
|
||||
// params.msg.sender.name.clone(),
|
||||
// Some(Channel(params.msg.channel_login.clone()))
|
||||
// ).await;
|
||||
|
||||
botlock.botmgrs.chat.send_botmsg(super::chat::BotMsgType::Notif(
|
||||
outmsg.to_string()
|
||||
|
@ -367,7 +367,7 @@ pub async fn init(mgr: Arc<ModulesManager>) {
|
|||
// _ => None,
|
||||
// };
|
||||
|
||||
let parent_module = params.get_parent_module().await;
|
||||
// let parent_module = params.get_parent_module().await;
|
||||
|
||||
// [x] Unwraps arguments from message
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ use casual_logger::Log;
|
|||
|
||||
use rand::Rng;
|
||||
|
||||
use crate::core::identity::Permissible;
|
||||
// use crate::core::identity::Permissible;
|
||||
use crate::core::ratelimiter;
|
||||
use crate::core::ratelimiter::RateLimiter;
|
||||
|
||||
|
@ -23,7 +23,7 @@ use crate::core::botlog;
|
|||
use tokio::time::{sleep, Duration};
|
||||
|
||||
use super::bot_actions::ExecBodyParams;
|
||||
use super::botmodules::BotModule;
|
||||
// use super::botmodules::BotModule;
|
||||
use super::identity;
|
||||
|
||||
|
||||
|
|
|
@ -8,11 +8,11 @@ use twitch_irc::message::PrivmsgMessage;
|
|||
use casual_logger::Log;
|
||||
|
||||
use crate::core::bot_actions::actions_util;
|
||||
use crate::core::bot_actions::BotAR;
|
||||
// use crate::core::bot_actions::BotAR;
|
||||
use crate::core::bot_actions::ExecBodyParams;
|
||||
use crate::core::botinstance::{Channel,ChangeResult};
|
||||
use crate::core::botlog;
|
||||
use crate::core::botmodules::BotAction;
|
||||
// use crate::core::botmodules::BotAction;
|
||||
use crate::core::botmodules::{BotActionTrait, BotCommand, BotModule, ModulesManager};
|
||||
|
||||
use dotenv::dotenv;
|
||||
|
@ -121,7 +121,7 @@ pub async fn init(mgr: Arc<ModulesManager>) {
|
|||
// _ => None,
|
||||
// };
|
||||
|
||||
let parent_module = params.get_parent_module().await;
|
||||
// let parent_module = params.get_parent_module().await;
|
||||
|
||||
// println!("{}",params.msg.message_text);
|
||||
botlog::trace(
|
||||
|
@ -331,7 +331,7 @@ pub async fn init(mgr: Arc<ModulesManager>) {
|
|||
// _ => None,
|
||||
// };
|
||||
|
||||
let parent_module = params.get_parent_module().await;
|
||||
// let parent_module = params.get_parent_module().await;
|
||||
|
||||
|
||||
// [x] Unwraps arguments from message
|
||||
|
@ -540,7 +540,7 @@ pub async fn init(mgr: Arc<ModulesManager>) {
|
|||
// _ => None,
|
||||
// };
|
||||
|
||||
let parent_module = params.get_parent_module().await;
|
||||
// let parent_module = params.get_parent_module().await;
|
||||
|
||||
let mut argv = params.msg.message_text.split(' ');
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
use rand::Rng;
|
||||
use std::sync::Arc;
|
||||
|
||||
use twitch_irc::message::PrivmsgMessage;
|
||||
// use twitch_irc::message::PrivmsgMessage;
|
||||
|
||||
use crate::core::bot_actions::ExecBodyParams;
|
||||
// use crate::core::botinstance::ChType::Channel;
|
||||
|
@ -21,8 +21,8 @@ use crate::core::botinstance::Channel;
|
|||
use crate::core::botlog;
|
||||
|
||||
use crate::core::bot_actions::actions_util;
|
||||
use crate::core::bot_actions::BotAR;
|
||||
use crate::core::botmodules::BotAction;
|
||||
// use crate::core::bot_actions::BotAR;
|
||||
// use crate::core::botmodules::BotAction;
|
||||
use crate::core::botmodules::{BotActionTrait, BotCommand, BotModule, Listener, ModulesManager};
|
||||
|
||||
use crate::core::identity::UserRole::*;
|
||||
|
@ -215,7 +215,7 @@ async fn babygirl(params : ExecBodyParams) {
|
|||
|
||||
|
||||
|
||||
let parent_module = params.get_parent_module().await;
|
||||
// let parent_module = params.get_parent_module().await;
|
||||
|
||||
|
||||
println!("babygirl triggered!"); // NOTE : This test function intends to print (e.g., to stdout) at fn call
|
||||
|
|
|
@ -15,19 +15,19 @@ use std::sync::Arc;
|
|||
|
||||
use chrono::{TimeZone,Local};
|
||||
|
||||
use twitch_irc::message::PrivmsgMessage;
|
||||
// use twitch_irc::message::PrivmsgMessage;
|
||||
|
||||
use crate::core::bot_actions::ExecBodyParams;
|
||||
// use crate::core::botinstance::ChType::Channel;
|
||||
use crate::core::botinstance::Channel;
|
||||
// use ChType::Channel;
|
||||
use crate::core::botlog;
|
||||
use crate::core::botmodules::BotAction;
|
||||
// use crate::core::botmodules::BotAction;
|
||||
|
||||
use casual_logger::Log;
|
||||
|
||||
use crate::core::bot_actions::actions_util;
|
||||
use crate::core::bot_actions::BotAR;
|
||||
// use crate::core::bot_actions::BotAR;
|
||||
use crate::core::botmodules::{BotActionTrait, BotCommand, BotModule, ModulesManager};
|
||||
|
||||
use crate::core::identity::UserRole::*;
|
||||
|
|
Loading…
Reference in a new issue