adj sayinreply to use channel & msgid
All checks were successful
ci/woodpecker/pr/cargo-checks Pipeline was successful
All checks were successful
ci/woodpecker/pr/cargo-checks Pipeline was successful
This commit is contained in:
parent
7199703766
commit
6867cc7af8
3 changed files with 51 additions and 21 deletions
|
@ -41,7 +41,8 @@ pub enum BotMsgType {
|
||||||
// SayInReplyTo(&'a PrivmsgMessage,String),
|
// SayInReplyTo(&'a PrivmsgMessage,String),
|
||||||
// SayInReplyTo(Arc<Box<dyn ReplyToMessage>>,String),
|
// SayInReplyTo(Arc<Box<dyn ReplyToMessage>>,String),
|
||||||
// SayInReplyTo(&'a dyn ReplyToMessage,String), // [ ] 04.03 - Having issues defining it this way?
|
// SayInReplyTo(&'a dyn ReplyToMessage,String), // [ ] 04.03 - Having issues defining it this way?
|
||||||
SayInReplyTo((String,String),String), // ( Destination Channel , Message ID to reply to ) , OutMessage // https://docs.rs/twitch-irc/latest/twitch_irc/client/struct.TwitchIRCClient.html#method.say_in_reply_to
|
// SayInReplyTo((String,String),String), // ( Destination Channel , Message ID to reply to ) , OutMessage // https://docs.rs/twitch-irc/latest/twitch_irc/client/struct.TwitchIRCClient.html#method.say_in_reply_to
|
||||||
|
SayInReplyTo(Channel,String,String), // ( Destination Channel , Message ID to reply to , OutMessage ) // https://docs.rs/twitch-irc/latest/twitch_irc/client/struct.TwitchIRCClient.html#method.say_in_reply_to
|
||||||
Say(String,String),
|
Say(String,String),
|
||||||
Notif(String), // For Bot Sent Notifications
|
Notif(String), // For Bot Sent Notifications
|
||||||
}
|
}
|
||||||
|
@ -88,10 +89,11 @@ impl Chat {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
let (channel_login,mut outmsg) = match msginput.clone() {
|
let (channel_login,mut outmsg) = match msginput.clone() {
|
||||||
BotMsgType::SayInReplyTo(msg, outmsg) => {
|
// BotMsgType::SayInReplyTo(msg, outmsg) => {
|
||||||
|
BotMsgType::SayInReplyTo(chnl, _, outmsg) => {
|
||||||
// (msg.channel_login.clone(),outmsg)
|
// (msg.channel_login.clone(),outmsg)
|
||||||
// (msg.clone().channel_login().to_string(),outmsg)
|
// (msg.clone().channel_login().to_string(),outmsg)
|
||||||
(msg.0, // Desintation Channel
|
(chnl.0.to_lowercase(), // Desintation Channel
|
||||||
outmsg)
|
outmsg)
|
||||||
},
|
},
|
||||||
BotMsgType::Say(a,b ) => {
|
BotMsgType::Say(a,b ) => {
|
||||||
|
@ -123,13 +125,16 @@ impl Chat {
|
||||||
).await;
|
).await;
|
||||||
|
|
||||||
if !params.bot.read().await.bot_channels.contains(&Channel(channel_login.clone())) {
|
if !params.bot.read().await.bot_channels.contains(&Channel(channel_login.clone())) {
|
||||||
|
|
||||||
|
dbg!("ISSUE : NONJOINED CHANNEL",¶ms.bot.read().await.bot_channels,Channel(channel_login.clone()));
|
||||||
botlog::warn(
|
botlog::warn(
|
||||||
&format!("A message attempted to send for a Non-Joined Channel : {}",channel_login.clone()),
|
&format!("A message attempted to send for a Non-Joined Channel : {}",channel_login.clone()),
|
||||||
Some("Chat > send_botmsg".to_string()),
|
Some("Chat > send_botmsg".to_string()),
|
||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
if let BotMsgType::SayInReplyTo(_prvmsg,_outmsg) = msginput {
|
// if let BotMsgType::SayInReplyTo(_prvmsg,_outmsg) = msginput {
|
||||||
|
if let BotMsgType::SayInReplyTo(_chnl,_msgid, _outmsg) = msginput {
|
||||||
|
|
||||||
self.send_botmsg(BotMsgType::Notif(
|
self.send_botmsg(BotMsgType::Notif(
|
||||||
"uuh Bot can't send to a channel it isn't joined".to_string(),
|
"uuh Bot can't send to a channel it isn't joined".to_string(),
|
||||||
|
@ -177,7 +182,8 @@ impl Chat {
|
||||||
|
|
||||||
match msginput {
|
match msginput {
|
||||||
BotMsgType::Notif(_) => (), // Do nothing with Notif > We'll validate the user later to handle
|
BotMsgType::Notif(_) => (), // Do nothing with Notif > We'll validate the user later to handle
|
||||||
BotMsgType::SayInReplyTo(_, _) | BotMsgType::Say(_,_) => {
|
// BotMsgType::SayInReplyTo(_, _) | BotMsgType::Say(_,_) => {
|
||||||
|
BotMsgType::SayInReplyTo(_, _, _) | BotMsgType::Say(_,_) => {
|
||||||
|
|
||||||
botlog::trace(
|
botlog::trace(
|
||||||
"BEFORE potential Async recursion",
|
"BEFORE potential Async recursion",
|
||||||
|
@ -276,7 +282,8 @@ impl Chat {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
BotMsgType::SayInReplyTo(_,_ ) | BotMsgType::Say(_,_) => {
|
// BotMsgType::SayInReplyTo(_,_ ) | BotMsgType::Say(_,_) => {
|
||||||
|
BotMsgType::SayInReplyTo(_,_,_ ) | BotMsgType::Say(_,_) => {
|
||||||
// If the BotMsg a Say/SayInReplyTo (from Developer or Chatter) , and the Sender does not have Specific Roles in the Source Channel Sent
|
// If the BotMsg a Say/SayInReplyTo (from Developer or Chatter) , and the Sender does not have Specific Roles in the Source Channel Sent
|
||||||
|
|
||||||
self.send_botmsg(BotMsgType::Notif(
|
self.send_botmsg(BotMsgType::Notif(
|
||||||
|
@ -349,18 +356,25 @@ impl Chat {
|
||||||
}
|
}
|
||||||
|
|
||||||
match msginput.clone() {
|
match msginput.clone() {
|
||||||
BotMsgType::SayInReplyTo(msg, _) => {
|
// BotMsgType::SayInReplyTo(msg, _) => {
|
||||||
|
// BotMsgType::SayInReplyTo(msg, _, _) => {
|
||||||
|
BotMsgType::SayInReplyTo(chnl,msgid, _) => {
|
||||||
|
|
||||||
|
// dbg!(msg.clone().channel_login(),msg.message_id(),outmsg.clone());
|
||||||
|
dbg!(chnl.clone(),msgid.clone(),outmsg.clone());
|
||||||
|
|
||||||
dbg!(msg.clone().channel_login(),msg.message_id(),outmsg.clone());
|
|
||||||
self.client.say_in_reply_to(&(
|
self.client.say_in_reply_to(&(
|
||||||
msg.clone().channel_login().to_string(),
|
chnl.0,
|
||||||
msg.message_id().to_string()),
|
msgid),
|
||||||
outmsg).await.unwrap();
|
outmsg).await.unwrap();
|
||||||
},
|
},
|
||||||
BotMsgType::Say(a, _) => {
|
BotMsgType::Say(a, _) => {
|
||||||
self.client.say(a, outmsg).await.unwrap();
|
self.client.say(a, outmsg).await.unwrap();
|
||||||
}
|
}
|
||||||
BotMsgType::Notif(outmsg) => {
|
BotMsgType::Notif(outmsg) => {
|
||||||
|
|
||||||
|
// dbg!(chnl.clone(),msgid.clone(),outmsg.clone());
|
||||||
|
dbg!(params.msg.channel_login(),params.msg.message_id());
|
||||||
self.client.say_in_reply_to(¶ms.msg, outmsg).await.unwrap();
|
self.client.say_in_reply_to(¶ms.msg, outmsg).await.unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -372,7 +386,8 @@ impl Chat {
|
||||||
channel_login.clone(), "rate limit counter increase", contextratelimiter
|
channel_login.clone(), "rate limit counter increase", contextratelimiter
|
||||||
);
|
);
|
||||||
|
|
||||||
if let BotMsgType::SayInReplyTo(_,_ ) = msginput {
|
// if let BotMsgType::SayInReplyTo(_,_ ) = msginput {
|
||||||
|
if let BotMsgType::SayInReplyTo(_,_,_ ) = msginput {
|
||||||
botlog::trace(
|
botlog::trace(
|
||||||
logstr.as_str(),
|
logstr.as_str(),
|
||||||
Some("Chat > send_botmsg".to_string()),
|
Some("Chat > send_botmsg".to_string()),
|
||||||
|
@ -408,7 +423,14 @@ impl Chat {
|
||||||
// #[async_recursion]
|
// #[async_recursion]
|
||||||
// pub async fn say_in_reply_to(&self, msg: &PrivmsgMessage, outmsg: String , params : ExecBodyParams) {
|
// pub async fn say_in_reply_to(&self, msg: &PrivmsgMessage, outmsg: String , params : ExecBodyParams) {
|
||||||
// pub async fn say_in_reply_to(&self, msg: &PrivmsgMessage, outmsg: String , params : ExecBodyParams) {
|
// pub async fn say_in_reply_to(&self, msg: &PrivmsgMessage, outmsg: String , params : ExecBodyParams) {
|
||||||
pub async fn say_in_reply_to(&self, msg: &impl ReplyToMessage, outmsg: String , params : ExecBodyParams) {
|
// pub async fn say_in_reply_to(&self, msg: &impl ReplyToMessage, outmsg: String , params : ExecBodyParams) {
|
||||||
|
pub async fn say_in_reply_to(
|
||||||
|
&self,
|
||||||
|
destination_channel : Channel ,
|
||||||
|
reply_message_id : String ,
|
||||||
|
outmsg: String ,
|
||||||
|
params : ExecBodyParams)
|
||||||
|
{
|
||||||
|
|
||||||
// let params_clone = params.clone();
|
// let params_clone = params.clone();
|
||||||
|
|
||||||
|
@ -462,8 +484,8 @@ impl Chat {
|
||||||
|
|
||||||
|
|
||||||
self.send_botmsg(BotMsgType::SayInReplyTo(
|
self.send_botmsg(BotMsgType::SayInReplyTo(
|
||||||
(msg.channel_login().to_string(),
|
destination_channel,
|
||||||
msg.message_id().to_string()),
|
reply_message_id,
|
||||||
outmsg) , params).await;
|
outmsg) , params).await;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ const OF_CMD_CHANNEL:Channel = Channel(String::new());
|
||||||
|
|
||||||
|
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
|
use twitch_irc::message::ReplyToMessage;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use crate::core::bot_actions::ExecBodyParams;
|
use crate::core::bot_actions::ExecBodyParams;
|
||||||
|
@ -140,7 +141,8 @@ async fn rp(params : ExecBodyParams)
|
||||||
.chat
|
.chat
|
||||||
.say_in_reply_to(
|
.say_in_reply_to(
|
||||||
//using the tuple as param to the message being replied
|
//using the tuple as param to the message being replied
|
||||||
&answear,
|
Channel(answear.0),
|
||||||
|
answear.1,
|
||||||
String::from("hey there"),
|
String::from("hey there"),
|
||||||
params.clone()
|
params.clone()
|
||||||
).await;
|
).await;
|
||||||
|
@ -188,7 +190,8 @@ async fn good_girl(params : ExecBodyParams) {
|
||||||
.botmgrs
|
.botmgrs
|
||||||
.chat
|
.chat
|
||||||
.say_in_reply_to(
|
.say_in_reply_to(
|
||||||
¶ms.msg,
|
Channel(params.clone().msg.channel_login().to_string()),
|
||||||
|
params.clone().msg.message_id().to_string(),
|
||||||
String::from("GoodGirl xdd "),
|
String::from("GoodGirl xdd "),
|
||||||
params.clone()
|
params.clone()
|
||||||
).await;
|
).await;
|
||||||
|
@ -228,7 +231,8 @@ async fn babygirl(params : ExecBodyParams) {
|
||||||
.botmgrs
|
.botmgrs
|
||||||
.chat
|
.chat
|
||||||
.say_in_reply_to(
|
.say_in_reply_to(
|
||||||
¶ms.msg,
|
Channel(params.clone().msg.channel_login().to_string()),
|
||||||
|
params.clone().msg.message_id().to_string(),
|
||||||
String::from("16:13 notohh: cafdk"),
|
String::from("16:13 notohh: cafdk"),
|
||||||
params.clone()
|
params.clone()
|
||||||
).await;
|
).await;
|
||||||
|
@ -240,7 +244,8 @@ async fn babygirl(params : ExecBodyParams) {
|
||||||
.botmgrs
|
.botmgrs
|
||||||
.chat
|
.chat
|
||||||
.say_in_reply_to(
|
.say_in_reply_to(
|
||||||
¶ms.msg,
|
Channel(params.clone().msg.channel_login().to_string()),
|
||||||
|
params.clone().msg.message_id().to_string(),
|
||||||
String::from("16:13 notohh: have fun eating princess"),
|
String::from("16:13 notohh: have fun eating princess"),
|
||||||
params.clone()
|
params.clone()
|
||||||
).await;
|
).await;
|
||||||
|
@ -252,7 +257,8 @@ async fn babygirl(params : ExecBodyParams) {
|
||||||
.botmgrs
|
.botmgrs
|
||||||
.chat
|
.chat
|
||||||
.say_in_reply_to(
|
.say_in_reply_to(
|
||||||
¶ms.msg,
|
Channel(params.clone().msg.channel_login().to_string()),
|
||||||
|
params.clone().msg.message_id().to_string(),
|
||||||
String::from("16:13 notohh: baby girl"),
|
String::from("16:13 notohh: baby girl"),
|
||||||
params.clone()
|
params.clone()
|
||||||
).await;
|
).await;
|
||||||
|
|
|
@ -17,6 +17,7 @@ const OF_CMD_CHANNEL:Channel = Channel(String::new());
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use chrono::{TimeZone,Local};
|
use chrono::{TimeZone,Local};
|
||||||
|
use twitch_irc::message::ReplyToMessage;
|
||||||
|
|
||||||
|
|
||||||
use crate::core::bot_actions::ExecBodyParams;
|
use crate::core::bot_actions::ExecBodyParams;
|
||||||
|
@ -180,7 +181,8 @@ async fn sayout(params : ExecBodyParams) {
|
||||||
.botmgrs
|
.botmgrs
|
||||||
.chat
|
.chat
|
||||||
.say_in_reply_to(
|
.say_in_reply_to(
|
||||||
¶ms.msg,
|
Channel(params.clone().msg.channel_login().to_string()),
|
||||||
|
params.clone().msg.message_id().to_string(),
|
||||||
String::from("Invalid arguments"),
|
String::from("Invalid arguments"),
|
||||||
params.clone()
|
params.clone()
|
||||||
).await;
|
).await;
|
||||||
|
|
Loading…
Reference in a new issue