This commit is contained in:
parent
582702fab2
commit
2c298663b1
1 changed files with 33 additions and 8 deletions
|
@ -19,7 +19,7 @@ use crate::core::ratelimiter::RateLimiter;
|
|||
|
||||
use crate::core::bot_actions::actions_util::BotAR;
|
||||
use crate::core::botmodules::ModulesManager;
|
||||
use crate::core::identity::{IdentityManager, Permissible};
|
||||
use crate::core::identity::{IdentityManager, Permissible,self};
|
||||
|
||||
use crate::core::botlog;
|
||||
use crate::core::chat::Chat;
|
||||
|
@ -295,7 +295,7 @@ 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
|
||||
// [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(
|
||||
c.module.clone(),
|
||||
|
@ -303,10 +303,35 @@ impl BotInstance {
|
|||
|
||||
|
||||
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
|
||||
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
|
@ -350,7 +375,7 @@ impl BotInstance {
|
|||
match eval {
|
||||
Permissible::Allow => {
|
||||
botlog::debug(
|
||||
"Executed as permissible",
|
||||
"Executing as permissible",
|
||||
Some("BotInstance > listener_main_prvmsg()".to_string()),
|
||||
Some(msg),
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue