From 89e22a6b6d0dd53be969a2c1aa7a1778f4c31edc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D1=8B=D1=80=D1=86=D0=B5=D0=B2=20=D0=92=D0=B0=D0=B4?= =?UTF-8?q?=D0=B8=D0=BC=20=D0=98=D0=B3=D0=BE=D1=80=D0=B5=D0=B2=D0=B8=D1=87?= Date: Thu, 6 Jun 2024 17:07:22 +0300 Subject: [PATCH] Fix wrong declaration for the GetMy(Short)Description method --- Cargo.lock | 129 ++++++++++++++++++ crates/teloxide-core/schema.ron | 21 +-- .../src/payloads/get_my_description.rs | 4 +- .../src/payloads/get_my_short_description.rs | 8 +- 4 files changed, 147 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7cabfb9e..4501b961 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -420,6 +420,7 @@ checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", "crypto-common", + "subtle", ] [[package]] @@ -507,6 +508,17 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "etcetera" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "136d1b5283a1ab77bd9257427ffd09d8667ced0570b6f938942bc7568ed5b943" +dependencies = [ + "cfg-if", + "home", + "windows-sys 0.48.0", +] + [[package]] name = "event-listener" version = "2.5.3" @@ -519,6 +531,12 @@ version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "658bd65b1cf4c852a3cc96f18a8ce7b5640f6b703f905c7d74532294c2a63984" +[[package]] +name = "finl_unicode" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fcfdc7a0362c9f4444381a9e697c79d435fe65b52a37466fc2c1184cee9edc6" + [[package]] name = "flume" version = "0.11.0" @@ -767,6 +785,33 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + +[[package]] +name = "home" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" +dependencies = [ + "windows-sys 0.52.0", +] + [[package]] name = "http" version = "0.2.12" @@ -1059,6 +1104,16 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" +[[package]] +name = "md-5" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" +dependencies = [ + "cfg-if", + "digest", +] + [[package]] name = "memchr" version = "2.7.2" @@ -1820,6 +1875,7 @@ checksum = "c9a2ccff1a000a5a59cd33da541d9f2fdcd9e6e8229cc200565942bff36d0aaa" dependencies = [ "sqlx-core", "sqlx-macros", + "sqlx-postgres", "sqlx-sqlite", ] @@ -1854,6 +1910,7 @@ dependencies = [ "rustls", "rustls-pemfile", "serde", + "serde_json", "sha2", "smallvec", "sqlformat", @@ -1895,6 +1952,7 @@ dependencies = [ "serde_json", "sha2", "sqlx-core", + "sqlx-postgres", "sqlx-sqlite", "syn 1.0.109", "tempfile", @@ -1902,6 +1960,44 @@ dependencies = [ "url", ] +[[package]] +name = "sqlx-postgres" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c824eb80b894f926f89a0b9da0c7f435d27cdd35b8c655b114e58223918577e" +dependencies = [ + "atoi", + "base64 0.21.7", + "bitflags 2.4.2", + "byteorder", + "crc", + "dotenvy", + "etcetera", + "futures-channel", + "futures-core", + "futures-io", + "futures-util", + "hex", + "hkdf", + "hmac", + "home", + "itoa", + "log", + "md-5", + "memchr", + "once_cell", + "rand", + "serde", + "serde_json", + "sha2", + "smallvec", + "sqlx-core", + "stringprep", + "thiserror", + "tracing", + "whoami", +] + [[package]] name = "sqlx-sqlite" version = "0.7.4" @@ -1925,12 +2021,29 @@ dependencies = [ "urlencoding", ] +[[package]] +name = "stringprep" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb41d74e231a107a1b4ee36bd1214b11285b77768d2e3824aedafa988fd36ee6" +dependencies = [ + "finl_unicode", + "unicode-bidi", + "unicode-normalization", +] + [[package]] name = "strsim" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +[[package]] +name = "subtle" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" + [[package]] name = "syn" version = "1.0.109" @@ -2403,6 +2516,12 @@ version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +[[package]] +name = "wasite" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b" + [[package]] name = "wasm-bindgen" version = "0.2.92" @@ -2498,6 +2617,16 @@ version = "0.25.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" +[[package]] +name = "whoami" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a44ab49fad634e88f55bf8f9bb3abd2f27d7204172a112c7c9987e01c1c94ea9" +dependencies = [ + "redox_syscall", + "wasite", +] + [[package]] name = "winapi" version = "0.3.9" diff --git a/crates/teloxide-core/schema.ron b/crates/teloxide-core/schema.ron index 1991fd1c..1fe6411b 100644 --- a/crates/teloxide-core/schema.ron +++ b/crates/teloxide-core/schema.ron @@ -2916,14 +2916,17 @@ Schema( Method( names: ("getMyDescription", "GetMyDescription", "get_my_description"), return_ty: RawTy("BotDescription"), - doc: Doc(md: "Use this method to get the current bot description for the given user language. Returns BotDescription on success."), + doc: Doc( + md: "Use this method to get the current bot description for the given user language. Returns [BotDescription] on success.", + md_links: {"BotDescription": "https://core.telegram.org/bots/api#botdescription"} + ), tg_doc: "https://core.telegram.org/bots/api#getmydescription", tg_category: "Available methods", params: [ Param( name: "language_code", ty: Option(String), - descr: Doc(md: "A two-letter ISO 639-1 language code or an empty string") + descr: Doc(md: "A two-letter ISO 639-1 language code") ) ] ), @@ -2949,19 +2952,17 @@ Schema( Method( names: ("getMyShortDescription", "GetMyShortDescription", "get_my_short_description"), return_ty: RawTy("BotShortDescription"), - doc: Doc(md: "Use this method to change the bot's short description, which is shown on the bot's profile page and is sent together with the link when users share the bot. Returns True on success."), - tg_doc: "https://core.telegram.org/bots/api#setmyshortdescription", + doc: Doc( + md: "Use this method to get the current bot short description for the given user language. Returns [BotShortDescription] on success.", + md_links: {"BotShortDescription": "https://core.telegram.org/bots/api#botshortdescription"} + ), + tg_doc: "https://core.telegram.org/bots/api#getmyshortdescription", tg_category: "Available methods", params: [ - Param( - name: "short_description", - ty: Option(String), - descr: Doc(md: "New short description for the bot; 0-120 characters. Pass an empty string to remove the dedicated short description for the given language.") - ), Param( name: "language_code", ty: Option(String), - descr: Doc(md: "A two-letter ISO 639-1 language code. If empty, the short description will be applied to all users for whose language there is no dedicated short description.") + descr: Doc(md: "A two-letter ISO 639-1 language code") ), ] ), diff --git a/crates/teloxide-core/src/payloads/get_my_description.rs b/crates/teloxide-core/src/payloads/get_my_description.rs index 1a15fa2a..8252b4cd 100644 --- a/crates/teloxide-core/src/payloads/get_my_description.rs +++ b/crates/teloxide-core/src/payloads/get_my_description.rs @@ -5,7 +5,9 @@ use serde::Serialize; use crate::types::BotDescription; impl_payload! { - /// Use this method to get the current bot description for the given user language. Returns BotDescription on success. + /// Use this method to get the current bot description for the given user language. Returns [`BotDescription`] on success. + /// + /// [`BotDescription`]: crate::types::BotDescription #[derive(Debug, PartialEq, Eq, Hash, Default, Clone, Serialize)] pub GetMyDescription (GetMyDescriptionSetters) => BotDescription { optional { diff --git a/crates/teloxide-core/src/payloads/get_my_short_description.rs b/crates/teloxide-core/src/payloads/get_my_short_description.rs index 8e378798..b4c8c2b8 100644 --- a/crates/teloxide-core/src/payloads/get_my_short_description.rs +++ b/crates/teloxide-core/src/payloads/get_my_short_description.rs @@ -5,13 +5,13 @@ use serde::Serialize; use crate::types::BotShortDescription; impl_payload! { - /// Use this method to change the bot's short description, which is shown on the bot's profile page and is sent together with the link when users share the bot. Returns True on success. + /// Use this method to get the current bot short description for the given user language. Returns [`BotShortDescription`] on success. + /// + /// [`BotShortDescription`]: crate::types::BotShortDescription #[derive(Debug, PartialEq, Eq, Hash, Default, Clone, Serialize)] pub GetMyShortDescription (GetMyShortDescriptionSetters) => BotShortDescription { optional { - /// New short description for the bot; 0-120 characters. Pass an empty string to remove the dedicated short description for the given language. - pub short_description: String [into], - /// A two-letter ISO 639-1 language code. If empty, the short description will be applied to all users for whose language there is no dedicated short description. + /// A two-letter ISO 639-1 language code or an empty string pub language_code: String [into], } }