This commit is contained in:
ModulatingForce 2024-03-24 23:42:59 -04:00
parent cfadd73096
commit 8b3395c19a

View file

@ -64,6 +64,9 @@ impl Chat {
// async fn send_botmsg(&self, msginput: BotMsgType<'_>) {
async fn send_botmsg(&self, msginput: BotMsgType<'_>, params : ExecBodyParams) {
/*
formats message before sending to TwitchIRC
@ -74,7 +77,7 @@ impl Chat {
*/
botlog::trace(
botlog::trace(
format!("send_bot_msg params : {:?}",msginput).as_str(),
Some("chat.rs > send_botmsg ".to_string()),
Some(&params.msg),
@ -90,47 +93,7 @@ impl Chat {
};
botlog::trace(
"BEFORE GET_CHANNEL_STATUS",
Some("chat.rs > send_botmsg ".to_string()),
Some(&params.msg),
);
let rslt = self.client.get_channel_status(channel_login.clone()).await == (false,false);
botlog::trace(
format!("GET_CHANNEL_STATUS result = {:?}",rslt).as_str(),
Some("chat.rs > send_botmsg ".to_string()),
Some(&params.msg),
);
Log::flush();
if rslt {
// in the case where the provided channel isn't something we're known to be connected to
botlog::warn(
&format!("A message attempted to send for a Non-Joined Channel : {}",channel_login.clone()),
Some("Chat > send_botmsg".to_string()),
None,
);
return ;
}
/*
[x] !! => 03.24 - Somewhere around here, we should be validating module for target channel
*/
/*
- Use ModulesManager.modstatus
modstatus(&self, in_module: BotModule, in_chnl: Channel) -> StatusType
*/
botlog::trace(
"BEFORE parent_module call",
@ -150,6 +113,65 @@ impl Chat {
Channel(channel_login.clone())
).await;
// botlog::trace(
// "BEFORE GET_CHANNEL_STATUS",
// Some("chat.rs > send_botmsg ".to_string()),
// Some(&params.msg),
// );
// let rslt = self.client.get_channel_status(channel_login.clone()).await == (false,false);
// botlog::trace(
// format!("GET_CHANNEL_STATUS result = {:?}",rslt).as_str(),
// Some("chat.rs > send_botmsg ".to_string()),
// Some(&params.msg),
// );
// Log::flush();
// if rslt {
// // in the case where the provided channel isn't something we're known to be connected to
// botlog::warn(
// &format!("A message attempted to send for a Non-Joined Channel : {}",channel_login.clone()),
// Some("Chat > send_botmsg".to_string()),
// None,
// );
// return ;
// }
if !params.bot.read().await.bot_channels.contains(&Channel(channel_login.clone())) {
botlog::warn(
&format!("A message attempted to send for a Non-Joined Channel : {}",channel_login.clone()),
Some("Chat > send_botmsg".to_string()),
None,
);
self.say_in_reply_to(
&params.msg,
"uuh Bot can't send to a channel it isn't joined".to_string(),
params.clone()
).await;
return ;
}
/*
[x] !! => 03.24 - Somewhere around here, we should be validating module for target channel
*/
/*
- Use ModulesManager.modstatus
modstatus(&self, in_module: BotModule, in_chnl: Channel) -> StatusType
*/
// match modstatus {
// super::botmodules::StatusType::Enabled(_) => (),
// super::botmodules::StatusType::Disabled(_) => (),
@ -190,35 +212,35 @@ impl Chat {
Log::flush();
// self.say_in_reply_to(
// a,
// format!("uuh {:?} is disabled on {} : {:?}",
// parent_module.clone().unwrap(),
// channel_login.clone(),
// lvl
// ),
// params.clone()
// ).await;
self.say_in_reply_to(
a,
format!("uuh {:?} is disabled on {} : {:?}",
parent_module.clone().unwrap(),
channel_login.clone(),
lvl
),
params.clone()
).await;
let chat_clone = self.clone();
// let chat_clone = self.clone();
// tokio::spawn( async move {
// // for _ in 0..5 {
// // println!(">> Innterroutine triggered!");
// // sleep(Duration::from_secs_f64(5.0)).await;
// // }
// // tokio::spawn( async move {
// // // for _ in 0..5 {
// // // println!(">> Innterroutine triggered!");
// // // sleep(Duration::from_secs_f64(5.0)).await;
// // // }
// chat_clone.say_in_reply_to(
// a,
// format!("uuh {:?} is disabled on {} : {:?}",
// parent_module.clone().unwrap(),
// channel_login.clone(),
// lvl
// ),
// params.clone()
// ).await;
// }
// );
// // chat_clone.say_in_reply_to(
// // a,
// // format!("uuh {:?} is disabled on {} : {:?}",
// // parent_module.clone().unwrap(),
// // channel_login.clone(),
// // lvl
// // ),
// // params.clone()
// // ).await;
// // }
// // );
botlog::trace(