added ts to experiment

This commit is contained in:
ModulatingForce 2024-03-23 22:40:06 -04:00
parent e4a44894d7
commit 97d76ea088
3 changed files with 41 additions and 8 deletions
src/custom/experimental

View file

@ -13,6 +13,8 @@
// use rand::Rng;
use std::sync::Arc;
use chrono::{TimeZone,Local};
use twitch_irc::message::PrivmsgMessage;
// use crate::core::botinstance::ChType::Channel;
@ -71,8 +73,18 @@ async fn sayout(bot: BotAR, msg: PrivmsgMessage) {
;
let reply_parent_usr = if let Some(Some(reply)) = msg.source.tags.0.get("reply-thread-parent-user-login") {
Some(reply)
// let reply_parent_usr = if let Some(Some(reply)) = msg.source.tags.0.get("reply-thread-parent-user-login") {
// Some(reply)
// } else { None }
// ;
let reply_parent_ts = if let Some(Some(replyts)) = msg.source.tags.0.get("tmi-sent-ts") {
let a: i64 = replyts.parse().unwrap();
let b = Local.timestamp_millis_opt(a).unwrap();
// println!("Output : {}",b.to_string());
// println!("Formatted : {}",b.format("%m-%d %H:%M") );
Some(b.format("%m-%d %H:%M"))
} else { None }
;
@ -150,14 +162,33 @@ async fn sayout(bot: BotAR, msg: PrivmsgMessage) {
[ ] Get Target Channel - trgchnl
*/
// reply_parent_ts
let newoutmsg = if let Some(srcmsg) = reply_parent {
format!("{} from #{} says {} . Replying to: {} : {}",
msg.sender.name,msg.channel_login,outmsg, reply_parent_usr.unwrap(),srcmsg)
// format!("{} from #{} says {} . Replying to: {} : {}",
// msg.sender.name,msg.channel_login,outmsg, reply_parent_usr.unwrap(),srcmsg)
// format!("{} from #{} says {} @ {} {} : {}",
// msg.sender.name,
// msg.channel_login,
// outmsg,
// reply_parent_ts.unwrap(),
// reply_parent_usr.unwrap(),
// srcmsg)
format!("{} {} @ {} : {}",
reply_parent_ts.unwrap(),
msg.sender.name,
msg.channel_login,
srcmsg)
} else {
format!("{} from #{} says : {}",
msg.sender.name,msg.channel_login, outmsg)
// format!("{} from #{} says : {}",
// msg.sender.name,
// msg.channel_login,
// outmsg)
format!("in {} - {} : {}",
msg.channel_login,
msg.sender.name,
outmsg)
};
// uses chat.say_in_reply_to() for the bot controls for messages