validate status

This commit is contained in:
ModulatingForce 2024-03-22 18:32:03 -04:00
parent 29c8f74531
commit ba6117d692

View file

@ -41,6 +41,8 @@ pub enum ChType {
pub use ChType::Channel; pub use ChType::Channel;
use super::botmodules::StatusType;
#[derive(Clone)] #[derive(Clone)]
pub struct BotManagers { pub struct BotManagers {
pub identity: Arc<RwLock<IdentityManager>>, pub identity: Arc<RwLock<IdentityManager>>,
@ -293,6 +295,23 @@ impl BotInstance {
let botlock = bot.read().await; let botlock = bot.read().await;
let id = botlock.get_identity(); let id = botlock.get_identity();
// [ ] 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(
c.module.clone(),
ChType::Channel(msg.channel_login.to_string())).await;
if let StatusType::Disabled(a) = modstatus {
let botlock = bot.read().await;
let outstr =
format!("sadg Module is disabled : {:?}",a);
botlock.botmgrs.chat.say_in_reply_to(msg, outstr).await;
return;
};
let eval = { let eval = {
let mut idlock = id.write().await; let mut idlock = id.write().await;
let (permissability, chngrslt) = idlock let (permissability, chngrslt) = idlock