Problem - with botmanagers
This commit is contained in:
parent
740a637c99
commit
39cd4ba65e
1 changed files with 47 additions and 6 deletions
|
@ -17,6 +17,7 @@ use rand::Rng;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
use crate::core::botmodules::BotAction;
|
||||||
use crate::core::ratelimiter::RateLimiter;
|
use crate::core::ratelimiter::RateLimiter;
|
||||||
use crate::core::ratelimiter;
|
use crate::core::ratelimiter;
|
||||||
|
|
||||||
|
@ -313,7 +314,10 @@ impl BotInstance
|
||||||
for (_m,acts) in &self.botmodules.botactions {
|
for (_m,acts) in &self.botmodules.botactions {
|
||||||
for a in acts {
|
for a in acts {
|
||||||
|
|
||||||
match a {
|
// match a {
|
||||||
|
// let Some((b,msg)) = match a {
|
||||||
|
let b = match a {
|
||||||
|
|
||||||
|
|
||||||
crate::core::botmodules::BotAction::C(c) => {
|
crate::core::botmodules::BotAction::C(c) => {
|
||||||
/*
|
/*
|
||||||
|
@ -364,27 +368,64 @@ 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()) {
|
||||||
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()) {
|
||||||
// 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;
|
||||||
|
// Some((BotAction::C(c),msg.clone()))
|
||||||
|
Some(msg)
|
||||||
|
//Some(BotAction::C(*c))
|
||||||
|
//Some(String::from("Hello"))
|
||||||
}
|
}
|
||||||
Permissible::Block => println!("User Not allowed to run command"),
|
Permissible::Block => {
|
||||||
|
println!("User Not allowed to run command");
|
||||||
|
// None::<(BotAction,PrivmsgMessage)>
|
||||||
|
None::<&PrivmsgMessage>
|
||||||
|
//None
|
||||||
|
//Some(String::from("Hello"))
|
||||||
|
},
|
||||||
// _ => (),
|
// _ => (),
|
||||||
}
|
};
|
||||||
|
|
||||||
// c.execute(self.chat.clone(), msg.clone()).await;
|
// c.execute(self.chat.clone(), msg.clone()).await;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
None::<&PrivmsgMessage> // [ ] Command not confirmed?
|
||||||
},
|
},
|
||||||
|
|
||||||
crate::core::botmodules::BotAction::L(l) => l.execute(self.botmgrs.clone(), msg.clone()).await,
|
// crate::core::botmodules::BotAction::L(l) => l.execute(self.botmgrs.clone(), msg.clone()).await,
|
||||||
|
//crate::core::botmodules::BotAction::L(l) => l.execute(self.botmgrs, msg.clone()).await,
|
||||||
|
|
||||||
_ => (),
|
_ => None::<&PrivmsgMessage> , // -- [ ] If not any known botaction
|
||||||
|
};
|
||||||
|
|
||||||
|
// b = BotAction either found or not
|
||||||
|
match b {
|
||||||
|
Some(b) => {
|
||||||
|
// 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
|
||||||
|
/*
|
||||||
|
error[E0507]: cannot move out of `self.botmgrs` which is behind a shared reference
|
||||||
|
--> src\core\botinstance.rs:409:35
|
||||||
|
|
|
||||||
|
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
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
None => (),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// // [ ] There should be a BotCommand Listener to check for prefixes ran
|
// // [ ] There should be a BotCommand Listener to check for prefixes ran
|
||||||
|
|
||||||
println!("End of Separate Listener Main prvmsg");
|
println!("End of Separate Listener Main prvmsg");
|
||||||
|
|
Loading…
Reference in a new issue