listener modules validated
Some checks failed
ci/woodpecker/pr/cargo-checks Pipeline failed

This commit is contained in:
ModulatingForce 2024-03-22 19:50:25 -04:00
parent 2c298663b1
commit 4b0d51a674
2 changed files with 63 additions and 3 deletions

View file

@ -307,6 +307,12 @@ impl BotInstance {
// [x] Should only respond if a BotAdmin , Mod , SupMod , BroadCaster // [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 // - 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()); const OF_CMD_CHANNEL:ChType = Channel(String::new());
@ -403,8 +409,62 @@ impl BotInstance {
} }
crate::core::botmodules::BotAction::L(l) => { 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;
} }
_ => (), _ => (),

View file

@ -125,7 +125,7 @@ async fn good_girl(bot: BotAR, msg: PrivmsgMessage) {
Some(&msg), Some(&msg),
); );
let rollwin = rand::thread_rng().gen_ratio(1, 8); let rollwin = rand::thread_rng().gen_ratio(1, 1);
if rollwin { if rollwin {
botlog::debug( botlog::debug(