diff --git a/src/core/botinstance.rs b/src/core/botinstance.rs index 2f1548c..1452860 100644 --- a/src/core/botinstance.rs +++ b/src/core/botinstance.rs @@ -307,6 +307,12 @@ impl BotInstance { // [x] Should only respond if a BotAdmin , Mod , SupMod , BroadCaster // - Specifically it should respond only to those who may be able to enable the module + botlog::trace( + &format!("Identified cmd is associated with Disabled Module : StatusLvl = {:?}", a), + Some("BotInstance > listener_main_prvmsg()".to_string()), + Some(msg), + ); + const OF_CMD_CHANNEL:ChType = Channel(String::new()); @@ -403,8 +409,62 @@ impl BotInstance { } crate::core::botmodules::BotAction::L(l) => { - let a = Arc::clone(&bot); - l.execute(a, msg.clone()).await; + + let botlock = bot.read().await; + // let id = botlock.get_identity(); + + // [x] Check first if the Module for that Given Command is Enabled or Disabled on the given Channel + let modmgr = Arc::clone(&botlock.botmodules); + let modstatus = modmgr.modstatus( + l.module.clone(), + ChType::Channel(msg.channel_login.to_string())).await; + + + if let StatusType::Disabled(a) = modstatus { + + // [x] Should only respond if a BotAdmin , Mod , SupMod , BroadCaster + // - Specifically it should respond only to those who may be able to enable the module + + botlog::trace( + &format!("Identified listener is associated with Disabled Module : StatusLvl = {:?}", a), + Some("BotInstance > listener_main_prvmsg()".to_string()), + Some(msg), + ); + + + // const OF_CMD_CHANNEL:ChType = Channel(String::new()); + + // let elevated_access = { + // let mut idlock = id.write().await; + // let (permissability, _) = idlock + // .can_user_run_prvmsg(msg, + // vec![ + // identity::UserRole::BotAdmin, + // identity::UserRole::Mod(OF_CMD_CHANNEL), + // identity::UserRole::SupMod(OF_CMD_CHANNEL), + // identity::UserRole::Broadcaster, + // ]) + // .await; + + // permissability + // }; + + // if let Permissible::Allow = elevated_access { + // let botlock = bot.read().await; + // let outstr = + // format!("sadg Module is disabled : {:?}",a); + // botlock.botmgrs.chat.say_in_reply_to(msg, outstr).await; + // } + + //return; + } else { + let a = Arc::clone(&bot); + l.execute(a, msg.clone()).await; + } + + + // let a = Arc::clone(&bot); + // l.execute(a, msg.clone()).await; } _ => (), diff --git a/src/custom/experiments.rs b/src/custom/experiments.rs index de2f424..529e551 100644 --- a/src/custom/experiments.rs +++ b/src/custom/experiments.rs @@ -125,7 +125,7 @@ async fn good_girl(bot: BotAR, msg: PrivmsgMessage) { Some(&msg), ); - let rollwin = rand::thread_rng().gen_ratio(1, 8); + let rollwin = rand::thread_rng().gen_ratio(1, 1); if rollwin { botlog::debug(