20240201 - latest issue

This commit is contained in:
ModulatingForce 2024-02-01 19:23:27 -05:00
parent 39cd4ba65e
commit da3ce920bf
2 changed files with 18 additions and 12 deletions

View file

@ -305,7 +305,7 @@ impl BotInstance
// async fn listener_main_prvmsg(&mut self,msg:PrivmsgMessage) -> () { // async fn listener_main_prvmsg(&mut self,msg:PrivmsgMessage) -> () {
async fn listener_main_prvmsg(&self,msg:&PrivmsgMessage) -> () { async fn listener_main_prvmsg(&mut self,msg:&PrivmsgMessage) -> () {
// println!("(#{}) {}: {}", msg.channel_login, msg.sender.name, msg.message_text); // println!("(#{}) {}: {}", msg.channel_login, msg.sender.name, msg.message_text);
@ -369,13 +369,15 @@ impl BotInstance
// match self.botmgrs.identity.to_owned().can_user_run_PRVMSG(&msg, c.required_roles.clone()) { // match self.botmgrs.identity.to_owned().can_user_run_PRVMSG(&msg, c.required_roles.clone()) {
// match self.botmgrs.identity.can_user_run_PRVMSG(&msg, c.required_roles.clone()) { // match self.botmgrs.identity.can_user_run_PRVMSG(&msg, c.required_roles.clone()) {
// let a = match self.botmgrs.identity.clone().can_user_run_PRVMSG(&msg, c.required_roles.clone()) { // let a = match self.botmgrs.identity.clone().can_user_run_PRVMSG(&msg, c.required_roles.clone()) {
match self.botmgrs.identity.clone().can_user_run_PRVMSG(&msg, c.required_roles.clone()) { // match self.botmgrs.identity.clone().can_user_run_PRVMSG(&msg, c.required_roles.clone()) {
match self.botmgrs.identity.can_user_run_PRVMSG(&msg, c.required_roles.clone()) {
// Ok(Permissible::Allow) => (), // Ok(Permissible::Allow) => (),
Permissible::Allow => { Permissible::Allow => {
println!("Executed as permissible"); println!("Executed as permissible");
// c.execute(self.botmgrs.clone(), msg.clone()).await; // c.execute(self.botmgrs.clone(), msg.clone()).await;
// c.execute(self.botmgrs, msg.clone()).await; // c.execute(self.botmgrs, msg.clone()).await;
// Some((BotAction::C(c),msg.clone())) // Some((BotAction::C(c),msg.clone()))
// Some((msg,self))
Some(msg) Some(msg)
//Some(BotAction::C(*c)) //Some(BotAction::C(*c))
//Some(String::from("Hello")) //Some(String::from("Hello"))
@ -383,6 +385,7 @@ impl BotInstance
Permissible::Block => { Permissible::Block => {
println!("User Not allowed to run command"); println!("User Not allowed to run command");
// None::<(BotAction,PrivmsgMessage)> // None::<(BotAction,PrivmsgMessage)>
// None::<(&PrivmsgMessage,&mut BotInstance)>
None::<&PrivmsgMessage> None::<&PrivmsgMessage>
//None //None
//Some(String::from("Hello")) //Some(String::from("Hello"))
@ -406,14 +409,17 @@ impl BotInstance
match b { match b {
Some(b) => { Some(b) => {
// a.execute(self.botmgrs.clone(), b.clone()).await; // This compiles but issue - botmgrs aren't updating // a.execute(self.botmgrs.clone(), b.clone()).await; // This compiles but issue - botmgrs aren't updating
a.execute(self.botmgrs, b.clone()).await; // This throws the following // a.execute(self.botmgrs, b.clone()).await; // This throws the following
/* // /*
error[E0507]: cannot move out of `self.botmgrs` which is behind a shared reference // error[E0507]: cannot move out of `self.botmgrs` which is behind a shared reference
--> src\core\botinstance.rs:409:35 // --> src\core\botinstance.rs:409:35
| // |
409 | a.execute(self.botmgrs, b.clone()).await; // This throws // 409 | a.execute(self.botmgrs, b.clone()).await; // This throws
| ^^^^^^^^^^^^ move occurs because `self.botmgrs` has type `BotManagers`, which does not implement the `Copy` trait // | ^^^^^^^^^^^^ move occurs because `self.botmgrs` has type `BotManagers`, which does not implement the `Copy` trait
*/ // */
let (msg) = b;
// a.execute(self.botmgrs.clone(), msg.clone()).await;
a.execute(self.botmgrs, msg.clone()).await;
} }
None => (), None => (),
} }

View file

@ -306,7 +306,7 @@ impl IdentityManager {
// [ ] Maybe I should create a can_user_run version that simply takes PrvMsg, but then calls can_user_run directly // [ ] Maybe I should create a can_user_run version that simply takes PrvMsg, but then calls can_user_run directly
// 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(&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);
@ -344,7 +344,7 @@ impl IdentityManager {
Permissible::Block Permissible::Block
} }
pub fn can_user_run(mut self, pub fn can_user_run(&mut self,
usr:String, usr:String,
channelname:ChType, channelname:ChType,
chat_badge:ChatBadge, chat_badge:ChatBadge,