Exec Body Fn should be passed Parent BotAction
#43
1 changed files with 38 additions and 9 deletions
|
@ -464,29 +464,58 @@ impl Chat {
|
|||
|
||||
|
||||
// pub async fn say_in_reply_to(&self, msg: &PrivmsgMessage, outmsg: String) {
|
||||
#[async_recursion]
|
||||
// #[async_recursion]
|
||||
pub async fn say_in_reply_to(&self, msg: &PrivmsgMessage, outmsg: String , params : ExecBodyParams) {
|
||||
|
||||
let botclone = Arc::clone(¶ms.bot);
|
||||
let params_clone = params.clone();
|
||||
|
||||
let botclone = Arc::clone(¶ms_clone.bot);
|
||||
let botlock = botclone.read().await;
|
||||
let id = botlock.get_identity();
|
||||
let id = Arc::clone(&id);
|
||||
|
||||
// botlog::trace(
|
||||
// "ACQUIRING WRITE LOCK : ID",
|
||||
// Some("Chat > send_botmsg".to_string()),
|
||||
// Some(¶ms.msg),
|
||||
// );
|
||||
// Log::flush();
|
||||
|
||||
botlog::trace(
|
||||
"ACQUIRING WRITE LOCK : ID",
|
||||
"ACQUIRING READ LOCK : ID",
|
||||
Some("Chat > send_botmsg".to_string()),
|
||||
Some(¶ms.msg),
|
||||
);
|
||||
Log::flush();
|
||||
|
||||
|
||||
{
|
||||
let mut idlock = id.write().await; // <-- [ ] 03.24 - This is definitely locking it
|
||||
}
|
||||
|
||||
|
||||
// let idlock = id.write().await; // <-- [ ] 03.24 - This is definitely locking it
|
||||
let idlock = id.read().await; // <-- [ ] 03.24 - seems to work
|
||||
let a = idlock.getspecialuserroles(params.get_sender(), Some(Channel(msg.channel_login.clone()))).await;
|
||||
botlog::trace(
|
||||
"ACQUIRED WRITE LOCK : ID",
|
||||
format!("GETSPECIALUSERROLES RESULT : {:?}",a).as_str(),
|
||||
Some("Chat > send_botmsg".to_string()),
|
||||
Some(¶ms.msg),
|
||||
);
|
||||
Log::flush();
|
||||
|
||||
|
||||
|
||||
// botlog::trace(
|
||||
// "ACQUIRED WRITE LOCK : ID",
|
||||
// Some("Chat > send_botmsg".to_string()),
|
||||
// Some(¶ms.msg),
|
||||
// );
|
||||
// Log::flush();
|
||||
|
||||
|
||||
|
||||
botlog::trace(
|
||||
"ACQUIRED READ LOCK : ID",
|
||||
Some("Chat > send_botmsg".to_string()),
|
||||
Some(¶ms.msg),
|
||||
);
|
||||
Log::flush();
|
||||
|
||||
|
||||
self.send_botmsg(BotMsgType::SayInReplyTo(msg, outmsg) , params).await;
|
||||
|
|
Loading…
Reference in a new issue