diff --git a/crates/teloxide-core/src/types/chat.rs b/crates/teloxide-core/src/types/chat.rs index 2b0fd386..eeef702f 100644 --- a/crates/teloxide-core/src/types/chat.rs +++ b/crates/teloxide-core/src/types/chat.rs @@ -1,7 +1,8 @@ use serde::{Deserialize, Serialize}; use crate::types::{ - ChatFullInfo, ChatId, ChatLocation, ChatPermissions, ChatPhoto, Message, Seconds, True, User, + ChatFullInfo, ChatId, ChatLocation, ChatPermissions, ChatPhoto, Message, ReactionType, Seconds, + True, User, }; /// This object represents a chat. @@ -21,6 +22,12 @@ pub struct Chat { /// [`GetChat`]: crate::payloads::GetChat pub photo: Option, + /// List of available reactions allowed in the chat. If omitted, then all + /// emoji reactions are allowed. Returned only from [`GetChat`]. + /// + /// [`GetChat`]: crate::payloads::GetChat + pub available_reactions: Option>, + /// The most recent pinned message (by sending date). Returned only in /// [`GetChat`]. /// @@ -602,13 +609,29 @@ mod tests { has_protected_content: None, }), photo: None, + available_reactions: Some(vec![ReactionType { + kind: ReactionTypeKind::Emoji { emoji: "🌭".to_owned() }, + }]), pinned_message: None, message_auto_delete_time: None, has_hidden_members: false, has_aggressive_anti_spam_enabled: false, chat_full_info: ChatFullInfo::default(), }; - let actual = from_str(r#"{"id":-1,"type":"channel","username":"channel_name"}"#).unwrap(); + let actual = from_str( + r#"{ + "id": -1, + "type": "channel", + "username": "channel_name", + "available_reactions": [ + { + "type": "emoji", + "emoji": "🌭" + } + ] + }"#, + ) + .unwrap(); assert_eq!(expected, actual); } @@ -626,14 +649,30 @@ mod tests { has_restricted_voice_and_video_messages: None, }), photo: None, + available_reactions: Some(vec![ReactionType { + kind: ReactionTypeKind::Emoji { emoji: "🌭".to_owned() }, + }]), pinned_message: None, message_auto_delete_time: None, has_hidden_members: false, has_aggressive_anti_spam_enabled: false, chat_full_info: ChatFullInfo::default() }, - from_str(r#"{"id":0,"type":"private","username":"username","first_name":"Anon"}"#) - .unwrap() + from_str( + r#"{ + "id": 0, + "type": "private", + "username": "username", + "first_name": "Anon", + "available_reactions": [ + { + "type": "emoji", + "emoji": "🌭" + } + ] + }"# + ) + .unwrap() ); } @@ -650,6 +689,7 @@ mod tests { has_restricted_voice_and_video_messages: None, }), photo: None, + available_reactions: None, pinned_message: None, message_auto_delete_time: None, has_hidden_members: false, diff --git a/crates/teloxide-core/src/types/message.rs b/crates/teloxide-core/src/types/message.rs index a862303b..24eff7cb 100644 --- a/crates/teloxide-core/src/types/message.rs +++ b/crates/teloxide-core/src/types/message.rs @@ -1841,6 +1841,7 @@ mod tests { has_restricted_voice_and_video_messages: None }), photo: None, + available_reactions: None, has_aggressive_anti_spam_enabled: false, pinned_message: None, message_auto_delete_time: None, @@ -2078,6 +2079,7 @@ mod tests { }), message_auto_delete_time: None, photo: None, + available_reactions: None, pinned_message: None, has_hidden_members: false, has_aggressive_anti_spam_enabled: false, @@ -2368,6 +2370,7 @@ mod tests { has_protected_content: None }), photo: None, + available_reactions: None, pinned_message: None, message_auto_delete_time: None, has_hidden_members: false, @@ -2476,6 +2479,7 @@ mod tests { has_protected_content: None }), photo: None, + available_reactions: None, pinned_message: None, message_auto_delete_time: None, has_hidden_members: false, @@ -2498,6 +2502,7 @@ mod tests { has_protected_content: None }), photo: None, + available_reactions: None, pinned_message: None, message_auto_delete_time: None, has_hidden_members: false, @@ -2598,6 +2603,7 @@ mod tests { has_protected_content: None }), photo: None, + available_reactions: None, pinned_message: None, message_auto_delete_time: None, has_hidden_members: false, diff --git a/crates/teloxide-core/src/types/update.rs b/crates/teloxide-core/src/types/update.rs index cd1b91be..18a37ad3 100644 --- a/crates/teloxide-core/src/types/update.rs +++ b/crates/teloxide-core/src/types/update.rs @@ -482,6 +482,7 @@ mod test { has_restricted_voice_and_video_messages: None, }), photo: None, + available_reactions: None, pinned_message: None, message_auto_delete_time: None, has_hidden_members: false, @@ -829,6 +830,7 @@ mod test { has_protected_content: None, }), photo: None, + available_reactions: None, pinned_message: None, message_auto_delete_time: None, has_hidden_members: false, @@ -908,6 +910,7 @@ mod test { has_protected_content: None, }), photo: None, + available_reactions: None, pinned_message: None, message_auto_delete_time: None, has_hidden_members: false,