diff options
| author | mat <git@matdoes.dev> | 2023-05-24 02:52:21 -0500 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2023-05-24 02:52:21 -0500 |
| commit | 8be3921ad450958ac9bc8c1911ecd65760ea42b6 (patch) | |
| tree | 2bf05b45f2aaa23f3b1f54c1ef365888ee02f08a /azalea-client/src/chat.rs | |
| parent | 630c78b3180443115b84261a63bfdb3e61c41822 (diff) | |
| parent | eb65b0ad6e03f5ffcf8f0f2328ec91bb7e26259f (diff) | |
| download | azalea-drasl-8be3921ad450958ac9bc8c1911ecd65760ea42b6.tar.xz | |
merge main
Diffstat (limited to 'azalea-client/src/chat.rs')
| -rwxr-xr-x | azalea-client/src/chat.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/azalea-client/src/chat.rs b/azalea-client/src/chat.rs index 0ae0250a..90618c80 100755 --- a/azalea-client/src/chat.rs +++ b/azalea-client/src/chat.rs @@ -108,6 +108,16 @@ impl ChatPacket { overlay: false, })) } + + /// Whether this message was sent with /msg (or aliases). It works by + /// checking the translation key, so it won't work on servers that use their + /// own whisper system. + pub fn is_whisper(&self) -> bool { + match self.message() { + FormattedText::Text(_) => false, + FormattedText::Translatable(t) => t.key == "commands.message.display.incoming", + } + } } impl Client { |
