diff options
| author | mat <git@matdoes.dev> | 2025-08-12 04:23:36 -0400 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2025-08-12 04:23:36 -0400 |
| commit | 163e24b18861a05523237e41d603d17348fbb389 (patch) | |
| tree | cd6207525f25da2d9e79c5e2664bc9e57643067d /azalea-client/src/plugins | |
| parent | 12aeae07d2667cd188acf88190ed5c3f7983926a (diff) | |
| download | azalea-drasl-163e24b18861a05523237e41d603d17348fbb389.tar.xz | |
improved whisper regex and autofill microsoft code on login
Diffstat (limited to 'azalea-client/src/plugins')
| -rw-r--r-- | azalea-client/src/plugins/chat/mod.rs | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/azalea-client/src/plugins/chat/mod.rs b/azalea-client/src/plugins/chat/mod.rs index 2e98fdf8..856184cc 100644 --- a/azalea-client/src/plugins/chat/mod.rs +++ b/azalea-client/src/plugins/chat/mod.rs @@ -63,14 +63,21 @@ impl ChatPacket { match self { ChatPacket::System(p) => { let message = p.content.to_string(); - - // Overlay messages aren't in chat + // overlay messages aren't in chat if p.overlay { return (None, message); } - // It's a system message, so we'll have to match the content with regex - if let Some(m) = regex!("^<([a-zA-Z_0-9]{1,16})> (?:-> me)?(.+)$").captures(&message) { + // it's a system message, so we'll have to match the content with regex + + if let Some(m) = + regex!("^<([a-zA-Z_0-9]{1,16})> (?:-> me)?(.+)$").captures(&message) + { + return (Some(m[1].to_string()), m[2].to_string()); + } + // 2b2t whispers + if let Some(m) = regex!("^([a-zA-Z_0-9]{1,16}) whispers: (.+)$").captures(&message) + { return (Some(m[1].to_string()), m[2].to_string()); } @@ -132,15 +139,11 @@ impl ChatPacket { match self { ChatPacket::System(p) => { let message = p.content.to_string(); - - // Overlay messages aren't in chat if p.overlay { return false; } - - // It's a system message, so we'll have to match the content with regex - if let Some(m) = regex!("^(-> me)?(?:.+)$").captures(&message) { - return m.get(1).is_some(); + if regex!("^(-> me|[a-zA-Z_0-9]{1,16} whispers: )").is_match(&message) { + return true; } false |
