Add unrestrict_boost_count field and getter

to the `PublicChatSupergroup` struct
This commit is contained in:
Andrey Brusnik 2024-07-20 20:49:25 +04:00
parent a362e1f825
commit 221742b98b
No known key found for this signature in database
GPG key ID: D33232F28CFF442C
4 changed files with 25 additions and 0 deletions

View file

@ -209,6 +209,13 @@ pub struct PublicChatSupergroup {
/// [`GetChat`]: crate::payloads::GetChat /// [`GetChat`]: crate::payloads::GetChat
pub slow_mode_delay: Option<Seconds>, pub slow_mode_delay: Option<Seconds>,
/// For supergroups, the minimum number of boosts that a non-administrator
/// user needs to add in order to ignore slow mode and chat permissions.
/// Returned only from [`GetChat`].
///
/// [`GetChat`]: crate::payloads::GetChat
pub unrestrict_boost_count: Option<u16>,
/// Unique identifier for the linked chat, i.e. the discussion group /// Unique identifier for the linked chat, i.e. the discussion group
/// identifier for a channel and vice versa. Returned only in [`GetChat`]. /// identifier for a channel and vice versa. Returned only in [`GetChat`].
/// ///
@ -370,6 +377,21 @@ impl Chat {
None None
} }
/// Unique identifier for the linked chat, i.e. the discussion group
/// identifier for a channel and vice versa. Returned only in [`GetChat`].
///
/// [`GetChat`]: crate::payloads::GetChat
#[must_use]
pub fn unrestrict_boost_count(&self) -> Option<u16> {
if let ChatKind::Public(this) = &self.kind {
if let PublicChatKind::Supergroup(this) = &this.kind {
return this.unrestrict_boost_count;
}
}
None
}
/// The location to which the supergroup is connected. Returned only in /// The location to which the supergroup is connected. Returned only in
/// [`GetChat`]. /// [`GetChat`].
/// ///

View file

@ -2116,6 +2116,7 @@ mod tests {
can_set_sticker_set: None, can_set_sticker_set: None,
permissions: None, permissions: None,
slow_mode_delay: None, slow_mode_delay: None,
unrestrict_boost_count: None,
linked_chat_id: None, linked_chat_id: None,
location: None, location: None,
join_by_request: None, join_by_request: None,

View file

@ -54,6 +54,7 @@ mod tests {
can_set_sticker_set: None, can_set_sticker_set: None,
permissions: None, permissions: None,
slow_mode_delay: None, slow_mode_delay: None,
unrestrict_boost_count: None,
linked_chat_id: None, linked_chat_id: None,
location: None, location: None,
join_to_send_messages: None, join_to_send_messages: None,

View file

@ -872,6 +872,7 @@ mod test {
can_set_sticker_set: None, can_set_sticker_set: None,
permissions: None, permissions: None,
slow_mode_delay: None, slow_mode_delay: None,
unrestrict_boost_count: None,
linked_chat_id: None, linked_chat_id: None,
location: None, location: None,
join_to_send_messages: None, join_to_send_messages: None,