diff --git a/src/core/chat.rs b/src/core/chat.rs index e6b520d..6bd61e5 100644 --- a/src/core/chat.rs +++ b/src/core/chat.rs @@ -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 mut rllock = rl.lock().await; diff --git a/src/custom/experimental/experiment002.rs b/src/custom/experimental/experiment002.rs index 5f4226b..5b4f11b 100644 --- a/src/custom/experimental/experiment002.rs +++ b/src/custom/experimental/experiment002.rs @@ -81,6 +81,7 @@ async fn sayout(bot: BotAR, msg: PrivmsgMessage) { + match argrslt { Some((trgchnl,outmsg)) => { @@ -93,6 +94,27 @@ async fn sayout(bot: BotAR, msg: PrivmsgMessage) { 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 botlock .botmgrs