From 3e05086d47a50bbbaf52860edda3ff496473471f Mon Sep 17 00:00:00 2001 From: TheAwiteb Date: Thu, 5 Oct 2023 00:32:47 +0300 Subject: [PATCH] Add the `use_independent_chat_permissions` field to `RestrictChatMember` and `SetChatPermissions` --- crates/teloxide-core/schema.ron | 10 ++++++++++ .../teloxide-core/src/payloads/restrict_chat_member.rs | 2 ++ .../teloxide-core/src/payloads/set_chat_permissions.rs | 4 ++++ 3 files changed, 16 insertions(+) diff --git a/crates/teloxide-core/schema.ron b/crates/teloxide-core/schema.ron index 6d6c7ca6..346f64b5 100644 --- a/crates/teloxide-core/schema.ron +++ b/crates/teloxide-core/schema.ron @@ -1988,6 +1988,11 @@ Schema( ty: RawTy("ChatPermissions"), descr: Doc(md: "A JSON-serialized object for new user permissions") ), + Param( + name: "use_independent_chat_permissions", + ty: Option(bool), + descr: Doc(md: "Pass _True_ if chat permissions are set independently. Otherwise, the _can\\_send\\_other\\_messages_ and _can\\_add\\_web\\_page\\_previews_ permissions will imply the _can\\_send\\_messages_, _can\\_send\\_audios_, _can\\_send\\_documents_, _can\\_send\\_photos_, _can\\_send\\_videos_, _can\\_send\\_video\\_notes_, and _can\\_send\\_voice\\_notes_ permissions; the _can\\_send\\_polls_ permission will imply the _can\\_send\\_messages_ permission.") + ), Param( name: "until_date", ty: Option(u64), @@ -2153,6 +2158,11 @@ Schema( ty: RawTy("ChatPermissions"), descr: Doc(md: "New default chat permissions") ), + Param( + name: "use_independent_chat_permissions", + ty: Option(bool), + descr: Doc(md: "Pass _True_ if chat permissions are set independently. Otherwise, the _can\\_send\\_other\\_messages_ and _can\\_add\\_web\\_page\\_previews_ permissions will imply the _can\\_send\\_messages_, _can\\_send\\_audios_, _can\\_send\\_documents_, _can\\_send\\_photos_, _can\\_send\\_videos_, _can\\_send\\_video\\_notes_, and _can\\_send\\_voice\\_notes_ permissions; the _can\\_send\\_polls_ permission will imply the _can\\_send\\_messages_ permission.") + ), ], ), Method( diff --git a/crates/teloxide-core/src/payloads/restrict_chat_member.rs b/crates/teloxide-core/src/payloads/restrict_chat_member.rs index 282af1dd..9ed55079 100644 --- a/crates/teloxide-core/src/payloads/restrict_chat_member.rs +++ b/crates/teloxide-core/src/payloads/restrict_chat_member.rs @@ -18,6 +18,8 @@ impl_payload! { pub permissions: ChatPermissions, } optional { + /// Pass _True_ if chat permissions are set independently. Otherwise, the _can\_send\_other\_messages_ and _can\_add\_web\_page\_previews_ permissions will imply the _can\_send\_messages_, _can\_send\_audios_, _can\_send\_documents_, _can\_send\_photos_, _can\_send\_videos_, _can\_send\_video\_notes_, and _can\_send\_voice\_notes_ permissions; the _can\_send\_polls_ permission will imply the _can\_send\_messages_ permission. + pub use_independent_chat_permissions: bool, /// Date when the user will be unbanned, unix time. If user is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever #[serde(with = "crate::types::serde_opt_date_from_unix_timestamp")] pub until_date: DateTime [into], diff --git a/crates/teloxide-core/src/payloads/set_chat_permissions.rs b/crates/teloxide-core/src/payloads/set_chat_permissions.rs index debfc9a9..38d40b4e 100644 --- a/crates/teloxide-core/src/payloads/set_chat_permissions.rs +++ b/crates/teloxide-core/src/payloads/set_chat_permissions.rs @@ -14,5 +14,9 @@ impl_payload! { /// New default chat permissions pub permissions: ChatPermissions, } + optional { + /// Pass _True_ if chat permissions are set independently. Otherwise, the _can\_send\_other\_messages_ and _can\_add\_web\_page\_previews_ permissions will imply the _can\_send\_messages_, _can\_send\_audios_, _can\_send\_documents_, _can\_send\_photos_, _can\_send\_videos_, _can\_send\_video\_notes_, and _can\_send\_voice\_notes_ permissions; the _can\_send\_polls_ permission will imply the _can\_send\_messages_ permission. + pub use_independent_chat_permissions: bool, + } } }