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::bot_actions::actions_util::BotAR;
|
||||||
use crate::core::botmodules::ModulesManager;
|
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::botlog;
|
||||||
use crate::core::chat::Chat;
|
use crate::core::chat::Chat;
|
||||||
|
@ -295,7 +295,7 @@ 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
|
// [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 modmgr = Arc::clone(&botlock.botmodules);
|
||||||
let modstatus = modmgr.modstatus(
|
let modstatus = modmgr.modstatus(
|
||||||
c.module.clone(),
|
c.module.clone(),
|
||||||
|
@ -303,10 +303,35 @@ impl BotInstance {
|
||||||
|
|
||||||
|
|
||||||
if let StatusType::Disabled(a) = modstatus {
|
if let StatusType::Disabled(a) = modstatus {
|
||||||
let botlock = bot.read().await;
|
|
||||||
let outstr =
|
// [x] Should only respond if a BotAdmin , Mod , SupMod , BroadCaster
|
||||||
format!("sadg Module is disabled : {:?}",a);
|
// - Specifically it should respond only to those who may be able to enable the module
|
||||||
botlock.botmgrs.chat.say_in_reply_to(msg, outstr).await;
|
|
||||||
|
|
||||||
|
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;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -350,7 +375,7 @@ impl BotInstance {
|
||||||
match eval {
|
match eval {
|
||||||
Permissible::Allow => {
|
Permissible::Allow => {
|
||||||
botlog::debug(
|
botlog::debug(
|
||||||
"Executed as permissible",
|
"Executing as permissible",
|
||||||
Some("BotInstance > listener_main_prvmsg()".to_string()),
|
Some("BotInstance > listener_main_prvmsg()".to_string()),
|
||||||
Some(msg),
|
Some(msg),
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue