Chat say functionality #41

Merged
modulatingforce merged 14 commits from chat-say into main 2024-03-24 00:00:48 -04:00
Showing only changes of commit b8bf2e33f6 - Show all commits

View file

@ -31,7 +31,7 @@ pub struct Chat {
#[derive(Clone)]
enum BotMsgType<'a> {
SayInReplyTo(&'a PrivmsgMessage,String),
_Say(String,String)
Say(String,String),
}
@ -68,9 +68,12 @@ impl Chat {
BotMsgType::SayInReplyTo(msg, outmsg) => {
(msg.channel_login.clone(),outmsg)
},
_ => {
panic!("ISSUE : NOT IMPLEMENTED")
BotMsgType::Say(a,b ) => {
(a.clone(),b.clone())
},
// _ => {
// panic!("ISSUE : NOT IMPLEMENTED")
// },
};
let rl = Arc::clone(&self.ratelimiters);
@ -99,9 +102,12 @@ impl Chat {
BotMsgType::SayInReplyTo(msg, _) => {
self.client.say_in_reply_to(msg, outmsg).await.unwrap();
},
_ => {
panic!("ISSUE : NOT IMPLEMENTED")
},
BotMsgType::Say(a, _) => {
self.client.say(a, outmsg).await.unwrap();
}
// _ => {
// panic!("ISSUE : NOT IMPLEMENTED")
// },
}
contextratelimiter.increment_counter();
@ -114,13 +120,13 @@ impl Chat {
if let BotMsgType::SayInReplyTo(msg,_ ) = msginput {
botlog::trace(
logstr.as_str(),
Some("Chat > say_in_reply_to".to_string()),
Some("Chat > send_botmsg".to_string()),
Some(&msg),
);
} else {
botlog::trace(
logstr.as_str(),
Some("Chat > say_in_reply_to".to_string()),
Some("Chat > send_botmsg".to_string()),
None,
);
}
@ -148,10 +154,11 @@ impl Chat {
}
async fn _say(&self, _: String, _: String) {
async fn _say(&self, channel_login: String, message: String) {
// more info https://docs.rs/twitch-irc/latest/twitch_irc/client/struct.TwitchIRCClient.html#method.say
// self.client.say(msg,outmsg).await.unwrap();
self.send_botmsg(BotMsgType::Say(channel_login, message)).await;
}
async fn _me(&self, _: String, _: String) {