diff --git a/src/types/chat.rs b/src/types/chat.rs index 6131b87d..6500dfcb 100644 --- a/src/types/chat.rs +++ b/src/types/chat.rs @@ -99,6 +99,13 @@ pub struct ChatPrivate { /// /// [`GetChat`]: crate::payloads::GetChat pub has_private_forwards: Option, + + /// `True`, if the privacy settings of the other party restrict sending + /// voice and video note messages in the private chat. Returned only in + /// [`GetChat`]. + /// + /// [`GetChat`]: crate::payloads::GetChat + pub has_restricted_voice_and_video_messages: Option, } #[serde_with_macros::skip_serializing_none] @@ -492,6 +499,7 @@ mod serde_helper { last_name: Option, bio: Option, has_private_forwards: Option, + has_restricted_voice_and_video_messages: Option, } impl From for super::ChatPrivate { @@ -503,6 +511,7 @@ mod serde_helper { last_name, bio, has_private_forwards, + has_restricted_voice_and_video_messages, }: ChatPrivate, ) -> Self { Self { @@ -511,6 +520,7 @@ mod serde_helper { last_name, bio, has_private_forwards, + has_restricted_voice_and_video_messages, } } } @@ -523,6 +533,7 @@ mod serde_helper { last_name, bio, has_private_forwards, + has_restricted_voice_and_video_messages, }: super::ChatPrivate, ) -> Self { Self { @@ -532,6 +543,7 @@ mod serde_helper { last_name, bio, has_private_forwards, + has_restricted_voice_and_video_messages, } } } @@ -576,6 +588,7 @@ mod tests { last_name: None, bio: None, has_private_forwards: None, + has_restricted_voice_and_video_messages: None, }), photo: None, pinned_message: None, @@ -596,6 +609,7 @@ mod tests { last_name: None, bio: None, has_private_forwards: None, + has_restricted_voice_and_video_messages: None, }), photo: None, pinned_message: None, diff --git a/src/types/message_entity.rs b/src/types/message_entity.rs index 4ac72484..f417d442 100644 --- a/src/types/message_entity.rs +++ b/src/types/message_entity.rs @@ -139,7 +139,7 @@ impl MessageEntity { /// If you don't have a complete [`User`] value, please use /// [`MessageEntity::text_mention_id`] instead. #[must_use] - pub fn text_mention(user: User, offset: usize, length: usize) -> Self { + pub const fn text_mention(user: User, offset: usize, length: usize) -> Self { Self { kind: MessageEntityKind::TextMention { user }, offset, @@ -158,6 +158,16 @@ impl MessageEntity { } } + /// Create a message entity representing a custom emoji. + #[must_use] + pub const fn custom_emoji(custom_emoji_id: String, offset: usize, length: usize) -> Self { + Self { + kind: MessageEntityKind::CustomEmoji { custom_emoji_id }, + offset, + length, + } + } + #[must_use] pub fn kind(mut self, val: MessageEntityKind) -> Self { self.kind = val; @@ -300,13 +310,14 @@ pub enum MessageEntityKind { PhoneNumber, Bold, Italic, + Underline, + Strikethrough, + Spoiler, Code, Pre { language: Option }, TextLink { url: reqwest::Url }, TextMention { user: User }, - Underline, - Strikethrough, - Spoiler, + CustomEmoji { custom_emoji_id: String }, // FIXME(waffle): newtype this } #[cfg(test)] diff --git a/src/types/update.rs b/src/types/update.rs index 05b55133..0ca68c3e 100644 --- a/src/types/update.rs +++ b/src/types/update.rs @@ -344,6 +344,7 @@ mod test { last_name: None, bio: None, has_private_forwards: None, + has_restricted_voice_and_video_messages: None, }), photo: None, pinned_message: None,