fix user parsing

This commit is contained in:
sad 2024-03-06 03:31:54 -07:00
parent 8853d17723
commit 322f473671
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG Key ID: 28D3A882F3E6AD02

View File

@ -160,7 +160,7 @@ async fn writemsg(mut writer: tokio::io::WriteHalf<tokio_native_tls::TlsStream<T
} }
if *cmd == "PRIVMSG" { if *cmd == "PRIVMSG" {
let channel = parts[2]; let channel = parts[2];
let user = parts[0].strip_prefix(':').unwrap().split_at(parts[0].find('!').unwrap()).0; let user = parts[0].strip_prefix(':').unwrap().split_at(parts[0].find('!').unwrap()).0.strip_suffix('!').unwrap();
let host = parts[0].split_at(parts[0].find('!').unwrap()).1; let host = parts[0].split_at(parts[0].find('!').unwrap()).1;
let msg_content = parts[3..].join(" ").replace(':', ""); let msg_content = parts[3..].join(" ").replace(':', "");
println!("{} {} {} {} {} {} {}", "DEBUG:".bold().yellow(), "channel:".bold().green(), channel.purple(), "user:".bold().green(), host.purple(), "msg:".bold().green(), msg_content.purple()); println!("{} {} {} {} {} {} {}", "DEBUG:".bold().yellow(), "channel:".bold().green(), channel.purple(), "user:".bold().green(), host.purple(), "msg:".bold().green(), msg_content.purple());