added ts to experiment
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
e4a44894d7
commit
97d76ea088
3 changed files with 41 additions and 8 deletions
5
Cargo.lock
generated
5
Cargo.lock
generated
|
@ -122,9 +122,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "chrono"
|
name = "chrono"
|
||||||
version = "0.4.34"
|
version = "0.4.35"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5bc015644b92d5890fab7489e49d21f879d5c990186827d42ec511919404f38b"
|
checksum = "8eaf5903dcbc0a39312feb77df2ff4c76387d591b9fc7b04a238dcf8bb62639a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"android-tzdata",
|
"android-tzdata",
|
||||||
"iana-time-zone",
|
"iana-time-zone",
|
||||||
|
@ -196,6 +196,7 @@ version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"casual_logger",
|
"casual_logger",
|
||||||
|
"chrono",
|
||||||
"dotenv",
|
"dotenv",
|
||||||
"futures",
|
"futures",
|
||||||
"rand",
|
"rand",
|
||||||
|
|
|
@ -13,6 +13,7 @@ rand = { version = "0.8.5", features = [] }
|
||||||
futures = "0.3"
|
futures = "0.3"
|
||||||
async-trait = "0.1.77"
|
async-trait = "0.1.77"
|
||||||
casual_logger = "0.6.5"
|
casual_logger = "0.6.5"
|
||||||
|
chrono = "0.4.35"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
name = "bot_lib"
|
name = "bot_lib"
|
||||||
|
|
|
@ -13,6 +13,8 @@
|
||||||
// use rand::Rng;
|
// use rand::Rng;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
use chrono::{TimeZone,Local};
|
||||||
|
|
||||||
use twitch_irc::message::PrivmsgMessage;
|
use twitch_irc::message::PrivmsgMessage;
|
||||||
|
|
||||||
// use crate::core::botinstance::ChType::Channel;
|
// 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") {
|
// let reply_parent_usr = if let Some(Some(reply)) = msg.source.tags.0.get("reply-thread-parent-user-login") {
|
||||||
Some(reply)
|
// 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 }
|
} else { None }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -150,14 +162,33 @@ async fn sayout(bot: BotAR, msg: PrivmsgMessage) {
|
||||||
[ ] Get Target Channel - trgchnl
|
[ ] Get Target Channel - trgchnl
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// reply_parent_ts
|
||||||
|
|
||||||
let newoutmsg = if let Some(srcmsg) = reply_parent {
|
let newoutmsg = if let Some(srcmsg) = reply_parent {
|
||||||
|
|
||||||
format!("{} from #{} says {} . Replying to: {} : {}",
|
// format!("{} from #{} says {} . Replying to: {} : {}",
|
||||||
msg.sender.name,msg.channel_login,outmsg, reply_parent_usr.unwrap(),srcmsg)
|
// 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 {
|
} else {
|
||||||
format!("{} from #{} says : {}",
|
// format!("{} from #{} says : {}",
|
||||||
msg.sender.name,msg.channel_login, outmsg)
|
// 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
|
// uses chat.say_in_reply_to() for the bot controls for messages
|
||||||
|
|
Loading…
Reference in a new issue