Add title, username and photo to ChatShared

This commit is contained in:
Akshett Rai Jindal 2024-08-20 20:16:59 +05:30
parent cc8df7a32e
commit d92ba9c12a
2 changed files with 19 additions and 3 deletions

View file

@ -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<String>,
/// Username of the chat, if it was requested.
#[serde(default)]
pub username: Option<String>,
/// Available sizes of the chat photo, if it was requested.
#[serde(default)]
pub photo: Option<Vec<PhotoSize>>,
}

View file

@ -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