mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-22 14:35:36 +01:00
Merge branch 'teloxide:master' into master
This commit is contained in:
commit
470e721b57
89 changed files with 2107 additions and 810 deletions
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
|
@ -20,7 +20,7 @@ env:
|
|||
# - crates/teloxide-core/src/codegen.rs
|
||||
# - rust-toolchain.toml
|
||||
# - below in the test matrix
|
||||
rust_nightly: nightly-2024-03-20
|
||||
rust_nightly: nightly-2024-07-03
|
||||
# When updating this, also update:
|
||||
# - **/README.md
|
||||
# - **/src/lib.rs
|
||||
|
@ -105,7 +105,7 @@ jobs:
|
|||
toolchain: beta
|
||||
features: "--features full"
|
||||
- rust: nightly
|
||||
toolchain: nightly-2024-03-20
|
||||
toolchain: nightly-2024-07-03
|
||||
features: "--features full nightly"
|
||||
- rust: msrv
|
||||
toolchain: 1.70.0
|
||||
|
|
|
@ -56,6 +56,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- High CPU usage on network errors ([PR 1002](https://github.com/teloxide/teloxide/pull/1002), [Issue 780](https://github.com/teloxide/teloxide/issues/780))
|
||||
- Fix app build errors when using items gated behind sqlite-storage with the feature sqlite-storage-rustls ([PR 1018](https://github.com/teloxide/teloxide/pull/1018))
|
||||
- Fix typo in `ApiError::ToMuchMessages` variant (rename it to `TooMuchMessages`) ([PR 1046](https://github.com/teloxide/teloxide/pull/1046))
|
||||
- Fix `ChatPermission` behavior to accurately reflect Telegram's functionality ([PR 1068](https://github.com/teloxide/teloxide/pull/1068))
|
||||
|
||||
### Changed
|
||||
|
||||
|
|
311
Cargo.lock
generated
311
Cargo.lock
generated
|
@ -4,9 +4,9 @@ version = 3
|
|||
|
||||
[[package]]
|
||||
name = "addr2line"
|
||||
version = "0.21.0"
|
||||
version = "0.22.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb"
|
||||
checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678"
|
||||
dependencies = [
|
||||
"gimli",
|
||||
]
|
||||
|
@ -50,9 +50,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "allocator-api2"
|
||||
version = "0.2.16"
|
||||
version = "0.2.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5"
|
||||
checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f"
|
||||
|
||||
[[package]]
|
||||
name = "android-tzdata"
|
||||
|
@ -76,7 +76,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "21cc1548309245035eb18aa7f0967da6bc65587005170c56e6ef2788a4cf3f4e"
|
||||
dependencies = [
|
||||
"include_dir",
|
||||
"itertools 0.10.5",
|
||||
"itertools",
|
||||
"proc-macro-error",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -85,9 +85,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "async-trait"
|
||||
version = "0.1.79"
|
||||
version = "0.1.81"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a507401cad91ec6a857ed5513a2073c82a9b9048762b885bb98655b306964681"
|
||||
checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -116,9 +116,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.2.0"
|
||||
version = "1.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80"
|
||||
checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0"
|
||||
|
||||
[[package]]
|
||||
name = "axum"
|
||||
|
@ -171,9 +171,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "backtrace"
|
||||
version = "0.3.71"
|
||||
version = "0.3.73"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d"
|
||||
checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a"
|
||||
dependencies = [
|
||||
"addr2line",
|
||||
"cc",
|
||||
|
@ -228,9 +228,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bumpalo"
|
||||
version = "3.15.4"
|
||||
version = "3.16.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7ff69b9dd49fd426c69a0db9fc04dd934cdb6645ff000864d98f7e2af8830eaa"
|
||||
checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c"
|
||||
|
||||
[[package]]
|
||||
name = "byteorder"
|
||||
|
@ -246,9 +246,9 @@ checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9"
|
|||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.0.91"
|
||||
version = "1.0.105"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1fd97381a8cc6493395a5afc4c691c1084b3768db713b73aa215217aa245d153"
|
||||
checksum = "5208975e568d83b6b05cc0a063c8e7e9acc2b43bee6da15616a5b73e109d7437"
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
|
@ -258,9 +258,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
|||
|
||||
[[package]]
|
||||
name = "chrono"
|
||||
version = "0.4.37"
|
||||
version = "0.4.38"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8a0d04d43504c61aa6c7531f1871dd0d418d91130162063b789da00fd7057a5e"
|
||||
checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401"
|
||||
dependencies = [
|
||||
"android-tzdata",
|
||||
"iana-time-zone",
|
||||
|
@ -272,9 +272,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "combine"
|
||||
version = "4.6.6"
|
||||
version = "4.6.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "35ed6e9d84f0b51a7f52daf1c7d71dd136fd7a3f41a8462b8cdb8c78d920fad4"
|
||||
checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"futures-core",
|
||||
|
@ -326,9 +326,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "crc"
|
||||
version = "3.2.0"
|
||||
version = "3.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c2b432c56615136f8dba245fed7ec3d5518c500a31108661067e61e72fe7e6bc"
|
||||
checksum = "69e6e4d7b33a94f0991c26729976b10ebde1d34c3ee82408fb536164fa10d636"
|
||||
dependencies = [
|
||||
"crc-catalog",
|
||||
]
|
||||
|
@ -350,9 +350,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "crossbeam-utils"
|
||||
version = "0.8.19"
|
||||
version = "0.8.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345"
|
||||
checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80"
|
||||
|
||||
[[package]]
|
||||
name = "crypto-common"
|
||||
|
@ -401,15 +401,15 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "derive_more"
|
||||
version = "0.99.17"
|
||||
version = "0.99.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321"
|
||||
checksum = "5f33878137e4dafd7fa914ad4e259e18a4e8e532b9617a2d0150262bf53abfce"
|
||||
dependencies = [
|
||||
"convert_case",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"rustc_version",
|
||||
"syn 1.0.109",
|
||||
"syn 2.0.52",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -440,18 +440,18 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "either"
|
||||
version = "1.10.0"
|
||||
version = "1.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a"
|
||||
checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "encoding_rs"
|
||||
version = "0.8.33"
|
||||
version = "0.8.34"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1"
|
||||
checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
@ -500,9 +500,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "errno"
|
||||
version = "0.3.8"
|
||||
version = "0.3.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245"
|
||||
checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.52.0",
|
||||
|
@ -527,9 +527,9 @@ checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0"
|
|||
|
||||
[[package]]
|
||||
name = "fastrand"
|
||||
version = "2.0.2"
|
||||
version = "2.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "658bd65b1cf4c852a3cc96f18a8ce7b5640f6b703f905c7d74532294c2a63984"
|
||||
checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a"
|
||||
|
||||
[[package]]
|
||||
name = "finl_unicode"
|
||||
|
@ -690,9 +690,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.2.13"
|
||||
version = "0.2.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a06fddc2749e0528d2813f95e050e87e52c8cbbae56223b9babf73b3e53b0cc6"
|
||||
checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
|
@ -701,9 +701,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "gimli"
|
||||
version = "0.28.1"
|
||||
version = "0.29.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253"
|
||||
checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd"
|
||||
|
||||
[[package]]
|
||||
name = "h2"
|
||||
|
@ -842,9 +842,9 @@ checksum = "add0ab9360ddbd88cfeb3bd9574a1d85cfdfa14db10b3e21d3700dbc4328758f"
|
|||
|
||||
[[package]]
|
||||
name = "httparse"
|
||||
version = "1.8.0"
|
||||
version = "1.9.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904"
|
||||
checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9"
|
||||
|
||||
[[package]]
|
||||
name = "httpdate"
|
||||
|
@ -869,9 +869,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
|
|||
|
||||
[[package]]
|
||||
name = "hyper"
|
||||
version = "0.14.28"
|
||||
version = "0.14.29"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80"
|
||||
checksum = "f361cde2f109281a220d4307746cdfd5ee3f410da58a70377762396775634b33"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"futures-channel",
|
||||
|
@ -959,18 +959,18 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "include_dir"
|
||||
version = "0.7.3"
|
||||
version = "0.7.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "18762faeff7122e89e0857b02f7ce6fcc0d101d5e9ad2ad7846cc01d61b7f19e"
|
||||
checksum = "923d117408f1e49d914f1a379a309cffe4f18c05cf4e3d12e613a15fc81bd0dd"
|
||||
dependencies = [
|
||||
"include_dir_macros",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "include_dir_macros"
|
||||
version = "0.7.3"
|
||||
version = "0.7.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b139284b5cf57ecfa712bcc66950bb635b31aff41c188e8a4cfc758eca374a3f"
|
||||
checksum = "7cab85a7ed0bd5f0e76d93846e0147172bed2e2d3f859bcc33a8d9699cad1a75"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -1029,15 +1029,6 @@ dependencies = [
|
|||
"either",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itertools"
|
||||
version = "0.12.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569"
|
||||
dependencies = [
|
||||
"either",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "1.0.11"
|
||||
|
@ -1053,17 +1044,11 @@ dependencies = [
|
|||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lazy_static"
|
||||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.153"
|
||||
version = "0.2.155"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd"
|
||||
checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c"
|
||||
|
||||
[[package]]
|
||||
name = "libsqlite3-sys"
|
||||
|
@ -1078,15 +1063,15 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "linux-raw-sys"
|
||||
version = "0.4.13"
|
||||
version = "0.4.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c"
|
||||
checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89"
|
||||
|
||||
[[package]]
|
||||
name = "lock_api"
|
||||
version = "0.4.11"
|
||||
version = "0.4.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45"
|
||||
checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"scopeguard",
|
||||
|
@ -1094,9 +1079,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.21"
|
||||
version = "0.4.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c"
|
||||
checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"
|
||||
|
||||
[[package]]
|
||||
name = "matchit"
|
||||
|
@ -1116,9 +1101,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.7.2"
|
||||
version = "2.7.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d"
|
||||
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
|
||||
|
||||
[[package]]
|
||||
name = "mime"
|
||||
|
@ -1128,9 +1113,9 @@ checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"
|
|||
|
||||
[[package]]
|
||||
name = "mime_guess"
|
||||
version = "2.0.4"
|
||||
version = "2.0.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4192263c238a5f0d0c6bfd21f336a313a4ce1c450542449ca191bb657b4642ef"
|
||||
checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e"
|
||||
dependencies = [
|
||||
"mime",
|
||||
"unicase",
|
||||
|
@ -1144,9 +1129,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
|
|||
|
||||
[[package]]
|
||||
name = "miniz_oxide"
|
||||
version = "0.7.2"
|
||||
version = "0.7.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7"
|
||||
checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08"
|
||||
dependencies = [
|
||||
"adler",
|
||||
]
|
||||
|
@ -1164,11 +1149,10 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "native-tls"
|
||||
version = "0.2.11"
|
||||
version = "0.2.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e"
|
||||
checksum = "a8614eb2c83d59d1c8cc974dd3f920198647674a0a035e1af1fa58707e317466"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"libc",
|
||||
"log",
|
||||
"openssl",
|
||||
|
@ -1192,9 +1176,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.2.18"
|
||||
version = "0.2.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a"
|
||||
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
]
|
||||
|
@ -1211,9 +1195,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "object"
|
||||
version = "0.32.2"
|
||||
version = "0.36.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441"
|
||||
checksum = "081b846d1d56ddfc18fdf1a922e4f6e07a11768ea1b92dec44e42b72712ccfce"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
@ -1270,9 +1254,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "parking_lot"
|
||||
version = "0.12.1"
|
||||
version = "0.12.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
|
||||
checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27"
|
||||
dependencies = [
|
||||
"lock_api",
|
||||
"parking_lot_core",
|
||||
|
@ -1280,22 +1264,22 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "parking_lot_core"
|
||||
version = "0.9.9"
|
||||
version = "0.9.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e"
|
||||
checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"redox_syscall",
|
||||
"redox_syscall 0.5.2",
|
||||
"smallvec",
|
||||
"windows-targets 0.48.5",
|
||||
"windows-targets 0.52.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "paste"
|
||||
version = "1.0.14"
|
||||
version = "1.0.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c"
|
||||
checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
|
||||
|
||||
[[package]]
|
||||
name = "percent-encoding"
|
||||
|
@ -1393,9 +1377,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.79"
|
||||
version = "1.0.86"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e"
|
||||
checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
@ -1408,9 +1392,9 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"
|
|||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.35"
|
||||
version = "1.0.36"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef"
|
||||
checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
@ -1485,10 +1469,19 @@ dependencies = [
|
|||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.10.4"
|
||||
name = "redox_syscall"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c"
|
||||
checksum = "c82cf8cff14456045f55ec4241383baeff27af886adb72ffb2162f99911de0fd"
|
||||
dependencies = [
|
||||
"bitflags 2.4.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.10.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f"
|
||||
dependencies = [
|
||||
"aho-corasick 1.1.2",
|
||||
"memchr",
|
||||
|
@ -1498,9 +1491,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "regex-automata"
|
||||
version = "0.4.6"
|
||||
version = "0.4.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea"
|
||||
checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df"
|
||||
dependencies = [
|
||||
"aho-corasick 1.1.2",
|
||||
"memchr",
|
||||
|
@ -1509,9 +1502,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.8.3"
|
||||
version = "0.8.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56"
|
||||
checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b"
|
||||
|
||||
[[package]]
|
||||
name = "reqwest"
|
||||
|
@ -1588,9 +1581,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "rustc-demangle"
|
||||
version = "0.1.23"
|
||||
version = "0.1.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76"
|
||||
checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f"
|
||||
|
||||
[[package]]
|
||||
name = "rustc_version"
|
||||
|
@ -1603,9 +1596,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "rustix"
|
||||
version = "0.38.32"
|
||||
version = "0.38.34"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "65e04861e65f21776e67888bfbea442b3642beaa0138fdb1dd7a84a52dffdb89"
|
||||
checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f"
|
||||
dependencies = [
|
||||
"bitflags 2.4.2",
|
||||
"errno",
|
||||
|
@ -1616,9 +1609,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "rustls"
|
||||
version = "0.21.11"
|
||||
version = "0.21.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7fecbfb7b1444f477b345853b1fce097a2c6fb637b2bfb87e6bc5db0f043fae4"
|
||||
checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e"
|
||||
dependencies = [
|
||||
"log",
|
||||
"ring",
|
||||
|
@ -1647,15 +1640,15 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "rustversion"
|
||||
version = "1.0.15"
|
||||
version = "1.0.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "80af6f9131f277a45a3fba6ce8e2258037bb0477a67e610d3c1fe046ab31de47"
|
||||
checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6"
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "1.0.17"
|
||||
version = "1.0.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1"
|
||||
checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f"
|
||||
|
||||
[[package]]
|
||||
name = "schannel"
|
||||
|
@ -1697,9 +1690,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "security-framework-sys"
|
||||
version = "2.10.0"
|
||||
version = "2.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "41f3cc463c0ef97e11c3461a9d3787412d30e8e7eb907c79180c4a57bf7c04ef"
|
||||
checksum = "317936bbbd05227752583946b9e66d7ce3b489f84e11a94a510b4437fef407d7"
|
||||
dependencies = [
|
||||
"core-foundation-sys",
|
||||
"libc",
|
||||
|
@ -1707,15 +1700,15 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "semver"
|
||||
version = "1.0.22"
|
||||
version = "1.0.23"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca"
|
||||
checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.197"
|
||||
version = "1.0.204"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2"
|
||||
checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
@ -1732,9 +1725,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.197"
|
||||
version = "1.0.204"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b"
|
||||
checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -1743,9 +1736,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.115"
|
||||
version = "1.0.120"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "12dc5c46daa8e9fdf4f5e71b6cf9a53f2487da0e86e55808e2d35539666497dd"
|
||||
checksum = "4e0d21c9a8cae1235ad58a00c11cb40d4b1e5c784f1ef2c537876ed6ffd8b7c5"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"ryu",
|
||||
|
@ -1805,9 +1798,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "signal-hook-registry"
|
||||
version = "1.4.1"
|
||||
version = "1.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1"
|
||||
checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
@ -1858,11 +1851,10 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "sqlformat"
|
||||
version = "0.2.3"
|
||||
version = "0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ce81b7bd7c4493975347ef60d8c7e8b742d4694f4c49f93e0a12ea263938176c"
|
||||
checksum = "f895e3734318cc55f1fe66258926c9b910c124d47520339efecbb6c59cec7c1f"
|
||||
dependencies = [
|
||||
"itertools 0.12.1",
|
||||
"nom",
|
||||
"unicode_categories",
|
||||
]
|
||||
|
@ -2023,13 +2015,13 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "stringprep"
|
||||
version = "0.1.4"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bb41d74e231a107a1b4ee36bd1214b11285b77768d2e3824aedafa988fd36ee6"
|
||||
checksum = "7b4df3d392d81bd458a8a621b8bffbd2302a12ffe288a9d931670948749463b1"
|
||||
dependencies = [
|
||||
"finl_unicode",
|
||||
"unicode-bidi",
|
||||
"unicode-normalization",
|
||||
"unicode-properties",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2040,9 +2032,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
|
|||
|
||||
[[package]]
|
||||
name = "subtle"
|
||||
version = "2.5.0"
|
||||
version = "2.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc"
|
||||
checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
|
@ -2154,7 +2146,7 @@ dependencies = [
|
|||
"either",
|
||||
"futures",
|
||||
"indexmap 1.9.3",
|
||||
"itertools 0.10.5",
|
||||
"itertools",
|
||||
"log",
|
||||
"mime",
|
||||
"once_cell",
|
||||
|
@ -2210,18 +2202,18 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.58"
|
||||
version = "1.0.61"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "03468839009160513471e86a034bb2c5c0e4baae3b43f79ffc55c4a5427b3297"
|
||||
checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709"
|
||||
dependencies = [
|
||||
"thiserror-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "1.0.58"
|
||||
version = "1.0.61"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7"
|
||||
checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -2230,9 +2222,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "tinyvec"
|
||||
version = "1.6.0"
|
||||
version = "1.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50"
|
||||
checksum = "ce6b6a2fb3a985e99cebfaefa9faa3024743da73304ca1c683a36429613d3d22"
|
||||
dependencies = [
|
||||
"tinyvec_macros",
|
||||
]
|
||||
|
@ -2245,9 +2237,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
|||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.37.0"
|
||||
version = "1.38.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787"
|
||||
checksum = "ba4f4a02a7a80d6f274636f0aa95c7e383b912d41fe721a31f29e29698585a4a"
|
||||
dependencies = [
|
||||
"backtrace",
|
||||
"bytes",
|
||||
|
@ -2263,9 +2255,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "tokio-macros"
|
||||
version = "2.2.0"
|
||||
version = "2.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b"
|
||||
checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -2305,16 +2297,15 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "tokio-util"
|
||||
version = "0.7.10"
|
||||
version = "0.7.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15"
|
||||
checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"futures-core",
|
||||
"futures-sink",
|
||||
"pin-project-lite",
|
||||
"tokio",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2438,6 +2429,12 @@ dependencies = [
|
|||
"tinyvec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-properties"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e4259d9d4425d9f0661581b804cb85fe66a4c631cadd8f490d1c13a35d5d9291"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-segmentation"
|
||||
version = "1.11.0"
|
||||
|
@ -2458,9 +2455,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
|
|||
|
||||
[[package]]
|
||||
name = "url"
|
||||
version = "2.5.0"
|
||||
version = "2.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633"
|
||||
checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c"
|
||||
dependencies = [
|
||||
"form_urlencoded",
|
||||
"idna",
|
||||
|
@ -2476,9 +2473,9 @@ checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da"
|
|||
|
||||
[[package]]
|
||||
name = "uuid"
|
||||
version = "1.8.0"
|
||||
version = "1.9.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a183cf7feeba97b4dd1c0d46788634f6221d87fa961b305bed08c851829efcc0"
|
||||
checksum = "5de17fd2f7da591098415cff336e12965a28061ddace43b59cb3c430179c9439"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
]
|
||||
|
@ -2623,7 +2620,7 @@ version = "1.5.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a44ab49fad634e88f55bf8f9bb3abd2f27d7204172a112c7c9987e01c1c94ea9"
|
||||
dependencies = [
|
||||
"redox_syscall",
|
||||
"redox_syscall 0.4.1",
|
||||
"wasite",
|
||||
]
|
||||
|
||||
|
@ -2645,11 +2642,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
|||
|
||||
[[package]]
|
||||
name = "winapi-util"
|
||||
version = "0.1.6"
|
||||
version = "0.1.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596"
|
||||
checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b"
|
||||
dependencies = [
|
||||
"winapi",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2826,18 +2823,18 @@ checksum = "9d422e8e38ec76e2f06ee439ccc765e9c6a9638b9e7c9f2e8255e4d41e8bd852"
|
|||
|
||||
[[package]]
|
||||
name = "zerocopy"
|
||||
version = "0.7.32"
|
||||
version = "0.7.35"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be"
|
||||
checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0"
|
||||
dependencies = [
|
||||
"zerocopy-derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy-derive"
|
||||
version = "0.7.32"
|
||||
version = "0.7.35"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6"
|
||||
checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<img src="https://img.shields.io/crates/v/teloxide.svg">
|
||||
</a>
|
||||
<a href="https://core.telegram.org/bots/api">
|
||||
<img src="https://img.shields.io/badge/API%20coverage-Up%20to%206.5%20(inclusively)-green.svg">
|
||||
<img src="https://img.shields.io/badge/API%20coverage-Up%20to%206.6%20(inclusively)-green.svg">
|
||||
</a>
|
||||
<a href="https://t.me/teloxide">
|
||||
<img src="https://img.shields.io/badge/support-t.me%2Fteloxide-blueviolet">
|
||||
|
|
|
@ -45,11 +45,48 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- Add `RequestUser` variant to `ButtonRequest`
|
||||
- Add `UserShared` variant to `MessageKind`
|
||||
- Add `shared_user` method to `Message`
|
||||
- Support for TBA 6.6 ([#1040](pr1040))
|
||||
- Add methods for working with bot's description:
|
||||
- `set_my_description`
|
||||
- `get_my_description`
|
||||
- `set_my_short_description`
|
||||
- `get_my_short_description`
|
||||
- Add methods for working with sticker sets:
|
||||
- `set_custom_emoji_sticker_set_thumbnail`
|
||||
- `set_sticker_set_title`
|
||||
- `delete_sticker_set`
|
||||
- `set_sticker_emoji_list`
|
||||
- `set_sticker_keywords`
|
||||
- `set_sticker_mask_position`
|
||||
- Add parameter `emoji` to the `send_sticker` method to specify an emoji for just uploaded stickers
|
||||
- Add support for the creation of custom emoji sticker sets in `create_new_sticker_set`
|
||||
- Add parameter `needs_repainting` to the `create_new_sticker_set` methodto automatically change the color of emoji based on context (e.g., use text color in messages, accent color in statuses, etc.)
|
||||
- Add field `needs_repainting` to the `Sticker` struct
|
||||
- Add support for the creation of sticker sets with multiple initial stickers in `create_new_sticker_set` by replacing the parameters `sticker`, `emojis` and `mask_position` with the parameters `stickers` and `sticker_format`.
|
||||
- Add support for .WEBP files in `create_new_sticker_set` and `add_sticker_to_set`
|
||||
- Add support for .WEBP, .TGS, and .WEBM files in `upload_sticker_file` by replacing the parameter `png_sticker` with the parameters `sticker` and `sticker_format`
|
||||
- Add the ability to specify search keywords for stickers added to sticker sets
|
||||
- Add new type `StickerFormatFlags` with fields `is_animated` and `is_video`
|
||||
- Add new method `Sticker::format` which returns the format of the sticker, the format is determined by the `StickerFormatFlags` of the `Sticker`
|
||||
- Add missing fields `{InlineQueryResultGif, InlineQueryResultMpeg4Gif}::thumbnail_mime_type`
|
||||
- Support for TBA 6.7 ([#1086](pr1086))
|
||||
- Add support for launching [Web Apps](https://core.telegram.org/bots/webapps) from inline query results by replacing the parameters `switch_pm_text` and `switch_pm_parameter` of the method `answer_inline_query` with the parameter `button` of type `InlineQueryResultsButton`
|
||||
- Add new fields:
|
||||
- `web_app_name` to `WriteAccessAllowed`
|
||||
- `switch_inline_query_chosen_chat` of the type `SwitchInlineQueryChosenChat` to `InlineKeyboardButton`
|
||||
- `via_chat_folder_invite_link` to `ChatMemberUpdated`
|
||||
- Add methods for working with bot's name:
|
||||
- `set_my_name`
|
||||
- `get_my_name`
|
||||
- Add the ability to specify custom emoji entities using `HTML` and `MarkdownV2` formatting options for bots that purchased additional usernames on [Fragment](https://fragment.com/)
|
||||
|
||||
|
||||
[pr851]: https://github.com/teloxide/teloxide/pull/851
|
||||
[pr887]: https://github.com/teloxide/teloxide/pull/887
|
||||
[pr905]: https://github.com/teloxide/teloxide/pull/905
|
||||
[pr982]: https://github.com/teloxide/teloxide/pull/982
|
||||
[pr1040]: https://github.com/teloxide/teloxide/pull/1040
|
||||
[pr1086]: https://github.com/teloxide/teloxide/pull/1086
|
||||
|
||||
### Fixed
|
||||
|
||||
|
@ -107,6 +144,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- Methods of the Message type: `delete_chat_photo`, `group_chat_created`, `super_group_chat_created`, `channel_chat_created`, `chat_migration`, `migrate_to_chat_id`, `migrate_from_chat_id` now return shared reference instead of owned value inside `Option` ([#982][pr982])
|
||||
- Methods `delete_chat_photo`, `group_chat_created`, `super_group_chat_created`, `channel_chat_created` now return appropriate structs not `Option<True>` ([#982][pr982])
|
||||
- MSRV (Minimal Supported Rust Version) was bumped from `1.68.0` to `1.70.0` ([#996][pr996])
|
||||
- Changes in the existing API to support TBA6.6 ([#1040](pr1040))
|
||||
- `InputSticker` was changed from enum to the struct
|
||||
- `{Animation, Audio, Document, Sticker, Video, VideoNote, InputMediaAnimation, InputMediaAudio, InputMediaDocument, InputMediaVideo, StickerSet}::thumb` has been renamed to `thumbnail`
|
||||
- `{SendAnimation, SendAudio, SendDocument, SendSticker, SendVideo, SendVideoNote}::thumb` has been renamed to`thumbnail`
|
||||
- Now `StickerFormat` is defined as the enum with the variants: `Static`, `Video`, `Animated`, so the previous variant `Raster` has been renamed to `Static`
|
||||
- Method `StickerFormat::is_raster` has been renamed to `StickerFormat::is_static`
|
||||
- Methods `StickerSet::{format, is_static, is_animated, is_video}` are deprecated now, due to the breaking change in TBA 7.2 API (which removes `StickerFormatFlags::{is_video, is_animated}` from the `StickerSet` class)
|
||||
- Method `set_sticker_set_thumb` and it's parameter `thumb` have been renamed to `set_sticker_set_thumbnail` and `thumbnail` respectively
|
||||
- Fields `{InlineQueryResultArticle, InlineQueryResultContact, InlineQueryResultDocument, InlineQueryResultLocation, InlineQueryResultVenue}::{thumb_url, thumb_width, thumb_height}` have been renamed to `{thumbnail_url, thumbnail_width, thumbnail_height}` respectively
|
||||
- Field `{InlineQueryResultPhoto, InlineQueryResultVideo, InlineQueryResultGif, InlineQueryResultMpeg4Gif}::thumb_url` has been renamed to `thumbnail_url`
|
||||
|
||||
[pr852]: https://github.com/teloxide/teloxide/pull/853
|
||||
[pr859]: https://github.com/teloxide/teloxide/pull/859
|
||||
|
|
|
@ -112,6 +112,9 @@ pre-release-replacements = [
|
|||
{ file = "CHANGELOG.md", search = "## unreleased", replace = "## unreleased\n\n## {{version}} - {{date}}", exactly = 1 },
|
||||
]
|
||||
|
||||
[lints.rust]
|
||||
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(dep_docsrs)'] }
|
||||
|
||||
[[example]]
|
||||
name = "self_info"
|
||||
required-features = ["tokio/macros", "tokio/rt-multi-thread"]
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<img src="https://img.shields.io/badge/license-MIT-blue.svg">
|
||||
</a>
|
||||
<a href="https://core.telegram.org/bots/api">
|
||||
<img src="https://img.shields.io/badge/API%20coverage-Up%20to%206.5%20(inclusively)-green.svg">
|
||||
<img src="https://img.shields.io/badge/API%20coverage-Up%20to%206.6%20(inclusively)-green.svg">
|
||||
</a>
|
||||
<a href="https://crates.io/crates/teloxide_core">
|
||||
<img src="https://img.shields.io/crates/v/teloxide_core.svg">
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
//! + `PollType` type of poll, either “quiz” or “regular”
|
||||
//! + `DiceEmoji` emoji that can be used in `sendDice` one of “🎲”, “🎯”, or “🏀”
|
||||
//! + `TargetMessage` either `inline_message_id: String` or `chat_id: ChatId` and `message_id: i64`
|
||||
//! + `InputSticker`
|
||||
//! * Integers represented with more strict (when possible) types, e.g.:
|
||||
//! `u8` (unsigned, 8-bit integer), `u32` (unsigned, 32-bit),
|
||||
//! `i64` (signed, 64-bit), etc
|
||||
|
@ -40,7 +39,7 @@
|
|||
//! [github]: https://github.com/WaffleLapkin/tg-methods-schema
|
||||
|
||||
Schema(
|
||||
api_version: ApiVersion(ver: "6.1", date: "June 20, 2022"),
|
||||
api_version: ApiVersion(ver: "6.7", date: "April 21, 2023"),
|
||||
methods: [
|
||||
Method(
|
||||
names: ("getUpdates", "GetUpdates", "get_updates"),
|
||||
|
@ -575,7 +574,7 @@ Schema(
|
|||
descr: Doc(md: "Track name"),
|
||||
),
|
||||
Param(
|
||||
name: "thumb",
|
||||
name: "thumbnail",
|
||||
ty: Option(RawTy("InputFile")),
|
||||
descr: Doc(
|
||||
md: "Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. [More info on Sending Files »]",
|
||||
|
@ -647,7 +646,7 @@ Schema(
|
|||
),
|
||||
),
|
||||
Param(
|
||||
name: "thumb",
|
||||
name: "thumbnail",
|
||||
ty: Option(RawTy("InputFile")),
|
||||
descr: Doc(
|
||||
md: "Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. [More info on Sending Files »]",
|
||||
|
@ -760,7 +759,7 @@ Schema(
|
|||
descr: Doc(md: "Video height"),
|
||||
),
|
||||
Param(
|
||||
name: "thumb",
|
||||
name: "thumbnail",
|
||||
ty: Option(RawTy("InputFile")),
|
||||
descr: Doc(
|
||||
md: "Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. [More info on Sending Files »]",
|
||||
|
@ -876,7 +875,7 @@ Schema(
|
|||
descr: Doc(md: "Animation height"),
|
||||
),
|
||||
Param(
|
||||
name: "thumb",
|
||||
name: "thumbnail",
|
||||
ty: Option(RawTy("InputFile")),
|
||||
descr: Doc(
|
||||
md: "Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. [More info on Sending Files »]",
|
||||
|
@ -1070,7 +1069,7 @@ Schema(
|
|||
descr: Doc(md: "Video width and height, i.e. diameter of the video message"),
|
||||
),
|
||||
Param(
|
||||
name: "thumb",
|
||||
name: "thumbnail",
|
||||
ty: Option(RawTy("InputFile")),
|
||||
descr: Doc(
|
||||
md: "Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. [More info on Sending Files »]",
|
||||
|
@ -2895,6 +2894,114 @@ Schema(
|
|||
),
|
||||
],
|
||||
),
|
||||
Method(
|
||||
names: ("setMyName", "SetMyName", "set_my_name"),
|
||||
return_ty: True,
|
||||
doc: Doc(md: "Use this method to change the bot's name. Returns True on success."),
|
||||
tg_doc: "https://core.telegram.org/bots/api#setmyname",
|
||||
tg_category: "Available methods",
|
||||
params: [
|
||||
Param(
|
||||
name: "name",
|
||||
ty: Option(String),
|
||||
descr: Doc(md: "New bot name; 0-64 characters. Pass an empty string to remove the dedicated name 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 name will be shown to all users for whose language there is no dedicated name.")
|
||||
),
|
||||
],
|
||||
),
|
||||
Method(
|
||||
names: ("getMyName", "GetMyName", "get_my_name"),
|
||||
return_ty: RawTy("BotName"),
|
||||
doc: Doc(
|
||||
md: "Use this method to get the current bot name for the given user language. Returns [BotName] on success.",
|
||||
md_links: {"BotName": "https://core.telegram.org/bots/api#botname"},
|
||||
),
|
||||
tg_doc: "https://core.telegram.org/bots/api#getmyname",
|
||||
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")
|
||||
),
|
||||
],
|
||||
),
|
||||
Method(
|
||||
names: ("setMyDescription", "SetMyDescription", "set_my_description"),
|
||||
return_ty: True,
|
||||
doc: Doc(md: "Use this method to change the bot's description, which is shown in the chat with the bot if the chat is empty. Returns True on success."),
|
||||
tg_doc: "https://core.telegram.org/bots/api#setmydescription",
|
||||
tg_category: "Available methods",
|
||||
params: [
|
||||
Param(
|
||||
name: "description",
|
||||
ty: Option(String),
|
||||
descr: Doc(md: "New bot description; 0-512 characters. Pass an empty string to remove the dedicated 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 description will be applied to all users for whose language there is no dedicated description.")
|
||||
)
|
||||
]
|
||||
),
|
||||
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.",
|
||||
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")
|
||||
)
|
||||
]
|
||||
),
|
||||
Method(
|
||||
names: ("setMyShortDescription", "SetMyShortDescription", "set_my_short_description"),
|
||||
return_ty: True,
|
||||
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",
|
||||
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.")
|
||||
),
|
||||
]
|
||||
),
|
||||
Method(
|
||||
names: ("getMyShortDescription", "GetMyShortDescription", "get_my_short_description"),
|
||||
return_ty: RawTy("BotShortDescription"),
|
||||
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: "language_code",
|
||||
ty: Option(String),
|
||||
descr: Doc(md: "A two-letter ISO 639-1 language code")
|
||||
),
|
||||
]
|
||||
),
|
||||
Method(
|
||||
names: ("setChatMenuButton", "SetChatMenuButton", "set_chat_menu_button"),
|
||||
return_ty: True,
|
||||
|
@ -3016,21 +3123,10 @@ Schema(
|
|||
descr: Doc(md: "Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don't support pagination. Offset length can't exceed 64 bytes.")
|
||||
),
|
||||
Param(
|
||||
name: "switch_pm_text",
|
||||
ty: Option(String),
|
||||
descr: Doc(md: "If passed, clients will display a button with specified text that switches the user to a private chat with the bot and sends the bot a start message with the parameter switch_pm_parameter")
|
||||
),
|
||||
Param(
|
||||
name: "switch_pm_parameter",
|
||||
ty: Option(String),
|
||||
descr: Doc(
|
||||
md: "[Deep-linking] parameter for the /start message sent to the bot when user presses the switch button. 1-64 characters, only `A-Z`, `a-z`, `0-9`, `_` and `-` are allowed.\n\n_Example_: An inline bot that sends YouTube videos can ask the user to connect the bot to their YouTube account to adapt search results accordingly. To do this, it displays a 'Connect your YouTube account' button above the results, or even before showing any. The user presses the button, switches to a private chat with the bot and, in doing so, passes a start parameter that instructs the bot to return an oauth link. Once done, the bot can offer a [switch_inline] button so that the user can easily return to the chat where they wanted to use the bot's inline capabilities.",
|
||||
md_links: {
|
||||
"Deep-linking": "https://core.telegram.org/bots#deep-linking",
|
||||
"switch_inline": "https://core.telegram.org/bots/api#inlinekeyboardmarkup",
|
||||
},
|
||||
),
|
||||
),
|
||||
name: "button",
|
||||
ty: Option(RawTy("InlineQueryResultsButton")),
|
||||
descr: Doc(md: "A JSON-serialized object describing a button to be shown above inline query results")
|
||||
)
|
||||
],
|
||||
),
|
||||
Method(
|
||||
|
@ -3432,6 +3528,11 @@ Schema(
|
|||
md_links: {"More info on Sending Files »": "https://core.telegram.org/bots/api#sending-files"},
|
||||
)
|
||||
),
|
||||
Param(
|
||||
name: "emoji",
|
||||
ty: Option(String),
|
||||
descr: Doc(md: "Emoji associated with the sticker; only for just uploaded stickers")
|
||||
),
|
||||
Param(
|
||||
name: "disable_notification",
|
||||
ty: Option(bool),
|
||||
|
@ -3499,7 +3600,14 @@ Schema(
|
|||
Method(
|
||||
names: ("uploadStickerFile", "UploadStickerFile", "upload_sticker_file"),
|
||||
return_ty: RawTy("FileMeta"),
|
||||
doc: Doc(md: "Use this method to upload a .PNG file with a sticker for later use in _createNewStickerSet_ and _addStickerToSet_ methods (can be used multiple times). Returns the uploaded File on success."),
|
||||
doc: Doc(
|
||||
md: "Use this method to upload a file with a sticker for later use in the [CreateNewStickerSet] and [AddStickerToSet] methods (the file can be used multiple times). Returns the uploaded [File] on success.",
|
||||
md_links: {
|
||||
"CreateNewStickerSet": "https://docs.rs/teloxide/latest/teloxide/payloads/struct.CreateNewStickerSet.html",
|
||||
"AddStickerToSet": "https://docs.rs/teloxide/latest/teloxide/payloads/struct.AddStickerToSet.html",
|
||||
"File": "https://core.telegram.org/bots/api#file"
|
||||
}
|
||||
),
|
||||
tg_doc: "https://core.telegram.org/bots/api#uploadstickerfile",
|
||||
tg_category: "Stickers",
|
||||
params: [
|
||||
|
@ -3509,19 +3617,27 @@ Schema(
|
|||
descr: Doc(md: "User identifier of sticker file owner"),
|
||||
),
|
||||
Param(
|
||||
name: "png_sticker",
|
||||
name: "sticker",
|
||||
ty: RawTy("InputFile"),
|
||||
descr: Doc(
|
||||
md: "PNG image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. [More info on Sending Files »]",
|
||||
md_links: {"More info on Sending Files »": "https://core.telegram.org/bots/api#sending-files"},
|
||||
md: "A file with the sticker in .WEBP, .PNG, .TGS, or .WEBM format. [Technical requirements]. [More info on Sending Files »]",
|
||||
md_links: {
|
||||
"More info on Sending Files »": "https://core.telegram.org/bots/api#sending-files",
|
||||
"Technical requirements": "https://core.telegram.org/stickers"
|
||||
},
|
||||
),
|
||||
),
|
||||
Param(
|
||||
name: "sticker_format",
|
||||
ty: RawTy("StickerFormat"),
|
||||
descr: Doc(md: "Format of the sticker, must be one of “static”, “animated”, “video”")
|
||||
)
|
||||
],
|
||||
),
|
||||
Method(
|
||||
names: ("createNewStickerSet", "CreateNewStickerSet", "create_new_sticker_set"),
|
||||
return_ty: True,
|
||||
doc: Doc(md: "Use this method to create a new sticker set owned by a user. The bot will be able to edit the sticker set thus created. You must use exactly one of the fields _png\\_sticker_ or _tgs\\_sticker_. Returns _True_ on success."),
|
||||
doc: Doc(md: "Use this method to create a new sticker set owned by a user. The bot will be able to edit the sticker set thus created. Returns True on success."),
|
||||
tg_doc: "https://core.telegram.org/bots/api#createstickerset",
|
||||
tg_category: "Stickers",
|
||||
params: [
|
||||
|
@ -3541,34 +3657,31 @@ Schema(
|
|||
descr: Doc(md: "Sticker set title, 1-64 characters"),
|
||||
),
|
||||
Param(
|
||||
name: "sticker",
|
||||
ty: RawTy("InputSticker"),
|
||||
descr: Doc(
|
||||
md: "**PNG** image, **TGS** animation or **WEBM** video with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. Pass a _file\\_id_ as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. [More info on Sending Files »]",
|
||||
md_links: {"More info on Sending Files »": "https://core.telegram.org/bots/api#sending-files"},
|
||||
),
|
||||
name: "stickers",
|
||||
ty: ArrayOf(RawTy("InputSticker")),
|
||||
descr: Doc(md: "A JSON-serialized list of 1-50 initial stickers to be added to the sticker set")
|
||||
),
|
||||
Param(
|
||||
name: "emojis",
|
||||
ty: String,
|
||||
descr: Doc(md: "One or more emoji corresponding to the sticker"),
|
||||
name: "sticker_format",
|
||||
ty: RawTy("StickerFormat"),
|
||||
descr: Doc(md: "Format of the sticker, must be one of “static”, “animated”, “video”")
|
||||
),
|
||||
Param(
|
||||
name: "sticker_type",
|
||||
ty: Option(RawTy("StickerType")),
|
||||
descr: Doc(md: "Type of stickers in the set, pass “regular” or “mask”. Custom emoji sticker sets can't be created via the Bot API at the moment. By default, a regular sticker set is created."),
|
||||
descr: Doc(md: "Type of stickers in the set, pass “regular”, “mask”, or “custom_emoji”. By default, a regular sticker set is created."),
|
||||
),
|
||||
Param(
|
||||
name: "mask_position",
|
||||
ty: Option(RawTy("MaskPosition")),
|
||||
descr: Doc(md: "A JSON-serialized object for position where the mask should be placed on faces"),
|
||||
),
|
||||
name: "needs_repainting",
|
||||
ty: Option(bool),
|
||||
descr: Doc(md: "Pass _True_ if stickers in the sticker set must be repainted to the color of text when used in messages, the accent color if used as emoji status, white on chat photos, or another appropriate color based on context; for custom emoji sticker sets only")
|
||||
)
|
||||
],
|
||||
),
|
||||
Method(
|
||||
names: ("addStickerToSet", "AddStickerToSet", "add_sticker_to_set"),
|
||||
return_ty: True,
|
||||
doc: Doc(md: "Use this method to add a new sticker to a set created by the bot. You **must** use exactly one of the fields _png\\_sticker_ or _tgs\\_sticker_. Animated stickers can be added to animated sticker sets and only to them. Animated sticker sets can have up to 50 stickers. Static sticker sets can have up to 120 stickers. Returns _True_ on success."),
|
||||
doc: Doc(md: "Use this method to add a new sticker to a set created by the bot. Emoji sticker sets can have up to 200 stickers. Other sticker sets can have up to 120 stickers. Returns True on success."),
|
||||
tg_doc: "https://core.telegram.org/bots/api#addstickertoset",
|
||||
tg_category: "Stickers",
|
||||
params: [
|
||||
|
@ -3586,20 +3699,9 @@ Schema(
|
|||
name: "sticker",
|
||||
ty: RawTy("InputSticker"),
|
||||
descr: Doc(
|
||||
md: "**PNG** or **TGS** image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. Pass a _file\\_id_ as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. [More info on Sending Files »]",
|
||||
md_links: {"More info on Sending Files »": "https://core.telegram.org/bots/api#sending-files"},
|
||||
md: "A JSON-serialized object with information about the added sticker. If exactly the same sticker had already been added to the set, then the set isn't changed.",
|
||||
),
|
||||
),
|
||||
Param(
|
||||
name: "emojis",
|
||||
ty: String,
|
||||
descr: Doc(md: "One or more emoji corresponding to the sticker"),
|
||||
),
|
||||
Param(
|
||||
name: "mask_position",
|
||||
ty: Option(RawTy("MaskPosition")),
|
||||
descr: Doc(md: "A JSON-serialized object for position where the mask should be placed on faces"),
|
||||
),
|
||||
],
|
||||
),
|
||||
Method(
|
||||
|
@ -3636,10 +3738,10 @@ Schema(
|
|||
],
|
||||
),
|
||||
Method(
|
||||
names: ("setStickerSetThumb", "SetStickerSetThumb", "set_sticker_set_thumb"),
|
||||
names: ("setStickerSetThumbnail", "SetStickerSetThumbnail", "set_sticker_set_thumbnail"),
|
||||
return_ty: True,
|
||||
doc: Doc(md: "Use this method to set the thumbnail of a sticker set. Animated thumbnails can be set for animated sticker sets only. Returns _True_ on success."),
|
||||
tg_doc: "https://core.telegram.org/bots/api#setstickersetthumb",
|
||||
doc: Doc(md: "Use this method to set the thumbnail of a regular or mask sticker set. The format of the thumbnail file must match the format of the stickers in the set. Returns True on success."),
|
||||
tg_doc: "https://core.telegram.org/bots/api#setstickersetthumbnail",
|
||||
tg_category: "Stickers",
|
||||
params: [
|
||||
Param(
|
||||
|
@ -3653,15 +3755,124 @@ Schema(
|
|||
descr: Doc(md: "User identifier of sticker file owner"),
|
||||
),
|
||||
Param(
|
||||
name: "thumb",
|
||||
name: "thumbnail",
|
||||
ty: Option(RawTy("InputFile")),
|
||||
descr: Doc(
|
||||
md: "A **PNG** image with the thumbnail, must be up to 128 kilobytes in size and have width and height exactly 100px, or a **TGS** animation with the thumbnail up to 32 kilobytes in size; see https://core.telegram.org/animated_stickers#technical-requirements for animated sticker technical requirements. Pass a _file\\_id_ as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. [More info on Sending Files »]. Animated sticker set thumbnail can't be uploaded via HTTP URL.",
|
||||
md: "A .WEBP or .PNG image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly 100px, or a .TGS animation with a thumbnail up to 32 kilobytes in size (see https://core.telegram.org/stickers#animated-sticker-requirements for animated sticker technical requirements), or a WEBM video with the thumbnail up to 32 kilobytes in size; see https://core.telegram.org/stickers#video-sticker-requirements for video sticker technical requirements. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. Animated and video sticker set thumbnails can't be uploaded via HTTP URL. If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail.",
|
||||
md_links: {"More info on Sending Files »": "https://core.telegram.org/bots/api#sending-files"},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Method(
|
||||
names: ("setCustomEmojiStickerSetThumbnail", "SetCustomEmojiStickerSetThumbnail", "set_custom_emoji_sticker_set_thumbnail"),
|
||||
return_ty: True,
|
||||
doc: Doc(md: "Use this method to set the thumbnail of a custom emoji sticker set. Returns True on success."),
|
||||
tg_doc: "https://core.telegram.org/bots/api#setcustomemojistickersetthumbnail",
|
||||
tg_category: "Stickers",
|
||||
params: [
|
||||
Param(
|
||||
name: "name",
|
||||
ty: String,
|
||||
descr: Doc(md: "Sticker set name"),
|
||||
),
|
||||
Param(
|
||||
name: "custom_emoji_id",
|
||||
ty: Option(String),
|
||||
descr: Doc(md: "Custom emoji identifier of a sticker from the sticker set; pass an empty string to drop the thumbnail and use the first sticker as the thumbnail."),
|
||||
)
|
||||
]
|
||||
),
|
||||
Method(
|
||||
names: ("setStickerSetTitle", "SetStickerSetTitle", "set_sticker_set_title"),
|
||||
return_ty: True,
|
||||
doc: Doc(md: "Use this method to set the title of a created sticker set. Returns True on success."),
|
||||
tg_doc: "https://core.telegram.org/bots/api#setstickersettitle",
|
||||
tg_category: "Stickers",
|
||||
params: [
|
||||
Param(
|
||||
name: "name",
|
||||
ty: String,
|
||||
descr: Doc(md: "Sticker set name"),
|
||||
),
|
||||
Param(
|
||||
name: "title",
|
||||
ty: String,
|
||||
descr: Doc(md: "Sticker set title, 1-64 characters"),
|
||||
)
|
||||
]
|
||||
),
|
||||
Method(
|
||||
names: ("deleteStickerSet", "DeleteStickerSet", "delete_sticker_set"),
|
||||
return_ty: True,
|
||||
doc: Doc(md: "Use this method to delete a sticker set that was created by the bot. Returns True on success."),
|
||||
tg_doc: "https://core.telegram.org/bots/api#deletestickerset",
|
||||
tg_category: "Stickers",
|
||||
params: [
|
||||
Param(
|
||||
name: "name",
|
||||
ty: String,
|
||||
descr: Doc(md: "Sticker set name"),
|
||||
),
|
||||
]
|
||||
),
|
||||
Method(
|
||||
names: ("setStickerEmojiList", "SetStickerEmojiList", "set_sticker_emoji_list"),
|
||||
return_ty: True,
|
||||
doc: Doc(md: "Use this method to change the list of emoji assigned to a regular or custom emoji sticker. The sticker must belong to a sticker set created by the bot. Returns True on success."),
|
||||
tg_doc: "https://core.telegram.org/bots/api#setstickeremojilist",
|
||||
tg_category: "Stickers",
|
||||
params: [
|
||||
Param(
|
||||
name: "sticker",
|
||||
ty: String,
|
||||
descr: Doc(md: "File identifier of the sticker"),
|
||||
),
|
||||
Param(
|
||||
name: "emoji_list",
|
||||
ty: ArrayOf(String),
|
||||
descr: Doc(md: "A JSON-serialized list of 1-20 emoji associated with the sticker"),
|
||||
),
|
||||
]
|
||||
),
|
||||
Method(
|
||||
names: ("setStickerKeywords", "SetStickerKeywords", "set_sticker_keywords"),
|
||||
return_ty: True,
|
||||
doc: Doc(md: "Use this method to change search keywords assigned to a regular or custom emoji sticker. The sticker must belong to a sticker set created by the bot. Returns True on success."),
|
||||
tg_doc: "https://core.telegram.org/bots/api#setstickerkeywords",
|
||||
tg_category: "Stickers",
|
||||
params: [
|
||||
Param(
|
||||
name: "sticker",
|
||||
ty: String,
|
||||
descr: Doc(md: "File identifier of the sticker"),
|
||||
),
|
||||
Param(
|
||||
name: "keywords",
|
||||
ty: Option(ArrayOf(String)),
|
||||
descr: Doc(md: "A JSON-serialized list of 0-20 search keywords for the sticker with total length of up to 64 characters"),
|
||||
),
|
||||
]
|
||||
),
|
||||
Method(
|
||||
names: ("setStickerMaskPosition", "SetStickerMaskPosition", "set_sticker_mask_position"),
|
||||
return_ty: True,
|
||||
doc: Doc(md: "Use this method to change the mask position of a mask sticker. The sticker must belong to a sticker set that was created by the bot. Returns True on success."),
|
||||
tg_doc: "https://core.telegram.org/bots/api#setstickermaskposition",
|
||||
tg_category: "Stickers",
|
||||
params: [
|
||||
Param(
|
||||
name: "sticker",
|
||||
ty: String,
|
||||
descr: Doc(md: "File identifier of the sticker"),
|
||||
),
|
||||
Param(
|
||||
name: "mask_position",
|
||||
ty: Option(RawTy("MaskPosition")),
|
||||
descr: Doc(md: "A JSON-serialized object with the position where the mask should be placed on faces. Omit the parameter to remove the mask position."),
|
||||
),
|
||||
]
|
||||
),
|
||||
Method(
|
||||
names: ("sendInvoice", "SendInvoice", "send_invoice"),
|
||||
return_ty: RawTy("Message"),
|
||||
|
|
|
@ -159,6 +159,12 @@ where
|
|||
answer_callback_query,
|
||||
set_my_commands,
|
||||
get_my_commands,
|
||||
set_my_name,
|
||||
get_my_name,
|
||||
set_my_description,
|
||||
get_my_description,
|
||||
set_my_short_description,
|
||||
get_my_short_description,
|
||||
set_chat_menu_button,
|
||||
get_chat_menu_button,
|
||||
set_my_default_administrator_rights,
|
||||
|
@ -184,7 +190,13 @@ where
|
|||
add_sticker_to_set,
|
||||
set_sticker_position_in_set,
|
||||
delete_sticker_from_set,
|
||||
set_sticker_set_thumb,
|
||||
set_sticker_set_thumbnail,
|
||||
set_custom_emoji_sticker_set_thumbnail,
|
||||
set_sticker_set_title,
|
||||
delete_sticker_set,
|
||||
set_sticker_emoji_list,
|
||||
set_sticker_keywords,
|
||||
set_sticker_mask_position,
|
||||
send_invoice,
|
||||
create_invoice_link,
|
||||
answer_shipping_query,
|
||||
|
|
|
@ -163,6 +163,12 @@ macro_rules! fwd_erased {
|
|||
(@convert $m:ident, $arg:ident, custom_emoji_ids : $T:ty) => {
|
||||
$arg.into_iter().collect()
|
||||
};
|
||||
(@convert $m:ident, $arg:ident, stickers: $T:ty) => {
|
||||
$arg.into_iter().collect()
|
||||
};
|
||||
(@convert $m:ident, $arg:ident, emoji_list: $T:ty) => {
|
||||
$arg.into_iter().collect()
|
||||
};
|
||||
(@convert $m:ident, $arg:ident, $arg_:ident : $T:ty) => {
|
||||
$arg.into()
|
||||
};
|
||||
|
@ -248,6 +254,12 @@ where
|
|||
answer_callback_query,
|
||||
set_my_commands,
|
||||
get_my_commands,
|
||||
set_my_name,
|
||||
get_my_name,
|
||||
set_my_description,
|
||||
get_my_description,
|
||||
set_my_short_description,
|
||||
get_my_short_description,
|
||||
set_chat_menu_button,
|
||||
get_chat_menu_button,
|
||||
set_my_default_administrator_rights,
|
||||
|
@ -273,7 +285,13 @@ where
|
|||
add_sticker_to_set,
|
||||
set_sticker_position_in_set,
|
||||
delete_sticker_from_set,
|
||||
set_sticker_set_thumb,
|
||||
set_sticker_set_thumbnail,
|
||||
set_custom_emoji_sticker_set_thumbnail,
|
||||
set_sticker_set_title,
|
||||
delete_sticker_set,
|
||||
set_sticker_emoji_list,
|
||||
set_sticker_keywords,
|
||||
set_sticker_mask_position,
|
||||
send_invoice,
|
||||
create_invoice_link,
|
||||
answer_shipping_query,
|
||||
|
@ -693,6 +711,18 @@ trait ErasableRequester<'a> {
|
|||
|
||||
fn get_my_commands(&self) -> ErasedRequest<'a, GetMyCommands, Self::Err>;
|
||||
|
||||
fn set_my_name(&self) -> ErasedRequest<'a, SetMyName, Self::Err>;
|
||||
|
||||
fn get_my_name(&self) -> ErasedRequest<'a, GetMyName, Self::Err>;
|
||||
|
||||
fn set_my_description(&self) -> ErasedRequest<'a, SetMyDescription, Self::Err>;
|
||||
|
||||
fn get_my_description(&self) -> ErasedRequest<'a, GetMyDescription, Self::Err>;
|
||||
|
||||
fn set_my_short_description(&self) -> ErasedRequest<'a, SetMyShortDescription, Self::Err>;
|
||||
|
||||
fn get_my_short_description(&self) -> ErasedRequest<'a, GetMyShortDescription, Self::Err>;
|
||||
|
||||
fn set_chat_menu_button(&self) -> ErasedRequest<'a, SetChatMenuButton, Self::Err>;
|
||||
|
||||
fn get_chat_menu_button(&self) -> ErasedRequest<'a, GetChatMenuButton, Self::Err>;
|
||||
|
@ -795,7 +825,8 @@ trait ErasableRequester<'a> {
|
|||
fn upload_sticker_file(
|
||||
&self,
|
||||
user_id: UserId,
|
||||
png_sticker: InputFile,
|
||||
sticker: InputFile,
|
||||
sticker_format: StickerFormat,
|
||||
) -> ErasedRequest<'a, UploadStickerFile, Self::Err>;
|
||||
|
||||
fn create_new_sticker_set(
|
||||
|
@ -803,8 +834,8 @@ trait ErasableRequester<'a> {
|
|||
user_id: UserId,
|
||||
name: String,
|
||||
title: String,
|
||||
sticker: InputSticker,
|
||||
emojis: String,
|
||||
stickers: Vec<InputSticker>,
|
||||
sticker_format: StickerFormat,
|
||||
) -> ErasedRequest<'a, CreateNewStickerSet, Self::Err>;
|
||||
|
||||
fn add_sticker_to_set(
|
||||
|
@ -812,7 +843,6 @@ trait ErasableRequester<'a> {
|
|||
user_id: UserId,
|
||||
name: String,
|
||||
sticker: InputSticker,
|
||||
emojis: String,
|
||||
) -> ErasedRequest<'a, AddStickerToSet, Self::Err>;
|
||||
|
||||
fn set_sticker_position_in_set(
|
||||
|
@ -826,11 +856,40 @@ trait ErasableRequester<'a> {
|
|||
sticker: String,
|
||||
) -> ErasedRequest<'a, DeleteStickerFromSet, Self::Err>;
|
||||
|
||||
fn set_sticker_set_thumb(
|
||||
fn set_sticker_set_thumbnail(
|
||||
&self,
|
||||
name: String,
|
||||
user_id: UserId,
|
||||
) -> ErasedRequest<'a, SetStickerSetThumb, Self::Err>;
|
||||
) -> ErasedRequest<'a, SetStickerSetThumbnail, Self::Err>;
|
||||
|
||||
fn set_custom_emoji_sticker_set_thumbnail(
|
||||
&self,
|
||||
name: String,
|
||||
) -> ErasedRequest<'a, SetCustomEmojiStickerSetThumbnail, Self::Err>;
|
||||
|
||||
fn set_sticker_set_title(
|
||||
&self,
|
||||
name: String,
|
||||
title: String,
|
||||
) -> ErasedRequest<'a, SetStickerSetTitle, Self::Err>;
|
||||
|
||||
fn delete_sticker_set(&self, name: String) -> ErasedRequest<'a, DeleteStickerSet, Self::Err>;
|
||||
|
||||
fn set_sticker_emoji_list(
|
||||
&self,
|
||||
sticker: String,
|
||||
emoji_list: Vec<String>,
|
||||
) -> ErasedRequest<'a, SetStickerEmojiList, Self::Err>;
|
||||
|
||||
fn set_sticker_keywords(
|
||||
&self,
|
||||
sticker: String,
|
||||
) -> ErasedRequest<'a, SetStickerKeywords, Self::Err>;
|
||||
|
||||
fn set_sticker_mask_position(
|
||||
&self,
|
||||
sticker: String,
|
||||
) -> ErasedRequest<'a, SetStickerMaskPosition, Self::Err>;
|
||||
|
||||
// we can't change telegram API
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
|
@ -1459,6 +1518,30 @@ where
|
|||
Requester::get_my_commands(self).erase()
|
||||
}
|
||||
|
||||
fn set_my_name(&self) -> ErasedRequest<'a, SetMyName, Self::Err> {
|
||||
Requester::set_my_name(self).erase()
|
||||
}
|
||||
|
||||
fn get_my_name(&self) -> ErasedRequest<'a, GetMyName, Self::Err> {
|
||||
Requester::get_my_name(self).erase()
|
||||
}
|
||||
|
||||
fn set_my_description(&self) -> ErasedRequest<'a, SetMyDescription, Self::Err> {
|
||||
Requester::set_my_description(self).erase()
|
||||
}
|
||||
|
||||
fn get_my_description(&self) -> ErasedRequest<'a, GetMyDescription, Self::Err> {
|
||||
Requester::get_my_description(self).erase()
|
||||
}
|
||||
|
||||
fn set_my_short_description(&self) -> ErasedRequest<'a, SetMyShortDescription, Self::Err> {
|
||||
Requester::set_my_short_description(self).erase()
|
||||
}
|
||||
|
||||
fn get_my_short_description(&self) -> ErasedRequest<'a, GetMyShortDescription, Self::Err> {
|
||||
Requester::get_my_short_description(self).erase()
|
||||
}
|
||||
|
||||
fn set_chat_menu_button(&self) -> ErasedRequest<'a, SetChatMenuButton, Self::Err> {
|
||||
Requester::set_chat_menu_button(self).erase()
|
||||
}
|
||||
|
@ -1601,9 +1684,10 @@ where
|
|||
fn upload_sticker_file(
|
||||
&self,
|
||||
user_id: UserId,
|
||||
png_sticker: InputFile,
|
||||
sticker: InputFile,
|
||||
sticker_format: StickerFormat,
|
||||
) -> ErasedRequest<'a, UploadStickerFile, Self::Err> {
|
||||
Requester::upload_sticker_file(self, user_id, png_sticker).erase()
|
||||
Requester::upload_sticker_file(self, user_id, sticker, sticker_format).erase()
|
||||
}
|
||||
|
||||
fn create_new_sticker_set(
|
||||
|
@ -1611,10 +1695,11 @@ where
|
|||
user_id: UserId,
|
||||
name: String,
|
||||
title: String,
|
||||
sticker: InputSticker,
|
||||
emojis: String,
|
||||
stickers: Vec<InputSticker>,
|
||||
sticker_format: StickerFormat,
|
||||
) -> ErasedRequest<'a, CreateNewStickerSet, Self::Err> {
|
||||
Requester::create_new_sticker_set(self, user_id, name, title, sticker, emojis).erase()
|
||||
Requester::create_new_sticker_set(self, user_id, name, title, stickers, sticker_format)
|
||||
.erase()
|
||||
}
|
||||
|
||||
fn add_sticker_to_set(
|
||||
|
@ -1622,9 +1707,8 @@ where
|
|||
user_id: UserId,
|
||||
name: String,
|
||||
sticker: InputSticker,
|
||||
emojis: String,
|
||||
) -> ErasedRequest<'a, AddStickerToSet, Self::Err> {
|
||||
Requester::add_sticker_to_set(self, user_id, name, sticker, emojis).erase()
|
||||
Requester::add_sticker_to_set(self, user_id, name, sticker).erase()
|
||||
}
|
||||
|
||||
fn set_sticker_position_in_set(
|
||||
|
@ -1642,12 +1726,53 @@ where
|
|||
Requester::delete_sticker_from_set(self, sticker).erase()
|
||||
}
|
||||
|
||||
fn set_sticker_set_thumb(
|
||||
fn set_sticker_set_thumbnail(
|
||||
&self,
|
||||
name: String,
|
||||
user_id: UserId,
|
||||
) -> ErasedRequest<'a, SetStickerSetThumb, Self::Err> {
|
||||
Requester::set_sticker_set_thumb(self, name, user_id).erase()
|
||||
) -> ErasedRequest<'a, SetStickerSetThumbnail, Self::Err> {
|
||||
Requester::set_sticker_set_thumbnail(self, name, user_id).erase()
|
||||
}
|
||||
|
||||
fn set_custom_emoji_sticker_set_thumbnail(
|
||||
&self,
|
||||
name: String,
|
||||
) -> ErasedRequest<'a, SetCustomEmojiStickerSetThumbnail, Self::Err> {
|
||||
Requester::set_custom_emoji_sticker_set_thumbnail(self, name).erase()
|
||||
}
|
||||
|
||||
fn set_sticker_set_title(
|
||||
&self,
|
||||
name: String,
|
||||
title: String,
|
||||
) -> ErasedRequest<'a, SetStickerSetTitle, Self::Err> {
|
||||
Requester::set_sticker_set_title(self, name, title).erase()
|
||||
}
|
||||
|
||||
fn delete_sticker_set(&self, name: String) -> ErasedRequest<'a, DeleteStickerSet, Self::Err> {
|
||||
Requester::delete_sticker_set(self, name).erase()
|
||||
}
|
||||
|
||||
fn set_sticker_emoji_list(
|
||||
&self,
|
||||
sticker: String,
|
||||
emoji_list: Vec<String>,
|
||||
) -> ErasedRequest<'a, SetStickerEmojiList, Self::Err> {
|
||||
Requester::set_sticker_emoji_list(self, sticker, emoji_list).erase()
|
||||
}
|
||||
|
||||
fn set_sticker_keywords(
|
||||
&self,
|
||||
sticker: String,
|
||||
) -> ErasedRequest<'a, SetStickerKeywords, Self::Err> {
|
||||
Requester::set_sticker_keywords(self, sticker).erase()
|
||||
}
|
||||
|
||||
fn set_sticker_mask_position(
|
||||
&self,
|
||||
sticker: String,
|
||||
) -> ErasedRequest<'a, SetStickerMaskPosition, Self::Err> {
|
||||
Requester::set_sticker_mask_position(self, sticker).erase()
|
||||
}
|
||||
|
||||
fn send_invoice(
|
||||
|
|
|
@ -240,6 +240,12 @@ where
|
|||
answer_callback_query,
|
||||
set_my_commands,
|
||||
get_my_commands,
|
||||
set_my_name,
|
||||
get_my_name,
|
||||
set_my_description,
|
||||
get_my_description,
|
||||
set_my_short_description,
|
||||
get_my_short_description,
|
||||
set_chat_menu_button,
|
||||
get_chat_menu_button,
|
||||
set_my_default_administrator_rights,
|
||||
|
@ -257,7 +263,13 @@ where
|
|||
add_sticker_to_set,
|
||||
set_sticker_position_in_set,
|
||||
delete_sticker_from_set,
|
||||
set_sticker_set_thumb,
|
||||
set_sticker_set_thumbnail,
|
||||
set_custom_emoji_sticker_set_thumbnail,
|
||||
set_sticker_set_title,
|
||||
delete_sticker_set,
|
||||
set_sticker_emoji_list,
|
||||
set_sticker_keywords,
|
||||
set_sticker_mask_position,
|
||||
send_invoice,
|
||||
create_invoice_link,
|
||||
answer_shipping_query,
|
||||
|
|
|
@ -142,6 +142,12 @@ where
|
|||
answer_callback_query,
|
||||
set_my_commands,
|
||||
get_my_commands,
|
||||
set_my_name,
|
||||
get_my_name,
|
||||
set_my_description,
|
||||
get_my_description,
|
||||
set_my_short_description,
|
||||
get_my_short_description,
|
||||
set_chat_menu_button,
|
||||
get_chat_menu_button,
|
||||
set_my_default_administrator_rights,
|
||||
|
@ -166,7 +172,13 @@ where
|
|||
add_sticker_to_set,
|
||||
set_sticker_position_in_set,
|
||||
delete_sticker_from_set,
|
||||
set_sticker_set_thumb,
|
||||
set_sticker_set_thumbnail,
|
||||
set_custom_emoji_sticker_set_thumbnail,
|
||||
set_sticker_set_title,
|
||||
delete_sticker_set,
|
||||
set_sticker_emoji_list,
|
||||
set_sticker_keywords,
|
||||
set_sticker_mask_position,
|
||||
answer_shipping_query,
|
||||
create_invoice_link,
|
||||
answer_pre_checkout_query,
|
||||
|
|
|
@ -66,20 +66,20 @@ bitflags::bitflags! {
|
|||
/// ```
|
||||
pub struct Settings: u8 {
|
||||
/// Trace requests (only request kind, e.g. `send_message`)
|
||||
const TRACE_REQUESTS = 0b00000001;
|
||||
const TRACE_REQUESTS = 1;
|
||||
|
||||
/// Trace requests verbosely (with all parameters).
|
||||
///
|
||||
/// Implies [`TRACE_REQUESTS`]
|
||||
const TRACE_REQUESTS_VERBOSE = 0b00000011;
|
||||
const TRACE_REQUESTS_VERBOSE = (1 << 1) | Self::TRACE_REQUESTS.bits;
|
||||
|
||||
/// Trace responses (only request kind, e.g. `send_message`)
|
||||
const TRACE_RESPONSES = 0b00000100;
|
||||
const TRACE_RESPONSES = 1 << 2;
|
||||
|
||||
/// Trace responses verbosely (with full response).
|
||||
///
|
||||
/// Implies [`TRACE_RESPONSES`]
|
||||
const TRACE_RESPONSES_VERBOSE = 0b00001100;
|
||||
const TRACE_RESPONSES_VERBOSE = (1 << 3) | Self::TRACE_RESPONSES.bits;
|
||||
|
||||
/// Trace everything.
|
||||
///
|
||||
|
@ -188,6 +188,12 @@ where
|
|||
answer_callback_query,
|
||||
set_my_commands,
|
||||
get_my_commands,
|
||||
set_my_name,
|
||||
get_my_name,
|
||||
set_my_description,
|
||||
get_my_description,
|
||||
set_my_short_description,
|
||||
get_my_short_description,
|
||||
set_chat_menu_button,
|
||||
get_chat_menu_button,
|
||||
set_my_default_administrator_rights,
|
||||
|
@ -213,7 +219,13 @@ where
|
|||
add_sticker_to_set,
|
||||
set_sticker_position_in_set,
|
||||
delete_sticker_from_set,
|
||||
set_sticker_set_thumb,
|
||||
set_sticker_set_thumbnail,
|
||||
set_custom_emoji_sticker_set_thumbnail,
|
||||
set_sticker_set_title,
|
||||
delete_sticker_set,
|
||||
set_sticker_emoji_list,
|
||||
set_sticker_keywords,
|
||||
set_sticker_mask_position,
|
||||
send_invoice,
|
||||
create_invoice_link,
|
||||
answer_shipping_query,
|
||||
|
|
|
@ -6,7 +6,7 @@ use crate::{
|
|||
requests::{JsonRequest, MultipartRequest},
|
||||
types::{
|
||||
BotCommand, ChatId, ChatPermissions, InlineQueryResult, InputFile, InputMedia,
|
||||
InputSticker, LabeledPrice, MessageId, Recipient, ThreadId, UserId,
|
||||
InputSticker, LabeledPrice, MessageId, Recipient, StickerFormat, ThreadId, UserId,
|
||||
},
|
||||
Bot,
|
||||
};
|
||||
|
@ -829,6 +829,41 @@ impl Requester for Bot {
|
|||
Self::GetMyCommands::new(self.clone(), payloads::GetMyCommands::new())
|
||||
}
|
||||
|
||||
type SetMyName = JsonRequest<payloads::SetMyName>;
|
||||
|
||||
fn set_my_name(&self) -> Self::SetMyName {
|
||||
Self::SetMyName::new(self.clone(), payloads::SetMyName::new())
|
||||
}
|
||||
|
||||
type GetMyName = JsonRequest<payloads::GetMyName>;
|
||||
|
||||
fn get_my_name(&self) -> Self::GetMyName {
|
||||
Self::GetMyName::new(self.clone(), payloads::GetMyName::new())
|
||||
}
|
||||
|
||||
type SetMyDescription = JsonRequest<payloads::SetMyDescription>;
|
||||
|
||||
fn set_my_description(&self) -> Self::SetMyDescription {
|
||||
Self::SetMyDescription::new(self.clone(), payloads::SetMyDescription::new())
|
||||
}
|
||||
|
||||
type GetMyDescription = JsonRequest<payloads::GetMyDescription>;
|
||||
|
||||
fn get_my_description(&self) -> Self::GetMyDescription {
|
||||
Self::GetMyDescription::new(self.clone(), payloads::GetMyDescription::new())
|
||||
}
|
||||
|
||||
type SetMyShortDescription = JsonRequest<payloads::SetMyShortDescription>;
|
||||
|
||||
fn set_my_short_description(&self) -> Self::SetMyShortDescription {
|
||||
Self::SetMyShortDescription::new(self.clone(), payloads::SetMyShortDescription::new())
|
||||
}
|
||||
|
||||
type GetMyShortDescription = JsonRequest<payloads::GetMyShortDescription>;
|
||||
fn get_my_short_description(&self) -> Self::GetMyShortDescription {
|
||||
Self::GetMyShortDescription::new(self.clone(), payloads::GetMyShortDescription::new())
|
||||
}
|
||||
|
||||
type SetChatMenuButton = JsonRequest<payloads::SetChatMenuButton>;
|
||||
|
||||
fn set_chat_menu_button(&self) -> Self::SetChatMenuButton {
|
||||
|
@ -1070,51 +1105,50 @@ impl Requester for Bot {
|
|||
fn upload_sticker_file(
|
||||
&self,
|
||||
user_id: UserId,
|
||||
png_sticker: InputFile,
|
||||
) -> Self::UploadStickerFile where {
|
||||
sticker: InputFile,
|
||||
sticker_format: crate::types::StickerFormat,
|
||||
) -> Self::UploadStickerFile {
|
||||
Self::UploadStickerFile::new(
|
||||
self.clone(),
|
||||
payloads::UploadStickerFile::new(user_id, png_sticker),
|
||||
payloads::UploadStickerFile::new(user_id, sticker, sticker_format),
|
||||
)
|
||||
}
|
||||
|
||||
type CreateNewStickerSet = MultipartRequest<payloads::CreateNewStickerSet>;
|
||||
|
||||
fn create_new_sticker_set<N, T, E>(
|
||||
fn create_new_sticker_set<N, T, S>(
|
||||
&self,
|
||||
user_id: UserId,
|
||||
name: N,
|
||||
title: T,
|
||||
sticker: InputSticker,
|
||||
emojis: E,
|
||||
stickers: S,
|
||||
sticker_format: StickerFormat,
|
||||
) -> Self::CreateNewStickerSet
|
||||
where
|
||||
N: Into<String>,
|
||||
T: Into<String>,
|
||||
E: Into<String>,
|
||||
S: IntoIterator<Item = InputSticker>,
|
||||
{
|
||||
Self::CreateNewStickerSet::new(
|
||||
self.clone(),
|
||||
payloads::CreateNewStickerSet::new(user_id, name, title, sticker, emojis),
|
||||
payloads::CreateNewStickerSet::new(user_id, name, title, stickers, sticker_format),
|
||||
)
|
||||
}
|
||||
|
||||
type AddStickerToSet = MultipartRequest<payloads::AddStickerToSet>;
|
||||
|
||||
fn add_sticker_to_set<N, E>(
|
||||
fn add_sticker_to_set<N>(
|
||||
&self,
|
||||
user_id: UserId,
|
||||
name: N,
|
||||
sticker: InputSticker,
|
||||
emojis: E,
|
||||
) -> Self::AddStickerToSet
|
||||
where
|
||||
N: Into<String>,
|
||||
E: Into<String>,
|
||||
{
|
||||
Self::AddStickerToSet::new(
|
||||
self.clone(),
|
||||
payloads::AddStickerToSet::new(user_id, name, sticker, emojis),
|
||||
payloads::AddStickerToSet::new(user_id, name, sticker),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -1143,15 +1177,84 @@ impl Requester for Bot {
|
|||
Self::DeleteStickerFromSet::new(self.clone(), payloads::DeleteStickerFromSet::new(sticker))
|
||||
}
|
||||
|
||||
type SetStickerSetThumb = MultipartRequest<payloads::SetStickerSetThumb>;
|
||||
type SetStickerSetThumbnail = MultipartRequest<payloads::SetStickerSetThumbnail>;
|
||||
|
||||
fn set_sticker_set_thumb<N>(&self, name: N, user_id: UserId) -> Self::SetStickerSetThumb
|
||||
fn set_sticker_set_thumbnail<N>(&self, name: N, user_id: UserId) -> Self::SetStickerSetThumbnail
|
||||
where
|
||||
N: Into<String>,
|
||||
{
|
||||
Self::SetStickerSetThumb::new(
|
||||
Self::SetStickerSetThumbnail::new(
|
||||
self.clone(),
|
||||
payloads::SetStickerSetThumb::new(name, user_id),
|
||||
payloads::SetStickerSetThumbnail::new(name, user_id),
|
||||
)
|
||||
}
|
||||
|
||||
type SetCustomEmojiStickerSetThumbnail =
|
||||
JsonRequest<payloads::SetCustomEmojiStickerSetThumbnail>;
|
||||
|
||||
fn set_custom_emoji_sticker_set_thumbnail<N>(
|
||||
&self,
|
||||
name: N,
|
||||
) -> Self::SetCustomEmojiStickerSetThumbnail
|
||||
where
|
||||
N: Into<String>,
|
||||
{
|
||||
Self::SetCustomEmojiStickerSetThumbnail::new(
|
||||
self.clone(),
|
||||
payloads::SetCustomEmojiStickerSetThumbnail::new(name),
|
||||
)
|
||||
}
|
||||
|
||||
type SetStickerSetTitle = JsonRequest<payloads::SetStickerSetTitle>;
|
||||
|
||||
fn set_sticker_set_title<N, T>(&self, name: N, title: T) -> Self::SetStickerSetTitle
|
||||
where
|
||||
N: Into<String>,
|
||||
T: Into<String>,
|
||||
{
|
||||
Self::SetStickerSetTitle::new(self.clone(), payloads::SetStickerSetTitle::new(name, title))
|
||||
}
|
||||
|
||||
type DeleteStickerSet = JsonRequest<payloads::DeleteStickerSet>;
|
||||
|
||||
fn delete_sticker_set<N>(&self, name: N) -> Self::DeleteStickerSet
|
||||
where
|
||||
N: Into<String>,
|
||||
{
|
||||
Self::DeleteStickerSet::new(self.clone(), payloads::DeleteStickerSet::new(name))
|
||||
}
|
||||
|
||||
type SetStickerEmojiList = JsonRequest<payloads::SetStickerEmojiList>;
|
||||
|
||||
fn set_sticker_emoji_list<S, E>(&self, sticker: S, emoji_list: E) -> Self::SetStickerEmojiList
|
||||
where
|
||||
S: Into<String>,
|
||||
E: IntoIterator<Item = String>,
|
||||
{
|
||||
Self::SetStickerEmojiList::new(
|
||||
self.clone(),
|
||||
payloads::SetStickerEmojiList::new(sticker, emoji_list),
|
||||
)
|
||||
}
|
||||
|
||||
type SetStickerKeywords = JsonRequest<payloads::SetStickerKeywords>;
|
||||
|
||||
fn set_sticker_keywords<S>(&self, sticker: S) -> Self::SetStickerKeywords
|
||||
where
|
||||
S: Into<String>,
|
||||
{
|
||||
Self::SetStickerKeywords::new(self.clone(), payloads::SetStickerKeywords::new(sticker))
|
||||
}
|
||||
|
||||
type SetStickerMaskPosition = JsonRequest<payloads::SetStickerMaskPosition>;
|
||||
|
||||
fn set_sticker_mask_position<S>(&self, sticker: S) -> Self::SetStickerMaskPosition
|
||||
where
|
||||
S: Into<String>,
|
||||
{
|
||||
Self::SetStickerMaskPosition::new(
|
||||
self.clone(),
|
||||
payloads::SetStickerMaskPosition::new(sticker),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ use xshell::{cmd, Shell};
|
|||
|
||||
fn ensure_rustfmt(sh: &Shell) {
|
||||
// FIXME(waffle): find a better way to set toolchain
|
||||
let toolchain = "nightly-2024-03-20";
|
||||
let toolchain = "nightly-2024-07-03";
|
||||
|
||||
let version = cmd!(sh, "rustup run {toolchain} rustfmt --version").read().unwrap_or_default();
|
||||
|
||||
|
@ -36,7 +36,7 @@ fn ensure_rustfmt(sh: &Shell) {
|
|||
}
|
||||
|
||||
pub fn reformat(text: String) -> String {
|
||||
let toolchain = "nightly-2024-03-20";
|
||||
let toolchain = "nightly-2024-07-03";
|
||||
|
||||
let sh = Shell::new().unwrap();
|
||||
ensure_rustfmt(&sh);
|
||||
|
@ -89,7 +89,7 @@ pub fn ensure_files_contents<'a>(
|
|||
|
||||
err_count += 1;
|
||||
|
||||
let display_path = path.strip_prefix(&project_root()).unwrap_or(path);
|
||||
let display_path = path.strip_prefix(project_root()).unwrap_or(path);
|
||||
eprintln!(
|
||||
"\n\x1b[31;1merror\x1b[0m: {} was not up-to-date, updating\n",
|
||||
display_path.display()
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
use crate::codegen::schema::Type;
|
||||
|
||||
pub enum Convert {
|
||||
#[allow(dead_code)]
|
||||
Id(Type),
|
||||
Into(Type),
|
||||
Collect(Type),
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//! Core part of the [`teloxide`] library.
|
||||
//!
|
||||
//! This library provides tools for making requests to the [Telegram Bot API]
|
||||
//! (Currently, version `6.5` is supported) with ease. The library is fully
|
||||
//! (Currently, version `6.6` is supported) with ease. The library is fully
|
||||
//! asynchronous and built using [`tokio`].
|
||||
//!
|
||||
//!```toml
|
||||
|
|
|
@ -1033,6 +1033,54 @@ macro_rules! requester_forward {
|
|||
$body!(get_my_commands this ())
|
||||
}
|
||||
};
|
||||
(@method set_my_name $body:ident $ty:ident) => {
|
||||
type SetMyName = $ty![SetMyName];
|
||||
|
||||
fn set_my_name(&self, ) -> Self::SetMyName {
|
||||
let this = self;
|
||||
$body!(set_my_name this ())
|
||||
}
|
||||
};
|
||||
(@method get_my_name $body:ident $ty:ident) => {
|
||||
type GetMyName = $ty![GetMyName];
|
||||
|
||||
fn get_my_name(&self, ) -> Self::GetMyName {
|
||||
let this = self;
|
||||
$body!(get_my_name this ())
|
||||
}
|
||||
};
|
||||
(@method set_my_description $body:ident $ty:ident) => {
|
||||
type SetMyDescription = $ty![SetMyDescription];
|
||||
|
||||
fn set_my_description(&self, ) -> Self::SetMyDescription {
|
||||
let this = self;
|
||||
$body!(set_my_description this ())
|
||||
}
|
||||
};
|
||||
(@method get_my_description $body:ident $ty:ident) => {
|
||||
type GetMyDescription = $ty![GetMyDescription];
|
||||
|
||||
fn get_my_description(&self, ) -> Self::GetMyDescription {
|
||||
let this = self;
|
||||
$body!(get_my_description this ())
|
||||
}
|
||||
};
|
||||
(@method set_my_short_description $body:ident $ty:ident) => {
|
||||
type SetMyShortDescription = $ty![SetMyShortDescription];
|
||||
|
||||
fn set_my_short_description(&self, ) -> Self::SetMyShortDescription {
|
||||
let this = self;
|
||||
$body!(set_my_short_description this ())
|
||||
}
|
||||
};
|
||||
(@method get_my_short_description $body:ident $ty:ident) => {
|
||||
type GetMyShortDescription = $ty![GetMyShortDescription];
|
||||
|
||||
fn get_my_short_description(&self, ) -> Self::GetMyShortDescription {
|
||||
let this = self;
|
||||
$body!(get_my_short_description this ())
|
||||
}
|
||||
};
|
||||
(@method set_chat_menu_button $body:ident $ty:ident) => {
|
||||
type SetChatMenuButton = $ty![SetChatMenuButton];
|
||||
|
||||
|
@ -1199,28 +1247,27 @@ macro_rules! requester_forward {
|
|||
(@method upload_sticker_file $body:ident $ty:ident) => {
|
||||
type UploadStickerFile = $ty![UploadStickerFile];
|
||||
|
||||
fn upload_sticker_file(&self, user_id: UserId, png_sticker: InputFile) -> Self::UploadStickerFile {
|
||||
fn upload_sticker_file(&self, user_id: UserId, sticker: InputFile, sticker_format: StickerFormat) -> Self::UploadStickerFile {
|
||||
let this = self;
|
||||
$body!(upload_sticker_file this (user_id: UserId, png_sticker: InputFile))
|
||||
$body!(upload_sticker_file this (user_id: UserId, sticker: InputFile, sticker_format: StickerFormat))
|
||||
}
|
||||
};
|
||||
(@method create_new_sticker_set $body:ident $ty:ident) => {
|
||||
type CreateNewStickerSet = $ty![CreateNewStickerSet];
|
||||
|
||||
fn create_new_sticker_set<N, T, E>(&self, user_id: UserId, name: N, title: T, sticker: InputSticker, emojis: E) -> Self::CreateNewStickerSet where N: Into<String>,
|
||||
fn create_new_sticker_set<N, T, S>(&self, user_id: UserId, name: N, title: T, stickers: S, sticker_format: StickerFormat) -> Self::CreateNewStickerSet where N: Into<String>,
|
||||
T: Into<String>,
|
||||
E: Into<String> {
|
||||
S: IntoIterator<Item = InputSticker> {
|
||||
let this = self;
|
||||
$body!(create_new_sticker_set this (user_id: UserId, name: N, title: T, sticker: InputSticker, emojis: E))
|
||||
$body!(create_new_sticker_set this (user_id: UserId, name: N, title: T, stickers: S, sticker_format: StickerFormat))
|
||||
}
|
||||
};
|
||||
(@method add_sticker_to_set $body:ident $ty:ident) => {
|
||||
type AddStickerToSet = $ty![AddStickerToSet];
|
||||
|
||||
fn add_sticker_to_set<N, E>(&self, user_id: UserId, name: N, sticker: InputSticker, emojis: E) -> Self::AddStickerToSet where N: Into<String>,
|
||||
E: Into<String> {
|
||||
fn add_sticker_to_set<N>(&self, user_id: UserId, name: N, sticker: InputSticker) -> Self::AddStickerToSet where N: Into<String> {
|
||||
let this = self;
|
||||
$body!(add_sticker_to_set this (user_id: UserId, name: N, sticker: InputSticker, emojis: E))
|
||||
$body!(add_sticker_to_set this (user_id: UserId, name: N, sticker: InputSticker))
|
||||
}
|
||||
};
|
||||
(@method set_sticker_position_in_set $body:ident $ty:ident) => {
|
||||
|
@ -1239,12 +1286,62 @@ macro_rules! requester_forward {
|
|||
$body!(delete_sticker_from_set this (sticker: S))
|
||||
}
|
||||
};
|
||||
(@method set_sticker_set_thumb $body:ident $ty:ident) => {
|
||||
type SetStickerSetThumb = $ty![SetStickerSetThumb];
|
||||
(@method set_sticker_set_thumbnail $body:ident $ty:ident) => {
|
||||
type SetStickerSetThumbnail = $ty![SetStickerSetThumbnail];
|
||||
|
||||
fn set_sticker_set_thumb<N>(&self, name: N, user_id: UserId) -> Self::SetStickerSetThumb where N: Into<String> {
|
||||
fn set_sticker_set_thumbnail<N>(&self, name: N, user_id: UserId) -> Self::SetStickerSetThumbnail where N: Into<String> {
|
||||
let this = self;
|
||||
$body!(set_sticker_set_thumb this (name: N, user_id: UserId))
|
||||
$body!(set_sticker_set_thumbnail this (name: N, user_id: UserId))
|
||||
}
|
||||
};
|
||||
(@method set_custom_emoji_sticker_set_thumbnail $body:ident $ty:ident) => {
|
||||
type SetCustomEmojiStickerSetThumbnail = $ty![SetCustomEmojiStickerSetThumbnail];
|
||||
|
||||
fn set_custom_emoji_sticker_set_thumbnail<N>(&self, name: N) -> Self::SetCustomEmojiStickerSetThumbnail where N: Into<String> {
|
||||
let this = self;
|
||||
$body!(set_custom_emoji_sticker_set_thumbnail this (name: N))
|
||||
}
|
||||
};
|
||||
(@method set_sticker_set_title $body:ident $ty:ident) => {
|
||||
type SetStickerSetTitle = $ty![SetStickerSetTitle];
|
||||
|
||||
fn set_sticker_set_title<N, T>(&self, name: N, title: T) -> Self::SetStickerSetTitle where N: Into<String>,
|
||||
T: Into<String> {
|
||||
let this = self;
|
||||
$body!(set_sticker_set_title this (name: N, title: T))
|
||||
}
|
||||
};
|
||||
(@method delete_sticker_set $body:ident $ty:ident) => {
|
||||
type DeleteStickerSet = $ty![DeleteStickerSet];
|
||||
|
||||
fn delete_sticker_set<N>(&self, name: N) -> Self::DeleteStickerSet where N: Into<String> {
|
||||
let this = self;
|
||||
$body!(delete_sticker_set this (name: N))
|
||||
}
|
||||
};
|
||||
(@method set_sticker_emoji_list $body:ident $ty:ident) => {
|
||||
type SetStickerEmojiList = $ty![SetStickerEmojiList];
|
||||
|
||||
fn set_sticker_emoji_list<S, E>(&self, sticker: S, emoji_list: E) -> Self::SetStickerEmojiList where S: Into<String>,
|
||||
E: IntoIterator<Item = String> {
|
||||
let this = self;
|
||||
$body!(set_sticker_emoji_list this (sticker: S, emoji_list: E))
|
||||
}
|
||||
};
|
||||
(@method set_sticker_keywords $body:ident $ty:ident) => {
|
||||
type SetStickerKeywords = $ty![SetStickerKeywords];
|
||||
|
||||
fn set_sticker_keywords<S>(&self, sticker: S) -> Self::SetStickerKeywords where S: Into<String> {
|
||||
let this = self;
|
||||
$body!(set_sticker_keywords this (sticker: S))
|
||||
}
|
||||
};
|
||||
(@method set_sticker_mask_position $body:ident $ty:ident) => {
|
||||
type SetStickerMaskPosition = $ty![SetStickerMaskPosition];
|
||||
|
||||
fn set_sticker_mask_position<S>(&self, sticker: S) -> Self::SetStickerMaskPosition where S: Into<String> {
|
||||
let this = self;
|
||||
$body!(set_sticker_mask_position this (sticker: S))
|
||||
}
|
||||
};
|
||||
(@method send_invoice $body:ident $ty:ident) => {
|
||||
|
|
|
@ -39,6 +39,7 @@ mod delete_forum_topic;
|
|||
mod delete_message;
|
||||
mod delete_my_commands;
|
||||
mod delete_sticker_from_set;
|
||||
mod delete_sticker_set;
|
||||
mod delete_webhook;
|
||||
mod edit_chat_invite_link;
|
||||
mod edit_forum_topic;
|
||||
|
@ -68,6 +69,9 @@ mod get_game_high_scores;
|
|||
mod get_me;
|
||||
mod get_my_commands;
|
||||
mod get_my_default_administrator_rights;
|
||||
mod get_my_description;
|
||||
mod get_my_name;
|
||||
mod get_my_short_description;
|
||||
mod get_sticker_set;
|
||||
mod get_updates;
|
||||
mod get_user_profile_photos;
|
||||
|
@ -107,13 +111,21 @@ mod set_chat_permissions;
|
|||
mod set_chat_photo;
|
||||
mod set_chat_sticker_set;
|
||||
mod set_chat_title;
|
||||
mod set_custom_emoji_sticker_set_thumbnail;
|
||||
mod set_game_score;
|
||||
mod set_game_score_inline;
|
||||
mod set_my_commands;
|
||||
mod set_my_default_administrator_rights;
|
||||
mod set_my_description;
|
||||
mod set_my_name;
|
||||
mod set_my_short_description;
|
||||
mod set_passport_data_errors;
|
||||
mod set_sticker_emoji_list;
|
||||
mod set_sticker_keywords;
|
||||
mod set_sticker_mask_position;
|
||||
mod set_sticker_position_in_set;
|
||||
mod set_sticker_set_thumb;
|
||||
mod set_sticker_set_thumbnail;
|
||||
mod set_sticker_set_title;
|
||||
mod set_webhook;
|
||||
mod stop_message_live_location;
|
||||
mod stop_message_live_location_inline;
|
||||
|
@ -150,6 +162,7 @@ pub use delete_forum_topic::{DeleteForumTopic, DeleteForumTopicSetters};
|
|||
pub use delete_message::{DeleteMessage, DeleteMessageSetters};
|
||||
pub use delete_my_commands::{DeleteMyCommands, DeleteMyCommandsSetters};
|
||||
pub use delete_sticker_from_set::{DeleteStickerFromSet, DeleteStickerFromSetSetters};
|
||||
pub use delete_sticker_set::{DeleteStickerSet, DeleteStickerSetSetters};
|
||||
pub use delete_webhook::{DeleteWebhook, DeleteWebhookSetters};
|
||||
pub use edit_chat_invite_link::{EditChatInviteLink, EditChatInviteLinkSetters};
|
||||
pub use edit_forum_topic::{EditForumTopic, EditForumTopicSetters};
|
||||
|
@ -187,6 +200,9 @@ pub use get_my_commands::{GetMyCommands, GetMyCommandsSetters};
|
|||
pub use get_my_default_administrator_rights::{
|
||||
GetMyDefaultAdministratorRights, GetMyDefaultAdministratorRightsSetters,
|
||||
};
|
||||
pub use get_my_description::{GetMyDescription, GetMyDescriptionSetters};
|
||||
pub use get_my_name::{GetMyName, GetMyNameSetters};
|
||||
pub use get_my_short_description::{GetMyShortDescription, GetMyShortDescriptionSetters};
|
||||
pub use get_sticker_set::{GetStickerSet, GetStickerSetSetters};
|
||||
pub use get_updates::{GetUpdates, GetUpdatesSetters};
|
||||
pub use get_user_profile_photos::{GetUserProfilePhotos, GetUserProfilePhotosSetters};
|
||||
|
@ -228,15 +244,25 @@ pub use set_chat_permissions::{SetChatPermissions, SetChatPermissionsSetters};
|
|||
pub use set_chat_photo::{SetChatPhoto, SetChatPhotoSetters};
|
||||
pub use set_chat_sticker_set::{SetChatStickerSet, SetChatStickerSetSetters};
|
||||
pub use set_chat_title::{SetChatTitle, SetChatTitleSetters};
|
||||
pub use set_custom_emoji_sticker_set_thumbnail::{
|
||||
SetCustomEmojiStickerSetThumbnail, SetCustomEmojiStickerSetThumbnailSetters,
|
||||
};
|
||||
pub use set_game_score::{SetGameScore, SetGameScoreSetters};
|
||||
pub use set_game_score_inline::{SetGameScoreInline, SetGameScoreInlineSetters};
|
||||
pub use set_my_commands::{SetMyCommands, SetMyCommandsSetters};
|
||||
pub use set_my_default_administrator_rights::{
|
||||
SetMyDefaultAdministratorRights, SetMyDefaultAdministratorRightsSetters,
|
||||
};
|
||||
pub use set_my_description::{SetMyDescription, SetMyDescriptionSetters};
|
||||
pub use set_my_name::{SetMyName, SetMyNameSetters};
|
||||
pub use set_my_short_description::{SetMyShortDescription, SetMyShortDescriptionSetters};
|
||||
pub use set_passport_data_errors::{SetPassportDataErrors, SetPassportDataErrorsSetters};
|
||||
pub use set_sticker_emoji_list::{SetStickerEmojiList, SetStickerEmojiListSetters};
|
||||
pub use set_sticker_keywords::{SetStickerKeywords, SetStickerKeywordsSetters};
|
||||
pub use set_sticker_mask_position::{SetStickerMaskPosition, SetStickerMaskPositionSetters};
|
||||
pub use set_sticker_position_in_set::{SetStickerPositionInSet, SetStickerPositionInSetSetters};
|
||||
pub use set_sticker_set_thumb::{SetStickerSetThumb, SetStickerSetThumbSetters};
|
||||
pub use set_sticker_set_thumbnail::{SetStickerSetThumbnail, SetStickerSetThumbnailSetters};
|
||||
pub use set_sticker_set_title::{SetStickerSetTitle, SetStickerSetTitleSetters};
|
||||
pub use set_webhook::{SetWebhook, SetWebhookSetters};
|
||||
pub use stop_message_live_location::{StopMessageLiveLocation, StopMessageLiveLocationSetters};
|
||||
pub use stop_message_live_location_inline::{
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::types::{InputSticker, MaskPosition, True, UserId};
|
||||
use crate::types::{InputSticker, True, UserId};
|
||||
|
||||
impl_payload! {
|
||||
@[multipart = sticker]
|
||||
/// Use this method to add a new sticker to a set created by the bot. Animated stickers can be added to animated sticker sets and only to them. Animated sticker sets can have up to 50 stickers. Static sticker sets can have up to 120 stickers. Returns _True_ on success.
|
||||
/// Use this method to add a new sticker to a set created by the bot. Emoji sticker sets can have up to 200 stickers. Other sticker sets can have up to 120 stickers. Returns True on success.
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
pub AddStickerToSet (AddStickerToSetSetters) => True {
|
||||
required {
|
||||
|
@ -14,17 +14,8 @@ impl_payload! {
|
|||
pub user_id: UserId,
|
||||
/// Sticker set name
|
||||
pub name: String [into],
|
||||
/// **PNG** or **TGS** image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. Pass a _file\_id_ as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. [More info on Sending Files »]
|
||||
///
|
||||
/// [More info on Sending Files »]: crate::types::InputFile
|
||||
#[serde(flatten)]
|
||||
/// A JSON-serialized object with information about the added sticker. If exactly the same sticker had already been added to the set, then the set isn't changed.
|
||||
pub sticker: InputSticker,
|
||||
/// One or more emoji corresponding to the sticker
|
||||
pub emojis: String [into],
|
||||
}
|
||||
optional {
|
||||
/// A JSON-serialized object for position where the mask should be placed on faces
|
||||
pub mask_position: MaskPosition,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::types::{InlineQueryResult, True};
|
||||
use crate::types::{InlineQueryResult, InlineQueryResultsButton, True};
|
||||
|
||||
impl_payload! {
|
||||
/// Use this method to send answers to an inline query. On success, _True_ is returned. No more than **50** results per query are allowed.
|
||||
|
@ -21,15 +21,8 @@ impl_payload! {
|
|||
pub is_personal: bool,
|
||||
/// Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don't support pagination. Offset length can't exceed 64 bytes.
|
||||
pub next_offset: String [into],
|
||||
/// If passed, clients will display a button with specified text that switches the user to a private chat with the bot and sends the bot a start message with the parameter switch_pm_parameter
|
||||
pub switch_pm_text: String [into],
|
||||
/// [Deep-linking] parameter for the /start message sent to the bot when user presses the switch button. 1-64 characters, only `A-Z`, `a-z`, `0-9`, `_` and `-` are allowed.
|
||||
///
|
||||
/// _Example_: An inline bot that sends YouTube videos can ask the user to connect the bot to their YouTube account to adapt search results accordingly. To do this, it displays a 'Connect your YouTube account' button above the results, or even before showing any. The user presses the button, switches to a private chat with the bot and, in doing so, passes a start parameter that instructs the bot to return an oauth link. Once done, the bot can offer a [switch_inline] button so that the user can easily return to the chat where they wanted to use the bot's inline capabilities.
|
||||
///
|
||||
/// [Deep-linking]: https://core.telegram.org/bots#deep-linking
|
||||
/// [switch_inline]: https://core.telegram.org/bots/api#inlinekeyboardmarkup
|
||||
pub switch_pm_parameter: String [into],
|
||||
/// A JSON-serialized object describing a button to be shown above inline query results
|
||||
pub button: InlineQueryResultsButton,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,10 +56,15 @@ fn codegen_payloads() {
|
|||
.map(|field| format!(" @[multipart = {}]\n", field.join(", ")))
|
||||
.unwrap_or_default();
|
||||
|
||||
// FIXME: CreateNewStickerSet has to be be only Debug + Clone + Serialize (maybe
|
||||
// better fix?)
|
||||
let derive = if !multipart.is_empty()
|
||||
|| matches!(
|
||||
&*method.names.1,
|
||||
"SendMediaGroup" | "EditMessageMedia" | "EditMessageMediaInline"
|
||||
"SendMediaGroup"
|
||||
| "EditMessageMedia"
|
||||
| "EditMessageMediaInline"
|
||||
| "CreateNewStickerSet"
|
||||
) {
|
||||
"#[derive(Debug, Clone, Serialize)]".to_owned()
|
||||
} else {
|
||||
|
@ -188,7 +193,9 @@ fn eq_hash_suitable(method: &Method) -> bool {
|
|||
|
||||
Type::Url | Type::DateTime => true,
|
||||
|
||||
Type::RawTy(raw) => raw != "MaskPosition" && raw != "InlineQueryResult",
|
||||
Type::RawTy(raw) => {
|
||||
raw != "InputSticker" && raw != "MaskPosition" && raw != "InlineQueryResult"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -212,10 +219,7 @@ fn params(params: impl Iterator<Item = impl Borrow<Param>>) -> String {
|
|||
\"crate::types::serialize_reply_to_message_id\")]"
|
||||
}
|
||||
Type::RawTy(s)
|
||||
if s == "MessageId"
|
||||
|| s == "InputSticker"
|
||||
|| s == "TargetMessage"
|
||||
|| s == "StickerType" =>
|
||||
if s == "MessageId" || s == "TargetMessage" || s == "StickerType" =>
|
||||
{
|
||||
"\n #[serde(flatten)]"
|
||||
}
|
||||
|
|
|
@ -2,11 +2,10 @@
|
|||
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::types::{InputSticker, MaskPosition, StickerType, True, UserId};
|
||||
use crate::types::{InputSticker, StickerFormat, StickerType, True, UserId};
|
||||
|
||||
impl_payload! {
|
||||
@[multipart = sticker]
|
||||
/// Use this method to create a new sticker set owned by a user. The bot will be able to edit the sticker set thus created. You must use exactly one of the fields _png\_sticker_ or _tgs\_sticker_. Returns _True_ on success.
|
||||
/// Use this method to create a new sticker set owned by a user. The bot will be able to edit the sticker set thus created. Returns True on success.
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
pub CreateNewStickerSet (CreateNewStickerSetSetters) => True {
|
||||
required {
|
||||
|
@ -16,20 +15,17 @@ impl_payload! {
|
|||
pub name: String [into],
|
||||
/// Sticker set title, 1-64 characters
|
||||
pub title: String [into],
|
||||
/// **PNG** image, **TGS** animation or **WEBM** video with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. Pass a _file\_id_ as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. [More info on Sending Files »]
|
||||
///
|
||||
/// [More info on Sending Files »]: crate::types::InputFile
|
||||
#[serde(flatten)]
|
||||
pub sticker: InputSticker,
|
||||
/// One or more emoji corresponding to the sticker
|
||||
pub emojis: String [into],
|
||||
/// A JSON-serialized list of 1-50 initial stickers to be added to the sticker set
|
||||
pub stickers: Vec<InputSticker> [collect],
|
||||
/// Format of the sticker, must be one of “static”, “animated”, “video”
|
||||
pub sticker_format: StickerFormat,
|
||||
}
|
||||
optional {
|
||||
/// Type of stickers in the set, pass “regular” or “mask”. Custom emoji sticker sets can't be created via the Bot API at the moment. By default, a regular sticker set is created.
|
||||
/// Type of stickers in the set, pass “regular”, “mask”, or “custom_emoji”. By default, a regular sticker set is created.
|
||||
#[serde(flatten)]
|
||||
pub sticker_type: StickerType,
|
||||
/// A JSON-serialized object for position where the mask should be placed on faces
|
||||
pub mask_position: MaskPosition,
|
||||
/// Pass _True_ if stickers in the sticker set must be repainted to the color of text when used in messages, the accent color if used as emoji status, white on chat photos, or another appropriate color based on context; for custom emoji sticker sets only
|
||||
pub needs_repainting: bool,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
16
crates/teloxide-core/src/payloads/delete_sticker_set.rs
Normal file
16
crates/teloxide-core/src/payloads/delete_sticker_set.rs
Normal file
|
@ -0,0 +1,16 @@
|
|||
//! Generated by `codegen_payloads`, do not edit by hand.
|
||||
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::types::True;
|
||||
|
||||
impl_payload! {
|
||||
/// Use this method to delete a sticker set that was created by the bot. Returns True on success.
|
||||
#[derive(Debug, PartialEq, Eq, Hash, Clone, Serialize)]
|
||||
pub DeleteStickerSet (DeleteStickerSetSetters) => True {
|
||||
required {
|
||||
/// Sticker set name
|
||||
pub name: String [into],
|
||||
}
|
||||
}
|
||||
}
|
18
crates/teloxide-core/src/payloads/get_my_description.rs
Normal file
18
crates/teloxide-core/src/payloads/get_my_description.rs
Normal file
|
@ -0,0 +1,18 @@
|
|||
//! Generated by `codegen_payloads`, do not edit by hand.
|
||||
|
||||
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.
|
||||
///
|
||||
/// [`BotDescription`]: crate::types::BotDescription
|
||||
#[derive(Debug, PartialEq, Eq, Hash, Default, Clone, Serialize)]
|
||||
pub GetMyDescription (GetMyDescriptionSetters) => BotDescription {
|
||||
optional {
|
||||
/// A two-letter ISO 639-1 language code
|
||||
pub language_code: String [into],
|
||||
}
|
||||
}
|
||||
}
|
18
crates/teloxide-core/src/payloads/get_my_name.rs
Normal file
18
crates/teloxide-core/src/payloads/get_my_name.rs
Normal file
|
@ -0,0 +1,18 @@
|
|||
//! Generated by `codegen_payloads`, do not edit by hand.
|
||||
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::types::BotName;
|
||||
|
||||
impl_payload! {
|
||||
/// Use this method to get the current bot name for the given user language. Returns [`BotName`] on success.
|
||||
///
|
||||
/// [`BotName`]: crate::types::BotName
|
||||
#[derive(Debug, PartialEq, Eq, Hash, Default, Clone, Serialize)]
|
||||
pub GetMyName (GetMyNameSetters) => BotName {
|
||||
optional {
|
||||
/// A two-letter ISO 639-1 language code or an empty string
|
||||
pub language_code: String [into],
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
//! Generated by `codegen_payloads`, do not edit by hand.
|
||||
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::types::BotShortDescription;
|
||||
|
||||
impl_payload! {
|
||||
/// 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 {
|
||||
/// A two-letter ISO 639-1 language code
|
||||
pub language_code: String [into],
|
||||
}
|
||||
}
|
||||
}
|
|
@ -7,7 +7,7 @@ use crate::types::{
|
|||
};
|
||||
|
||||
impl_payload! {
|
||||
@[multipart = animation, thumb]
|
||||
@[multipart = animation, thumbnail]
|
||||
/// Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). On success, the sent [`Message`] is returned. Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future.
|
||||
///
|
||||
/// [`Message`]: crate::types::Message
|
||||
|
@ -33,7 +33,7 @@ impl_payload! {
|
|||
/// Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. [More info on Sending Files »]
|
||||
///
|
||||
/// [More info on Sending Files »]: crate::types::InputFile
|
||||
pub thumb: InputFile,
|
||||
pub thumbnail: InputFile,
|
||||
/// Animation caption (may also be used when resending videos by _file\_id_), 0-1024 characters after entities parsing
|
||||
pub caption: String [into],
|
||||
/// Mode for parsing entities in the animation caption. See [formatting options] for more details.
|
||||
|
|
|
@ -7,7 +7,7 @@ use crate::types::{
|
|||
};
|
||||
|
||||
impl_payload! {
|
||||
@[multipart = audio, thumb]
|
||||
@[multipart = audio, thumbnail]
|
||||
/// Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .MP3 or .M4A format. On success, the sent [`Message`] is returned. Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future.
|
||||
///
|
||||
/// For sending voice messages, use the [`SendVoice`] method instead.
|
||||
|
@ -44,7 +44,7 @@ impl_payload! {
|
|||
/// Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. [More info on Sending Files »]
|
||||
///
|
||||
/// [More info on Sending Files »]: crate::types::InputFile
|
||||
pub thumb: InputFile,
|
||||
pub thumbnail: InputFile,
|
||||
/// Sends the message [silently]. Users will receive a notification with no sound.
|
||||
///
|
||||
/// [silently]: https://telegram.org/blog/channels-2-0#silent-messages
|
||||
|
|
|
@ -7,7 +7,7 @@ use crate::types::{
|
|||
};
|
||||
|
||||
impl_payload! {
|
||||
@[multipart = document, thumb]
|
||||
@[multipart = document, thumbnail]
|
||||
/// Use this method to send general files. On success, the sent [`Message`] is returned. Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future.
|
||||
///
|
||||
/// [`Message`]: crate::types::Message
|
||||
|
@ -27,7 +27,7 @@ impl_payload! {
|
|||
/// Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. [More info on Sending Files »]
|
||||
///
|
||||
/// [More info on Sending Files »]: crate::types::InputFile
|
||||
pub thumb: InputFile,
|
||||
pub thumbnail: InputFile,
|
||||
/// Document caption (may also be used when resending documents by _file\_id_), 0-1024 characters after entities parsing
|
||||
pub caption: String [into],
|
||||
/// Mode for parsing entities in the audio caption. See [formatting options] for more details.
|
||||
|
|
|
@ -22,6 +22,8 @@ impl_payload! {
|
|||
optional {
|
||||
/// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
|
||||
pub message_thread_id: ThreadId,
|
||||
/// Emoji associated with the sticker; only for just uploaded stickers
|
||||
pub emoji: String [into],
|
||||
/// Sends the message [silently]. Users will receive a notification with no sound.
|
||||
///
|
||||
/// [silently]: https://telegram.org/blog/channels-2-0#silent-messages
|
||||
|
|
|
@ -7,7 +7,7 @@ use crate::types::{
|
|||
};
|
||||
|
||||
impl_payload! {
|
||||
@[multipart = video, thumb]
|
||||
@[multipart = video, thumbnail]
|
||||
/// Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent as [`Document`]). On success, the sent [`Message`] is returned. Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future.
|
||||
///
|
||||
/// [`Document`]: crate::types::Document
|
||||
|
@ -34,7 +34,7 @@ impl_payload! {
|
|||
/// Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. [More info on Sending Files »]
|
||||
///
|
||||
/// [More info on Sending Files »]: crate::types::InputFile
|
||||
pub thumb: InputFile,
|
||||
pub thumbnail: InputFile,
|
||||
/// Video caption (may also be used when resending videos by _file\_id_), 0-1024 characters after entities parsing
|
||||
pub caption: String [into],
|
||||
/// Mode for parsing entities in the video caption. See [formatting options] for more details.
|
||||
|
|
|
@ -5,7 +5,7 @@ use serde::Serialize;
|
|||
use crate::types::{InputFile, Message, MessageId, Recipient, ReplyMarkup, ThreadId};
|
||||
|
||||
impl_payload! {
|
||||
@[multipart = video_note, thumb]
|
||||
@[multipart = video_note, thumbnail]
|
||||
/// As of [v.4.0], Telegram clients support rounded square mp4 videos of up to 1 minute long. Use this method to send video messages. On success, the sent [`Message`] is returned.
|
||||
///
|
||||
/// [v.4.0]: https://core.telegram.org/bots/api#document
|
||||
|
@ -30,7 +30,7 @@ impl_payload! {
|
|||
/// Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. [More info on Sending Files »]
|
||||
///
|
||||
/// [More info on Sending Files »]: crate::types::InputFile
|
||||
pub thumb: InputFile,
|
||||
pub thumbnail: InputFile,
|
||||
/// Sends the message [silently]. Users will receive a notification with no sound.
|
||||
///
|
||||
/// [silently]: https://telegram.org/blog/channels-2-0#silent-messages
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
//! Generated by `codegen_payloads`, do not edit by hand.
|
||||
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::types::True;
|
||||
|
||||
impl_payload! {
|
||||
/// Use this method to set the thumbnail of a custom emoji sticker set. Returns True on success.
|
||||
#[derive(Debug, PartialEq, Eq, Hash, Clone, Serialize)]
|
||||
pub SetCustomEmojiStickerSetThumbnail (SetCustomEmojiStickerSetThumbnailSetters) => True {
|
||||
required {
|
||||
/// Sticker set name
|
||||
pub name: String [into],
|
||||
}
|
||||
optional {
|
||||
/// Custom emoji identifier of a sticker from the sticker set; pass an empty string to drop the thumbnail and use the first sticker as the thumbnail.
|
||||
pub custom_emoji_id: String [into],
|
||||
}
|
||||
}
|
||||
}
|
18
crates/teloxide-core/src/payloads/set_my_description.rs
Normal file
18
crates/teloxide-core/src/payloads/set_my_description.rs
Normal file
|
@ -0,0 +1,18 @@
|
|||
//! Generated by `codegen_payloads`, do not edit by hand.
|
||||
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::types::True;
|
||||
|
||||
impl_payload! {
|
||||
/// Use this method to change the bot's description, which is shown in the chat with the bot if the chat is empty. Returns True on success.
|
||||
#[derive(Debug, PartialEq, Eq, Hash, Default, Clone, Serialize)]
|
||||
pub SetMyDescription (SetMyDescriptionSetters) => True {
|
||||
optional {
|
||||
/// New bot description; 0-512 characters. Pass an empty string to remove the dedicated description for the given language.
|
||||
pub description: String [into],
|
||||
/// A two-letter ISO 639-1 language code. If empty, the description will be applied to all users for whose language there is no dedicated description.
|
||||
pub language_code: String [into],
|
||||
}
|
||||
}
|
||||
}
|
18
crates/teloxide-core/src/payloads/set_my_name.rs
Normal file
18
crates/teloxide-core/src/payloads/set_my_name.rs
Normal file
|
@ -0,0 +1,18 @@
|
|||
//! Generated by `codegen_payloads`, do not edit by hand.
|
||||
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::types::True;
|
||||
|
||||
impl_payload! {
|
||||
/// Use this method to change the bot's name. Returns True on success.
|
||||
#[derive(Debug, PartialEq, Eq, Hash, Default, Clone, Serialize)]
|
||||
pub SetMyName (SetMyNameSetters) => True {
|
||||
optional {
|
||||
/// New bot name; 0-64 characters. Pass an empty string to remove the dedicated name for the given language.
|
||||
pub name: String [into],
|
||||
/// A two-letter ISO 639-1 language code. If empty, the name will be shown to all users for whose language there is no dedicated name.
|
||||
pub language_code: String [into],
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
//! Generated by `codegen_payloads`, do not edit by hand.
|
||||
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::types::True;
|
||||
|
||||
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.
|
||||
#[derive(Debug, PartialEq, Eq, Hash, Default, Clone, Serialize)]
|
||||
pub SetMyShortDescription (SetMyShortDescriptionSetters) => True {
|
||||
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.
|
||||
pub language_code: String [into],
|
||||
}
|
||||
}
|
||||
}
|
18
crates/teloxide-core/src/payloads/set_sticker_emoji_list.rs
Normal file
18
crates/teloxide-core/src/payloads/set_sticker_emoji_list.rs
Normal file
|
@ -0,0 +1,18 @@
|
|||
//! Generated by `codegen_payloads`, do not edit by hand.
|
||||
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::types::True;
|
||||
|
||||
impl_payload! {
|
||||
/// Use this method to change the list of emoji assigned to a regular or custom emoji sticker. The sticker must belong to a sticker set created by the bot. Returns True on success.
|
||||
#[derive(Debug, PartialEq, Eq, Hash, Clone, Serialize)]
|
||||
pub SetStickerEmojiList (SetStickerEmojiListSetters) => True {
|
||||
required {
|
||||
/// File identifier of the sticker
|
||||
pub sticker: String [into],
|
||||
/// A JSON-serialized list of 1-20 emoji associated with the sticker
|
||||
pub emoji_list: Vec<String> [collect],
|
||||
}
|
||||
}
|
||||
}
|
20
crates/teloxide-core/src/payloads/set_sticker_keywords.rs
Normal file
20
crates/teloxide-core/src/payloads/set_sticker_keywords.rs
Normal file
|
@ -0,0 +1,20 @@
|
|||
//! Generated by `codegen_payloads`, do not edit by hand.
|
||||
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::types::True;
|
||||
|
||||
impl_payload! {
|
||||
/// Use this method to change search keywords assigned to a regular or custom emoji sticker. The sticker must belong to a sticker set created by the bot. Returns True on success.
|
||||
#[derive(Debug, PartialEq, Eq, Hash, Clone, Serialize)]
|
||||
pub SetStickerKeywords (SetStickerKeywordsSetters) => True {
|
||||
required {
|
||||
/// File identifier of the sticker
|
||||
pub sticker: String [into],
|
||||
}
|
||||
optional {
|
||||
/// A JSON-serialized list of 0-20 search keywords for the sticker with total length of up to 64 characters
|
||||
pub keywords: Vec<String> [collect],
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
//! Generated by `codegen_payloads`, do not edit by hand.
|
||||
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::types::{MaskPosition, True};
|
||||
|
||||
impl_payload! {
|
||||
/// Use this method to change the mask position of a mask sticker. The sticker must belong to a sticker set that was created by the bot. Returns True on success.
|
||||
#[derive(Debug, PartialEq, Clone, Serialize)]
|
||||
pub SetStickerMaskPosition (SetStickerMaskPositionSetters) => True {
|
||||
required {
|
||||
/// File identifier of the sticker
|
||||
pub sticker: String [into],
|
||||
}
|
||||
optional {
|
||||
/// A JSON-serialized object with the position where the mask should be placed on faces. Omit the parameter to remove the mask position.
|
||||
pub mask_position: MaskPosition,
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
//! Generated by `codegen_payloads`, do not edit by hand.
|
||||
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::types::{InputFile, True, UserId};
|
||||
|
||||
impl_payload! {
|
||||
@[multipart = thumb]
|
||||
/// Use this method to set the thumbnail of a sticker set. Animated thumbnails can be set for animated sticker sets only. Returns _True_ on success.
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
pub SetStickerSetThumb (SetStickerSetThumbSetters) => True {
|
||||
required {
|
||||
/// Name of the sticker set
|
||||
pub name: String [into],
|
||||
/// User identifier of sticker file owner
|
||||
pub user_id: UserId,
|
||||
}
|
||||
optional {
|
||||
/// A **PNG** image with the thumbnail, must be up to 128 kilobytes in size and have width and height exactly 100px, or a **TGS** animation with the thumbnail up to 32 kilobytes in size; see https://core.telegram.org/animated_stickers#technical-requirements for animated sticker technical requirements. Pass a _file\_id_ as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. [More info on Sending Files »]. Animated sticker set thumbnail can't be uploaded via HTTP URL.
|
||||
///
|
||||
/// [More info on Sending Files »]: crate::types::InputFile
|
||||
pub thumb: InputFile,
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
//! Generated by `codegen_payloads`, do not edit by hand.
|
||||
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::types::{InputFile, True, UserId};
|
||||
|
||||
impl_payload! {
|
||||
@[multipart = thumbnail]
|
||||
/// Use this method to set the thumbnail of a regular or mask sticker set. The format of the thumbnail file must match the format of the stickers in the set. Returns True on success.
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
pub SetStickerSetThumbnail (SetStickerSetThumbnailSetters) => True {
|
||||
required {
|
||||
/// Name of the sticker set
|
||||
pub name: String [into],
|
||||
/// User identifier of sticker file owner
|
||||
pub user_id: UserId,
|
||||
}
|
||||
optional {
|
||||
/// A .WEBP or .PNG image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly 100px, or a .TGS animation with a thumbnail up to 32 kilobytes in size (see https://core.telegram.org/stickers#animated-sticker-requirements for animated sticker technical requirements), or a WEBM video with the thumbnail up to 32 kilobytes in size; see https://core.telegram.org/stickers#video-sticker-requirements for video sticker technical requirements. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. Animated and video sticker set thumbnails can't be uploaded via HTTP URL. If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail.
|
||||
///
|
||||
/// [More info on Sending Files »]: crate::types::InputFile
|
||||
pub thumbnail: InputFile,
|
||||
}
|
||||
}
|
||||
}
|
18
crates/teloxide-core/src/payloads/set_sticker_set_title.rs
Normal file
18
crates/teloxide-core/src/payloads/set_sticker_set_title.rs
Normal file
|
@ -0,0 +1,18 @@
|
|||
//! Generated by `codegen_payloads`, do not edit by hand.
|
||||
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::types::True;
|
||||
|
||||
impl_payload! {
|
||||
/// Use this method to set the title of a created sticker set. Returns True on success.
|
||||
#[derive(Debug, PartialEq, Eq, Hash, Clone, Serialize)]
|
||||
pub SetStickerSetTitle (SetStickerSetTitleSetters) => True {
|
||||
required {
|
||||
/// Sticker set name
|
||||
pub name: String [into],
|
||||
/// Sticker set title, 1-64 characters
|
||||
pub title: String [into],
|
||||
}
|
||||
}
|
||||
}
|
|
@ -10,20 +10,21 @@ pub use crate::payloads::{
|
|||
CreateForumTopicSetters as _, CreateInvoiceLinkSetters as _, CreateNewStickerSetSetters as _,
|
||||
DeclineChatJoinRequestSetters as _, DeleteChatPhotoSetters as _,
|
||||
DeleteChatStickerSetSetters as _, DeleteForumTopicSetters as _, DeleteMessageSetters as _,
|
||||
DeleteMyCommandsSetters as _, DeleteStickerFromSetSetters as _, DeleteWebhookSetters as _,
|
||||
EditChatInviteLinkSetters as _, EditForumTopicSetters as _, EditGeneralForumTopicSetters as _,
|
||||
EditMessageCaptionInlineSetters as _, EditMessageCaptionSetters as _,
|
||||
EditMessageLiveLocationInlineSetters as _, EditMessageLiveLocationSetters as _,
|
||||
EditMessageMediaInlineSetters as _, EditMessageMediaSetters as _,
|
||||
EditMessageReplyMarkupInlineSetters as _, EditMessageReplyMarkupSetters as _,
|
||||
EditMessageTextInlineSetters as _, EditMessageTextSetters as _,
|
||||
ExportChatInviteLinkSetters as _, ForwardMessageSetters as _,
|
||||
DeleteMyCommandsSetters as _, DeleteStickerFromSetSetters as _, DeleteStickerSetSetters as _,
|
||||
DeleteWebhookSetters as _, EditChatInviteLinkSetters as _, EditForumTopicSetters as _,
|
||||
EditGeneralForumTopicSetters as _, EditMessageCaptionInlineSetters as _,
|
||||
EditMessageCaptionSetters as _, EditMessageLiveLocationInlineSetters as _,
|
||||
EditMessageLiveLocationSetters as _, EditMessageMediaInlineSetters as _,
|
||||
EditMessageMediaSetters as _, EditMessageReplyMarkupInlineSetters as _,
|
||||
EditMessageReplyMarkupSetters as _, EditMessageTextInlineSetters as _,
|
||||
EditMessageTextSetters as _, ExportChatInviteLinkSetters as _, ForwardMessageSetters as _,
|
||||
GetChatAdministratorsSetters as _, GetChatMemberCountSetters as _, GetChatMemberSetters as _,
|
||||
GetChatMembersCountSetters as _, GetChatMenuButtonSetters as _, GetChatSetters as _,
|
||||
GetCustomEmojiStickersSetters as _, GetFileSetters as _, GetForumTopicIconStickersSetters as _,
|
||||
GetGameHighScoresSetters as _, GetMeSetters as _, GetMyCommandsSetters as _,
|
||||
GetMyDefaultAdministratorRightsSetters as _, GetStickerSetSetters as _, GetUpdatesSetters as _,
|
||||
GetUserProfilePhotosSetters as _, GetWebhookInfoSetters as _,
|
||||
GetMyDefaultAdministratorRightsSetters as _, GetMyDescriptionSetters as _,
|
||||
GetMyNameSetters as _, GetMyShortDescriptionSetters as _, GetStickerSetSetters as _,
|
||||
GetUpdatesSetters as _, GetUserProfilePhotosSetters as _, GetWebhookInfoSetters as _,
|
||||
HideGeneralForumTopicSetters as _, KickChatMemberSetters as _, LeaveChatSetters as _,
|
||||
LogOutSetters as _, PinChatMessageSetters as _, PromoteChatMemberSetters as _,
|
||||
ReopenForumTopicSetters as _, ReopenGeneralForumTopicSetters as _,
|
||||
|
@ -35,10 +36,14 @@ pub use crate::payloads::{
|
|||
SendVideoNoteSetters as _, SendVideoSetters as _, SendVoiceSetters as _,
|
||||
SetChatAdministratorCustomTitleSetters as _, SetChatDescriptionSetters as _,
|
||||
SetChatMenuButtonSetters as _, SetChatPermissionsSetters as _, SetChatPhotoSetters as _,
|
||||
SetChatStickerSetSetters as _, SetChatTitleSetters as _, SetGameScoreInlineSetters as _,
|
||||
SetChatStickerSetSetters as _, SetChatTitleSetters as _,
|
||||
SetCustomEmojiStickerSetThumbnailSetters as _, SetGameScoreInlineSetters as _,
|
||||
SetGameScoreSetters as _, SetMyCommandsSetters as _,
|
||||
SetMyDefaultAdministratorRightsSetters as _, SetPassportDataErrorsSetters as _,
|
||||
SetStickerPositionInSetSetters as _, SetStickerSetThumbSetters as _, SetWebhookSetters as _,
|
||||
SetMyDefaultAdministratorRightsSetters as _, SetMyDescriptionSetters as _,
|
||||
SetMyNameSetters as _, SetMyShortDescriptionSetters as _, SetPassportDataErrorsSetters as _,
|
||||
SetStickerEmojiListSetters as _, SetStickerKeywordsSetters as _,
|
||||
SetStickerMaskPositionSetters as _, SetStickerPositionInSetSetters as _,
|
||||
SetStickerSetThumbnailSetters as _, SetStickerSetTitleSetters as _, SetWebhookSetters as _,
|
||||
StopMessageLiveLocationInlineSetters as _, StopMessageLiveLocationSetters as _,
|
||||
StopPollSetters as _, UnbanChatMemberSetters as _, UnbanChatSenderChatSetters as _,
|
||||
UnhideGeneralForumTopicSetters as _, UnpinAllChatMessagesSetters as _,
|
||||
|
|
|
@ -2,20 +2,27 @@
|
|||
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::types::{FileMeta, InputFile, UserId};
|
||||
use crate::types::{FileMeta, InputFile, StickerFormat, UserId};
|
||||
|
||||
impl_payload! {
|
||||
@[multipart = png_sticker]
|
||||
/// Use this method to upload a .PNG file with a sticker for later use in _createNewStickerSet_ and _addStickerToSet_ methods (can be used multiple times). Returns the uploaded File on success.
|
||||
@[multipart = sticker]
|
||||
/// Use this method to upload a file with a sticker for later use in the [CreateNewStickerSet] and [AddStickerToSet] methods (the file can be used multiple times). Returns the uploaded [`File`] on success.
|
||||
///
|
||||
/// [CreateNewStickerSet]: https://docs.rs/teloxide/latest/teloxide/payloads/struct.CreateNewStickerSet.html
|
||||
/// [AddStickerToSet]: https://docs.rs/teloxide/latest/teloxide/payloads/struct.AddStickerToSet.html
|
||||
/// [`File`]: crate::types::File
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
pub UploadStickerFile (UploadStickerFileSetters) => FileMeta {
|
||||
required {
|
||||
/// User identifier of sticker file owner
|
||||
pub user_id: UserId,
|
||||
/// PNG image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. [More info on Sending Files »]
|
||||
/// A file with the sticker in .WEBP, .PNG, .TGS, or .WEBM format. [Technical requirements]. [More info on Sending Files »]
|
||||
///
|
||||
/// [More info on Sending Files »]: crate::types::InputFile
|
||||
pub png_sticker: InputFile,
|
||||
/// [Technical requirements]: https://core.telegram.org/stickers
|
||||
pub sticker: InputFile,
|
||||
/// Format of the sticker, must be one of “static”, “animated”, “video”
|
||||
pub sticker_format: StickerFormat,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use crate::{
|
||||
payloads,
|
||||
requests::Payload,
|
||||
types::{InputFile, InputFileLike, InputMedia},
|
||||
types::{InputFile, InputFileLike, InputMedia, InputSticker},
|
||||
};
|
||||
|
||||
/// Payloads that need to be sent as `multipart/form-data` because they contain
|
||||
|
@ -41,3 +41,17 @@ impl MultipartPayload for payloads::EditMessageMediaInline {
|
|||
self.media.files_mut().for_each(|f| f.move_into(into))
|
||||
}
|
||||
}
|
||||
|
||||
impl MultipartPayload for payloads::CreateNewStickerSet {
|
||||
fn copy_files(&self, into: &mut dyn FnMut(InputFile)) {
|
||||
self.stickers
|
||||
.iter()
|
||||
.for_each(|InputSticker { sticker: f, .. }: &InputSticker| f.copy_into(into))
|
||||
}
|
||||
|
||||
fn move_files(&mut self, into: &mut dyn FnMut(InputFile)) {
|
||||
self.stickers
|
||||
.iter_mut()
|
||||
.for_each(|InputSticker { sticker: f, .. }: &mut InputSticker| f.move_into(into))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -777,6 +777,36 @@ pub trait Requester {
|
|||
/// For Telegram documentation see [`GetMyCommands`].
|
||||
fn get_my_commands(&self) -> Self::GetMyCommands;
|
||||
|
||||
type SetMyName: Request<Payload = SetMyName, Err = Self::Err>;
|
||||
|
||||
/// For Telegram documentation see [`SetMyName`].
|
||||
fn set_my_name(&self) -> Self::SetMyName;
|
||||
|
||||
type GetMyName: Request<Payload = GetMyName, Err = Self::Err>;
|
||||
|
||||
/// For Telegram documentation see [`GetMyName`].
|
||||
fn get_my_name(&self) -> Self::GetMyName;
|
||||
|
||||
type SetMyDescription: Request<Payload = SetMyDescription, Err = Self::Err>;
|
||||
|
||||
/// For Telegram documentation see [`SetMyDescription`].
|
||||
fn set_my_description(&self) -> Self::SetMyDescription;
|
||||
|
||||
type GetMyDescription: Request<Payload = GetMyDescription, Err = Self::Err>;
|
||||
|
||||
/// For Telegram documentation see [`GetMyDescription`].
|
||||
fn get_my_description(&self) -> Self::GetMyDescription;
|
||||
|
||||
type SetMyShortDescription: Request<Payload = SetMyShortDescription, Err = Self::Err>;
|
||||
|
||||
/// For Telegram documentation see [`SetMyShortDescription`].
|
||||
fn set_my_short_description(&self) -> Self::SetMyShortDescription;
|
||||
|
||||
type GetMyShortDescription: Request<Payload = GetMyShortDescription, Err = Self::Err>;
|
||||
|
||||
/// For Telegram documentation see [`GetMyShortDescription`].
|
||||
fn get_my_short_description(&self) -> Self::GetMyShortDescription;
|
||||
|
||||
type SetChatMenuButton: Request<Payload = SetChatMenuButton, Err = Self::Err>;
|
||||
|
||||
/// For Telegram documentation see [`SetChatMenuButton`].
|
||||
|
@ -961,38 +991,37 @@ pub trait Requester {
|
|||
fn upload_sticker_file(
|
||||
&self,
|
||||
user_id: UserId,
|
||||
png_sticker: InputFile,
|
||||
sticker: InputFile,
|
||||
sticker_format: StickerFormat,
|
||||
) -> Self::UploadStickerFile;
|
||||
|
||||
type CreateNewStickerSet: Request<Payload = CreateNewStickerSet, Err = Self::Err>;
|
||||
|
||||
/// For Telegram documentation see [`CreateNewStickerSet`].
|
||||
fn create_new_sticker_set<N, T, E>(
|
||||
fn create_new_sticker_set<N, T, S>(
|
||||
&self,
|
||||
user_id: UserId,
|
||||
name: N,
|
||||
title: T,
|
||||
sticker: InputSticker,
|
||||
emojis: E,
|
||||
stickers: S,
|
||||
sticker_format: StickerFormat,
|
||||
) -> Self::CreateNewStickerSet
|
||||
where
|
||||
N: Into<String>,
|
||||
T: Into<String>,
|
||||
E: Into<String>;
|
||||
S: IntoIterator<Item = InputSticker>;
|
||||
|
||||
type AddStickerToSet: Request<Payload = AddStickerToSet, Err = Self::Err>;
|
||||
|
||||
/// For Telegram documentation see [`AddStickerToSet`].
|
||||
fn add_sticker_to_set<N, E>(
|
||||
fn add_sticker_to_set<N>(
|
||||
&self,
|
||||
user_id: UserId,
|
||||
name: N,
|
||||
sticker: InputSticker,
|
||||
emojis: E,
|
||||
) -> Self::AddStickerToSet
|
||||
where
|
||||
N: Into<String>,
|
||||
E: Into<String>;
|
||||
N: Into<String>;
|
||||
|
||||
type SetStickerPositionInSet: Request<Payload = SetStickerPositionInSet, Err = Self::Err>;
|
||||
|
||||
|
@ -1012,13 +1041,67 @@ pub trait Requester {
|
|||
where
|
||||
S: Into<String>;
|
||||
|
||||
type SetStickerSetThumb: Request<Payload = SetStickerSetThumb, Err = Self::Err>;
|
||||
type SetStickerSetThumbnail: Request<Payload = SetStickerSetThumbnail, Err = Self::Err>;
|
||||
|
||||
/// For Telegram documentation see [`SetStickerSetThumb`].
|
||||
fn set_sticker_set_thumb<N>(&self, name: N, user_id: UserId) -> Self::SetStickerSetThumb
|
||||
/// For Telegram documentation see [`SetStickerSetThumbnail`].
|
||||
fn set_sticker_set_thumbnail<N>(
|
||||
&self,
|
||||
name: N,
|
||||
user_id: UserId,
|
||||
) -> Self::SetStickerSetThumbnail
|
||||
where
|
||||
N: Into<String>;
|
||||
|
||||
type SetCustomEmojiStickerSetThumbnail: Request<
|
||||
Payload = SetCustomEmojiStickerSetThumbnail,
|
||||
Err = Self::Err,
|
||||
>;
|
||||
|
||||
/// For Telegram documentation see [`SetCustomEmojiStickerSetThumbnail`].
|
||||
fn set_custom_emoji_sticker_set_thumbnail<N>(
|
||||
&self,
|
||||
name: N,
|
||||
) -> Self::SetCustomEmojiStickerSetThumbnail
|
||||
where
|
||||
N: Into<String>;
|
||||
|
||||
type SetStickerSetTitle: Request<Payload = SetStickerSetTitle, Err = Self::Err>;
|
||||
|
||||
/// For Telegram documentation see [`SetStickerSetTitle`].
|
||||
fn set_sticker_set_title<N, T>(&self, name: N, title: T) -> Self::SetStickerSetTitle
|
||||
where
|
||||
N: Into<String>,
|
||||
T: Into<String>;
|
||||
|
||||
type DeleteStickerSet: Request<Payload = DeleteStickerSet, Err = Self::Err>;
|
||||
|
||||
/// For Telegram documentation see [`DeleteStickerSet`].
|
||||
fn delete_sticker_set<N>(&self, name: N) -> Self::DeleteStickerSet
|
||||
where
|
||||
N: Into<String>;
|
||||
|
||||
type SetStickerEmojiList: Request<Payload = SetStickerEmojiList, Err = Self::Err>;
|
||||
|
||||
/// For Telegram documentation see [`SetStickerEmojiList`].
|
||||
fn set_sticker_emoji_list<S, E>(&self, sticker: S, emoji_list: E) -> Self::SetStickerEmojiList
|
||||
where
|
||||
S: Into<String>,
|
||||
E: IntoIterator<Item = String>;
|
||||
|
||||
type SetStickerKeywords: Request<Payload = SetStickerKeywords, Err = Self::Err>;
|
||||
|
||||
/// For Telegram documentation see [`SetStickerKeywords`].
|
||||
fn set_sticker_keywords<S>(&self, sticker: S) -> Self::SetStickerKeywords
|
||||
where
|
||||
S: Into<String>;
|
||||
|
||||
type SetStickerMaskPosition: Request<Payload = SetStickerMaskPosition, Err = Self::Err>;
|
||||
|
||||
/// For Telegram documentation see [`SetStickerMaskPosition`].
|
||||
fn set_sticker_mask_position<S>(&self, sticker: S) -> Self::SetStickerMaskPosition
|
||||
where
|
||||
S: Into<String>;
|
||||
|
||||
type SendInvoice: Request<Payload = SendInvoice, Err = Self::Err>;
|
||||
|
||||
/// For Telegram documentation see [`SendInvoice`].
|
||||
|
@ -1217,6 +1300,12 @@ macro_rules! forward_all {
|
|||
answer_callback_query,
|
||||
set_my_commands,
|
||||
get_my_commands,
|
||||
set_my_name,
|
||||
get_my_name,
|
||||
set_my_description,
|
||||
get_my_description,
|
||||
set_my_short_description,
|
||||
get_my_short_description,
|
||||
set_chat_menu_button,
|
||||
get_chat_menu_button,
|
||||
set_my_default_administrator_rights,
|
||||
|
@ -1242,7 +1331,13 @@ macro_rules! forward_all {
|
|||
add_sticker_to_set,
|
||||
set_sticker_position_in_set,
|
||||
delete_sticker_from_set,
|
||||
set_sticker_set_thumb,
|
||||
set_sticker_set_thumbnail,
|
||||
set_custom_emoji_sticker_set_thumbnail,
|
||||
set_sticker_set_title,
|
||||
delete_sticker_set,
|
||||
set_sticker_emoji_list,
|
||||
set_sticker_keywords,
|
||||
set_sticker_mask_position,
|
||||
send_invoice,
|
||||
create_invoice_link,
|
||||
answer_shipping_query,
|
||||
|
|
|
@ -126,7 +126,7 @@ mod tests {
|
|||
InputMediaAnimation::new(InputFile::read(
|
||||
File::open("../../media/example.gif").await.unwrap(),
|
||||
))
|
||||
.thumb(InputFile::read(
|
||||
.thumbnail(InputFile::read(
|
||||
File::open("../../media/teloxide-core-logo.png").await.unwrap(),
|
||||
))
|
||||
.duration(17),
|
||||
|
@ -149,8 +149,15 @@ mod tests {
|
|||
to_form_ref(&payloads::AddStickerToSet::new(
|
||||
UserId(0),
|
||||
"name",
|
||||
InputSticker::Png(InputFile::file("../../media/teloxide-core-logo.png")),
|
||||
"✈️⚙️",
|
||||
InputSticker {
|
||||
sticker: InputFile::file(
|
||||
"../../media/
|
||||
teloxide-core-logo.png",
|
||||
),
|
||||
emoji_list: vec!["✈️⚙️".to_owned()],
|
||||
keywords: vec![],
|
||||
mask_position: None,
|
||||
},
|
||||
))
|
||||
.unwrap()
|
||||
.await;
|
||||
|
@ -164,7 +171,9 @@ mod tests {
|
|||
InputFile::file("../../media/teloxide-core-logo.png"),
|
||||
)
|
||||
.caption_entities(entities())
|
||||
.thumb(InputFile::read(File::open("../../media/teloxide-core-logo.png").await.unwrap()))
|
||||
.thumbnail(InputFile::read(
|
||||
File::open("../../media/teloxide-core-logo.png").await.unwrap(),
|
||||
))
|
||||
.allow_sending_without_reply(true),
|
||||
)
|
||||
.unwrap()
|
||||
|
|
|
@ -5,6 +5,9 @@ pub use animation::*;
|
|||
pub use audio::*;
|
||||
pub use bot_command::*;
|
||||
pub use bot_command_scope::*;
|
||||
pub use bot_description::*;
|
||||
pub use bot_name::*;
|
||||
pub use bot_short_description::*;
|
||||
pub use callback_game::*;
|
||||
pub use callback_query::*;
|
||||
pub use chat::*;
|
||||
|
@ -61,6 +64,7 @@ pub use inline_query_result_photo::*;
|
|||
pub use inline_query_result_venue::*;
|
||||
pub use inline_query_result_video::*;
|
||||
pub use inline_query_result_voice::*;
|
||||
pub use inline_query_results_button::*;
|
||||
pub use input_file::*;
|
||||
pub use input_media::*;
|
||||
pub use input_message_content::*;
|
||||
|
@ -102,6 +106,7 @@ pub use shipping_query::*;
|
|||
pub use sticker::*;
|
||||
pub use sticker_set::*;
|
||||
pub use successful_payment::*;
|
||||
pub use switch_inline_query_chosen_chat::*;
|
||||
pub use target_message::*;
|
||||
pub use thread_id::*;
|
||||
pub use unit_false::*;
|
||||
|
@ -128,6 +133,9 @@ mod animation;
|
|||
mod audio;
|
||||
mod bot_command;
|
||||
mod bot_command_scope;
|
||||
mod bot_description;
|
||||
mod bot_name;
|
||||
mod bot_short_description;
|
||||
mod callback_game;
|
||||
mod callback_query;
|
||||
mod chat;
|
||||
|
@ -160,6 +168,7 @@ mod general_forum_topic_hidden;
|
|||
mod general_forum_topic_unhidden;
|
||||
mod inline_keyboard_button;
|
||||
mod inline_keyboard_markup;
|
||||
mod inline_query_results_button;
|
||||
mod input_file;
|
||||
mod input_media;
|
||||
mod input_message_content;
|
||||
|
@ -198,6 +207,7 @@ mod shipping_query;
|
|||
mod sticker;
|
||||
mod sticker_set;
|
||||
mod successful_payment;
|
||||
mod switch_inline_query_chosen_chat;
|
||||
mod target_message;
|
||||
mod thread_id;
|
||||
mod unit_false;
|
||||
|
|
|
@ -24,7 +24,7 @@ pub struct Animation {
|
|||
pub duration: Seconds,
|
||||
|
||||
/// An animation thumbnail as defined by a sender.
|
||||
pub thumb: Option<PhotoSize>,
|
||||
pub thumbnail: Option<PhotoSize>,
|
||||
|
||||
/// An original animation filename as defined by a sender.
|
||||
pub file_name: Option<String>,
|
||||
|
@ -46,7 +46,7 @@ mod tests {
|
|||
"width":320,
|
||||
"height":320,
|
||||
"duration":59,
|
||||
"thumb":{
|
||||
"thumbnail":{
|
||||
"file_id":"id",
|
||||
"file_unique_id":"",
|
||||
"width":320,
|
||||
|
@ -61,7 +61,7 @@ mod tests {
|
|||
width: 320,
|
||||
height: 320,
|
||||
duration: Seconds::from_seconds(59),
|
||||
thumb: Some(PhotoSize {
|
||||
thumbnail: Some(PhotoSize {
|
||||
file: FileMeta { id: "id".to_owned(), unique_id: "".to_owned(), size: 3452 },
|
||||
width: 320,
|
||||
height: 320,
|
||||
|
|
|
@ -31,7 +31,7 @@ pub struct Audio {
|
|||
pub mime_type: Option<Mime>,
|
||||
|
||||
/// A thumbnail of the album cover to which the music file belongs.
|
||||
pub thumb: Option<PhotoSize>,
|
||||
pub thumbnail: Option<PhotoSize>,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
@ -48,7 +48,7 @@ mod tests {
|
|||
"title":"Title",
|
||||
"mime_type":"application/zip",
|
||||
"file_size":123456,
|
||||
"thumb":{
|
||||
"thumbnail":{
|
||||
"file_id":"id",
|
||||
"file_unique_id":"",
|
||||
"width":320,
|
||||
|
@ -62,7 +62,7 @@ mod tests {
|
|||
performer: Some("Performer".to_string()),
|
||||
title: Some("Title".to_string()),
|
||||
mime_type: Some("application/zip".parse().unwrap()),
|
||||
thumb: Some(PhotoSize {
|
||||
thumbnail: Some(PhotoSize {
|
||||
file: FileMeta { id: "id".to_owned(), unique_id: "".to_owned(), size: 3452 },
|
||||
width: 320,
|
||||
height: 320,
|
||||
|
|
7
crates/teloxide-core/src/types/bot_description.rs
Normal file
7
crates/teloxide-core/src/types/bot_description.rs
Normal file
|
@ -0,0 +1,7 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct BotDescription {
|
||||
/// The bot's description
|
||||
pub description: String,
|
||||
}
|
7
crates/teloxide-core/src/types/bot_name.rs
Normal file
7
crates/teloxide-core/src/types/bot_name.rs
Normal file
|
@ -0,0 +1,7 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct BotName {
|
||||
/// The bot's name
|
||||
pub name: String,
|
||||
}
|
7
crates/teloxide-core/src/types/bot_short_description.rs
Normal file
7
crates/teloxide-core/src/types/bot_short_description.rs
Normal file
|
@ -0,0 +1,7 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct BotShortDescription {
|
||||
/// The bot's short description
|
||||
pub short_description: String,
|
||||
}
|
|
@ -361,6 +361,7 @@ impl ChatMemberKind {
|
|||
/// - is the owner of the chat
|
||||
/// - is an administrator in the given chat and has [`can_manage_chat`]
|
||||
/// privilege.
|
||||
///
|
||||
/// Returns `false` otherwise.
|
||||
///
|
||||
/// [`can_manage_chat`]: Administrator::can_manage_chat
|
||||
|
@ -379,6 +380,7 @@ impl ChatMemberKind {
|
|||
/// - is the owner of the chat (even if the chat is not a channel)
|
||||
/// - is an administrator in the given chat and has [`can_post_messages`]
|
||||
/// privilege.
|
||||
///
|
||||
/// Returns `false` otherwise.
|
||||
///
|
||||
/// [`can_post_messages`]: Administrator::can_post_messages
|
||||
|
@ -398,6 +400,7 @@ impl ChatMemberKind {
|
|||
/// - is the owner of the chat (even if the chat is not a channel)
|
||||
/// - is an administrator in the given chat and has the
|
||||
/// [`can_edit_messages`] privilege.
|
||||
///
|
||||
/// Returns `false` otherwise.
|
||||
///
|
||||
/// [`can_edit_messages`]: Administrator::can_edit_messages
|
||||
|
@ -416,6 +419,7 @@ impl ChatMemberKind {
|
|||
/// - is the owner of the chat
|
||||
/// - is an administrator in the given chat and has the
|
||||
/// [`can_delete_messages`] privilege.
|
||||
///
|
||||
/// Returns `false` otherwise.
|
||||
///
|
||||
/// [`can_delete_messages`]: Administrator::can_delete_messages
|
||||
|
@ -434,6 +438,7 @@ impl ChatMemberKind {
|
|||
/// - is the owner of the chat
|
||||
/// - is an administrator in the given chat and has the
|
||||
/// [`can_manage_video_chats`] privilege.
|
||||
///
|
||||
/// Returns `false` otherwise.
|
||||
///
|
||||
/// [`can_manage_video_chats`]: Administrator::can_manage_video_chats
|
||||
|
@ -454,6 +459,7 @@ impl ChatMemberKind {
|
|||
/// - is the owner of the chat
|
||||
/// - is an administrator in the given chat and has the
|
||||
/// [`can_restrict_members`] privilege.
|
||||
///
|
||||
/// Returns `false` otherwise.
|
||||
///
|
||||
/// [`can_restrict_members`]: Administrator::can_restrict_members
|
||||
|
@ -477,6 +483,7 @@ impl ChatMemberKind {
|
|||
/// - is the owner of the chat (even if the chat is not a channel)
|
||||
/// - is an administrator in the given chat and has the
|
||||
/// [`can_promote_members`] privilege.
|
||||
///
|
||||
/// Returns `false` otherwise.
|
||||
///
|
||||
/// [`can_promote_members`]: Administrator::can_promote_members
|
||||
|
|
|
@ -3,6 +3,9 @@ use serde::{Deserialize, Serialize};
|
|||
|
||||
use crate::types::{Chat, ChatInviteLink, ChatMember, User};
|
||||
|
||||
/// This object represents changes in the status of a chat member.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#chatmemberupdated).
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct ChatMemberUpdated {
|
||||
|
@ -20,6 +23,9 @@ pub struct ChatMemberUpdated {
|
|||
/// Chat invite link, which was used by the user to join the chat; for
|
||||
/// joining by invite link events only.
|
||||
pub invite_link: Option<ChatInviteLink>,
|
||||
#[serde(default)]
|
||||
/// True, if the user joined the chat via a chat folder invite link
|
||||
pub via_chat_folder_invite_link: bool,
|
||||
}
|
||||
|
||||
impl ChatMemberUpdated {
|
||||
|
|
|
@ -30,84 +30,67 @@ bitflags::bitflags! {
|
|||
/// assert!(permissions_v1.contains(ChatPermissions::INVITE_USERS));
|
||||
/// assert!(permissions_v1.contains(ChatPermissions::SEND_VIDEOS));
|
||||
///
|
||||
/// // Implied by `SEND_VIDEOS`
|
||||
/// assert!(permissions_v1.contains(ChatPermissions::SEND_MESSAGES));
|
||||
///
|
||||
/// // Difference, remove permissions
|
||||
/// let permissions_v2 = permissions_v1 - ChatPermissions::SEND_VIDEOS;
|
||||
/// assert!(!permissions_v2.contains(ChatPermissions::SEND_VIDEOS));
|
||||
///
|
||||
/// // Removing `SEND_VIDEOS` also removes `SEND_MESSAGES` and vice versa
|
||||
/// // because `SEND_MESSAGES` is implied by `SEND_VIDEOS`
|
||||
/// assert!(!permissions_v2.contains(ChatPermissions::SEND_MESSAGES));
|
||||
///
|
||||
/// let permissions_v3 = permissions_v1 - ChatPermissions::SEND_MESSAGES;
|
||||
/// assert!(!permissions_v3.contains(ChatPermissions::SEND_VIDEOS));
|
||||
/// ```
|
||||
#[derive(Serialize, Deserialize)]
|
||||
#[serde(from = "ChatPermissionsRaw", into = "ChatPermissionsRaw")]
|
||||
pub struct ChatPermissions: u16 {
|
||||
/// Set if the user is allowed to send text messages, contacts,
|
||||
/// locations and venues.
|
||||
/// giveaways, giveaway winners, invoices, locations and venues
|
||||
const SEND_MESSAGES = 1;
|
||||
|
||||
/// Set if the user is allowed to send polls, implies
|
||||
/// `SEND_MESSAGES`.
|
||||
const SEND_POLLS = (1 << 2) | Self::SEND_MESSAGES.bits;
|
||||
/// Set if the user is allowed to send polls
|
||||
const SEND_POLLS = 1 << 1;
|
||||
|
||||
/// Set if the user is allowed to send animations, games, stickers and
|
||||
/// use inline bots, implies `SEND_MEDIA_MESSAGES`.
|
||||
const SEND_OTHER_MESSAGES = (1 << 3);
|
||||
/// use inline bots.
|
||||
const SEND_OTHER_MESSAGES = 1 << 2;
|
||||
|
||||
/// Set if the user is allowed to add web page previews to
|
||||
/// their messages, implies `SEND_MEDIA_MESSAGES`.
|
||||
const ADD_WEB_PAGE_PREVIEWS = (1 << 4);
|
||||
/// their messages.
|
||||
const ADD_WEB_PAGE_PREVIEWS = 1 << 3;
|
||||
|
||||
/// Set if the user is allowed to change the chat title, photo and
|
||||
/// other settings. Ignored in public supergroups.
|
||||
const CHANGE_INFO = (1 << 5);
|
||||
const CHANGE_INFO = 1 << 4;
|
||||
|
||||
/// Set if the user is allowed to invite new users to the chat.
|
||||
const INVITE_USERS = (1 << 6);
|
||||
const INVITE_USERS = 1 << 5;
|
||||
|
||||
/// Set if the user is allowed to pin messages. Ignored in public
|
||||
/// supergroups.
|
||||
const PIN_MESSAGES = (1 << 7);
|
||||
const PIN_MESSAGES = 1 << 6;
|
||||
|
||||
/// Set if the user is allowed to create, rename, close, and reopen forum topics.
|
||||
const MANAGE_TOPICS = (1 << 8);
|
||||
const MANAGE_TOPICS = 1 << 7;
|
||||
|
||||
/// Set if the user is allowed to send audios. implies
|
||||
/// `SEND_MESSAGES`.
|
||||
const SEND_AUDIOS = (1 << 9) | Self::SEND_MESSAGES.bits;
|
||||
/// Set if the user is allowed to send audios.
|
||||
const SEND_AUDIOS = 1 << 8;
|
||||
|
||||
/// Set if the user is allowed to send documents. implies
|
||||
/// `SEND_MESSAGES`.
|
||||
const SEND_DOCUMENTS = (1 << 10) | Self::SEND_MESSAGES.bits;
|
||||
/// Set if the user is allowed to send documents.
|
||||
const SEND_DOCUMENTS = 1 << 9;
|
||||
|
||||
/// Set if the user is allowed to send photos. implies
|
||||
/// `SEND_MESSAGES`.
|
||||
const SEND_PHOTOS = (1 << 11) | Self::SEND_MESSAGES.bits;
|
||||
/// Set if the user is allowed to send photos.
|
||||
const SEND_PHOTOS = 1 << 10;
|
||||
|
||||
/// Set if the user is allowed to send videos. implies
|
||||
/// `SEND_MESSAGES`.
|
||||
const SEND_VIDEOS = (1 << 12) | Self::SEND_MESSAGES.bits;
|
||||
/// Set if the user is allowed to send videos.
|
||||
const SEND_VIDEOS = 1 << 11;
|
||||
|
||||
/// Set if the user is allowed to send video notes. implies
|
||||
/// `SEND_MESSAGES`.
|
||||
const SEND_VIDEO_NOTES = (1 << 13) | Self::SEND_MESSAGES.bits;
|
||||
/// Set if the user is allowed to send video notes.
|
||||
const SEND_VIDEO_NOTES = 1 << 12;
|
||||
|
||||
/// Set if the user is allowed to send voice notes. implies
|
||||
/// `SEND_MESSAGES`.
|
||||
const SEND_VOICE_NOTES = (1 << 14) | Self::SEND_MESSAGES.bits;
|
||||
const SEND_VOICE_NOTES = 1 << 13;
|
||||
|
||||
/// Set if the user is allowed to send audios, documents,
|
||||
/// photos, videos, video notes and voice notes, implies
|
||||
/// `SEND_MESSAGES`, `SEND_AUDIOS`, `SEND_DOCUMENTS`,
|
||||
/// `SEND_PHOTOS`, `SEND_VIDEOS`, `SEND_VIDEO_NOTES` and `SEND_VOICE_NOTES`.
|
||||
/// `SEND_AUDIOS`, `SEND_DOCUMENTS`, `SEND_PHOTOS`,
|
||||
/// `SEND_VIDEOS`, `SEND_VIDEO_NOTES` and `SEND_VOICE_NOTES`.
|
||||
/// Note: this is not a separate permission on it's own, this is just a alias for all the permissions mentioned.
|
||||
const SEND_MEDIA_MESSAGES = Self::SEND_MESSAGES.bits
|
||||
| Self::SEND_AUDIOS.bits
|
||||
const SEND_MEDIA_MESSAGES = Self::SEND_AUDIOS.bits
|
||||
| Self::SEND_DOCUMENTS.bits
|
||||
| Self::SEND_PHOTOS.bits
|
||||
| Self::SEND_VIDEOS.bits
|
||||
|
@ -278,12 +261,12 @@ impl From<ChatPermissions> for ChatPermissionsRaw {
|
|||
fn from(this: ChatPermissions) -> Self {
|
||||
Self {
|
||||
can_send_messages: this.can_send_messages(),
|
||||
can_send_audios: this.contains(ChatPermissions::SEND_AUDIOS),
|
||||
can_send_documents: this.contains(ChatPermissions::SEND_DOCUMENTS),
|
||||
can_send_photos: this.contains(ChatPermissions::SEND_PHOTOS),
|
||||
can_send_videos: this.contains(ChatPermissions::SEND_VIDEOS),
|
||||
can_send_video_notes: this.contains(ChatPermissions::SEND_VIDEO_NOTES),
|
||||
can_send_voice_notes: this.contains(ChatPermissions::SEND_VOICE_NOTES),
|
||||
can_send_audios: this.can_send_audios(),
|
||||
can_send_documents: this.can_send_documents(),
|
||||
can_send_photos: this.can_send_photos(),
|
||||
can_send_videos: this.can_send_videos(),
|
||||
can_send_video_notes: this.can_send_video_notes(),
|
||||
can_send_voice_notes: this.can_send_voice_notes(),
|
||||
can_send_polls: this.can_send_polls(),
|
||||
can_send_other_messages: this.can_send_other_messages(),
|
||||
can_add_web_page_previews: this.can_add_web_page_previews(),
|
||||
|
@ -370,7 +353,9 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn serialization() {
|
||||
let permissions = ChatPermissions::SEND_AUDIOS | ChatPermissions::PIN_MESSAGES;
|
||||
let permissions = ChatPermissions::SEND_MESSAGES
|
||||
| ChatPermissions::SEND_AUDIOS
|
||||
| ChatPermissions::PIN_MESSAGES;
|
||||
let expected = r#"{"can_send_messages":true,"can_send_audios":true,"can_pin_messages":true,"can_manage_topics":false}"#;
|
||||
let actual = serde_json::to_string(&permissions).unwrap();
|
||||
assert_eq!(expected, actual);
|
||||
|
@ -379,8 +364,20 @@ mod tests {
|
|||
#[test]
|
||||
fn deserialization() {
|
||||
let json = r#"{"can_send_messages":true,"can_send_photos":true,"can_pin_messages":true}"#;
|
||||
let expected = ChatPermissions::SEND_PHOTOS | ChatPermissions::PIN_MESSAGES;
|
||||
let expected = ChatPermissions::SEND_MESSAGES
|
||||
| ChatPermissions::SEND_PHOTOS
|
||||
| ChatPermissions::PIN_MESSAGES;
|
||||
let actual = serde_json::from_str(json).unwrap();
|
||||
assert_eq!(expected, actual);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn modfiy_permission() {
|
||||
let before = ChatPermissions::SEND_MESSAGES
|
||||
| ChatPermissions::SEND_PHOTOS
|
||||
| ChatPermissions::SEND_AUDIOS;
|
||||
let after = before - ChatPermissions::SEND_MESSAGES;
|
||||
let expected = ChatPermissions::SEND_PHOTOS | ChatPermissions::SEND_AUDIOS;
|
||||
assert_eq!(after, expected);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ pub struct Document {
|
|||
pub file: FileMeta,
|
||||
|
||||
/// A document thumbnail as defined by a sender.
|
||||
pub thumb: Option<PhotoSize>,
|
||||
pub thumbnail: Option<PhotoSize>,
|
||||
|
||||
/// An original filename as defined by a sender.
|
||||
pub file_name: Option<String>,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use crate::types::{CallbackGame, LoginUrl, True, WebAppInfo};
|
||||
use crate::types::{CallbackGame, LoginUrl, SwitchInlineQueryChosenChat, True, WebAppInfo};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// This object represents one button of an inline keyboard.
|
||||
|
@ -71,6 +71,11 @@ pub enum InlineKeyboardButtonKind {
|
|||
/// the same chat – good for selecting something from multiple options.
|
||||
SwitchInlineQueryCurrentChat(String),
|
||||
|
||||
/// If set, pressing the button will prompt the user to select one of their
|
||||
/// chats of the specified type, open that chat and insert the bot's
|
||||
/// username and the specified inline query in the input field
|
||||
SwitchInlineQueryChosenChat(SwitchInlineQueryChosenChat),
|
||||
|
||||
/// Description of the game that will be launched when the user presses the
|
||||
/// button.
|
||||
///
|
||||
|
|
|
@ -426,9 +426,9 @@ mod tests {
|
|||
description: None,
|
||||
reply_markup: None,
|
||||
input_message_content: None,
|
||||
thumb_url: None,
|
||||
thumb_width: None,
|
||||
thumb_height: None,
|
||||
thumbnail_url: None,
|
||||
thumbnail_width: None,
|
||||
thumbnail_height: None,
|
||||
});
|
||||
|
||||
let expected_json = r#"{"type":"document","id":"id","title":"title","document_url":"http://document_url/","mime_type":"application/pdf"}"#;
|
||||
|
@ -456,12 +456,12 @@ mod tests {
|
|||
disable_web_page_preview: Some(true),
|
||||
entities: None,
|
||||
})),
|
||||
thumb_url: Some(reqwest::Url::parse("http://thumb_url/").unwrap()),
|
||||
thumb_width: Some(1),
|
||||
thumb_height: Some(1),
|
||||
thumbnail_url: Some(reqwest::Url::parse("http://thumb_url/").unwrap()),
|
||||
thumbnail_width: Some(1),
|
||||
thumbnail_height: Some(1),
|
||||
});
|
||||
|
||||
let expected_json = r#"{"type":"document","id":"id","title":"title","caption":"caption","parse_mode":"HTML","document_url":"http://document_url/","mime_type":"application/pdf","description":"description","reply_markup":{"inline_keyboard":[]},"input_message_content":{"message_text":"message_text","parse_mode":"MarkdownV2","disable_web_page_preview":true},"thumb_url":"http://thumb_url/","thumb_width":1,"thumb_height":1}"#;
|
||||
let expected_json = r#"{"type":"document","id":"id","title":"title","caption":"caption","parse_mode":"HTML","document_url":"http://document_url/","mime_type":"application/pdf","description":"description","reply_markup":{"inline_keyboard":[]},"input_message_content":{"message_text":"message_text","parse_mode":"MarkdownV2","disable_web_page_preview":true},"thumbnail_url":"http://thumb_url/","thumbnail_width":1,"thumbnail_height":1}"#;
|
||||
let actual_json = serde_json::to_string(&structure).unwrap();
|
||||
|
||||
assert_eq!(expected_json, actual_json);
|
||||
|
@ -521,7 +521,8 @@ mod tests {
|
|||
gif_width: None,
|
||||
gif_height: None,
|
||||
gif_duration: None,
|
||||
thumb_url: Url::parse("http://thumb_url/").unwrap(),
|
||||
thumbnail_url: Url::parse("http://thumb_url/").unwrap(),
|
||||
thumbnail_mime_type: None,
|
||||
title: None,
|
||||
caption: None,
|
||||
parse_mode: None,
|
||||
|
@ -530,7 +531,7 @@ mod tests {
|
|||
input_message_content: None,
|
||||
});
|
||||
|
||||
let expected_json = r#"{"type":"gif","id":"id","gif_url":"http://gif_url/","thumb_url":"http://thumb_url/"}"#;
|
||||
let expected_json = r#"{"type":"gif","id":"id","gif_url":"http://gif_url/","thumbnail_url":"http://thumb_url/"}"#;
|
||||
let actual_json = serde_json::to_string(&structure).unwrap();
|
||||
|
||||
assert_eq!(expected_json, actual_json);
|
||||
|
@ -545,7 +546,8 @@ mod tests {
|
|||
gif_width: Some(1),
|
||||
gif_height: Some(1),
|
||||
gif_duration: Some(Seconds::from_seconds(1)),
|
||||
thumb_url: Url::parse("http://thumb_url/").unwrap(),
|
||||
thumbnail_url: Url::parse("http://thumb_url/").unwrap(),
|
||||
thumbnail_mime_type: None,
|
||||
title: Some(String::from("title")),
|
||||
caption: Some(String::from("caption")),
|
||||
parse_mode: Some(ParseMode::Html),
|
||||
|
@ -559,7 +561,7 @@ mod tests {
|
|||
})),
|
||||
});
|
||||
|
||||
let expected_json = r#"{"type":"gif","id":"id","gif_url":"http://gif_url/","gif_width":1,"gif_height":1,"gif_duration":1,"thumb_url":"http://thumb_url/","title":"title","caption":"caption","parse_mode":"HTML","reply_markup":{"inline_keyboard":[]},"input_message_content":{"message_text":"message_text","parse_mode":"MarkdownV2","disable_web_page_preview":true}}"#;
|
||||
let expected_json = r#"{"type":"gif","id":"id","gif_url":"http://gif_url/","gif_width":1,"gif_height":1,"gif_duration":1,"thumbnail_url":"http://thumb_url/","title":"title","caption":"caption","parse_mode":"HTML","reply_markup":{"inline_keyboard":[]},"input_message_content":{"message_text":"message_text","parse_mode":"MarkdownV2","disable_web_page_preview":true}}"#;
|
||||
let actual_json = serde_json::to_string(&structure).unwrap();
|
||||
|
||||
assert_eq!(expected_json, actual_json);
|
||||
|
@ -619,7 +621,8 @@ mod tests {
|
|||
mpeg4_width: None,
|
||||
mpeg4_height: None,
|
||||
mpeg4_duration: None,
|
||||
thumb_url: Url::parse("http://thumb_url/").unwrap(),
|
||||
thumbnail_url: Url::parse("http://thumb_url/").unwrap(),
|
||||
thumbnail_mime_type: None,
|
||||
title: None,
|
||||
caption: None,
|
||||
parse_mode: None,
|
||||
|
@ -628,7 +631,7 @@ mod tests {
|
|||
input_message_content: None,
|
||||
});
|
||||
|
||||
let expected_json = r#"{"type":"mpeg4_gif","id":"id","mpeg4_url":"http://mpeg4_url/","thumb_url":"http://thumb_url/"}"#;
|
||||
let expected_json = r#"{"type":"mpeg4_gif","id":"id","mpeg4_url":"http://mpeg4_url/","thumbnail_url":"http://thumb_url/"}"#;
|
||||
let actual_json = serde_json::to_string(&structure).unwrap();
|
||||
|
||||
assert_eq!(expected_json, actual_json);
|
||||
|
@ -643,7 +646,8 @@ mod tests {
|
|||
mpeg4_width: Some(1),
|
||||
mpeg4_height: Some(1),
|
||||
mpeg4_duration: Some(Seconds::from_seconds(1)),
|
||||
thumb_url: Url::parse("http://thumb_url/").unwrap(),
|
||||
thumbnail_url: Url::parse("http://thumb_url/").unwrap(),
|
||||
thumbnail_mime_type: None,
|
||||
title: Some(String::from("title")),
|
||||
caption: Some(String::from("caption")),
|
||||
parse_mode: Some(ParseMode::Html),
|
||||
|
@ -657,7 +661,7 @@ mod tests {
|
|||
})),
|
||||
});
|
||||
|
||||
let expected_json = r#"{"type":"mpeg4_gif","id":"id","mpeg4_url":"http://mpeg4_url/","mpeg4_width":1,"mpeg4_height":1,"mpeg4_duration":1,"thumb_url":"http://thumb_url/","title":"title","caption":"caption","parse_mode":"HTML","reply_markup":{"inline_keyboard":[]},"input_message_content":{"message_text":"message_text","parse_mode":"MarkdownV2","disable_web_page_preview":true}}"#;
|
||||
let expected_json = r#"{"type":"mpeg4_gif","id":"id","mpeg4_url":"http://mpeg4_url/","mpeg4_width":1,"mpeg4_height":1,"mpeg4_duration":1,"thumbnail_url":"http://thumb_url/","title":"title","caption":"caption","parse_mode":"HTML","reply_markup":{"inline_keyboard":[]},"input_message_content":{"message_text":"message_text","parse_mode":"MarkdownV2","disable_web_page_preview":true}}"#;
|
||||
let actual_json = serde_json::to_string(&structure).unwrap();
|
||||
|
||||
assert_eq!(expected_json, actual_json);
|
||||
|
@ -716,7 +720,7 @@ mod tests {
|
|||
let structure = InlineQueryResult::Photo(InlineQueryResultPhoto {
|
||||
id: String::from("id"),
|
||||
photo_url: Url::parse("http://photo_url/").unwrap(),
|
||||
thumb_url: Url::parse("http://thumb_url/").unwrap(),
|
||||
thumbnail_url: Url::parse("http://thumb_url/").unwrap(),
|
||||
photo_width: None,
|
||||
photo_height: None,
|
||||
title: None,
|
||||
|
@ -728,7 +732,7 @@ mod tests {
|
|||
input_message_content: None,
|
||||
});
|
||||
|
||||
let expected_json = r#"{"type":"photo","id":"id","photo_url":"http://photo_url/","thumb_url":"http://thumb_url/"}"#;
|
||||
let expected_json = r#"{"type":"photo","id":"id","photo_url":"http://photo_url/","thumbnail_url":"http://thumb_url/"}"#;
|
||||
let actual_json = serde_json::to_string(&structure).unwrap();
|
||||
|
||||
assert_eq!(expected_json, actual_json);
|
||||
|
@ -740,7 +744,7 @@ mod tests {
|
|||
let structure = InlineQueryResult::Photo(InlineQueryResultPhoto {
|
||||
id: String::from("id"),
|
||||
photo_url: Url::parse("http://photo_url/").unwrap(),
|
||||
thumb_url: Url::parse("http://thumb_url/").unwrap(),
|
||||
thumbnail_url: Url::parse("http://thumb_url/").unwrap(),
|
||||
photo_width: Some(1),
|
||||
photo_height: Some(1),
|
||||
title: Some(String::from("title")),
|
||||
|
@ -757,7 +761,7 @@ mod tests {
|
|||
})),
|
||||
});
|
||||
|
||||
let expected_json = r#"{"type":"photo","id":"id","photo_url":"http://photo_url/","thumb_url":"http://thumb_url/","photo_width":1,"photo_height":1,"title":"title","description":"description","caption":"caption","parse_mode":"HTML","reply_markup":{"inline_keyboard":[]},"input_message_content":{"message_text":"message_text","parse_mode":"MarkdownV2","disable_web_page_preview":true}}"#;
|
||||
let expected_json = r#"{"type":"photo","id":"id","photo_url":"http://photo_url/","thumbnail_url":"http://thumb_url/","photo_width":1,"photo_height":1,"title":"title","description":"description","caption":"caption","parse_mode":"HTML","reply_markup":{"inline_keyboard":[]},"input_message_content":{"message_text":"message_text","parse_mode":"MarkdownV2","disable_web_page_preview":true}}"#;
|
||||
let actual_json = serde_json::to_string(&structure).unwrap();
|
||||
|
||||
assert_eq!(expected_json, actual_json);
|
||||
|
@ -859,7 +863,7 @@ mod tests {
|
|||
id: String::from("id"),
|
||||
video_url: Url::parse("http://video_url/").unwrap(),
|
||||
mime_type: Mime::from_str("video/mp4").unwrap(),
|
||||
thumb_url: Url::parse("http://thumb_url/").unwrap(),
|
||||
thumbnail_url: Url::parse("http://thumb_url/").unwrap(),
|
||||
title: String::from("title"),
|
||||
caption: None,
|
||||
parse_mode: None,
|
||||
|
@ -872,7 +876,7 @@ mod tests {
|
|||
input_message_content: None,
|
||||
});
|
||||
|
||||
let expected_json = r#"{"type":"video","id":"id","video_url":"http://video_url/","mime_type":"video/mp4","thumb_url":"http://thumb_url/","title":"title"}"#;
|
||||
let expected_json = r#"{"type":"video","id":"id","video_url":"http://video_url/","mime_type":"video/mp4","thumbnail_url":"http://thumb_url/","title":"title"}"#;
|
||||
let actual_json = serde_json::to_string(&structure).unwrap();
|
||||
|
||||
assert_eq!(expected_json, actual_json);
|
||||
|
@ -885,7 +889,7 @@ mod tests {
|
|||
id: String::from("id"),
|
||||
video_url: Url::parse("http://video_url/").unwrap(),
|
||||
mime_type: Mime::from_str("video/mp4").unwrap(),
|
||||
thumb_url: Url::parse("http://thumb_url/").unwrap(),
|
||||
thumbnail_url: Url::parse("http://thumb_url/").unwrap(),
|
||||
title: String::from("title"),
|
||||
caption: Some(String::from("caption")),
|
||||
parse_mode: Some(ParseMode::Html),
|
||||
|
@ -907,7 +911,7 @@ mod tests {
|
|||
)),
|
||||
});
|
||||
|
||||
let expected_json = r#"{"type":"video","id":"id","video_url":"http://video_url/","mime_type":"video/mp4","thumb_url":"http://thumb_url/","title":"title","caption":"caption","parse_mode":"HTML","video_width":1,"video_height":1,"video_duration":1,"description":"description","reply_markup":{"inline_keyboard":[]},"input_message_content":{"latitude":1.0,"longitude":1.0}}"#;
|
||||
let expected_json = r#"{"type":"video","id":"id","video_url":"http://video_url/","mime_type":"video/mp4","thumbnail_url":"http://thumb_url/","title":"title","caption":"caption","parse_mode":"HTML","video_width":1,"video_height":1,"video_duration":1,"description":"description","reply_markup":{"inline_keyboard":[]},"input_message_content":{"latitude":1.0,"longitude":1.0}}"#;
|
||||
let actual_json = serde_json::to_string(&structure).unwrap();
|
||||
|
||||
assert_eq!(expected_json, actual_json);
|
||||
|
@ -1031,9 +1035,9 @@ mod tests {
|
|||
url: None,
|
||||
hide_url: None,
|
||||
description: None,
|
||||
thumb_url: None,
|
||||
thumb_width: None,
|
||||
thumb_height: None,
|
||||
thumbnail_url: None,
|
||||
thumbnail_width: None,
|
||||
thumbnail_height: None,
|
||||
});
|
||||
|
||||
let expected_json = r#"{"type":"article","id":"id","title":"title","input_message_content":{"message_text":"message_text"}}"#;
|
||||
|
@ -1058,12 +1062,12 @@ mod tests {
|
|||
url: Some(Url::parse("http://url/").unwrap()),
|
||||
hide_url: Some(true),
|
||||
description: Some(String::from("description")),
|
||||
thumb_url: Some(Url::parse("http://thumb_url/").unwrap()),
|
||||
thumb_width: Some(1),
|
||||
thumb_height: Some(1),
|
||||
thumbnail_url: Some(Url::parse("http://thumb_url/").unwrap()),
|
||||
thumbnail_width: Some(1),
|
||||
thumbnail_height: Some(1),
|
||||
});
|
||||
|
||||
let expected_json = r#"{"type":"article","id":"id","title":"title","input_message_content":{"message_text":"message_text"},"reply_markup":{"inline_keyboard":[]},"url":"http://url/","hide_url":true,"description":"description","thumb_url":"http://thumb_url/","thumb_width":1,"thumb_height":1}"#;
|
||||
let expected_json = r#"{"type":"article","id":"id","title":"title","input_message_content":{"message_text":"message_text"},"reply_markup":{"inline_keyboard":[]},"url":"http://url/","hide_url":true,"description":"description","thumbnail_url":"http://thumb_url/","thumbnail_width":1,"thumbnail_height":1}"#;
|
||||
let actual_json = serde_json::to_string(&structure).unwrap();
|
||||
|
||||
assert_eq!(expected_json, actual_json);
|
||||
|
@ -1080,9 +1084,9 @@ mod tests {
|
|||
vcard: None,
|
||||
reply_markup: None,
|
||||
input_message_content: None,
|
||||
thumb_url: None,
|
||||
thumb_width: None,
|
||||
thumb_height: None,
|
||||
thumbnail_url: None,
|
||||
thumbnail_width: None,
|
||||
thumbnail_height: None,
|
||||
});
|
||||
|
||||
let expected_json = r#"{"type":"contact","id":"id","phone_number":"phone_number","first_name":"first_name"}"#;
|
||||
|
@ -1107,12 +1111,12 @@ mod tests {
|
|||
parse_mode: None,
|
||||
disable_web_page_preview: None,
|
||||
})),
|
||||
thumb_url: Some(Url::parse("http://thumb_url/").unwrap()),
|
||||
thumb_width: Some(1),
|
||||
thumb_height: Some(1),
|
||||
thumbnail_url: Some(Url::parse("http://thumb_url/").unwrap()),
|
||||
thumbnail_width: Some(1),
|
||||
thumbnail_height: Some(1),
|
||||
});
|
||||
|
||||
let expected_json = r#"{"type":"contact","id":"id","phone_number":"phone_number","first_name":"first_name","last_name":"last_name","vcard":"vcard","reply_markup":{"inline_keyboard":[]},"input_message_content":{"message_text":"message_text"},"thumb_url":"http://thumb_url/","thumb_width":1,"thumb_height":1}"#;
|
||||
let expected_json = r#"{"type":"contact","id":"id","phone_number":"phone_number","first_name":"first_name","last_name":"last_name","vcard":"vcard","reply_markup":{"inline_keyboard":[]},"input_message_content":{"message_text":"message_text"},"thumbnail_url":"http://thumb_url/","thumbnail_width":1,"thumbnail_height":1}"#;
|
||||
let actual_json = serde_json::to_string(&structure).unwrap();
|
||||
|
||||
assert_eq!(expected_json, actual_json);
|
||||
|
@ -1162,9 +1166,9 @@ mod tests {
|
|||
proximity_alert_radius: None,
|
||||
reply_markup: None,
|
||||
input_message_content: None,
|
||||
thumb_url: None,
|
||||
thumb_width: None,
|
||||
thumb_height: None,
|
||||
thumbnail_url: None,
|
||||
thumbnail_width: None,
|
||||
thumbnail_height: None,
|
||||
});
|
||||
|
||||
let expected_json =
|
||||
|
@ -1193,12 +1197,12 @@ mod tests {
|
|||
parse_mode: None,
|
||||
disable_web_page_preview: None,
|
||||
})),
|
||||
thumb_url: Some(Url::parse("http://thumb_url/").unwrap()),
|
||||
thumb_width: Some(1),
|
||||
thumb_height: Some(1),
|
||||
thumbnail_url: Some(Url::parse("http://thumb_url/").unwrap()),
|
||||
thumbnail_width: Some(1),
|
||||
thumbnail_height: Some(1),
|
||||
});
|
||||
|
||||
let expected_json = r#"{"type":"location","id":"id","latitude":1.0,"longitude":1.0,"title":"title","horizontal_accuracy":1.0,"live_period":1,"heading":1,"proximity_alert_radius":1,"reply_markup":{"inline_keyboard":[]},"input_message_content":{"message_text":"message_text"},"thumb_url":"http://thumb_url/","thumb_width":1,"thumb_height":1}"#;
|
||||
let expected_json = r#"{"type":"location","id":"id","latitude":1.0,"longitude":1.0,"title":"title","horizontal_accuracy":1.0,"live_period":1,"heading":1,"proximity_alert_radius":1,"reply_markup":{"inline_keyboard":[]},"input_message_content":{"message_text":"message_text"},"thumbnail_url":"http://thumb_url/","thumbnail_width":1,"thumbnail_height":1}"#;
|
||||
let actual_json = serde_json::to_string(&structure).unwrap();
|
||||
|
||||
assert_eq!(expected_json, actual_json);
|
||||
|
@ -1219,9 +1223,9 @@ mod tests {
|
|||
google_place_type: None,
|
||||
reply_markup: None,
|
||||
input_message_content: None,
|
||||
thumb_url: None,
|
||||
thumb_width: None,
|
||||
thumb_height: None,
|
||||
thumbnail_url: None,
|
||||
thumbnail_width: None,
|
||||
thumbnail_height: None,
|
||||
});
|
||||
|
||||
let expected_json = r#"{"type":"venue","id":"id","latitude":1.0,"longitude":1.0,"title":"title","address":"address"}"#;
|
||||
|
@ -1250,12 +1254,12 @@ mod tests {
|
|||
parse_mode: None,
|
||||
disable_web_page_preview: None,
|
||||
})),
|
||||
thumb_url: Some(Url::parse("http://thumb_url/").unwrap()),
|
||||
thumb_width: Some(1),
|
||||
thumb_height: Some(1),
|
||||
thumbnail_url: Some(Url::parse("http://thumb_url/").unwrap()),
|
||||
thumbnail_width: Some(1),
|
||||
thumbnail_height: Some(1),
|
||||
});
|
||||
|
||||
let expected_json = r#"{"type":"venue","id":"id","latitude":1.0,"longitude":1.0,"title":"title","address":"address","foursquare_id":"foursquare_id","foursquare_type":"foursquare_type","google_place_id":"google_place_id","google_place_type":"google_place_type","reply_markup":{"inline_keyboard":[]},"input_message_content":{"message_text":"message_text"},"thumb_url":"http://thumb_url/","thumb_width":1,"thumb_height":1}"#;
|
||||
let expected_json = r#"{"type":"venue","id":"id","latitude":1.0,"longitude":1.0,"title":"title","address":"address","foursquare_id":"foursquare_id","foursquare_type":"foursquare_type","google_place_id":"google_place_id","google_place_type":"google_place_type","reply_markup":{"inline_keyboard":[]},"input_message_content":{"message_text":"message_text"},"thumbnail_url":"http://thumb_url/","thumbnail_width":1,"thumbnail_height":1}"#;
|
||||
let actual_json = serde_json::to_string(&structure).unwrap();
|
||||
|
||||
assert_eq!(expected_json, actual_json);
|
||||
|
|
|
@ -31,13 +31,13 @@ pub struct InlineQueryResultArticle {
|
|||
pub description: Option<String>,
|
||||
|
||||
/// Url of the thumbnail for the result.
|
||||
pub thumb_url: Option<reqwest::Url>,
|
||||
pub thumbnail_url: Option<reqwest::Url>,
|
||||
|
||||
/// Thumbnail width.
|
||||
pub thumb_width: Option<u32>,
|
||||
pub thumbnail_width: Option<u32>,
|
||||
|
||||
/// Thumbnail height.
|
||||
pub thumb_height: Option<u32>,
|
||||
pub thumbnail_height: Option<u32>,
|
||||
}
|
||||
|
||||
impl InlineQueryResultArticle {
|
||||
|
@ -54,9 +54,9 @@ impl InlineQueryResultArticle {
|
|||
url: None,
|
||||
hide_url: None,
|
||||
description: None,
|
||||
thumb_url: None,
|
||||
thumb_width: None,
|
||||
thumb_height: None,
|
||||
thumbnail_url: None,
|
||||
thumbnail_width: None,
|
||||
thumbnail_height: None,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -109,20 +109,20 @@ impl InlineQueryResultArticle {
|
|||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn thumb_url(mut self, val: reqwest::Url) -> Self {
|
||||
self.thumb_url = Some(val);
|
||||
pub fn thumbnail_url(mut self, val: reqwest::Url) -> Self {
|
||||
self.thumbnail_url = Some(val);
|
||||
self
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn thumb_width(mut self, val: u32) -> Self {
|
||||
self.thumb_width = Some(val);
|
||||
pub fn thumbnail_width(mut self, val: u32) -> Self {
|
||||
self.thumbnail_width = Some(val);
|
||||
self
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn thumb_height(mut self, val: u32) -> Self {
|
||||
self.thumb_height = Some(val);
|
||||
pub fn thumbnail_height(mut self, val: u32) -> Self {
|
||||
self.thumbnail_height = Some(val);
|
||||
self
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,13 +39,13 @@ pub struct InlineQueryResultContact {
|
|||
pub input_message_content: Option<InputMessageContent>,
|
||||
|
||||
/// Url of the thumbnail for the result.
|
||||
pub thumb_url: Option<reqwest::Url>,
|
||||
pub thumbnail_url: Option<reqwest::Url>,
|
||||
|
||||
/// Thumbnail width.
|
||||
pub thumb_width: Option<u32>,
|
||||
pub thumbnail_width: Option<u32>,
|
||||
|
||||
/// Thumbnail height.
|
||||
pub thumb_height: Option<u32>,
|
||||
pub thumbnail_height: Option<u32>,
|
||||
}
|
||||
|
||||
impl InlineQueryResultContact {
|
||||
|
@ -63,9 +63,9 @@ impl InlineQueryResultContact {
|
|||
vcard: None,
|
||||
reply_markup: None,
|
||||
input_message_content: None,
|
||||
thumb_url: None,
|
||||
thumb_width: None,
|
||||
thumb_height: None,
|
||||
thumbnail_url: None,
|
||||
thumbnail_width: None,
|
||||
thumbnail_height: None,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -122,20 +122,20 @@ impl InlineQueryResultContact {
|
|||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn thumb_url(mut self, val: reqwest::Url) -> Self {
|
||||
self.thumb_url = Some(val);
|
||||
pub fn thumbnail_url(mut self, val: reqwest::Url) -> Self {
|
||||
self.thumbnail_url = Some(val);
|
||||
self
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn thumb_width(mut self, val: u32) -> Self {
|
||||
self.thumb_width = Some(val);
|
||||
pub fn thumbnail_width(mut self, val: u32) -> Self {
|
||||
self.thumbnail_width = Some(val);
|
||||
self
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn thumb_height(mut self, val: u32) -> Self {
|
||||
self.thumb_height = Some(val);
|
||||
pub fn thumbnail_height(mut self, val: u32) -> Self {
|
||||
self.thumbnail_height = Some(val);
|
||||
self
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,13 +53,13 @@ pub struct InlineQueryResultDocument {
|
|||
pub input_message_content: Option<InputMessageContent>,
|
||||
|
||||
/// URL of the thumbnail (jpeg only) for the file.
|
||||
pub thumb_url: Option<reqwest::Url>,
|
||||
pub thumbnail_url: Option<reqwest::Url>,
|
||||
|
||||
/// Thumbnail width.
|
||||
pub thumb_width: Option<u32>,
|
||||
pub thumbnail_width: Option<u32>,
|
||||
|
||||
/// Thumbnail height.
|
||||
pub thumb_height: Option<u32>,
|
||||
pub thumbnail_height: Option<u32>,
|
||||
}
|
||||
|
||||
impl InlineQueryResultDocument {
|
||||
|
@ -134,20 +134,20 @@ impl InlineQueryResultDocument {
|
|||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn thumb_url(mut self, val: reqwest::Url) -> Self {
|
||||
self.thumb_url = Some(val);
|
||||
pub fn thumbnail_url(mut self, val: reqwest::Url) -> Self {
|
||||
self.thumbnail_url = Some(val);
|
||||
self
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn thumb_width(mut self, val: u32) -> Self {
|
||||
self.thumb_width = Some(val);
|
||||
pub fn thumbnail_width(mut self, val: u32) -> Self {
|
||||
self.thumbnail_width = Some(val);
|
||||
self
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn thumb_height(mut self, val: u32) -> Self {
|
||||
self.thumb_height = Some(val);
|
||||
pub fn thumbnail_height(mut self, val: u32) -> Self {
|
||||
self.thumbnail_height = Some(val);
|
||||
self
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,14 +21,20 @@ pub struct InlineQueryResultGif {
|
|||
/// Width of the GIF.
|
||||
pub gif_width: Option<u32>,
|
||||
|
||||
/// Height of the GIFv.
|
||||
/// Height of the GIF.
|
||||
pub gif_height: Option<u32>,
|
||||
|
||||
/// Duration of the GIF.
|
||||
pub gif_duration: Option<Seconds>,
|
||||
|
||||
/// URL of the static thumbnail for the result (jpeg or gif).
|
||||
pub thumb_url: reqwest::Url,
|
||||
/// URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the
|
||||
/// result
|
||||
pub thumbnail_url: reqwest::Url,
|
||||
|
||||
// FIXME: maybe make dedicated enum for the mime type?
|
||||
/// MIME type of the thumbnail, must be one of “image/jpeg”,
|
||||
/// “image/gif”, or “video/mp4”. Defaults to “image/jpeg”
|
||||
pub thumbnail_mime_type: Option<String>,
|
||||
|
||||
/// Title for the result.
|
||||
pub title: Option<String>,
|
||||
|
@ -58,7 +64,7 @@ pub struct InlineQueryResultGif {
|
|||
}
|
||||
|
||||
impl InlineQueryResultGif {
|
||||
pub fn new<S>(id: S, gif_url: reqwest::Url, thumb_url: reqwest::Url) -> Self
|
||||
pub fn new<S>(id: S, gif_url: reqwest::Url, thumbnail_url: reqwest::Url) -> Self
|
||||
where
|
||||
S: Into<String>,
|
||||
{
|
||||
|
@ -68,7 +74,8 @@ impl InlineQueryResultGif {
|
|||
gif_width: None,
|
||||
gif_height: None,
|
||||
gif_duration: None,
|
||||
thumb_url,
|
||||
thumbnail_url,
|
||||
thumbnail_mime_type: None,
|
||||
title: None,
|
||||
caption: None,
|
||||
parse_mode: None,
|
||||
|
@ -111,8 +118,8 @@ impl InlineQueryResultGif {
|
|||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn thumb_url(mut self, val: reqwest::Url) -> Self {
|
||||
self.thumb_url = val;
|
||||
pub fn thumbnail_url(mut self, val: reqwest::Url) -> Self {
|
||||
self.thumbnail_url = val;
|
||||
self
|
||||
}
|
||||
|
||||
|
|
|
@ -49,13 +49,13 @@ pub struct InlineQueryResultLocation {
|
|||
pub input_message_content: Option<InputMessageContent>,
|
||||
|
||||
/// Url of the thumbnail for the result.
|
||||
pub thumb_url: Option<reqwest::Url>,
|
||||
pub thumbnail_url: Option<reqwest::Url>,
|
||||
|
||||
/// Thumbnail width.
|
||||
pub thumb_width: Option<u32>,
|
||||
pub thumbnail_width: Option<u32>,
|
||||
|
||||
/// Thumbnail height.
|
||||
pub thumb_height: Option<u32>,
|
||||
pub thumbnail_height: Option<u32>,
|
||||
}
|
||||
|
||||
impl InlineQueryResultLocation {
|
||||
|
@ -72,9 +72,9 @@ impl InlineQueryResultLocation {
|
|||
live_period: None,
|
||||
reply_markup: None,
|
||||
input_message_content: None,
|
||||
thumb_url: None,
|
||||
thumb_width: None,
|
||||
thumb_height: None,
|
||||
thumbnail_url: None,
|
||||
thumbnail_width: None,
|
||||
thumbnail_height: None,
|
||||
horizontal_accuracy: None,
|
||||
heading: None,
|
||||
proximity_alert_radius: None,
|
||||
|
@ -146,20 +146,20 @@ impl InlineQueryResultLocation {
|
|||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn thumb_url(mut self, val: reqwest::Url) -> Self {
|
||||
self.thumb_url = Some(val);
|
||||
pub fn thumbnail_url(mut self, val: reqwest::Url) -> Self {
|
||||
self.thumbnail_url = Some(val);
|
||||
self
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn thumb_width(mut self, val: u32) -> Self {
|
||||
self.thumb_width = Some(val);
|
||||
pub fn thumbnail_width(mut self, val: u32) -> Self {
|
||||
self.thumbnail_width = Some(val);
|
||||
self
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn thumb_height(mut self, val: u32) -> Self {
|
||||
self.thumb_height = Some(val);
|
||||
pub fn thumbnail_height(mut self, val: u32) -> Self {
|
||||
self.thumbnail_height = Some(val);
|
||||
self
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,8 +30,14 @@ pub struct InlineQueryResultMpeg4Gif {
|
|||
/// Video duration.
|
||||
pub mpeg4_duration: Option<Seconds>,
|
||||
|
||||
/// URL of the static thumbnail (jpeg or gif) for the result.
|
||||
pub thumb_url: reqwest::Url,
|
||||
/// URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the
|
||||
/// result
|
||||
pub thumbnail_url: reqwest::Url,
|
||||
|
||||
// FIXME: maybe make dedicated enum for the mime type?
|
||||
/// MIME type of the thumbnail, must be one of “image/jpeg”, “image/gif”, or
|
||||
/// “video/mp4”. Defaults to “image/jpeg”
|
||||
pub thumbnail_mime_type: Option<String>,
|
||||
|
||||
/// Title for the result.
|
||||
pub title: Option<String>,
|
||||
|
@ -61,14 +67,15 @@ pub struct InlineQueryResultMpeg4Gif {
|
|||
}
|
||||
|
||||
impl InlineQueryResultMpeg4Gif {
|
||||
pub fn new<S>(id: S, mpeg4_url: reqwest::Url, thumb_url: reqwest::Url) -> Self
|
||||
pub fn new<S>(id: S, mpeg4_url: reqwest::Url, thumbnail_url: reqwest::Url) -> Self
|
||||
where
|
||||
S: Into<String>,
|
||||
{
|
||||
Self {
|
||||
id: id.into(),
|
||||
mpeg4_url,
|
||||
thumb_url,
|
||||
thumbnail_url,
|
||||
thumbnail_mime_type: None,
|
||||
mpeg4_width: None,
|
||||
mpeg4_height: None,
|
||||
mpeg4_duration: None,
|
||||
|
@ -114,8 +121,8 @@ impl InlineQueryResultMpeg4Gif {
|
|||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn thumb_url(mut self, val: reqwest::Url) -> Self {
|
||||
self.thumb_url = val;
|
||||
pub fn thumbnail_url(mut self, val: reqwest::Url) -> Self {
|
||||
self.thumbnail_url = val;
|
||||
self
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ pub struct InlineQueryResultPhoto {
|
|||
pub photo_url: reqwest::Url,
|
||||
|
||||
/// URL of the thumbnail for the photo.
|
||||
pub thumb_url: reqwest::Url,
|
||||
pub thumbnail_url: reqwest::Url,
|
||||
|
||||
/// Width of the photo.
|
||||
pub photo_width: Option<u32>,
|
||||
|
@ -59,14 +59,14 @@ pub struct InlineQueryResultPhoto {
|
|||
}
|
||||
|
||||
impl InlineQueryResultPhoto {
|
||||
pub fn new<S>(id: S, photo_url: reqwest::Url, thumb_url: reqwest::Url) -> Self
|
||||
pub fn new<S>(id: S, photo_url: reqwest::Url, thumbnail_url: reqwest::Url) -> Self
|
||||
where
|
||||
S: Into<String>,
|
||||
{
|
||||
Self {
|
||||
id: id.into(),
|
||||
photo_url,
|
||||
thumb_url,
|
||||
thumbnail_url,
|
||||
photo_width: None,
|
||||
photo_height: None,
|
||||
title: None,
|
||||
|
@ -94,8 +94,8 @@ impl InlineQueryResultPhoto {
|
|||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn thumb_url<S>(mut self, val: reqwest::Url) -> Self {
|
||||
self.thumb_url = val;
|
||||
pub fn thumbnail_url<S>(mut self, val: reqwest::Url) -> Self {
|
||||
self.thumbnail_url = val;
|
||||
self
|
||||
}
|
||||
|
||||
|
|
|
@ -52,13 +52,13 @@ pub struct InlineQueryResultVenue {
|
|||
pub input_message_content: Option<InputMessageContent>,
|
||||
|
||||
/// Url of the thumbnail for the result.
|
||||
pub thumb_url: Option<reqwest::Url>,
|
||||
pub thumbnail_url: Option<reqwest::Url>,
|
||||
|
||||
/// Thumbnail width.
|
||||
pub thumb_width: Option<u32>,
|
||||
pub thumbnail_width: Option<u32>,
|
||||
|
||||
/// Thumbnail height.
|
||||
pub thumb_height: Option<u32>,
|
||||
pub thumbnail_height: Option<u32>,
|
||||
}
|
||||
|
||||
impl InlineQueryResultVenue {
|
||||
|
@ -80,9 +80,9 @@ impl InlineQueryResultVenue {
|
|||
google_place_type: None,
|
||||
reply_markup: None,
|
||||
input_message_content: None,
|
||||
thumb_url: None,
|
||||
thumb_width: None,
|
||||
thumb_height: None,
|
||||
thumbnail_url: None,
|
||||
thumbnail_width: None,
|
||||
thumbnail_height: None,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -167,20 +167,20 @@ impl InlineQueryResultVenue {
|
|||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn thumb_url(mut self, val: reqwest::Url) -> Self {
|
||||
self.thumb_url = Some(val);
|
||||
pub fn thumbnail_url(mut self, val: reqwest::Url) -> Self {
|
||||
self.thumbnail_url = Some(val);
|
||||
self
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn thumb_width(mut self, val: u32) -> Self {
|
||||
self.thumb_width = Some(val);
|
||||
pub fn thumbnail_width(mut self, val: u32) -> Self {
|
||||
self.thumbnail_width = Some(val);
|
||||
self
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn thumb_height(mut self, val: u32) -> Self {
|
||||
self.thumb_height = Some(val);
|
||||
pub fn thumbnail_height(mut self, val: u32) -> Self {
|
||||
self.thumbnail_height = Some(val);
|
||||
self
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ pub struct InlineQueryResultVideo {
|
|||
pub mime_type: Mime,
|
||||
|
||||
/// URL of the thumbnail (jpeg only) for the video.
|
||||
pub thumb_url: reqwest::Url,
|
||||
pub thumbnail_url: reqwest::Url,
|
||||
|
||||
/// Title for the result.
|
||||
pub title: String,
|
||||
|
@ -76,7 +76,7 @@ impl InlineQueryResultVideo {
|
|||
id: S1,
|
||||
video_url: reqwest::Url,
|
||||
mime_type: Mime,
|
||||
thumb_url: reqwest::Url,
|
||||
thumbnail_url: reqwest::Url,
|
||||
title: S2,
|
||||
) -> Self
|
||||
where
|
||||
|
@ -87,7 +87,7 @@ impl InlineQueryResultVideo {
|
|||
id: id.into(),
|
||||
video_url,
|
||||
mime_type,
|
||||
thumb_url,
|
||||
thumbnail_url,
|
||||
title: title.into(),
|
||||
caption: None,
|
||||
parse_mode: None,
|
||||
|
@ -122,8 +122,8 @@ impl InlineQueryResultVideo {
|
|||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn thumb_url(mut self, val: reqwest::Url) -> Self {
|
||||
self.thumb_url = val;
|
||||
pub fn thumbnail_url(mut self, val: reqwest::Url) -> Self {
|
||||
self.thumbnail_url = val;
|
||||
self
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::types::WebAppInfo;
|
||||
|
||||
/// This object represents a button to be shown above inline query results. You
|
||||
/// must use exactly one of the optional fields.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultsbutton)
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
|
||||
pub struct InlineQueryResultsButton {
|
||||
/// Label text on the button
|
||||
pub text: String,
|
||||
|
||||
#[serde(flatten)]
|
||||
pub kind: InlineQueryResultsButtonKind,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
|
||||
pub enum InlineQueryResultsButtonKind {
|
||||
/// Description of the [Web App] that will be launched when the user presses
|
||||
/// the button. The Web App will be able to switch back to the inline mode
|
||||
/// using the method [switchInlineQuery] inside the Web App.
|
||||
///
|
||||
/// [Web App]: https://core.telegram.org/bots/webapps
|
||||
/// [switchInlineQuery]: https://core.telegram.org/bots/webapps#initializing-mini-apps
|
||||
WebApp(WebAppInfo),
|
||||
|
||||
/// [Deep-linking] parameter for the /start message sent to the bot when a
|
||||
/// user presses the button. 1-64 characters, only `A-Z`, `a-z`, `0-9`, `_`
|
||||
/// and `-` are allowed.
|
||||
///
|
||||
/// Example: An inline bot that sends YouTube videos can
|
||||
/// ask the user to connect the bot to their YouTube account to adapt search
|
||||
/// results accordingly. To do this, it displays a 'Connect your YouTube
|
||||
/// account' button above the results, or even before showing any. The user
|
||||
/// presses the button, switches to a private chat with the bot and, in
|
||||
/// doing so, passes a start parameter that instructs the bot to return an
|
||||
/// OAuth link. Once done, the bot can offer a [switch_inline] button so
|
||||
/// that the user can easily return to the chat where they wanted to use
|
||||
/// the bot's inline capabilities.
|
||||
///
|
||||
/// [Deep-linking]: https://core.telegram.org/bots/features#deep-linking
|
||||
/// [switch_inline]: https://core.telegram.org/bots/api#inlinekeyboardmarkup
|
||||
StartParameter(String),
|
||||
}
|
|
@ -418,14 +418,10 @@ impl InputFileLike for Option<InputFile> {
|
|||
|
||||
impl InputFileLike for InputSticker {
|
||||
fn copy_into(&self, into: &mut dyn FnMut(InputFile)) {
|
||||
let (Self::Png(input_file) | Self::Tgs(input_file) | Self::Webm(input_file)) = self;
|
||||
|
||||
input_file.copy_into(into)
|
||||
self.sticker.copy_into(into)
|
||||
}
|
||||
|
||||
fn move_into(&mut self, into: &mut dyn FnMut(InputFile)) {
|
||||
let (Self::Png(input_file) | Self::Tgs(input_file) | Self::Webm(input_file)) = self;
|
||||
|
||||
input_file.move_into(into)
|
||||
self.sticker.move_into(into)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ pub struct InputMediaVideo {
|
|||
/// JPEG format and less than 200 kB in size. A thumbnail‘s width and
|
||||
/// height should not exceed 320. Ignored if the file is not uploaded
|
||||
/// using multipart/form-data.
|
||||
pub thumb: Option<InputFile>,
|
||||
pub thumbnail: Option<InputFile>,
|
||||
|
||||
/// Caption of the video to be sent, 0-1024 characters.
|
||||
pub caption: Option<String>,
|
||||
|
@ -139,7 +139,7 @@ impl InputMediaVideo {
|
|||
pub const fn new(media: InputFile) -> Self {
|
||||
Self {
|
||||
media,
|
||||
thumb: None,
|
||||
thumbnail: None,
|
||||
caption: None,
|
||||
parse_mode: None,
|
||||
caption_entities: None,
|
||||
|
@ -156,8 +156,8 @@ impl InputMediaVideo {
|
|||
self
|
||||
}
|
||||
|
||||
pub fn thumb(mut self, val: InputFile) -> Self {
|
||||
self.thumb = Some(val);
|
||||
pub fn thumbnail(mut self, val: InputFile) -> Self {
|
||||
self.thumbnail = Some(val);
|
||||
self
|
||||
}
|
||||
|
||||
|
@ -226,7 +226,7 @@ pub struct InputMediaAnimation {
|
|||
/// JPEG format and less than 200 kB in size. A thumbnail‘s width and
|
||||
/// height should not exceed 320. Ignored if the file is not uploaded
|
||||
/// using multipart/form-data.
|
||||
pub thumb: Option<InputFile>,
|
||||
pub thumbnail: Option<InputFile>,
|
||||
|
||||
/// Caption of the animation to be sent, 0-1024 characters.
|
||||
pub caption: Option<String>,
|
||||
|
@ -262,7 +262,7 @@ impl InputMediaAnimation {
|
|||
pub const fn new(media: InputFile) -> Self {
|
||||
Self {
|
||||
media,
|
||||
thumb: None,
|
||||
thumbnail: None,
|
||||
caption: None,
|
||||
parse_mode: None,
|
||||
width: None,
|
||||
|
@ -278,8 +278,8 @@ impl InputMediaAnimation {
|
|||
self
|
||||
}
|
||||
|
||||
pub fn thumb(mut self, val: InputFile) -> Self {
|
||||
self.thumb = Some(val);
|
||||
pub fn thumbnail(mut self, val: InputFile) -> Self {
|
||||
self.thumbnail = Some(val);
|
||||
self
|
||||
}
|
||||
|
||||
|
@ -342,7 +342,7 @@ pub struct InputMediaAudio {
|
|||
/// JPEG format and less than 200 kB in size. A thumbnail‘s width and
|
||||
/// height should not exceed 320. Ignored if the file is not uploaded
|
||||
/// using multipart/form-data.
|
||||
pub thumb: Option<InputFile>,
|
||||
pub thumbnail: Option<InputFile>,
|
||||
|
||||
/// Caption of the audio to be sent, 0-1024 characters.
|
||||
pub caption: Option<String>,
|
||||
|
@ -373,7 +373,7 @@ impl InputMediaAudio {
|
|||
pub const fn new(media: InputFile) -> Self {
|
||||
Self {
|
||||
media,
|
||||
thumb: None,
|
||||
thumbnail: None,
|
||||
caption: None,
|
||||
parse_mode: None,
|
||||
performer: None,
|
||||
|
@ -388,8 +388,8 @@ impl InputMediaAudio {
|
|||
self
|
||||
}
|
||||
|
||||
pub fn thumb(mut self, val: InputFile) -> Self {
|
||||
self.thumb = Some(val);
|
||||
pub fn thumbnail(mut self, val: InputFile) -> Self {
|
||||
self.thumbnail = Some(val);
|
||||
self
|
||||
}
|
||||
|
||||
|
@ -450,7 +450,7 @@ pub struct InputMediaDocument {
|
|||
/// JPEG format and less than 200 kB in size. A thumbnail‘s width and
|
||||
/// height should not exceed 320. Ignored if the file is not uploaded
|
||||
/// using multipart/form-data.
|
||||
pub thumb: Option<InputFile>,
|
||||
pub thumbnail: Option<InputFile>,
|
||||
|
||||
/// Caption of the document to be sent, 0-1024 characters.
|
||||
pub caption: Option<String>,
|
||||
|
@ -477,7 +477,7 @@ impl InputMediaDocument {
|
|||
pub const fn new(media: InputFile) -> Self {
|
||||
Self {
|
||||
media,
|
||||
thumb: None,
|
||||
thumbnail: None,
|
||||
caption: None,
|
||||
parse_mode: None,
|
||||
disable_content_type_detection: None,
|
||||
|
@ -490,8 +490,8 @@ impl InputMediaDocument {
|
|||
self
|
||||
}
|
||||
|
||||
pub fn thumb(mut self, val: InputFile) -> Self {
|
||||
self.thumb = Some(val);
|
||||
pub fn thumbnail(mut self, val: InputFile) -> Self {
|
||||
self.thumbnail = Some(val);
|
||||
self
|
||||
}
|
||||
|
||||
|
@ -534,30 +534,30 @@ impl InputMedia {
|
|||
pub(crate) fn files(&self) -> impl Iterator<Item = &InputFile> {
|
||||
use InputMedia::*;
|
||||
|
||||
let (media, thumb) = match self {
|
||||
let (media, thumbnail) = match self {
|
||||
Photo(InputMediaPhoto { media, .. }) => (media, None),
|
||||
Document(InputMediaDocument { media, thumb, .. })
|
||||
| Audio(InputMediaAudio { media, thumb, .. })
|
||||
| Animation(InputMediaAnimation { media, thumb, .. })
|
||||
| Video(InputMediaVideo { media, thumb, .. }) => (media, thumb.as_ref()),
|
||||
Document(InputMediaDocument { media, thumbnail, .. })
|
||||
| Audio(InputMediaAudio { media, thumbnail, .. })
|
||||
| Animation(InputMediaAnimation { media, thumbnail, .. })
|
||||
| Video(InputMediaVideo { media, thumbnail, .. }) => (media, thumbnail.as_ref()),
|
||||
};
|
||||
|
||||
iter::once(media).chain(thumb)
|
||||
iter::once(media).chain(thumbnail)
|
||||
}
|
||||
|
||||
/// Returns an iterator of all files in this input media
|
||||
pub(crate) fn files_mut(&mut self) -> impl Iterator<Item = &mut InputFile> {
|
||||
use InputMedia::*;
|
||||
|
||||
let (media, thumb) = match self {
|
||||
let (media, thumbnail) = match self {
|
||||
Photo(InputMediaPhoto { media, .. }) => (media, None),
|
||||
Document(InputMediaDocument { media, thumb, .. })
|
||||
| Audio(InputMediaAudio { media, thumb, .. })
|
||||
| Animation(InputMediaAnimation { media, thumb, .. })
|
||||
| Video(InputMediaVideo { media, thumb, .. }) => (media, thumb.as_mut()),
|
||||
Document(InputMediaDocument { media, thumbnail, .. })
|
||||
| Audio(InputMediaAudio { media, thumbnail, .. })
|
||||
| Animation(InputMediaAnimation { media, thumbnail, .. })
|
||||
| Video(InputMediaVideo { media, thumbnail, .. }) => (media, thumbnail.as_mut()),
|
||||
};
|
||||
|
||||
iter::once(media).chain(thumb)
|
||||
iter::once(media).chain(thumbnail)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -585,7 +585,7 @@ mod tests {
|
|||
let expected_json = r#"{"type":"video","media":"123456"}"#;
|
||||
let video = InputMedia::Video(InputMediaVideo {
|
||||
media: InputFile::file_id("123456"),
|
||||
thumb: None,
|
||||
thumbnail: None,
|
||||
caption: None,
|
||||
parse_mode: None,
|
||||
width: None,
|
||||
|
@ -605,7 +605,7 @@ mod tests {
|
|||
let expected_json = r#"{"type":"animation","media":"123456"}"#;
|
||||
let video = InputMedia::Animation(InputMediaAnimation {
|
||||
media: InputFile::file_id("123456"),
|
||||
thumb: None,
|
||||
thumbnail: None,
|
||||
caption: None,
|
||||
parse_mode: None,
|
||||
width: None,
|
||||
|
@ -624,7 +624,7 @@ mod tests {
|
|||
let expected_json = r#"{"type":"audio","media":"123456"}"#;
|
||||
let video = InputMedia::Audio(InputMediaAudio {
|
||||
media: InputFile::file_id("123456"),
|
||||
thumb: None,
|
||||
thumbnail: None,
|
||||
caption: None,
|
||||
parse_mode: None,
|
||||
duration: None,
|
||||
|
@ -642,7 +642,7 @@ mod tests {
|
|||
let expected_json = r#"{"type":"document","media":"123456"}"#;
|
||||
let video = InputMedia::Document(InputMediaDocument {
|
||||
media: InputFile::file_id("123456"),
|
||||
thumb: None,
|
||||
thumbnail: None,
|
||||
caption: None,
|
||||
parse_mode: None,
|
||||
caption_entities: None,
|
||||
|
|
|
@ -1,39 +1,29 @@
|
|||
use serde::Serialize;
|
||||
|
||||
use crate::types::InputFile;
|
||||
use crate::types::{InputFile, MaskPosition};
|
||||
|
||||
/// Sticker file that may be uploaded to telegram.
|
||||
/// This object describes a sticker to be added to a sticker set.
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Clone, Debug, Serialize)]
|
||||
pub enum InputSticker {
|
||||
/// PNG image with the sticker, must be up to 512 kilobytes in size,
|
||||
/// dimensions must not exceed 512px, and either width or height must be
|
||||
/// exactly 512px.
|
||||
pub struct InputSticker {
|
||||
/// The added sticker. Pass a file_id as a String to send a file that
|
||||
/// already exists on the Telegram servers, pass an HTTP URL as a String
|
||||
/// for Telegram to get a file from the Internet, upload a new one using
|
||||
/// multipart/form-data, or pass “attach://<file_attach_name>” to upload a
|
||||
/// new one using multipart/form-data under <file_attach_name> name.
|
||||
/// Animated and video stickers can't be uploaded via HTTP URL.
|
||||
///
|
||||
/// Pass [`InputFile::file_id`] to send a file that exists on
|
||||
/// the Telegram servers (recommended), pass an [`InputFile::url`] for
|
||||
/// Telegram to get a .webp file from the Internet, or upload a new one
|
||||
/// using [`InputFile::file`], [`InputFile::memory`] or [`InputFile::read`].
|
||||
/// [More info on Sending Files »].
|
||||
///
|
||||
/// [`InputFile::file_id`]: InputFile::file_id
|
||||
/// [`InputFile::url`]: InputFile::url
|
||||
/// [`InputFile::file`]: InputFile::file
|
||||
/// [`InputFile::memory`]: InputFile::memory
|
||||
/// [`InputFile::read`]: InputFile::read
|
||||
///
|
||||
/// [More info on Sending Files »]: https://core.telegram.org/bots/api#sending-files
|
||||
#[serde(rename = "png_sticker")]
|
||||
Png(InputFile),
|
||||
/// More information on Sending Files <https://core.telegram.org/bots/api#sending-files>
|
||||
pub sticker: InputFile,
|
||||
|
||||
/// TGS animation with the sticker, uploaded using multipart/form-data.
|
||||
///
|
||||
/// See <https://core.telegram.org/animated_stickers#technical-requirements> for technical requirements.
|
||||
#[serde(rename = "tgs_sticker")]
|
||||
Tgs(InputFile),
|
||||
/// List of 1-20 emoji associated with the sticker
|
||||
pub emoji_list: Vec<String>,
|
||||
|
||||
/// WEBM video with the sticker, uploaded using multipart/form-data.
|
||||
///
|
||||
/// See <https://core.telegram.org/stickers#video-sticker-requirements> for technical requirements.
|
||||
#[serde(rename = "webm_sticker")]
|
||||
Webm(InputFile),
|
||||
/// Position where the mask should be placed on faces. For “mask” stickers
|
||||
/// only.
|
||||
pub mask_position: Option<MaskPosition>,
|
||||
|
||||
/// List of 0-20 search keywords for the sticker with total length of up to
|
||||
/// 64 characters. For “regular” and “custom_emoji” stickers only.
|
||||
pub keywords: Vec<String>,
|
||||
}
|
||||
|
|
|
@ -1009,17 +1009,16 @@ mod getters {
|
|||
#[must_use]
|
||||
pub fn caption(&self) -> Option<&str> {
|
||||
match &self.kind {
|
||||
Common(MessageCommon { media_kind, .. }) => match media_kind {
|
||||
MediaKind::Animation(MediaAnimation { caption, .. })
|
||||
| MediaKind::Audio(MediaAudio { caption, .. })
|
||||
| MediaKind::Document(MediaDocument { caption, .. })
|
||||
| MediaKind::Photo(MediaPhoto { caption, .. })
|
||||
| MediaKind::Video(MediaVideo { caption, .. })
|
||||
| MediaKind::Voice(MediaVoice { caption, .. }) => {
|
||||
caption.as_ref().map(Deref::deref)
|
||||
}
|
||||
_ => None,
|
||||
},
|
||||
Common(MessageCommon {
|
||||
media_kind:
|
||||
MediaKind::Animation(MediaAnimation { caption, .. })
|
||||
| MediaKind::Audio(MediaAudio { caption, .. })
|
||||
| MediaKind::Document(MediaDocument { caption, .. })
|
||||
| MediaKind::Photo(MediaPhoto { caption, .. })
|
||||
| MediaKind::Video(MediaVideo { caption, .. })
|
||||
| MediaKind::Voice(MediaVoice { caption, .. }),
|
||||
..
|
||||
}) => caption.as_ref().map(Deref::deref),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
@ -1708,7 +1707,7 @@ mod tests {
|
|||
"width": 512,
|
||||
"height": 640,
|
||||
"mime_type": "video/mp4",
|
||||
"thumb": {
|
||||
"thumbnail": {
|
||||
"file_id": "AAQCAAOmBAACBf2oS53pByA-I4CWWCObDwAEAQAHbQADMWcAAhYE",
|
||||
"file_unique_id":"",
|
||||
"file_size": 10339,
|
||||
|
@ -1800,7 +1799,7 @@ mod tests {
|
|||
"width": 512,
|
||||
"height": 640,
|
||||
"mime_type": "video/mp4",
|
||||
"thumb": {
|
||||
"thumbnail": {
|
||||
"file_id": "AAQCAAOmBAACBf2oS53pByA-I4CWWCObDwAEAQAHbQADMWcAAhYE",
|
||||
"file_unique_id":"",
|
||||
"file_size": 10339,
|
||||
|
@ -1870,7 +1869,7 @@ mod tests {
|
|||
"is_animated": true,
|
||||
"is_video": false,
|
||||
"type": "regular",
|
||||
"thumb": {
|
||||
"thumbnail": {
|
||||
"file_id": "AAMCAgADGQEAARIt0GMwiZ6n4nRbxdpM3pL8vPX6PVAhAAIjAAOw0PgMaabKAcaXKCABAAdtAAMpBA",
|
||||
"file_unique_id": "AQADIwADsND4DHI",
|
||||
"file_size": 4118,
|
||||
|
|
|
@ -47,6 +47,7 @@ use serde::{Deserialize, Serialize};
|
|||
/// *bold _italic bold ~italic bold strikethrough ||italic bold strikethrough spoiler||~ __underline italic bold___ bold*
|
||||
/// [inline URL](http://www.example.com/)
|
||||
/// [inline mention of a user](tg://user?id=123456789)
|
||||
/// ![👍](tg://emoji?id=5368324170671202286)
|
||||
/// `inline fixed-width code`
|
||||
/// ```
|
||||
/// pre-formatted fixed-width code block
|
||||
|
@ -72,6 +73,12 @@ use serde::{Deserialize, Serialize};
|
|||
/// `underline` entity, so instead of `___italic underline___` use `___italic
|
||||
/// underline_\r__`, where `\r` is a character with code `13`, which will be
|
||||
/// ignored.
|
||||
/// - A valid emoji must be provided as an alternative value for the custom
|
||||
/// emoji. The emoji will be shown instead of the custom emoji in places where
|
||||
/// a custom emoji cannot be displayed (e.g., system notifications) or if the
|
||||
/// message is forwarded by a non-premium user. It is recommended to use the
|
||||
/// emoji from the emoji field of the custom emoji [sticker](https://core.telegram.org/bots/api#sticker).
|
||||
/// - Custom emoji entities can only be used by bots that purchased additional usernames on [Fragment](https://fragment.com/).
|
||||
///
|
||||
/// ## HTML style
|
||||
///
|
||||
|
@ -86,6 +93,7 @@ use serde::{Deserialize, Serialize};
|
|||
/// <b>bold <i>italic bold <s>italic bold strikethrough <span class="tg-spoiler">italic bold strikethrough spoiler</span></s> <u>underline italic bold</u></i> bold</b>
|
||||
/// <a href="http://www.example.com/">inline URL</a>
|
||||
/// <a href="tg://user?id=123456789">inline mention of a user</a>
|
||||
/// <tg-emoji emoji-id="5368324170671202286">👍</tg-emoji>
|
||||
/// <code>inline fixed-width code</code>
|
||||
/// <pre>pre-formatted fixed-width code block</pre>
|
||||
#[doc = "<pre><code class=\"language-rust\">pre-formatted fixed-width code block written in the \
|
||||
|
@ -104,6 +112,8 @@ use serde::{Deserialize, Serialize};
|
|||
/// - Use nested `pre` and `code` tags, to define programming language for `pre`
|
||||
/// entity.
|
||||
/// - Programming language can't be specified for standalone `code` tags.
|
||||
/// - A valid emoji must be used as the content of the `tg-emoji` tag. The emoji will be shown instead of the custom emoji in places where a custom emoji cannot be displayed (e.g., system notifications) or if the message is forwarded by a non-premium user. It is recommended to use the emoji from the emoji field of the custom emoji [sticker](https://core.telegram.org/bots/api#sticker).
|
||||
/// - Custom emoji entities can only be used by bots that purchased additional usernames on [Fragment](https://fragment.com/).
|
||||
///
|
||||
/// ## Markdown style
|
||||
///
|
||||
|
|
|
@ -36,21 +36,30 @@ pub struct Sticker {
|
|||
#[serde(flatten)]
|
||||
pub kind: StickerKind,
|
||||
|
||||
/// Format of this sticker - raster/`.webp`, animated/`.tgs` or
|
||||
/// video/`.webm`.
|
||||
/// Format flags of this sticker:
|
||||
///
|
||||
/// `(is_animated, is_video)` == `(false, false)` - raster/`.webp` or
|
||||
/// `is_animated == true` - animated/`.tgs` or
|
||||
/// `is_video == true` - video/`.webm`.
|
||||
///
|
||||
/// In other words this represents how the sticker is encoded.
|
||||
#[serde(flatten)]
|
||||
pub format: StickerFormat,
|
||||
pub flags: StickerFormatFlags,
|
||||
|
||||
/// Sticker thumbnail in the `.webp` or `.jpg` format.
|
||||
pub thumb: Option<PhotoSize>,
|
||||
pub thumbnail: Option<PhotoSize>,
|
||||
|
||||
/// Emoji associated with the sticker.
|
||||
pub emoji: Option<String>,
|
||||
|
||||
/// Name of the sticker set to which the sticker belongs.
|
||||
pub set_name: Option<String>,
|
||||
|
||||
/// True, if the sticker must be repainted to a text color in messages, the
|
||||
/// color of the Telegram Premium badge in emoji status, white color on
|
||||
/// chat photos, or another appropriate color in other places
|
||||
#[serde(default)]
|
||||
pub needs_repainting: bool,
|
||||
}
|
||||
|
||||
/// Kind of a [`Sticker`] - regular, mask or custom emoji.
|
||||
|
@ -93,12 +102,22 @@ pub enum StickerType {
|
|||
CustomEmoji,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub struct StickerFormatFlags {
|
||||
/// True, if the sticker is animated
|
||||
#[serde(default)]
|
||||
pub is_animated: bool,
|
||||
/// True, if the sticker is a video sticker
|
||||
#[serde(default)]
|
||||
pub is_video: bool,
|
||||
}
|
||||
|
||||
/// Format of a [`Sticker`] - regular/webp, animated/tgs or video/webm.
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[serde(try_from = "StickerFormatRaw", into = "StickerFormatRaw")]
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum StickerFormat {
|
||||
/// "Normal", raster, `.webp` sticker.
|
||||
Raster,
|
||||
/// Image in `.png` or `.webp` format.
|
||||
Static,
|
||||
/// [Animated], `.tgs` sticker.
|
||||
///
|
||||
/// [Animated]: https://telegram.org/blog/animated-stickers
|
||||
|
@ -131,36 +150,45 @@ impl Deref for Sticker {
|
|||
}
|
||||
|
||||
impl Sticker {
|
||||
/// Returns the format of the [`Sticker`] based on the [`self.flags`] values
|
||||
///
|
||||
/// [`Sticker`]: Sticker
|
||||
/// [`self.flags`]: Sticker::flags
|
||||
#[must_use]
|
||||
pub fn format(&self) -> StickerFormat {
|
||||
self.flags.format()
|
||||
}
|
||||
|
||||
/// Returns `true` is this is a "normal" raster sticker.
|
||||
///
|
||||
/// Alias to [`self.format.is_raster()`].
|
||||
/// Alias to [`self.format().is_raster()`].
|
||||
///
|
||||
/// [`self.format.is_raster()`]: StickerFormat::is_raster
|
||||
/// [`self.format().is_static()`]: StickerFormat::is_static
|
||||
#[must_use]
|
||||
pub fn is_raster(&self) -> bool {
|
||||
self.format.is_raster()
|
||||
pub fn is_static(&self) -> bool {
|
||||
self.format().is_static()
|
||||
}
|
||||
|
||||
/// Returns `true` is this is an [animated] sticker.
|
||||
///
|
||||
/// Alias to [`self.format.is_animated()`].
|
||||
/// Alias to [`self.format().is_animated()`].
|
||||
///
|
||||
/// [`self.format.is_animated()`]: StickerFormat::is_animated
|
||||
/// [`self.format().is_animated()`]: StickerFormat::is_animated
|
||||
/// [animated]: https://telegram.org/blog/animated-stickers
|
||||
#[must_use]
|
||||
pub fn is_animated(&self) -> bool {
|
||||
self.format.is_animated()
|
||||
self.format().is_animated()
|
||||
}
|
||||
|
||||
/// Returns `true` is this is a [video] sticker.
|
||||
///
|
||||
/// Alias to [`self.format.is_video()`].
|
||||
/// Alias to [`self.format().is_video()`].
|
||||
///
|
||||
/// [`self.format.is_video()`]: StickerFormat::is_video
|
||||
/// [`self.format().is_video()`]: StickerFormat::is_video
|
||||
/// [video]: https://telegram.org/blog/video-stickers-better-reactions
|
||||
#[must_use]
|
||||
pub fn is_video(&self) -> bool {
|
||||
self.format.is_video()
|
||||
self.format().is_video()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -256,13 +284,24 @@ impl StickerType {
|
|||
}
|
||||
}
|
||||
|
||||
impl StickerFormatFlags {
|
||||
pub fn format(&self) -> StickerFormat {
|
||||
match (self.is_animated, self.is_video) {
|
||||
(false, false) => StickerFormat::Static,
|
||||
(true, false) => StickerFormat::Animated,
|
||||
(false, true) => StickerFormat::Video,
|
||||
(true, true) => panic!("`is_animated` and `is_video` flags present at the same time"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl StickerFormat {
|
||||
/// Returns `true` if the sticker format is [`Raster`].
|
||||
/// Returns `true` if the sticker format is [`Static`].
|
||||
///
|
||||
/// [`Raster`]: StickerFormat::Raster
|
||||
/// [`Static`]: StickerFormat::Static
|
||||
#[must_use]
|
||||
pub fn is_raster(&self) -> bool {
|
||||
matches!(self, Self::Raster)
|
||||
pub fn is_static(&self) -> bool {
|
||||
matches!(self, Self::Static)
|
||||
}
|
||||
|
||||
/// Returns `true` if the sticker format is [`Animated`].
|
||||
|
@ -282,42 +321,31 @@ impl StickerFormat {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
struct StickerFormatRaw {
|
||||
is_animated: bool,
|
||||
is_video: bool,
|
||||
}
|
||||
|
||||
impl TryFrom<StickerFormatRaw> for StickerFormat {
|
||||
type Error = &'static str;
|
||||
|
||||
fn try_from(
|
||||
StickerFormatRaw { is_animated, is_video }: StickerFormatRaw,
|
||||
) -> Result<Self, Self::Error> {
|
||||
let ret = match (is_animated, is_video) {
|
||||
(false, false) => Self::Raster,
|
||||
(true, false) => Self::Animated,
|
||||
(false, true) => Self::Video,
|
||||
(true, true) => return Err("`is_animated` and `is_video` present at the same time"),
|
||||
};
|
||||
|
||||
Ok(ret)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<StickerFormat> for StickerFormatRaw {
|
||||
fn from(kind: StickerFormat) -> Self {
|
||||
match kind {
|
||||
StickerFormat::Raster => Self { is_animated: false, is_video: false },
|
||||
StickerFormat::Animated => Self { is_animated: true, is_video: false },
|
||||
StickerFormat::Video => Self { is_animated: false, is_video: true },
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::types::{MaskPoint, Sticker, StickerFormat, StickerType};
|
||||
use crate::types::{MaskPoint, Sticker, StickerFormat, StickerFormatFlags, StickerType};
|
||||
|
||||
#[test]
|
||||
fn sticker_format_serde() {
|
||||
// Ser
|
||||
assert_eq!(serde_json::to_string(&StickerFormat::Static).unwrap(), r#""static""#);
|
||||
assert_eq!(serde_json::to_string(&StickerFormat::Animated).unwrap(), r#""animated""#);
|
||||
assert_eq!(serde_json::to_string(&StickerFormat::Video).unwrap(), r#""video""#);
|
||||
|
||||
// De
|
||||
assert_eq!(
|
||||
serde_json::from_str::<StickerFormat>(r#""static""#).unwrap(),
|
||||
StickerFormat::Static
|
||||
);
|
||||
assert_eq!(
|
||||
serde_json::from_str::<StickerFormat>(r#""animated""#).unwrap(),
|
||||
StickerFormat::Animated
|
||||
);
|
||||
assert_eq!(
|
||||
serde_json::from_str::<StickerFormat>(r#""video""#).unwrap(),
|
||||
StickerFormat::Video
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn mask_serde() {
|
||||
|
@ -336,7 +364,7 @@ mod tests {
|
|||
"y_shift": 0.5525,
|
||||
"scale": 1.94
|
||||
},
|
||||
"thumb": {
|
||||
"thumbnail": {
|
||||
"file_id": "AAMCAQADFQABYzA0qlYHijpjMzMwBFKnEVE5XdkAAjIKAAK_jJAE1TRw7D936M8BAAdtAAMpBA",
|
||||
"file_unique_id": "AQADMgoAAr-MkARy",
|
||||
"file_size": 11028,
|
||||
|
@ -355,7 +383,7 @@ mod tests {
|
|||
assert_eq!(sticker.mask_position().unwrap().point, MaskPoint::Forehead);
|
||||
assert_eq!(sticker.is_animated(), false);
|
||||
assert_eq!(sticker.is_video(), false);
|
||||
assert_eq!(sticker.thumb.clone().unwrap().file.size, 11028);
|
||||
assert_eq!(sticker.thumbnail.clone().unwrap().file.size, 11028);
|
||||
assert_eq!(sticker.file.size, 18290);
|
||||
assert_eq!(sticker.width, 512);
|
||||
assert_eq!(sticker.height, 512);
|
||||
|
@ -376,7 +404,7 @@ mod tests {
|
|||
"is_animated": false,
|
||||
"is_video": false,
|
||||
"type": "regular",
|
||||
"thumb": {
|
||||
"thumbnail": {
|
||||
"file_id": "AAMCAgADFQABYzBxOJ1GWrttqL7FSRwdAtrq-AkAAtkHAALBGJ4LUUUh5CUew90BAAdtAAMpBA",
|
||||
"file_unique_id": "AQAD2QcAAsEYngty",
|
||||
"file_size": 4558,
|
||||
|
@ -395,7 +423,7 @@ mod tests {
|
|||
assert_eq!(sticker.premium_animation(), None);
|
||||
assert_eq!(sticker.is_animated(), false);
|
||||
assert_eq!(sticker.is_video(), false);
|
||||
assert_eq!(sticker.thumb.clone().unwrap().file.size, 4558);
|
||||
assert_eq!(sticker.thumbnail.clone().unwrap().file.size, 4558);
|
||||
assert_eq!(sticker.file.size, 25734);
|
||||
assert_eq!(sticker.width, 463);
|
||||
assert_eq!(sticker.height, 512);
|
||||
|
@ -407,35 +435,73 @@ mod tests {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn sticker_format_serde() {
|
||||
fn regular_serde_with_options() {
|
||||
let json = r#"{
|
||||
"width": 463,
|
||||
"height": 512,
|
||||
"is_animated": false,
|
||||
"is_video": false,
|
||||
"type": "regular",
|
||||
"file_id": "CAACAgIAAxUAAWMwcTidRlq7bai-xUkcHQLa6vgJAALZBwACwRieC1FFIeQlHsPdKQQ",
|
||||
"file_unique_id": "AgAD2QcAAsEYngs",
|
||||
"file_size": 25734
|
||||
}"#;
|
||||
|
||||
let sticker: Sticker = serde_json::from_str(json).unwrap();
|
||||
|
||||
// Assert some basic properties are correctly deserialized
|
||||
assert_eq!(sticker.type_(), StickerType::Regular);
|
||||
assert_eq!(sticker.premium_animation(), None);
|
||||
assert_eq!(sticker.is_animated(), false);
|
||||
assert_eq!(sticker.is_video(), false);
|
||||
assert_eq!(sticker.thumbnail, None);
|
||||
assert_eq!(sticker.emoji, None);
|
||||
assert_eq!(sticker.file.size, 25734);
|
||||
assert_eq!(sticker.width, 463);
|
||||
assert_eq!(sticker.height, 512);
|
||||
assert_eq!(sticker.set_name, None);
|
||||
assert_eq!(sticker.needs_repainting, false);
|
||||
|
||||
let json2 = serde_json::to_string(&sticker).unwrap();
|
||||
let sticker2: Sticker = serde_json::from_str(&json2).unwrap();
|
||||
assert_eq!(sticker, sticker2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sticker_format_flags_serde() {
|
||||
{
|
||||
let json = r#"{"is_animated":false,"is_video":false}"#;
|
||||
let fmt: StickerFormat = serde_json::from_str(json).unwrap();
|
||||
assert_eq!(fmt, StickerFormat::Raster);
|
||||
let fmt_flags: StickerFormatFlags = serde_json::from_str(json).unwrap();
|
||||
assert_eq!(fmt_flags.format(), StickerFormat::Static);
|
||||
|
||||
let json2 = serde_json::to_string(&fmt).unwrap();
|
||||
let json2 = serde_json::to_string(&fmt_flags).unwrap();
|
||||
assert_eq!(json, json2);
|
||||
}
|
||||
{
|
||||
let json = r#"{"is_animated":true,"is_video":false}"#;
|
||||
let fmt: StickerFormat = serde_json::from_str(json).unwrap();
|
||||
assert_eq!(fmt, StickerFormat::Animated);
|
||||
let fmt_flags: StickerFormatFlags = serde_json::from_str(json).unwrap();
|
||||
assert_eq!(fmt_flags.format(), StickerFormat::Animated);
|
||||
|
||||
let json2 = serde_json::to_string(&fmt).unwrap();
|
||||
let json2 = serde_json::to_string(&fmt_flags).unwrap();
|
||||
assert_eq!(json, json2);
|
||||
}
|
||||
{
|
||||
let json = r#"{"is_animated":false,"is_video":true}"#;
|
||||
let fmt: StickerFormat = serde_json::from_str(json).unwrap();
|
||||
assert_eq!(fmt, StickerFormat::Video);
|
||||
let fmt_flags: StickerFormatFlags = serde_json::from_str(json).unwrap();
|
||||
assert_eq!(fmt_flags.format(), StickerFormat::Video);
|
||||
|
||||
let json2 = serde_json::to_string(&fmt).unwrap();
|
||||
let json2 = serde_json::to_string(&fmt_flags).unwrap();
|
||||
assert_eq!(json, json2);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic]
|
||||
fn wrong_sticker_format_flags_serde() {
|
||||
{
|
||||
let json = r#"{"is_animated":true,"is_video":true}"#;
|
||||
let fmt: Result<StickerFormat, _> = serde_json::from_str(json);
|
||||
assert!(fmt.is_err());
|
||||
let fmt_flags: StickerFormatFlags = serde_json::from_str(json).unwrap();
|
||||
fmt_flags.format();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ use std::ops::Deref;
|
|||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::types::{PhotoSize, Sticker, StickerFormat, StickerType};
|
||||
use crate::types::{PhotoSize, Sticker, StickerFormat, StickerFormatFlags, StickerType};
|
||||
|
||||
/// This object represents a sticker set.
|
||||
///
|
||||
|
@ -20,15 +20,16 @@ pub struct StickerSet {
|
|||
#[serde(flatten)]
|
||||
pub kind: StickerType,
|
||||
|
||||
/// Sticker format shared by all stickers in this set.
|
||||
// FIXME: remove it in 7.2 https://core.telegram.org/bots/api#march-31-2024
|
||||
/// Sticker format flags shared by all stickers in this set.
|
||||
#[serde(flatten)]
|
||||
pub format: StickerFormat,
|
||||
pub flags: StickerFormatFlags,
|
||||
|
||||
/// List of all set stickers.
|
||||
pub stickers: Vec<Sticker>,
|
||||
|
||||
/// Sticker set thumbnail in the `.webp`, `.tgs` or `.webm` format.
|
||||
pub thumb: Option<PhotoSize>,
|
||||
pub thumbnail: Option<PhotoSize>,
|
||||
}
|
||||
|
||||
/// This allows calling [`StickerType`]'s methods directly on [`StickerSet`].
|
||||
|
@ -50,36 +51,62 @@ impl Deref for StickerSet {
|
|||
}
|
||||
|
||||
impl StickerSet {
|
||||
// FIXME: remove deprecation, when it will be a way to determine the format of
|
||||
// the sticker set
|
||||
/// Returns the format of the stickers in this set
|
||||
///
|
||||
/// Note: this method currently is useless, so the format is always
|
||||
/// StickerFormat::Static
|
||||
#[must_use]
|
||||
#[deprecated(note = "TBA7.2 brought the breaking change: flags 'is_video' and 'is_animated' \
|
||||
were removed, so currently there is no way to determine the format of \
|
||||
the sticker set in the currently supported version (TBA6.6)")]
|
||||
pub fn format(&self) -> StickerFormat {
|
||||
self.flags.format()
|
||||
}
|
||||
|
||||
/// Returns `true` is this is a "normal" raster sticker.
|
||||
///
|
||||
/// Alias to [`self.format.is_raster()`].
|
||||
/// Alias to [`self.format().is_static()`].
|
||||
///
|
||||
/// [`self.format.is_raster()`]: StickerFormat::is_raster
|
||||
/// [`self.format().is_static()`]: StickerFormat::is_static
|
||||
#[must_use]
|
||||
pub fn is_raster(&self) -> bool {
|
||||
self.format.is_raster()
|
||||
#[deprecated(note = "TBA7.2 brought the breaking change: flags 'is_video' and 'is_animated' \
|
||||
were removed, so currently there is no way to determine the format of \
|
||||
the sticker set in the currently supported version (TBA6.6)")]
|
||||
pub fn is_static(&self) -> bool {
|
||||
#[allow(deprecated)]
|
||||
self.format().is_static()
|
||||
}
|
||||
|
||||
/// Returns `true` is this is an [animated] sticker.
|
||||
///
|
||||
/// Alias to [`self.format.is_animated()`].
|
||||
/// Alias to [`self.format().is_animated()`].
|
||||
///
|
||||
/// [`self.format.is_animated()`]: StickerFormat::is_animated
|
||||
/// [`self.format().is_animated()`]: StickerFormat::is_animated
|
||||
/// [animated]: https://telegram.org/blog/animated-stickers
|
||||
#[must_use]
|
||||
#[deprecated(note = "TBA7.2 brought the breaking change: flags 'is_video' and 'is_animated' \
|
||||
were removed, so currently there is no way to determine the format of \
|
||||
the sticker set in the currently supported version (TBA6.6)")]
|
||||
pub fn is_animated(&self) -> bool {
|
||||
self.format.is_animated()
|
||||
#[allow(deprecated)]
|
||||
self.format().is_animated()
|
||||
}
|
||||
|
||||
/// Returns `true` is this is a [video] sticker.
|
||||
///
|
||||
/// Alias to [`self.format.is_video()`].
|
||||
/// Alias to [`self.format().is_video()`].
|
||||
///
|
||||
/// [`self.format.is_video()`]: StickerFormat::is_video
|
||||
/// [`self.format().is_video()`]: StickerFormat::is_video
|
||||
/// [video]: https://telegram.org/blog/video-stickers-better-reactions
|
||||
#[must_use]
|
||||
#[deprecated(note = "TBA7.2 brought the breaking change: flags 'is_video' and 'is_animated' \
|
||||
were removed, so currently there is no way to determine the format of \
|
||||
the sticker set in the currently supported version (TBA6.6)")]
|
||||
pub fn is_video(&self) -> bool {
|
||||
self.format.is_video()
|
||||
#[allow(deprecated)]
|
||||
self.format().is_video()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -106,7 +133,7 @@ mod tests {
|
|||
"is_animated": false,
|
||||
"is_video": false,
|
||||
"type": "regular",
|
||||
"thumb": {
|
||||
"thumbnail": {
|
||||
"file_id": "AAMCAQADFQABYzB4ATH0sqXx351gZ5GpY1Z3Tl8AAlgCAAJ1t4hFbxNCoAg1-akBAAdtAAMpBA",
|
||||
"file_unique_id": "AQADWAIAAnW3iEVy",
|
||||
"file_size": 7698,
|
||||
|
@ -125,7 +152,7 @@ mod tests {
|
|||
"is_animated": false,
|
||||
"is_video": false,
|
||||
"type": "regular",
|
||||
"thumb": {
|
||||
"thumbnail": {
|
||||
"file_id": "AAMCAQADFQABYzB4AcABR8-MuvGagis9Pk6liSAAAs8DAAL2YYBFNbvduoN1p7oBAAdtAAMpBA",
|
||||
"file_unique_id": "AQADzwMAAvZhgEVy",
|
||||
"file_size": 7780,
|
||||
|
@ -141,9 +168,81 @@ mod tests {
|
|||
|
||||
let set: StickerSet = serde_json::from_str(json).unwrap();
|
||||
|
||||
assert!(set.is_raster());
|
||||
assert!(set.is_regular());
|
||||
assert!(set.thumb.is_none());
|
||||
assert!(set.thumbnail.is_none());
|
||||
assert_eq!(set.stickers.len(), 2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
// In TBA7.2 fields `is_video` and `is_audio` are removed, so it's the breaking
|
||||
// change (previously, sticker set format inference heavily relied upon these
|
||||
// fields)
|
||||
fn test() {
|
||||
let json = r#"{
|
||||
"name": "tba66_by_memorization_helper_bot",
|
||||
"title": "Teloxide TBA6.6 TEST",
|
||||
"sticker_type": "regular",
|
||||
"contains_masks": false,
|
||||
"stickers": [
|
||||
{
|
||||
"width": 512,
|
||||
"height": 512,
|
||||
"emoji": "\\ud83e\\udd80",
|
||||
"set_name": "tba66_by_memorization_helper_bot",
|
||||
"is_animated": false,
|
||||
"is_video": false,
|
||||
"type": "regular",
|
||||
"thumbnail": {
|
||||
"file_id": "AAMCAgADFQABZmbS1r0a5NWqrPIHJSCabGw3LUwAAh5MAAKRGTlL-H1XHcgw5coBAAdtAAM1BA",
|
||||
"file_unique_id": "AQADHkwAApEZOUty",
|
||||
"file_size": 7786,
|
||||
"width": 320,
|
||||
"height": 320
|
||||
},
|
||||
"thumb": {
|
||||
"file_id": "AAMCAgADFQABZmbS1r0a5NWqrPIHJSCabGw3LUwAAh5MAAKRGTlL-H1XHcgw5coBAAdtAAM1BA",
|
||||
"file_unique_id": "AQADHkwAApEZOUty",
|
||||
"file_size": 7786,
|
||||
"width": 320,
|
||||
"height": 320
|
||||
},
|
||||
"file_id": "CAACAgIAAxUAAWZm0ta9GuTVqqzyByUgmmxsNy1MAAIeTAACkRk5S_h9Vx3IMOXKNQQ",
|
||||
"file_unique_id": "AgADHkwAApEZOUs",
|
||||
"file_size": 11936
|
||||
},
|
||||
{
|
||||
"width": 512,
|
||||
"height": 512,
|
||||
"emoji": "\\ud83e\\udd80",
|
||||
"set_name": "tba66_by_memorization_helper_bot",
|
||||
"is_animated": false,
|
||||
"is_video": false,
|
||||
"type": "regular",
|
||||
"thumbnail": {
|
||||
"file_id": "AAMCAgADFQABZmbS1jN5O3rMp4gsH3eeBPajWVUAAoxIAAKtXDhLhabEKw0iE9sBAAdtAAM1BA",
|
||||
"file_unique_id": "AQADjEgAAq1cOEty",
|
||||
"file_size": 7768,
|
||||
"width": 320,
|
||||
"height": 320
|
||||
},
|
||||
"thumb": {
|
||||
"file_id": "AAMCAgADFQABZmbS1jN5O3rMp4gsH3eeBPajWVUAAoxIAAKtXDhLhabEKw0iE9sBAAdtAAM1BA",
|
||||
"file_unique_id": "AQADjEgAAq1cOEty",
|
||||
"file_size": 7768,
|
||||
"width": 320,
|
||||
"height": 320
|
||||
},
|
||||
"file_id": "CAACAgIAAxUAAWZm0tYzeTt6zKeILB93ngT2o1lVAAKMSAACrVw4S4WmxCsNIhPbNQQ",
|
||||
"file_unique_id": "AgADjEgAAq1cOEs",
|
||||
"file_size": 12092
|
||||
}
|
||||
]
|
||||
}"#;
|
||||
|
||||
let set: StickerSet = serde_json::from_str(json).unwrap();
|
||||
|
||||
assert!(set.is_regular());
|
||||
assert!(set.thumbnail.is_none());
|
||||
assert_eq!(set.stickers.len(), 2);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// This object represents an inline button that switches the current user to
|
||||
/// inline mode in a chosen chat, with an optional default inline query.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#switchinlinequerychosenchat)
|
||||
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Clone, Debug, Hash, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct SwitchInlineQueryChosenChat {
|
||||
/// The default inline query to be inserted in the input field. If left
|
||||
/// empty, only the bot's username will be inserted
|
||||
pub query: Option<String>,
|
||||
/// True, if private chats with users can be chosen
|
||||
#[serde(default)]
|
||||
pub allow_user_chats: bool,
|
||||
/// True, if private chats with bots can be chosen
|
||||
#[serde(default)]
|
||||
pub allow_bot_chats: bool,
|
||||
/// True, if group and supergroup chats can be chosen
|
||||
#[serde(default)]
|
||||
pub allow_group_chats: bool,
|
||||
/// True, if channel chats can be chosen
|
||||
#[serde(default)]
|
||||
pub allow_channel_chats: bool,
|
||||
}
|
|
@ -23,7 +23,7 @@ pub struct Video {
|
|||
pub duration: Seconds,
|
||||
|
||||
/// Video thumbnail.
|
||||
pub thumb: Option<PhotoSize>,
|
||||
pub thumbnail: Option<PhotoSize>,
|
||||
|
||||
/// Original filename as defined by sender
|
||||
pub file_name: Option<String>,
|
||||
|
|
|
@ -24,5 +24,5 @@ pub struct VideoNote {
|
|||
pub duration: Seconds,
|
||||
|
||||
/// Video thumbnail.
|
||||
pub thumb: Option<PhotoSize>,
|
||||
pub thumbnail: Option<PhotoSize>,
|
||||
}
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// This object represents a service message about a user allowing a bot added
|
||||
/// to the attachment menu to write messages. Currently holds no information.
|
||||
/// This object represents a service message about a user allowing a bot to
|
||||
/// write messages after adding the bot to the attachment menu or launching a
|
||||
/// Web App from a link.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#writeaccessallowed).
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
|
||||
pub struct WriteAccessAllowed {}
|
||||
pub struct WriteAccessAllowed {
|
||||
/// Name of the Web App which was launched from a link
|
||||
pub web_app_name: Option<String>,
|
||||
}
|
||||
|
|
|
@ -165,6 +165,12 @@ name = "postgres"
|
|||
path = "tests/postgres.rs"
|
||||
required-features = ["postgres-storage-nativetls", "cbor-serializer", "bincode-serializer"]
|
||||
|
||||
[lints.rust]
|
||||
unexpected_cfgs = { level = "warn", check-cfg = [
|
||||
'cfg(CI_POSTGRES)',
|
||||
'cfg(CI_REDIS)',
|
||||
] }
|
||||
|
||||
[[example]]
|
||||
name = "admin"
|
||||
required-features = ["macros", "ctrlc_handler"]
|
||||
|
|
|
@ -41,7 +41,7 @@ async fn main() {
|
|||
))),
|
||||
)
|
||||
.description("DuckDuckGo Search")
|
||||
.thumb_url("https://duckduckgo.com/assets/logo_header.v108.png".parse().unwrap())
|
||||
.thumbnail_url("https://duckduckgo.com/assets/logo_header.v108.png".parse().unwrap())
|
||||
.url("https://duckduckgo.com/about".parse().unwrap()); // Note: This is the url that will open if they click the thumbnail
|
||||
|
||||
let results = vec![
|
||||
|
|
|
@ -91,8 +91,7 @@
|
|||
//! several techniques:
|
||||
//!
|
||||
//! - **Branching:** `a.branch(b)` roughly means "try to handle an update with
|
||||
//! `a`, then, if it
|
||||
//! neglects the update, try `b`".
|
||||
//! `a`, then, if it neglects the update, try `b`".
|
||||
//! - **Pattern matching:** We also use the [`dptree::case!`] macro
|
||||
//! extensively, which acts as a filter on an enumeration: if it is of a
|
||||
//! certain variant, it passes the variant's payload down the handler chain;
|
||||
|
|
|
@ -44,9 +44,8 @@ impl<S> PostgresStorage<S> {
|
|||
/// - database_url: full url to the postgres database, for example
|
||||
/// `"postgres://postgres:password@localhost/test")`
|
||||
/// - max_connections: number of connections in creating connection pool. Be
|
||||
/// mindful of the connection limits for your database, each
|
||||
/// connection established with the Postgres creates a new process on the
|
||||
/// server side
|
||||
/// mindful of the connection limits for your database, each connection
|
||||
/// established with the Postgres creates a new process on the server side
|
||||
/// - serializer: what [`Serializer`] will be used to encode the dialogue
|
||||
/// data. Available ones are: [`Json`], [`Bincode`], [`Cbor`]
|
||||
///
|
||||
|
|
|
@ -89,7 +89,7 @@ where
|
|||
Box::pin(async move {
|
||||
let dialogue =
|
||||
self.serializer.serialize(&dialogue).map_err(RedisStorageError::SerdeError)?;
|
||||
self.conn.lock().await.set::<_, Vec<u8>, _>(chat_id, dialogue).await?;
|
||||
() = self.conn.lock().await.set::<_, Vec<u8>, _>(chat_id, dialogue).await?;
|
||||
Ok(())
|
||||
})
|
||||
}
|
||||
|
|
|
@ -28,11 +28,11 @@ pub trait HandlerExt<Output> {
|
|||
/// It does so by the following steps:
|
||||
///
|
||||
/// 1. If an incoming update has no chat ID ([`GetChatId::chat_id`] returns
|
||||
/// `None`), the rest of the chain will not be executed. Otherwise, passes
|
||||
/// `Dialogue::new(storage, chat_id)` forwards.
|
||||
/// `None`), the rest of the chain will not be executed. Otherwise,
|
||||
/// passes `Dialogue::new(storage, chat_id)` forwards.
|
||||
/// 2. If [`Dialogue::get_or_default`] on the passed dialogue returns `Ok`,
|
||||
/// passes the dialogue state forwards. Otherwise, logs an error and the
|
||||
/// rest of the chain is not executed.
|
||||
/// passes the dialogue state forwards. Otherwise, logs an error and the
|
||||
/// rest of the chain is not executed.
|
||||
///
|
||||
/// ## Dependency requirements
|
||||
///
|
||||
|
|
|
@ -81,22 +81,22 @@ pub use teloxide_macros::BotCommands;
|
|||
/// ```
|
||||
///
|
||||
/// # Enum attributes
|
||||
/// 1. `#[command(rename_rule = "rule")]`
|
||||
/// Rename all commands by `rule`. Allowed rules are `lowercase`, `UPPERCASE`,
|
||||
/// `PascalCase`, `camelCase`, `snake_case`, `SCREAMING_SNAKE_CASE`,
|
||||
/// `kebab-case`, and `SCREAMING-KEBAB-CASE`.
|
||||
/// 1. `#[command(rename_rule = "rule")]` Rename all commands by `rule`.
|
||||
/// Allowed rules are `lowercase`, `UPPERCASE`, `PascalCase`, `camelCase`,
|
||||
/// `snake_case`, `SCREAMING_SNAKE_CASE`, `kebab-case`, and
|
||||
/// `SCREAMING-KEBAB-CASE`.
|
||||
///
|
||||
/// 2. `#[command(prefix = "prefix")]`
|
||||
/// Change a prefix for all commands (the default is `/`).
|
||||
/// 2. `#[command(prefix = "prefix")]` Change a prefix for all commands (the
|
||||
/// default is `/`).
|
||||
///
|
||||
/// 3. `#[command(description = "description")]` and `/// description`
|
||||
/// Add a summary description of commands before all commands.
|
||||
/// 3. `#[command(description = "description")]` and `/// description` Add a
|
||||
/// summary description of commands before all commands.
|
||||
///
|
||||
/// 4. `#[command(parse_with = "parser")]`
|
||||
/// Change the parser of arguments. Possible values:
|
||||
/// - `default` - the same as the unspecified parser. It only puts all text
|
||||
/// after the first space into the first argument, which must implement
|
||||
/// [`FromStr`].
|
||||
/// 4. `#[command(parse_with = "parser")]` Change the parser of arguments.
|
||||
/// Possible values:
|
||||
/// - `default` - the same as the unspecified parser. It only puts all
|
||||
/// text after the first space into the first argument, which must
|
||||
/// implement [`FromStr`].
|
||||
///
|
||||
/// ## Example
|
||||
/// ```
|
||||
|
@ -134,9 +134,8 @@ pub use teloxide_macros::BotCommands;
|
|||
/// # }
|
||||
/// ```
|
||||
///
|
||||
/// 5. `#[command(separator = "sep")]`
|
||||
/// Specify separator used by the `split` parser. It will be ignored when
|
||||
/// accompanied by another type of parsers.
|
||||
/// 5. `#[command(separator = "sep")]` Specify separator used by the `split`
|
||||
/// parser. It will be ignored when accompanied by another type of parsers.
|
||||
///
|
||||
/// ## Example
|
||||
/// ```
|
||||
|
@ -154,8 +153,8 @@ pub use teloxide_macros::BotCommands;
|
|||
/// # }
|
||||
/// ```
|
||||
///
|
||||
/// 6. `#[command(command_separator = "sep")]`
|
||||
/// Specify separator between command and args. Default is a space character.
|
||||
/// 6. `#[command(command_separator = "sep")]` Specify separator between command
|
||||
/// and args. Default is a space character.
|
||||
///
|
||||
/// ## Example
|
||||
/// ```
|
||||
|
@ -181,34 +180,33 @@ pub use teloxide_macros::BotCommands;
|
|||
/// # Variant attributes
|
||||
/// All variant attributes override the corresponding `enum` attributes.
|
||||
///
|
||||
/// 1. `#[command(rename_rule = "rule")]`
|
||||
/// Rename one command by a rule. Allowed rules are `lowercase`, `UPPERCASE`,
|
||||
/// `PascalCase`, `camelCase`, `snake_case`, `SCREAMING_SNAKE_CASE`,
|
||||
/// `kebab-case`, `SCREAMING-KEBAB-CASE`.
|
||||
/// 1. `#[command(rename_rule = "rule")]` Rename one command by a rule. Allowed
|
||||
/// rules are `lowercase`, `UPPERCASE`, `PascalCase`, `camelCase`,
|
||||
/// `snake_case`, `SCREAMING_SNAKE_CASE`, `kebab-case`,
|
||||
/// `SCREAMING-KEBAB-CASE`.
|
||||
///
|
||||
/// 2. `#[command(rename = "name")]`
|
||||
/// Rename one command to `name` (literal renaming; do not confuse with
|
||||
/// `rename_rule`).
|
||||
/// 2. `#[command(rename = "name")]` Rename one command to `name` (literal
|
||||
/// renaming; do not confuse with `rename_rule`).
|
||||
///
|
||||
/// 3. `#[command(description = "description")]` and `/// description`
|
||||
/// Give your command a description. It will be shown in the help message.
|
||||
/// 3. `#[command(description = "description")]` and `/// description` Give
|
||||
/// your command a description. It will be shown in the help message.
|
||||
///
|
||||
/// 4. `#[command(parse_with = "parser")]`
|
||||
/// Parse arguments of one command with a given parser. `parser` must be a
|
||||
/// function of the signature `fn(String) -> Result<Tuple, ParseError>`, where
|
||||
/// `Tuple` corresponds to the variant's arguments.
|
||||
/// 4. `#[command(parse_with = "parser")]` Parse arguments of one command with
|
||||
/// a given parser. `parser` must be a function of the signature `fn(String)
|
||||
/// -> Result<Tuple, ParseError>`, where `Tuple` corresponds to the
|
||||
/// variant's arguments.
|
||||
///
|
||||
/// 5. `#[command(hide)]`
|
||||
/// Hide a command from the help message. It will still be parsed.
|
||||
/// 5. `#[command(hide)]` Hide a command from the help message. It will still
|
||||
/// be parsed.
|
||||
///
|
||||
/// 6. `#[command(alias = "alias")]`
|
||||
/// Add an alias to a command. It will be shown in the help message.
|
||||
/// 6. `#[command(alias = "alias")]` Add an alias to a command. It will be shown
|
||||
/// in the help message.
|
||||
///
|
||||
/// 7. `#[command(aliases = ["alias1", "alias2"])]`
|
||||
/// Add multiple aliases to a command. They will be shown in the help message.
|
||||
/// 7. `#[command(aliases = ["alias1", "alias2"])]` Add multiple aliases to a
|
||||
/// command. They will be shown in the help message.
|
||||
///
|
||||
/// 8. `#[command(hide_aliases)]`
|
||||
/// Hide all aliases of a command from the help message.
|
||||
/// 8. `#[command(hide_aliases)]` Hide all aliases of a command from the help
|
||||
/// message.
|
||||
///
|
||||
/// ## Example
|
||||
/// ```
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[toolchain]
|
||||
channel = "nightly-2024-03-20"
|
||||
channel = "nightly-2024-07-03"
|
||||
components = ["rustfmt", "clippy"]
|
||||
profile = "minimal"
|
||||
|
|
Loading…
Reference in a new issue