Chat say functionality #41
2 changed files with 33 additions and 0 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue