Merge branch 'master' into feature/support-tba-6.6

This commit is contained in:
Сырцев Вадим Игоревич 2024-07-08 18:34:36 +03:00 committed by GitHub
commit 324758548e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 324 additions and 304 deletions

View file

@ -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

View file

@ -55,6 +55,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Use `Seconds` instead of `String` in `InlineQueryResultAudio` for `audio_duration` ([PR 994](https://github.com/teloxide/teloxide/pull/994))
- 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

317
Cargo.lock generated
View file

@ -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.90"
version = "1.0.105"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8cd6604a82acf3039f1144f54b8eb34e91ffba622051189e71b781822d5ee1f5"
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.0.1"
version = "3.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86ec7a15cbe22e59248fc7eadb1907dab5ba09372595da4d73dd805ed4417dfe"
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.12"
version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5"
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",
@ -884,7 +884,7 @@ dependencies = [
"httpdate",
"itoa",
"pin-project-lite",
"socket2 0.4.10",
"socket2 0.5.6",
"tokio",
"tower-service",
"tracing",
@ -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.10"
version = "0.21.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba"
checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e"
dependencies = [
"log",
"ring",
@ -1647,15 +1640,15 @@ dependencies = [
[[package]]
name = "rustversion"
version = "1.0.14"
version = "1.0.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4"
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"
@ -1684,9 +1677,9 @@ dependencies = [
[[package]]
name = "security-framework"
version = "2.9.2"
version = "2.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de"
checksum = "770452e37cad93e0a50d5abc3990d2bc351c36d0328f86cefec2f2fb206eaef6"
dependencies = [
"bitflags 1.3.2",
"core-foundation",
@ -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",

View file

@ -350,7 +350,7 @@ Feel free to propose your own bot to our collection!
</details>
See [700+ other public repositories using `teloxide` >>](https://github.com/teloxide/teloxide/network/dependents)
See [1600+ other public repositories using `teloxide` >>](https://github.com/teloxide/teloxide/network/dependents)
## Contributing

View file

@ -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"]

View file

@ -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.
///

View file

@ -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()

View file

@ -1,6 +1,7 @@
use crate::codegen::schema::Type;
pub enum Convert {
#[allow(dead_code)]
Id(Type),
Into(Type),
Collect(Type),

View file

@ -289,7 +289,7 @@ impl_api_error! {
/// 1. [`SendMediaGroup`]
///
/// [`SendMediaGroup`]: crate::payloads::SendMediaGroup
ToMuchMessages = "Bad Request: Too much messages to send as an album",
TooMuchMessages = "Bad Request: Too much messages to send as an album",
/// Occurs when bot tries to answer an inline query with more than 50
/// results.
@ -861,7 +861,7 @@ mod tests {
("{\"data\": \"Bad Request: MESSAGE_TOO_LONG\"}", ApiError::EditedMessageIsTooLong),
(
"{\"data\": \"Bad Request: Too much messages to send as an album\"}",
ApiError::ToMuchMessages,
ApiError::TooMuchMessages,
),
("{\"data\": \"Bad Request: RESULTS_TOO_MUCH\"}", ApiError::TooMuchInlineQueryResults),
(

View file

@ -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

View file

@ -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);
}
}

View file

@ -1009,17 +1009,16 @@ mod getters {
#[must_use]
pub fn caption(&self) -> Option<&str> {
match &self.kind {
Common(MessageCommon { media_kind, .. }) => match media_kind {
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,
},
| MediaKind::Voice(MediaVoice { caption, .. }),
..
}) => caption.as_ref().map(Deref::deref),
_ => None,
}
}

View file

@ -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"]

View file

@ -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;

View file

@ -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`]
///

View file

@ -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(())
})
}

View file

@ -28,8 +28,8 @@ 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.

View file

@ -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
/// ```

View file

@ -101,7 +101,15 @@ pub fn code_inline(s: &str) -> String {
#[must_use = "This function returns a new string, rather than mutating the argument, so calling it \
without using its output does nothing useful"]
pub fn escape(s: &str) -> String {
s.replace('&', "&amp;").replace('<', "&lt;").replace('>', "&gt;")
s.chars().fold(String::with_capacity(s.len()), |mut s, c| {
match c {
'&' => s.push_str("&amp;"),
'<' => s.push_str("&lt;"),
'>' => s.push_str("&gt;"),
c => s.push(c),
}
s
})
}
#[must_use = "This function returns a new string, rather than mutating the argument, so calling it \

View file

@ -109,24 +109,16 @@ pub fn code_inline(s: &str) -> String {
#[must_use = "This function returns a new string, rather than mutating the argument, so calling it \
without using its output does nothing useful"]
pub fn escape(s: &str) -> String {
s.replace('_', r"\_")
.replace('*', r"\*")
.replace('[', r"\[")
.replace(']', r"\]")
.replace('(', r"\(")
.replace(')', r"\)")
.replace('~', r"\~")
.replace('`', r"\`")
.replace('>', r"\>")
.replace('#', r"\#")
.replace('+', r"\+")
.replace('-', r"\-")
.replace('=', r"\=")
.replace('|', r"\|")
.replace('{', r"\{")
.replace('}', r"\}")
.replace('.', r"\.")
.replace('!', r"\!")
const CHARS: [char; 18] =
['_', '*', '[', ']', '(', ')', '~', '`', '>', '#', '+', '-', '=', '|', '{', '}', '.', '!'];
s.chars().fold(String::with_capacity(s.len()), |mut s, c| {
if CHARS.contains(&c) {
s.push('\\');
}
s.push(c);
s
})
}
/// Escapes all markdown special characters specific for the inline link URL
@ -134,7 +126,13 @@ pub fn escape(s: &str) -> String {
#[must_use = "This function returns a new string, rather than mutating the argument, so calling it \
without using its output does nothing useful"]
pub fn escape_link_url(s: &str) -> String {
s.replace('`', r"\`").replace(')', r"\)")
s.chars().fold(String::with_capacity(s.len()), |mut s, c| {
if ['`', ')'].contains(&c) {
s.push('\\');
}
s.push(c);
s
})
}
/// Escapes all markdown special characters specific for the code block (``` and
@ -142,7 +140,13 @@ pub fn escape_link_url(s: &str) -> String {
#[must_use = "This function returns a new string, rather than mutating the argument, so calling it \
without using its output does nothing useful"]
pub fn escape_code(s: &str) -> String {
s.replace('\\', r"\\").replace('`', r"\`")
s.chars().fold(String::with_capacity(s.len()), |mut s, c| {
if ['`', '\\'].contains(&c) {
s.push('\\');
}
s.push(c);
s
})
}
#[must_use = "This function returns a new string, rather than mutating the argument, so calling it \

View file

@ -1,4 +1,4 @@
[toolchain]
channel = "nightly-2024-03-20"
channel = "nightly-2024-07-03"
components = ["rustfmt", "clippy"]
profile = "minimal"