added say to Chat
This commit is contained in:
parent
2957f9462b
commit
b8bf2e33f6
1 changed files with 16 additions and 9 deletions
|
@ -31,7 +31,7 @@ pub struct Chat {
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
enum BotMsgType<'a> {
|
enum BotMsgType<'a> {
|
||||||
SayInReplyTo(&'a PrivmsgMessage,String),
|
SayInReplyTo(&'a PrivmsgMessage,String),
|
||||||
_Say(String,String)
|
Say(String,String),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -68,9 +68,12 @@ impl Chat {
|
||||||
BotMsgType::SayInReplyTo(msg, outmsg) => {
|
BotMsgType::SayInReplyTo(msg, outmsg) => {
|
||||||
(msg.channel_login.clone(),outmsg)
|
(msg.channel_login.clone(),outmsg)
|
||||||
},
|
},
|
||||||
_ => {
|
BotMsgType::Say(a,b ) => {
|
||||||
panic!("ISSUE : NOT IMPLEMENTED")
|
(a.clone(),b.clone())
|
||||||
},
|
},
|
||||||
|
// _ => {
|
||||||
|
// panic!("ISSUE : NOT IMPLEMENTED")
|
||||||
|
// },
|
||||||
};
|
};
|
||||||
|
|
||||||
let rl = Arc::clone(&self.ratelimiters);
|
let rl = Arc::clone(&self.ratelimiters);
|
||||||
|
@ -99,9 +102,12 @@ impl Chat {
|
||||||
BotMsgType::SayInReplyTo(msg, _) => {
|
BotMsgType::SayInReplyTo(msg, _) => {
|
||||||
self.client.say_in_reply_to(msg, outmsg).await.unwrap();
|
self.client.say_in_reply_to(msg, outmsg).await.unwrap();
|
||||||
},
|
},
|
||||||
_ => {
|
BotMsgType::Say(a, _) => {
|
||||||
panic!("ISSUE : NOT IMPLEMENTED")
|
self.client.say(a, outmsg).await.unwrap();
|
||||||
},
|
}
|
||||||
|
// _ => {
|
||||||
|
// panic!("ISSUE : NOT IMPLEMENTED")
|
||||||
|
// },
|
||||||
}
|
}
|
||||||
|
|
||||||
contextratelimiter.increment_counter();
|
contextratelimiter.increment_counter();
|
||||||
|
@ -114,13 +120,13 @@ impl Chat {
|
||||||
if let BotMsgType::SayInReplyTo(msg,_ ) = msginput {
|
if let BotMsgType::SayInReplyTo(msg,_ ) = msginput {
|
||||||
botlog::trace(
|
botlog::trace(
|
||||||
logstr.as_str(),
|
logstr.as_str(),
|
||||||
Some("Chat > say_in_reply_to".to_string()),
|
Some("Chat > send_botmsg".to_string()),
|
||||||
Some(&msg),
|
Some(&msg),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
botlog::trace(
|
botlog::trace(
|
||||||
logstr.as_str(),
|
logstr.as_str(),
|
||||||
Some("Chat > say_in_reply_to".to_string()),
|
Some("Chat > send_botmsg".to_string()),
|
||||||
None,
|
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
|
// more info https://docs.rs/twitch-irc/latest/twitch_irc/client/struct.TwitchIRCClient.html#method.say
|
||||||
|
|
||||||
// self.client.say(msg,outmsg).await.unwrap();
|
// self.client.say(msg,outmsg).await.unwrap();
|
||||||
|
self.send_botmsg(BotMsgType::Say(channel_login, message)).await;
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn _me(&self, _: String, _: String) {
|
async fn _me(&self, _: String, _: String) {
|
||||||
|
|
Loading…
Reference in a new issue