From f04a0379aa50e76893ea0bd77a5610e51391e307 Mon Sep 17 00:00:00 2001 From: aria Date: Fri, 11 Jul 2025 20:43:45 +1000 Subject: [PATCH] feat(is_possible_chat_msg): support extra chat log format and add catchall backup --- src/main.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 198f6f5..16f5e30 100644 --- a/src/main.rs +++ b/src/main.rs @@ -237,10 +237,21 @@ fn is_possible_chat_msg(input: &str) -> bool { ) .unwrap() }); - static CLIENT_MSG_RE: Lazy = Lazy::new(|| { + static CLIENT_PRISM_MSG_RE: Lazy = Lazy::new(|| { Regex::new(r"\[.*\] \[Render thread\/INFO\] \[minecraft\/ChatComponent\]: \[CHAT\] <.*>*") .unwrap() }); + static CLIENT_LOG_MSG_RE: Lazy = Lazy::new(|| { + Regex::new(r"\[.*\] \[Render thread\/INFO\] \[net.minecraft.client.gui.components.ChatComponent\/\]: \[CHAT\] <.*>*") + .unwrap() + }); - SERVER_MSG_RE.is_match(input) || CLIENT_MSG_RE.is_match(input) + // This is here just in case I need to get a chat message from a strange place + static _CLIENT_CATCHALL_MSG_RE: Lazy = Lazy::new(|| { + Regex::new(r".*?: \[CHAT\] .*") + .unwrap() + }); + + + SERVER_MSG_RE.is_match(input) || CLIENT_PRISM_MSG_RE.is_match(input) || CLIENT_LOG_MSG_RE.is_match(input) }