2024.02.12 - Working getuserroles

This commit is contained in:
ModulatingForce 2024-02-12 05:25:38 -05:00
parent d6139664e1
commit 680a335e7b
3 changed files with 128 additions and 63 deletions

View file

@ -776,7 +776,7 @@ impl BotInstance
} }
if confirmed_bot_command { if confirmed_bot_command {
println!("Confirmed bot command");
// self.identity.clone().can_user_run_PRVMSG(&msg, c.required_roles.clone()); // self.identity.clone().can_user_run_PRVMSG(&msg, c.required_roles.clone());
// [ ] Around here, validate if permissable before executing // [ ] Around here, validate if permissable before executing
@ -819,7 +819,7 @@ impl BotInstance
// match a.lock().await.can_user_run_PRVMSG(&msg, c.required_roles.clone()).await { // match a.lock().await.can_user_run_PRVMSG(&msg, c.required_roles.clone()).await {
{
// let le = boxed_bot.lock().await; // let le = boxed_bot.lock().await;
// // let le = le.lock().await; // // let le = le.lock().await;
// let le = le.get_identity().await; // let le = le.get_identity().await;
@ -836,10 +836,19 @@ impl BotInstance
// let id = Arc::clone(&self.botmgrs.identity); // let id = Arc::clone(&self.botmgrs.identity);
// let id = id.write().await; // let id = id.write().await;
// let id = &(*self.get_identity()); // let id = &(*self.get_identity());
println!("Going for botlock");
let botlock = bot.read().await; let botlock = bot.read().await;
println!("Going for identity");
let id = botlock.get_identity(); let id = botlock.get_identity();
let id = id.read().await; // let mut id = id.write().await;
let eval= id.can_user_run_PRVMSG(&msg, c.required_roles.clone()).await; // println!("Unlocking identity");
// let eval= id.can_user_run_PRVMSG(&msg, c.required_roles.clone()).await;
let eval = {
let mut id = id.write().await;
println!("Unlocking identity");
id.can_user_run_PRVMSG(&msg, c.required_roles.clone()).await
};
println!("Checking if permissible");
match eval { match eval {
// Ok(Permissible::Allow) => (), // Ok(Permissible::Allow) => (),
Permissible::Allow => { Permissible::Allow => {
@ -857,7 +866,8 @@ impl BotInstance
// let a = Arc::clone(&self); // let a = Arc::clone(&self);
let a = Arc::clone(&bot); let a = Arc::clone(&bot);
// let a = Arc::clone(&bot); // let a = Arc::clone(&bot);
c.execute(a, msg.clone()); c.execute(a, msg.clone()).await;
println!("exit out of execution");
} }
Permissible::Block => { Permissible::Block => {
@ -867,7 +877,7 @@ impl BotInstance
}; };
// c.execute(self.chat.clone(), msg.clone()).await; // c.execute(self.chat.clone(), msg.clone()).await;
}
} }
}, },
@ -881,7 +891,7 @@ impl BotInstance
// l.execute(boxed_bot.clone(), msg.clone()).await; // l.execute(boxed_bot.clone(), msg.clone()).await;
// let a = Arc::clone(&self); // let a = Arc::clone(&self);
let a = Arc::clone(&bot); let a = Arc::clone(&bot);
l.execute(a, msg.clone()); l.execute(a, msg.clone()).await;
}, },
_ => (), _ => (),

View file

@ -89,12 +89,12 @@ pub enum BotAction
impl BotAction { impl BotAction {
// pub async fn execute(&self,m:botinstance::BotManagers,n:PrivmsgMessage){ // pub async fn execute(&self,m:botinstance::BotManagers,n:PrivmsgMessage){
pub fn execute(&self,m:BotAR,n:PrivmsgMessage) -> () pub async fn execute(&self,m:BotAR,n:PrivmsgMessage) -> ()
{ {
match self { match self {
BotAction::L(a) => a.execute(m,n), BotAction::L(a) => a.execute(m,n).await,
BotAction::C(a) => a.execute(m,n), BotAction::C(a) => a.execute(m,n).await,
_ => (), _ => (),
} }
@ -129,12 +129,12 @@ impl BotCommand
// } // }
// pub fn execute(&self,m:&mut BotInstance,n:PrivmsgMessage) -> () { // pub fn execute(&self,m:&mut BotInstance,n:PrivmsgMessage) -> () {
// pub fn execute(&self,m:actions_util::BotAR,n:PrivmsgMessage) -> () { // pub fn execute(&self,m:actions_util::BotAR,n:PrivmsgMessage) -> () {
pub fn execute(&self,m:BotAR,n:PrivmsgMessage) -> () { pub async fn execute(&self,m:BotAR,n:PrivmsgMessage) -> () {
// ((*self).exec_body)(m,n); // ((*self).exec_body)(m,n);
// ((*self).exec_body)(*m,n); // ((*self).exec_body)(*m,n);
// m // m
// ((*self).exec_body)( // ((*self).exec_body)(
((*self).exec_body)(m,n); ((*self).exec_body)(m,n).await;
// m // m
} }
} }
@ -147,7 +147,7 @@ impl BotActionTrait for BotCommand
// let mut mgr = *mgr.lock().await; // let mut mgr = *mgr.lock().await;
// let mut mgr = &mut mgr; // let mut mgr = &mut mgr;
// (*self).add_to_modmgr(bot.botmodules); // (*self).add_to_modmgr(bot.botmodules);
self.add_to_modmgr(bot.botmodules); self.add_to_modmgr(bot.botmodules).await;
} }
// async fn add_to_modmgr(self, modmgr:Arc<Mutex<ModulesManager>>) { // async fn add_to_modmgr(self, modmgr:Arc<Mutex<ModulesManager>>) {
@ -261,9 +261,9 @@ impl Listener
// } // }
// pub fn execute(&self,m:&BotInstance,n:PrivmsgMessage) -> &BotInstance { // pub fn execute(&self,m:&BotInstance,n:PrivmsgMessage) -> &BotInstance {
// pub fn execute(&self,m:actions_util::BotAR,n:PrivmsgMessage) -> () { // pub fn execute(&self,m:actions_util::BotAR,n:PrivmsgMessage) -> () {
pub fn execute(&self,m:BotAR,n:PrivmsgMessage) -> () { pub async fn execute(&self,m:BotAR,n:PrivmsgMessage) -> () {
// let mut m = Arc::*m; // let mut m = Arc::*m;
((*self).exec_body)(m,n); ((*self).exec_body)(m,n).await;
// *self // *self
// &m // &m
} }

View file

@ -18,7 +18,9 @@ use crate::core::botinstance::ArcBox;
use std::rc::Rc; use std::rc::Rc;
use std::cell::RefCell; use std::cell::RefCell;
use std::sync::{Arc, RwLock}; use std::sync::{Arc};
use tokio::sync::RwLock;
use super::botmodules::bot_actions::actions_util::BotAR; use super::botmodules::bot_actions::actions_util::BotAR;
@ -50,7 +52,7 @@ pub async fn init(mgr:Arc<ModulesManager>)
], ],
}; };
tempb.add_to_modmgr(Arc::clone(&mgr)); tempb.add_to_modmgr(Arc::clone(&mgr)).await;
// async fn cmd_promote(mut bot:Arc<Mutex<BotInstance>>,msg:PrivmsgMessage) // async fn cmd_promote(mut bot:Arc<Mutex<BotInstance>>,msg:PrivmsgMessage)
// async fn cmd_promote(mut bot:&BotInstance,msg:PrivmsgMessage) -> &BotInstance // async fn cmd_promote(mut bot:&BotInstance,msg:PrivmsgMessage) -> &BotInstance
@ -148,9 +150,14 @@ pub async fn init(mgr:Arc<ModulesManager>)
// let mut p = p.lock().await; // let mut p = p.lock().await;
// let ta = p.getspecialuserroles(String::from("Hello"), Some(ChType::Channel(msg.channel_login.to_lowercase()))).await; // let ta = p.getspecialuserroles(String::from("Hello"), Some(ChType::Channel(msg.channel_login.to_lowercase()))).await;
let botlock = bot.read().await; let botlock = bot.read().await;
let ta = botlock.get_identity().read().await.getspecialuserroles(String::from("Hello"), Some(ChType::Channel(msg.channel_login.to_lowercase()))).await; let ta = botlock.get_identity();
let ta = ta.read().await;
if let Some(a) = ta { let ta = ta.getspecialuserroles(String::from("Hello"), Some(ChType::Channel(msg.channel_login.to_lowercase()))).await;
let ta = ta.unwrap();
let a = ta.read().await;
// let ta = *ta;
// let ta = *ta;
// if let Some(a) = *ta {
if a.contains(&UserRole::BotAdmin) { if a.contains(&UserRole::BotAdmin) {
println!("BotAdmin allowed to promote admin"); println!("BotAdmin allowed to promote admin");
@ -217,11 +224,11 @@ pub async fn init(mgr:Arc<ModulesManager>)
} }
} }
}, // },
Some(_) => { // Some(_) => {
// - // // -
}, // },
_ => (), _ => (),
} }
@ -318,6 +325,7 @@ pub async fn init(mgr:Arc<ModulesManager>)
tempcomm.add_to_modmgr(Arc::clone(&mgr)).await; tempcomm.add_to_modmgr(Arc::clone(&mgr)).await;
// async fn getroles(bot:Arc<Mutex<BotInstance>>,msg:PrivmsgMessage) { // async fn getroles(bot:Arc<Mutex<BotInstance>>,msg:PrivmsgMessage) {
async fn getroles(bot:BotAR,msg:PrivmsgMessage) { async fn getroles(bot:BotAR,msg:PrivmsgMessage) {
println!("Called cmd getroles"); println!("Called cmd getroles");
@ -393,8 +401,11 @@ pub async fn init(mgr:Arc<ModulesManager>)
// let a = a.lock().await; // let a = a.lock().await;
// let a = bot.get_identity(); // let a = bot.get_identity();
let botlock = bot.read().await; let botlock = bot.read().await;
println!("botlock read");
let idlock = botlock.get_identity(); let idlock = botlock.get_identity();
let idlock = idlock.read().await; println!("got identity");
let idlock = idlock.read().await; // <-- 02.12 - Latest where it gest stuck - before or at this point
println!("id lock");
let sproles = match targetchnl { let sproles = match targetchnl {
None => { None => {
// let bot = Rc::clone(&bot); // let bot = Rc::clone(&bot);
@ -465,7 +476,9 @@ pub enum Permissible {
#[derive(Clone)] #[derive(Clone)]
pub struct IdentityManager { pub struct IdentityManager {
// special_roles_users : HashMap<String,Vec<UserRole>>, // # <-- (!) This must be String instead of ChType because we're checking a User not a Channel // special_roles_users : HashMap<String,Vec<UserRole>>, // # <-- (!) This must be String instead of ChType because we're checking a User not a Channel
special_roles_users : Arc<Mutex<HashMap<String,Vec<UserRole>>>>, // # <-- (!) This must be String instead of ChType because we're checking a User not a Channel // special_roles_users : Arc<Mutex<HashMap<String,Vec<UserRole>>>>, // # <-- (!) This must be String instead of ChType because we're checking a User not a Channel
// special_roles_users : Arc<RwLock<HashMap<String,Vec<UserRole>>>>,
special_roles_users : Arc<RwLock<HashMap<String,Arc<RwLock<Vec<UserRole>>>>>>,
// parent_mgr : Box<crate::core::botinstance::BotManagers>, // parent_mgr : Box<crate::core::botinstance::BotManagers>,
//parent_mgr : Option<Box<crate::core::botinstance::BotManagers>>, //parent_mgr : Option<Box<crate::core::botinstance::BotManagers>>,
} }
@ -488,11 +501,11 @@ impl IdentityManager {
pub fn init() -> IdentityManager { pub fn init() -> IdentityManager {
let mut a = HashMap::new(); let mut a = HashMap::new();
for admn in adminvector() { for admn in adminvector() {
a.insert(admn.to_lowercase(),vec![UserRole::BotAdmin]); a.insert(admn.to_lowercase(),Arc::new(RwLock::new(vec![UserRole::BotAdmin])));
}; };
IdentityManager { IdentityManager {
special_roles_users : Arc::new(Mutex::new(a)), special_roles_users : Arc::new(RwLock::new(a)),
//parent_mgr : None, //parent_mgr : None,
} }
} }
@ -502,11 +515,12 @@ impl IdentityManager {
// pub fn can_user_run_PRVMSG(self,msg:&PrivmsgMessage,cmdreqroles:Vec<UserRole>) -> Result<Permissible,Box<dyn Error>> // pub fn can_user_run_PRVMSG(self,msg:&PrivmsgMessage,cmdreqroles:Vec<UserRole>) -> Result<Permissible,Box<dyn Error>>
// pub fn can_user_run_PRVMSG(&self,msg:&PrivmsgMessage,cmdreqroles:Vec<UserRole>) -> Permissible // pub fn can_user_run_PRVMSG(&self,msg:&PrivmsgMessage,cmdreqroles:Vec<UserRole>) -> Permissible
// pub async fn can_user_run_PRVMSG(self,msg:&PrivmsgMessage,cmdreqroles:Vec<UserRole>) -> Permissible // pub async fn can_user_run_PRVMSG(self,msg:&PrivmsgMessage,cmdreqroles:Vec<UserRole>) -> Permissible
pub async fn can_user_run_PRVMSG(&self,msg:&PrivmsgMessage,cmdreqroles:Vec<UserRole>) -> Permissible pub async fn can_user_run_PRVMSG(&mut self,msg:&PrivmsgMessage,cmdreqroles:Vec<UserRole>) -> Permissible
{ {
// println!("(#{}) {}: {}", msg.channel_login, msg.sender.name, msg.message_text); // println!("(#{}) {}: {}", msg.channel_login, msg.sender.name, msg.message_text);
// [ ] Check what Badges in PrivmsgMessage // [ ] Check what Badges in PrivmsgMessage
println!{"Checking within PRVMSG"};
let mut sender_badge:Option<ChatBadge> = None; let mut sender_badge:Option<ChatBadge> = None;
@ -544,11 +558,11 @@ impl IdentityManager {
// cmdreqroles // cmdreqroles
// ) ; // ) ;
// return a; // return a;
self.can_user_run(msg.sender.name.to_owned(), return self.can_user_run(msg.sender.name.to_owned(),
ChType::Channel(msg.channel_login.to_owned()), ChType::Channel(msg.channel_login.to_owned()),
sender_badge, sender_badge,
cmdreqroles cmdreqroles
).await ; ).await
} }
@ -559,13 +573,14 @@ impl IdentityManager {
} }
pub async fn can_user_run(&self, pub async fn can_user_run(&mut self,
usr:String, usr:String,
channelname:ChType, channelname:ChType,
chat_badge:ChatBadge, chat_badge:ChatBadge,
cmdreqroles:Vec<UserRole> cmdreqroles:Vec<UserRole>
// ) -> Result<Permissible,Box<dyn Error>> { // ) -> Result<Permissible,Box<dyn Error>> {
) -> Permissible { ) -> Permissible {
println!{"Checking within can_user_run()"};
/* /*
canUserRun - canUserRun -
@ -604,6 +619,8 @@ impl IdentityManager {
// [x] If cmdreqroles is empty vector , automatically assume Ok(Permissible::Allow) // [x] If cmdreqroles is empty vector , automatically assume Ok(Permissible::Allow)
// let idar = Arc::new(RwLock::new(self));
if cmdreqroles.len() == 0 { if cmdreqroles.len() == 0 {
// return Ok(Permissible::Allow) // return Ok(Permissible::Allow)
return Permissible::Allow return Permissible::Allow
@ -632,7 +649,7 @@ impl IdentityManager {
ChatBadge::Mod => { ChatBadge::Mod => {
// println!("Mod Chatbadge detected"); println!("Mod Chatbadge detected");
// println!("debug special roles : {:?}",self.special_roles_users); // println!("debug special roles : {:?}",self.special_roles_users);
// println!("debug usr : {}",&usr.to_lowercase()); // println!("debug usr : {}",&usr.to_lowercase());
@ -640,27 +657,39 @@ impl IdentityManager {
// let Some((k,v)) = self.special_roles_users.get_key_value(usr); // let Some((k,v)) = self.special_roles_users.get_key_value(usr);
// match self.special_roles_users.get_mut(&usr.to_lowercase()) { // match self.special_roles_users.get_mut(&usr.to_lowercase()) {
// match self.special_roles_users.get(&usr.to_lowercase()) { // match self.special_roles_users.get(&usr.to_lowercase()) {
match self.special_roles_users.lock().await.get(&usr.to_lowercase()) { println!("Creating clone");
Some(usrroles) => { let roleslock = Arc::clone(&(*self).special_roles_users);
// println!("contains mod : {}", usrroles.contains(&UserRole::Mod(channelname.clone()))); println!("Read lock on : Special_Roles_User"); // <-- after this is slightly different between working and problem
// println!("contains supmod : {}", usrroles.contains(&UserRole::SupMod(channelname.clone()))); let mut roleslock = roleslock.write().await;
if usrroles.contains(&UserRole::Mod(channelname.clone())) || match (*roleslock).get(&usr.to_lowercase()) {
usrroles.contains(&UserRole::SupMod(channelname.clone())) { Some(usrroles) => { // <-- working got to this point
println!("contains mod : {}", usrroles.read().await.contains(&UserRole::Mod(channelname.clone())));
println!("contains supmod : {}", usrroles.read().await.contains(&UserRole::SupMod(channelname.clone())));
if usrroles.read().await.contains(&UserRole::Mod(channelname.clone())) ||
usrroles.read().await.contains(&UserRole::SupMod(channelname.clone())) {
// Do nothing - this is expected // Do nothing - this is expected
println!("Already a mod in roles");
} else { } else {
// in this case, they have a ChatBadge::Mod but should have this for the channel // in this case, they have a ChatBadge::Mod but should have this for the channel
// let mut a = usrroles; // let mut a = usrroles;
// usrroles.push(UserRole::Mod(channelname.clone())); // usrroles.push(UserRole::Mod(channelname.clone()));
// a.push(UserRole::Mod(channelname.clone())); // a.push(UserRole::Mod(channelname.clone()));
self.special_roles_users println!("Was in the else loop");
.lock().await
.get_mut(&usr.to_lowercase()) // let a = &*self;
.expect("ERROR") // let mut lock = a.special_roles_users.write().await;
.push(UserRole::Mod(channelname.clone())); println!("lock created > adding with a mod role o7");
roleslock.get_mut(&usr.to_lowercase())
// .expect("ERROR")
.unwrap()
.write().await
// .get_mut()
.push(UserRole::Mod(channelname.clone()));
// println!("debug special roles : {:?}",self.special_roles_users); // println!("debug special roles : {:?}",self.special_roles_users);
} }
}, },
_ => () _ => ( ) // <-- I'm assuming problem got to here
} }
}, },
@ -680,9 +709,11 @@ impl IdentityManager {
println!("Mod Role required"); println!("Mod Role required");
if let Some(a) = self.special_roles_users.lock().await.get(&usr.to_lowercase()) { if let Some(a) = (&*self).special_roles_users.read().await.get(&usr.to_lowercase()) {
if a.contains(&UserRole::Mod(channelname.clone())) || a.contains(&UserRole::SupMod(channelname.clone())){ println!("Special roles found for user");
if a.read().await.contains(&UserRole::Mod(channelname.clone())) || a.read().await.contains(&UserRole::SupMod(channelname.clone())){
// return Ok(Permissible::Allow); // return Ok(Permissible::Allow);
println!("Special roles found for user : A mod idenfified ");
return Permissible::Allow return Permissible::Allow
} }
} }
@ -693,8 +724,8 @@ impl IdentityManager {
if cmdreqroles.contains(&UserRole::SupMod(ChType::Channel(String::new()))) { if cmdreqroles.contains(&UserRole::SupMod(ChType::Channel(String::new()))) {
if let Some(a) = self.special_roles_users.lock().await.get(&usr.to_lowercase()) { if let Some(a) = (&*self).special_roles_users.read().await.get(&usr.to_lowercase()) {
if a.contains(&UserRole::SupMod(channelname.clone())) { if a.read().await.contains(&UserRole::SupMod(channelname.clone())) {
// return Ok(Permissible::Allow); // return Ok(Permissible::Allow);
return Permissible::Allow return Permissible::Allow
} }
@ -707,10 +738,10 @@ impl IdentityManager {
println!("Eval cmdreqroles with botadmin : {}",cmdreqroles.contains(&UserRole::BotAdmin)); println!("Eval cmdreqroles with botadmin : {}",cmdreqroles.contains(&UserRole::BotAdmin));
if cmdreqroles.contains(&UserRole::BotAdmin) { if cmdreqroles.contains(&UserRole::BotAdmin) {
println!("special roles get : {:?}",self.special_roles_users.lock().await.get(&usr.to_lowercase())); println!("special roles get : {:?}",(&*self).special_roles_users.read().await.get(&usr.to_lowercase()));
if let Some(a) = self.special_roles_users.lock().await.get(&usr.to_lowercase()) { if let Some(a) = (&*self).special_roles_users.read().await.get(&usr.to_lowercase()) {
println!("special roles contains BotAdmin: {}",a.contains(&UserRole::BotAdmin)); println!("special roles contains BotAdmin: {}",a.read().await.contains(&UserRole::BotAdmin));
if a.contains(&UserRole::BotAdmin) { if a.read().await.contains(&UserRole::BotAdmin) {
// return Ok(Permissible::Allow); // return Ok(Permissible::Allow);
return Permissible::Allow return Permissible::Allow
} }
@ -737,7 +768,7 @@ impl IdentityManager {
let chatterroles = self.getspecialuserroles(trgchatter.clone(), channel.clone()).await; let chatterroles = self.getspecialuserroles(trgchatter.clone(), channel.clone()).await;
// let chatterroles = chatterroles.lock().await; // let chatterroles = chatterroles.lock().await;
// let chatterroles = *chatterroles; // let chatterroles = *chatterroles;
let chatterroles = chatterroles.unwrap(); // let chatterroles = chatterroles.unwrap();
// let emptyvec = vec![]; // let emptyvec = vec![];
@ -747,19 +778,26 @@ impl IdentityManager {
// _ => &(emptyvec), // _ => &(emptyvec),
// }; // };
let chatterroles = chatterroles.unwrap();
let chatterroles = chatterroles.read().await;
let rolemap = &(*chatterroles);
match trg_role { match trg_role {
Some(UserRole::Mod(a)) => { Some(UserRole::Mod(a)) => {
if let Some(trg_chnl) = channel { if let Some(trg_chnl) = channel {
if chatterroles.contains(&UserRole::Mod(trg_chnl.clone())) { // let rolemap = rolemap.unwrap();
if rolemap.contains(&UserRole::Mod(trg_chnl.clone())) {
return ChangeResult::NoChange(String::from("Target User already has Target Role")); return ChangeResult::NoChange(String::from("Target User already has Target Role"));
} }
// # otherwise, trg_role for the given chnl is not assigned to the trgchatter // # otherwise, trg_role for the given chnl is not assigned to the trgchatter
// chatterroles.push(UserRole::Mod(trg_chnl.clone())); // chatterroles.push(UserRole::Mod(trg_chnl.clone()));
self.special_roles_users self.special_roles_users
.lock().await .write().await
.get_mut(&trgchatter) .get_mut(&trgchatter)
.expect("Error getting roles") .expect("Error getting roles")
.write().await
.push(UserRole::Mod(trg_chnl)); .push(UserRole::Mod(trg_chnl));
return ChangeResult::Success(String::from("Promotion Successful")); return ChangeResult::Success(String::from("Promotion Successful"));
@ -845,7 +883,10 @@ impl IdentityManager {
ChangeResult::Success(String::from("TEST > Promotion Successful")) ChangeResult::Success(String::from("TEST > Promotion Successful"))
} }
pub async fn getspecialuserroles(&self,chattername:String,channel:Option<ChType>) -> Option<Vec<UserRole>> { pub async fn getspecialuserroles(&self,chattername:String,channel:Option<ChType>) -> Option<Arc<RwLock<Vec<UserRole>>>> {
/*
Note : Ideally this be called for a given chatter name ?
*/
// let a = chattername.to_lowercase(); // let a = chattername.to_lowercase();
@ -863,7 +904,7 @@ impl IdentityManager {
// println!("> Roles : {:?}",v); // println!("> Roles : {:?}",v);
// } // }
let a = chattername.to_lowercase(); let chattername = chattername.to_lowercase();
// println!("{a}"); // println!("{a}");
@ -873,12 +914,26 @@ impl IdentityManager {
// Some(b) => Some(*b), // Some(b) => Some(*b),
// None => None, // None => None,
// } // }
// println!("Write Lock on Special Roles @ Getspecialuserroles()");
// let b = self.special_roles_users.write().await.remove(&a);
// let outp = b;
// // let b = Arc::new(Mutex::new(outp));
// outp
let b = self.special_roles_users.lock().await.remove(&a); let rolesa = Arc::clone(&self.special_roles_users);
let outp = b;
// let b = Arc::new(Mutex::new(outp));
outp
let a = rolesa.read().await;
// let a = Arc::clone(a)
let a = a;
let outr = &(*a);
let outr = outr.get(&chattername);
match outr {
Some(a) => Some(Arc::clone(a)),
None => None,
}
// Arc::new(RwLock::new(outr))
// let b = Arc::new(Mutex::new(b)); // let b = Arc::new(Mutex::new(b));
// b // b