diff --git a/CHANGELOG.md b/CHANGELOG.md index fa1bb419..ce7be0c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `ApiError::TooMuchInlineQueryResults` ([#135][pr135]) - `ApiError::NotEnoughRightsToChangeChatPermissions` ([#155][pr155]) - Support for 5.4 telegram bot API ([#133][pr133]) -- Support for 5.5 telegram bot API ([#143][pr143]) +- Support for 5.5 telegram bot API ([#143][pr143], [#164][pr164]) - `EditedMessageIsTooLong` error ([#109][pr109]) - `UntilDate` enum and use it for `{Restricted, Banned}::until_date` ([#116][pr116]) - `Limits::messages_per_min_channel` ([#121][pr121]) @@ -29,6 +29,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 [pr143]: https://github.com/teloxide/teloxide-core/pull/143 [pr151]: https://github.com/teloxide/teloxide-core/pull/151 [pr155]: https://github.com/teloxide/teloxide-core/pull/155 +[pr164]: https://github.com/teloxide/teloxide-core/pull/164 ### Changed diff --git a/src/types/chat.rs b/src/types/chat.rs index e46f06ae..a3e6f3fa 100644 --- a/src/types/chat.rs +++ b/src/types/chat.rs @@ -70,6 +70,12 @@ pub struct ChatPublic { /// /// [`GetChat`]: crate::payloads::GetChat pub invite_link: Option, + + /// `True`, if messages from the chat can't be forwarded to other chats. + /// Returned only in [`GetChat`]. + /// + /// [`GetChat`]: crate::payloads::GetChat + pub has_protected_content: Option, } #[serde_with_macros::skip_serializing_none] @@ -97,7 +103,7 @@ pub struct ChatPrivate { pub bio: Option, /// `True`, if privacy settings of the other party in the private chat - /// allows to use tg://user?id= links only in chats with the + /// allows to use `tg://user?id=` links only in chats with the /// user. Returned only in [`GetChat`]. /// /// [`GetChat`]: crate::payloads::GetChat @@ -389,6 +395,17 @@ impl Chat { } } + /// `True`, if messages from the chat can't be forwarded to other chats. + /// Returned only in [`GetChat`]. + /// + /// [`GetChat`]: crate::payloads::GetChat + pub fn has_protected_content(&self) -> Option { + match &self.kind { + ChatKind::Public(this) => this.has_protected_content, + _ => None, + } + } + /// A first name of the other party in a private chat. pub fn first_name(&self) -> Option<&str> { match &self.kind { @@ -446,6 +463,7 @@ mod tests { }), description: None, invite_link: None, + has_protected_content: None, }), photo: None, pinned_message: None, @@ -466,7 +484,7 @@ mod tests { first_name: Some("Anon".into()), last_name: None, bio: None, - has_private_forwards: None + has_private_forwards: None, }), photo: None, pinned_message: None, diff --git a/src/types/message.rs b/src/types/message.rs index 93d44aed..7405c7ad 100644 --- a/src/types/message.rs +++ b/src/types/message.rs @@ -1339,10 +1339,11 @@ mod tests { }), description: None, invite_link: None, + has_protected_content: None, }), + message_auto_delete_time: None, photo: None, pinned_message: None, - message_auto_delete_time: None, }; assert!(message.from().unwrap().is_anonymous());