diff options
| author | mat <git@matdoes.dev> | 2023-05-13 19:29:55 -0500 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2023-05-13 19:29:55 -0500 |
| commit | 0cc76dfb67e852868e30d1c8529826c41a18e9d1 (patch) | |
| tree | 2e8c8c9aa3702431608509caa75dd3b5c8329f14 /azalea-client/src | |
| parent | ca39b8b6af27a91431d2a837037881bc882f0dde (diff) | |
| download | azalea-drasl-0cc76dfb67e852868e30d1c8529826c41a18e9d1.tar.xz | |
ChatPacket::is_whisper
Diffstat (limited to 'azalea-client/src')
| -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 { |
