say chnl must be valid

This commit is contained in:
ModulatingForce 2024-03-23 18:33:33 -04:00
parent ff6046bb1f
commit 7e59b8b251
2 changed files with 33 additions and 0 deletions

View file

@ -76,6 +76,17 @@ impl Chat {
// }, // },
}; };
if self.client.get_channel_status(channel_login.clone()).await == (false,false) {
// 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 ;
}
let rl = Arc::clone(&self.ratelimiters); let rl = Arc::clone(&self.ratelimiters);
let mut rllock = rl.lock().await; let mut rllock = rl.lock().await;

View file

@ -82,6 +82,7 @@ async fn sayout(bot: BotAR, msg: PrivmsgMessage) {
match argrslt { match argrslt {
Some((trgchnl,outmsg)) => { Some((trgchnl,outmsg)) => {
@ -93,6 +94,27 @@ async fn sayout(bot: BotAR, msg: PrivmsgMessage) {
let botlock = bot.read().await; let botlock = bot.read().await;
// [x] Validate first if trgchnl exists
if botlock.botmgrs.chat.client.get_channel_status(trgchnl.to_string().clone()).await == (false,false) {
// 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 ;
botlock
.botmgrs
.chat
.say_in_reply_to(&msg, format!("Cannot join channel : {}",trgchnl.to_string()))
.await;
}
// uses chat.say_in_reply_to() for the bot controls for messages // uses chat.say_in_reply_to() for the bot controls for messages
botlock botlock
.botmgrs .botmgrs