ModulesManager #37

Merged
modulatingforce merged 22 commits from modulesmanager into main 2024-03-22 21:34:08 -04:00
Showing only changes of commit ba6117d692 - Show all commits

View file

@ -41,6 +41,8 @@ pub enum ChType {
pub use ChType::Channel;
use super::botmodules::StatusType;
#[derive(Clone)]
pub struct BotManagers {
pub identity: Arc<RwLock<IdentityManager>>,
@ -293,6 +295,23 @@ impl BotInstance {
let botlock = bot.read().await;
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 mut idlock = id.write().await;
let (permissability, chngrslt) = idlock