validate status
This commit is contained in:
parent
29c8f74531
commit
ba6117d692
1 changed files with 19 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue