2024.02.12 - Working getuserroles
This commit is contained in:
parent
cc11479bf2
commit
372893af15
3 changed files with 128 additions and 63 deletions
src/core
|
@ -776,7 +776,7 @@ impl BotInstance
|
|||
}
|
||||
|
||||
if confirmed_bot_command {
|
||||
|
||||
println!("Confirmed bot command");
|
||||
// self.identity.clone().can_user_run_PRVMSG(&msg, c.required_roles.clone());
|
||||
|
||||
// [ ] 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 {
|
||||
|
||||
{
|
||||
|
||||
// let le = boxed_bot.lock().await;
|
||||
// // let le = le.lock().await;
|
||||
// let le = le.get_identity().await;
|
||||
|
@ -836,10 +836,19 @@ impl BotInstance
|
|||
// let id = Arc::clone(&self.botmgrs.identity);
|
||||
// let id = id.write().await;
|
||||
// let id = &(*self.get_identity());
|
||||
println!("Going for botlock");
|
||||
let botlock = bot.read().await;
|
||||
println!("Going for identity");
|
||||
let id = botlock.get_identity();
|
||||
let id = id.read().await;
|
||||
let eval= id.can_user_run_PRVMSG(&msg, c.required_roles.clone()).await;
|
||||
// let mut id = id.write().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 {
|
||||
// Ok(Permissible::Allow) => (),
|
||||
Permissible::Allow => {
|
||||
|
@ -857,7 +866,8 @@ impl BotInstance
|
|||
// let a = Arc::clone(&self);
|
||||
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 => {
|
||||
|
@ -867,7 +877,7 @@ impl BotInstance
|
|||
};
|
||||
|
||||
// c.execute(self.chat.clone(), msg.clone()).await;
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -881,7 +891,7 @@ impl BotInstance
|
|||
// l.execute(boxed_bot.clone(), msg.clone()).await;
|
||||
// let a = Arc::clone(&self);
|
||||
let a = Arc::clone(&bot);
|
||||
l.execute(a, msg.clone());
|
||||
l.execute(a, msg.clone()).await;
|
||||
},
|
||||
|
||||
_ => (),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue