Chat say functionality #41
1 changed files with 16 additions and 9 deletions
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue