This commit is contained in:
ModulatingForce 2024-03-25 15:46:37 -04:00
parent d746d0d073
commit f582c36f97
7 changed files with 44 additions and 32 deletions

View file

@ -27,7 +27,19 @@ impl ExecBodyParams {
let parent_act = Arc::clone(&self.parent_act); let parent_act = Arc::clone(&self.parent_act);
let parent_act_lock = parent_act.read().await; let parent_act_lock = parent_act.read().await;
let act = &(*parent_act_lock); 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) => { BotAction::C(c) => {
let temp = c.module.clone(); let temp = c.module.clone();
Some(temp) Some(temp)
@ -37,8 +49,7 @@ impl ExecBodyParams {
Some(temp) Some(temp)
}, },
_ => None _ => None
}; }
parent_module
} }
pub fn get_sender(&self) -> String { 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
} }

View file

@ -20,7 +20,7 @@ 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::bot_actions::BotAR;
use crate::core::botmodules::ModulesManager; 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::botlog;
use crate::core::chat::Chat; use crate::core::chat::Chat;
@ -47,7 +47,7 @@ pub enum ChangeResult {
pub struct Channel(pub String); pub struct Channel(pub String);
use super::bot_actions::ExecBodyParams; use super::bot_actions::ExecBodyParams;
use super::botmodules::{BotAction, StatusType}; use super::botmodules::StatusType;
#[derive(Clone)] #[derive(Clone)]
pub struct BotManagers { pub struct BotManagers {

View file

@ -24,7 +24,7 @@ use core::panic;
use std::collections::HashMap; use std::collections::HashMap;
use std::sync::Arc; use std::sync::Arc;
use twitch_irc::message::PrivmsgMessage; // use twitch_irc::message::PrivmsgMessage;
use casual_logger::Log; use casual_logger::Log;
@ -33,7 +33,7 @@ use tokio::sync::RwLock;
use async_trait::async_trait; 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::BotAR;
use crate::core::bot_actions::actions_util; use crate::core::bot_actions::actions_util;
use crate::core::bot_actions::ExecBodyParams; use crate::core::bot_actions::ExecBodyParams;
use crate::core::botinstance::{BotInstance, Channel,ChangeResult}; use crate::core::botinstance::{BotInstance, Channel,ChangeResult};
@ -181,7 +181,7 @@ pub async fn init(mgr: Arc<ModulesManager>) {
// if let None = trg_module { // if let None = trg_module {
if trg_module.is_none() { 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"; 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 botclone = Arc::clone(&bot);
let botlock = botclone.read().await; let botlock = botclone.read().await;
let id = botlock.get_identity(); // let id = botlock.get_identity();
let id = Arc::clone(&id); // let id = Arc::clone(&id);
let idlock = id.read().await; // <-- [ ] 03.24 - seems to work // let idlock = id.read().await; // <-- [ ] 03.24 - seems to work
let user_roles = idlock.getspecialuserroles( // let user_roles = idlock.getspecialuserroles(
params.msg.sender.name.clone(), // params.msg.sender.name.clone(),
Some(Channel(params.msg.channel_login.clone())) // Some(Channel(params.msg.channel_login.clone()))
).await; // ).await;
botlock.botmgrs.chat.send_botmsg(super::chat::BotMsgType::Notif( botlock.botmgrs.chat.send_botmsg(super::chat::BotMsgType::Notif(
outmsg.to_string() outmsg.to_string()
@ -367,7 +367,7 @@ pub async fn init(mgr: Arc<ModulesManager>) {
// _ => None, // _ => None,
// }; // };
let parent_module = params.get_parent_module().await; // let parent_module = params.get_parent_module().await;
// [x] Unwraps arguments from message // [x] Unwraps arguments from message

View file

@ -12,7 +12,7 @@ use casual_logger::Log;
use rand::Rng; use rand::Rng;
use crate::core::identity::Permissible; // use crate::core::identity::Permissible;
use crate::core::ratelimiter; use crate::core::ratelimiter;
use crate::core::ratelimiter::RateLimiter; use crate::core::ratelimiter::RateLimiter;
@ -23,7 +23,7 @@ use crate::core::botlog;
use tokio::time::{sleep, Duration}; use tokio::time::{sleep, Duration};
use super::bot_actions::ExecBodyParams; use super::bot_actions::ExecBodyParams;
use super::botmodules::BotModule; // use super::botmodules::BotModule;
use super::identity; use super::identity;

View file

@ -8,11 +8,11 @@ use twitch_irc::message::PrivmsgMessage;
use casual_logger::Log; use casual_logger::Log;
use crate::core::bot_actions::actions_util; 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::bot_actions::ExecBodyParams;
use crate::core::botinstance::{Channel,ChangeResult}; use crate::core::botinstance::{Channel,ChangeResult};
use crate::core::botlog; use crate::core::botlog;
use crate::core::botmodules::BotAction; // use crate::core::botmodules::BotAction;
use crate::core::botmodules::{BotActionTrait, BotCommand, BotModule, ModulesManager}; use crate::core::botmodules::{BotActionTrait, BotCommand, BotModule, ModulesManager};
use dotenv::dotenv; use dotenv::dotenv;
@ -121,7 +121,7 @@ pub async fn init(mgr: Arc<ModulesManager>) {
// _ => None, // _ => None,
// }; // };
let parent_module = params.get_parent_module().await; // let parent_module = params.get_parent_module().await;
// println!("{}",params.msg.message_text); // println!("{}",params.msg.message_text);
botlog::trace( botlog::trace(
@ -331,7 +331,7 @@ pub async fn init(mgr: Arc<ModulesManager>) {
// _ => None, // _ => None,
// }; // };
let parent_module = params.get_parent_module().await; // let parent_module = params.get_parent_module().await;
// [x] Unwraps arguments from message // [x] Unwraps arguments from message
@ -540,7 +540,7 @@ pub async fn init(mgr: Arc<ModulesManager>) {
// _ => None, // _ => 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(' '); let mut argv = params.msg.message_text.split(' ');

View file

@ -13,7 +13,7 @@
use rand::Rng; use rand::Rng;
use std::sync::Arc; use std::sync::Arc;
use twitch_irc::message::PrivmsgMessage; // use twitch_irc::message::PrivmsgMessage;
use crate::core::bot_actions::ExecBodyParams; use crate::core::bot_actions::ExecBodyParams;
// use crate::core::botinstance::ChType::Channel; // use crate::core::botinstance::ChType::Channel;
@ -21,8 +21,8 @@ use crate::core::botinstance::Channel;
use crate::core::botlog; use crate::core::botlog;
use crate::core::bot_actions::actions_util; use crate::core::bot_actions::actions_util;
use crate::core::bot_actions::BotAR; // use crate::core::bot_actions::BotAR;
use crate::core::botmodules::BotAction; // use crate::core::botmodules::BotAction;
use crate::core::botmodules::{BotActionTrait, BotCommand, BotModule, Listener, ModulesManager}; use crate::core::botmodules::{BotActionTrait, BotCommand, BotModule, Listener, ModulesManager};
use crate::core::identity::UserRole::*; 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 println!("babygirl triggered!"); // NOTE : This test function intends to print (e.g., to stdout) at fn call

View file

@ -15,19 +15,19 @@ use std::sync::Arc;
use chrono::{TimeZone,Local}; use chrono::{TimeZone,Local};
use twitch_irc::message::PrivmsgMessage; // use twitch_irc::message::PrivmsgMessage;
use crate::core::bot_actions::ExecBodyParams; use crate::core::bot_actions::ExecBodyParams;
// use crate::core::botinstance::ChType::Channel; // use crate::core::botinstance::ChType::Channel;
use crate::core::botinstance::Channel; use crate::core::botinstance::Channel;
// use ChType::Channel; // use ChType::Channel;
use crate::core::botlog; use crate::core::botlog;
use crate::core::botmodules::BotAction; // use crate::core::botmodules::BotAction;
use casual_logger::Log; use casual_logger::Log;
use crate::core::bot_actions::actions_util; 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::botmodules::{BotActionTrait, BotCommand, BotModule, ModulesManager};
use crate::core::identity::UserRole::*; use crate::core::identity::UserRole::*;