Add custom_emoji_sticker_set_name field and getter

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

View file

@ -197,6 +197,13 @@ pub struct PublicChatSupergroup {
/// [`GetChat`]: crate::payloads::GetChat
pub can_set_sticker_set: Option<bool>,
/// For supergroups, the name of the group's custom emoji sticker set.
/// Custom emoji from this set can be used by all users and bots in the
/// group. Returned only from [`GetChat`].
///
/// [`GetChat`]: crate::payloads::GetChat
pub custom_emoji_sticker_set_name: Option<String>,
/// A default chat member permissions, for groups and supergroups.
/// Returned only from [`GetChat`].
///
@ -362,6 +369,22 @@ impl Chat {
None
}
/// For supergroups, the name of the group's custom emoji sticker set.
/// Custom emoji from this set can be used by all users and bots in the
/// group. Returned only from [`GetChat`].
///
/// [`GetChat`]: crate::payloads::GetChat
#[must_use]
pub fn custom_emoji_sticker_set_name(&self) -> Option<&str> {
if let ChatKind::Public(this) = &self.kind {
if let PublicChatKind::Supergroup(this) = &this.kind {
return this.custom_emoji_sticker_set_name.as_deref();
}
}
None
}
/// The minimum allowed delay between consecutive messages sent by each
/// unpriviledged user. Returned only from [`GetChat`].
///

View file

@ -2114,6 +2114,7 @@ mod tests {
username: None,
sticker_set_name: None,
can_set_sticker_set: None,
custom_emoji_sticker_set_name: None,
permissions: None,
slow_mode_delay: None,
unrestrict_boost_count: None,

View file

@ -52,6 +52,7 @@ mod tests {
is_forum: false,
sticker_set_name: None,
can_set_sticker_set: None,
custom_emoji_sticker_set_name: None,
permissions: None,
slow_mode_delay: None,
unrestrict_boost_count: None,

View file

@ -870,6 +870,7 @@ mod test {
is_forum: false,
sticker_set_name: None,
can_set_sticker_set: None,
custom_emoji_sticker_set_name: None,
permissions: None,
slow_mode_delay: None,
unrestrict_boost_count: None,