From d92ba9c12a27bc7f1f8b8f62a67fbcfafe4db455 Mon Sep 17 00:00:00 2001 From: Akshett Rai Jindal Date: Tue, 20 Aug 2024 20:16:59 +0530 Subject: [PATCH] Add `title`, `username` and `photo` to `ChatShared` --- crates/teloxide-core/src/types/chat_shared.rs | 17 +++++++++++++++-- crates/teloxide-core/src/types/message.rs | 5 ++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/crates/teloxide-core/src/types/chat_shared.rs b/crates/teloxide-core/src/types/chat_shared.rs index f23c94bb..3eeace53 100644 --- a/crates/teloxide-core/src/types/chat_shared.rs +++ b/crates/teloxide-core/src/types/chat_shared.rs @@ -1,8 +1,8 @@ use serde::{Deserialize, Serialize}; -use crate::types::{ChatId, RequestId}; +use crate::types::{ChatId, PhotoSize, RequestId}; -/// Information about the chat whose identifier was shared with the bot using a +/// Information about a chat that was shared with the bot using a /// [`KeyboardButtonRequestChat`] button. /// /// [`KeyboardButtonRequestChat`]: crate::types::KeyboardButtonRequestChat @@ -10,6 +10,19 @@ use crate::types::{ChatId, RequestId}; pub struct ChatShared { /// Identifier of the request. pub request_id: RequestId, + /// Identifier of the shared chat. pub chat_id: ChatId, + + /// Title of the chat, if it was requested. + #[serde(default)] + pub title: Option, + + /// Username of the chat, if it was requested. + #[serde(default)] + pub username: Option, + + /// Available sizes of the chat photo, if it was requested. + #[serde(default)] + pub photo: Option>, } diff --git a/crates/teloxide-core/src/types/message.rs b/crates/teloxide-core/src/types/message.rs index 17fbe150..7789142e 100644 --- a/crates/teloxide-core/src/types/message.rs +++ b/crates/teloxide-core/src/types/message.rs @@ -1905,7 +1905,10 @@ mod tests { kind: MessageKind::ChatShared(MessageChatShared { chat_shared: ChatShared { request_id: RequestId(348349), - chat_id: ChatId(384939) + chat_id: ChatId(384939), + title: None, + username: None, + photo: None, } }), via_bot: None