parent
f582c36f97
commit
6912708cfb
7 changed files with 17 additions and 821 deletions
src/core
|
@ -17,7 +17,6 @@ use casual_logger::Log;
|
|||
|
||||
use crate::core::ratelimiter::RateLimiter;
|
||||
|
||||
// use crate::core::bot_actions::actions_util::BotAR;
|
||||
use crate::core::bot_actions::BotAR;
|
||||
use crate::core::botmodules::ModulesManager;
|
||||
use crate::core::identity::{IdentityManager, Permissible};
|
||||
|
@ -34,16 +33,8 @@ pub enum ChangeResult {
|
|||
}
|
||||
|
||||
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, Hash, Clone)]
|
||||
|
||||
// pub enum ChType {
|
||||
// Channel(String),
|
||||
// }
|
||||
//
|
||||
// pub use ChType::Channel;
|
||||
//
|
||||
//simplifying from enum to struct
|
||||
pub struct Channel(pub String);
|
||||
|
||||
use super::bot_actions::ExecBodyParams;
|
||||
|
@ -316,12 +307,8 @@ impl BotInstance {
|
|||
|
||||
for a in acts {
|
||||
|
||||
// let act_ar = Arc::new(RwLock::new(a));
|
||||
// let act_ar_clone = Arc::clone(&act_ar);
|
||||
let act_clone = Arc::clone(a);
|
||||
|
||||
// match a {
|
||||
// match &(*act_ar_clone.read().await) {
|
||||
match &(*act_clone.read().await) {
|
||||
crate::core::botmodules::BotAction::C(c) => {
|
||||
/*
|
||||
|
@ -428,85 +415,6 @@ impl BotInstance {
|
|||
params,
|
||||
).await;
|
||||
|
||||
|
||||
// if user_roles.contains(&identity::UserRole::Mod(Channel(msg.channel_login.clone())))
|
||||
// || user_roles.contains(&identity::UserRole::SupMod(Channel(msg.channel_login.clone())))
|
||||
// || user_roles.contains(&identity::UserRole::Broadcaster)
|
||||
// || user_roles.contains(&identity::UserRole::BotAdmin)
|
||||
// {
|
||||
|
||||
|
||||
// // self.say_in_reply_to(
|
||||
// // ¶ms.msg,
|
||||
// // format!("uuh You do not have the right roles to send to {}",
|
||||
// // channel_login.clone(),
|
||||
// // ),
|
||||
// // params.clone()
|
||||
// // ).await;
|
||||
// let outstr =
|
||||
// format!("sadg Module is disabled : {:?}",a);
|
||||
|
||||
|
||||
// let params = ExecBodyParams {
|
||||
// bot : Arc::clone(&bot),
|
||||
// msg : (*msg).clone(),
|
||||
// parent_act : Arc::clone(&act_clone),
|
||||
// };
|
||||
|
||||
// botlock.botmgrs.chat.say_in_reply_to(
|
||||
// msg,
|
||||
// outstr,
|
||||
// // c.module.clone()
|
||||
// params,
|
||||
// ).await;
|
||||
|
||||
// }
|
||||
|
||||
|
||||
// botlog::trace(
|
||||
// "ACQUIRING WRITE LOCK : ID",
|
||||
// Some("BotInstance > listener_main_prvmsg()".to_string()),
|
||||
// Some(msg),
|
||||
// );
|
||||
|
||||
|
||||
// const OF_CMD_CHANNEL:Channel = 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);
|
||||
|
||||
// let params = ExecBodyParams {
|
||||
// bot : Arc::clone(&bot),
|
||||
// msg : (*msg).clone(),
|
||||
// parent_act : Arc::clone(&act_clone),
|
||||
|
||||
// };
|
||||
|
||||
// botlock.botmgrs.chat.say_in_reply_to(
|
||||
// msg,
|
||||
// outstr,
|
||||
// // c.module.clone()
|
||||
// params,
|
||||
// ).await;
|
||||
// }
|
||||
|
||||
return;
|
||||
};
|
||||
|
||||
|
@ -575,19 +483,15 @@ impl BotInstance {
|
|||
);
|
||||
|
||||
let a = Arc::clone(&bot);
|
||||
// c.execute(a, msg.clone()).await;
|
||||
// c.execute(ExecBodyParams { bot : a, msg : msg.clone() }).await;
|
||||
c.execute(ExecBodyParams {
|
||||
bot : a,
|
||||
msg : msg.clone() ,
|
||||
// parent_act : BotAction::C(c) ,
|
||||
parent_act : Arc::clone(&act_clone),
|
||||
}).await;
|
||||
|
||||
botlog::trace(
|
||||
"exit out of execution",
|
||||
Some("BotInstance > listener_main_prvmsg()".to_string()),
|
||||
// Some(&msg),
|
||||
Some(msg),
|
||||
);
|
||||
}
|
||||
|
@ -606,7 +510,6 @@ impl BotInstance {
|
|||
crate::core::botmodules::BotAction::L(l) => {
|
||||
|
||||
let botlock = bot.read().await;
|
||||
// let id = botlock.get_identity();
|
||||
|
||||
// [x] Check first if the Module for that Given Command is Enabled or Disabled on the given Channel
|
||||
let modmgr = Arc::clone(&botlock.botmodules);
|
||||
|
@ -628,11 +531,9 @@ impl BotInstance {
|
|||
|
||||
} else {
|
||||
let a = Arc::clone(&bot);
|
||||
// l.execute(a, msg.clone()).await;
|
||||
l.execute(ExecBodyParams {
|
||||
bot : a,
|
||||
msg : msg.clone() ,
|
||||
// parent_act : BotAction::L(l) ,
|
||||
parent_act : Arc::clone(&act_clone),
|
||||
} ).await;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue