diff --git a/crates/teloxide-core/src/types/chat.rs b/crates/teloxide-core/src/types/chat.rs index 3f6fbd52..2b0fd386 100644 --- a/crates/teloxide-core/src/types/chat.rs +++ b/crates/teloxide-core/src/types/chat.rs @@ -108,13 +108,6 @@ pub struct ChatPrivate { /// A last name of the other party in a private chat. pub last_name: Option, - /// Custom emoji identifier of emoji status of the other party in a private - /// chat. Returned only in [`GetChat`]. - /// - /// [`GetChat`]: crate::payloads::GetChat - // FIXME: CustomEmojiId - pub emoji_status_custom_emoji_id: Option, - /// Bio of the other party in a private chat. Returned only in [`GetChat`]. /// /// [`GetChat`]: crate::payloads::GetChat @@ -539,7 +532,6 @@ mod serde_helper { bio: Option, has_private_forwards: Option, has_restricted_voice_and_video_messages: Option, - emoji_status_custom_emoji_id: Option, } impl From for super::ChatPrivate { @@ -552,7 +544,6 @@ mod serde_helper { bio, has_private_forwards, has_restricted_voice_and_video_messages, - emoji_status_custom_emoji_id, }: ChatPrivate, ) -> Self { Self { @@ -562,7 +553,6 @@ mod serde_helper { bio, has_private_forwards, has_restricted_voice_and_video_messages, - emoji_status_custom_emoji_id, } } } @@ -576,7 +566,6 @@ mod serde_helper { bio, has_private_forwards, has_restricted_voice_and_video_messages, - emoji_status_custom_emoji_id, }: super::ChatPrivate, ) -> Self { Self { @@ -587,7 +576,6 @@ mod serde_helper { bio, has_private_forwards, has_restricted_voice_and_video_messages, - emoji_status_custom_emoji_id, } } } @@ -618,7 +606,7 @@ mod tests { message_auto_delete_time: None, has_hidden_members: false, has_aggressive_anti_spam_enabled: false, - chat_full_info: ChatFullInfo { emoji_status_expiration_date: None }, + chat_full_info: ChatFullInfo::default(), }; let actual = from_str(r#"{"id":-1,"type":"channel","username":"channel_name"}"#).unwrap(); assert_eq!(expected, actual); @@ -636,14 +624,13 @@ mod tests { bio: None, has_private_forwards: None, has_restricted_voice_and_video_messages: None, - emoji_status_custom_emoji_id: None }), photo: None, pinned_message: None, message_auto_delete_time: None, has_hidden_members: false, has_aggressive_anti_spam_enabled: false, - chat_full_info: ChatFullInfo { emoji_status_expiration_date: None } + chat_full_info: ChatFullInfo::default() }, from_str(r#"{"id":0,"type":"private","username":"username","first_name":"Anon"}"#) .unwrap() @@ -661,14 +648,13 @@ mod tests { bio: None, has_private_forwards: None, has_restricted_voice_and_video_messages: None, - emoji_status_custom_emoji_id: None, }), photo: None, pinned_message: None, message_auto_delete_time: None, has_hidden_members: false, has_aggressive_anti_spam_enabled: false, - chat_full_info: ChatFullInfo { emoji_status_expiration_date: None }, + chat_full_info: ChatFullInfo::default(), }; let json = to_string(&chat).unwrap(); diff --git a/crates/teloxide-core/src/types/chat_full_info.rs b/crates/teloxide-core/src/types/chat_full_info.rs index 69d547a7..f48f3d07 100644 --- a/crates/teloxide-core/src/types/chat_full_info.rs +++ b/crates/teloxide-core/src/types/chat_full_info.rs @@ -4,12 +4,43 @@ use serde::{Deserialize, Serialize}; // TODO: in the TBA7.3 the Chat will be splitted into Chat and ChatInfo // Currently it's just a container for the some fields of the Chat struct #[serde_with::skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Default, Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct ChatFullInfo { + /// Identifier of the accent color for the chat name and backgrounds of the + /// chat photo, reply header, and link preview. See [accent colors] for more + /// details. + /// + /// [accent colors]: https://core.telegram.org/bots/api#accent-colors + pub accent_color_id: Option, + /// Custom emoji identifier of the emoji chosen by the chat for the reply + /// header and link preview background + // FIXME: CustomEmojiId + pub background_custom_emoji_id: Option, + /// Identifier of the accent color for the chat's profile background. See + /// [profile accent colors] for more details. + /// + /// [profile accent colors]: https://core.telegram.org/bots/api#profile-accent-colors + pub profile_accent_color_id: Option, + /// Custom emoji identifier of the emoji chosen by the chat for its profile + /// background + // FIXME: CustomEmojiId + pub profile_background_custom_emoji_id: Option, + /// Custom emoji identifier of emoji status of the other party in a private + /// chat. Returned only in [`GetChat`]. + /// + /// [`GetChat`]: crate::payloads::GetChat + // FIXME: CustomEmojiId + pub emoji_status_custom_emoji_id: Option, /// Expiration date of the emoji status of the chat or the other party in a /// private chat, in Unix time, if any #[serde(default, with = "crate::types::serde_opt_date_from_unix_timestamp")] pub emoji_status_expiration_date: Option>, + /// True, if new chat members will have access to old messages; available + /// only to chat administrators. Returned only in [`GetChat`]. + /// + /// [`GetChat`]: crate::payloads::GetChat + #[serde(default)] + pub has_visible_history: bool, } #[cfg(test)] @@ -18,18 +49,18 @@ mod tests { #[test] fn test_chat_full_info_de() { - assert_eq!( - serde_json::from_str::("{}").unwrap(), - ChatFullInfo { emoji_status_expiration_date: None } - ); + assert_eq!(serde_json::from_str::("{}").unwrap(), ChatFullInfo::default()); assert_eq!( serde_json::from_str::( r#"{ - "emoji_status_expiration_date": 1720708004 - }"# + "emoji_status_expiration_date": 1720708004 + }"# ) .unwrap(), - ChatFullInfo { emoji_status_expiration_date: DateTime::from_timestamp(1720708004, 0) } + ChatFullInfo { + emoji_status_expiration_date: DateTime::from_timestamp(1720708004, 0), + ..ChatFullInfo::default() + } ); } } diff --git a/crates/teloxide-core/src/types/message.rs b/crates/teloxide-core/src/types/message.rs index b2696028..eddd623e 100644 --- a/crates/teloxide-core/src/types/message.rs +++ b/crates/teloxide-core/src/types/message.rs @@ -1775,7 +1775,6 @@ mod tests { last_name: Some("Власов".to_string()), username: Some("aka_dude".to_string()), bio: None, - emoji_status_custom_emoji_id: None, has_private_forwards: None, has_restricted_voice_and_video_messages: None }), @@ -1784,7 +1783,7 @@ mod tests { pinned_message: None, message_auto_delete_time: None, has_hidden_members: false, - chat_full_info: ChatFullInfo { emoji_status_expiration_date: None } + chat_full_info: ChatFullInfo::default() }, kind: MessageKind::ChatShared(MessageChatShared { chat_shared: ChatShared { request_id: 348349, chat_id: ChatId(384939) } @@ -2017,7 +2016,7 @@ mod tests { pinned_message: None, has_hidden_members: false, has_aggressive_anti_spam_enabled: false, - chat_full_info: ChatFullInfo { emoji_status_expiration_date: None }, + chat_full_info: ChatFullInfo::default(), }; assert!(message.from().unwrap().is_anonymous()); diff --git a/crates/teloxide-core/src/types/update.rs b/crates/teloxide-core/src/types/update.rs index cd08a326..a1d504ee 100644 --- a/crates/teloxide-core/src/types/update.rs +++ b/crates/teloxide-core/src/types/update.rs @@ -435,14 +435,13 @@ mod test { bio: None, has_private_forwards: None, has_restricted_voice_and_video_messages: None, - emoji_status_custom_emoji_id: None, }), photo: None, pinned_message: None, message_auto_delete_time: None, has_hidden_members: false, has_aggressive_anti_spam_enabled: false, - chat_full_info: ChatFullInfo { emoji_status_expiration_date: None }, + chat_full_info: ChatFullInfo::default(), }, kind: MessageKind::Common(MessageCommon { from: Some(User {