mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-22 06:25:10 +01:00
Merge branch 'master' into master
This commit is contained in:
commit
fa08605c02
28 changed files with 791 additions and 291 deletions
385
Cargo.lock
generated
385
Cargo.lock
generated
|
@ -4,18 +4,18 @@ version = 3
|
|||
|
||||
[[package]]
|
||||
name = "addr2line"
|
||||
version = "0.22.0"
|
||||
version = "0.24.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678"
|
||||
checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1"
|
||||
dependencies = [
|
||||
"gimli",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "adler"
|
||||
version = "1.0.2"
|
||||
name = "adler2"
|
||||
version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
|
||||
checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627"
|
||||
|
||||
[[package]]
|
||||
name = "ahash"
|
||||
|
@ -84,9 +84,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "async-trait"
|
||||
version = "0.1.81"
|
||||
version = "0.1.83"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107"
|
||||
checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -110,15 +110,15 @@ checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
|
|||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.3.0"
|
||||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0"
|
||||
checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
|
||||
|
||||
[[package]]
|
||||
name = "axum"
|
||||
version = "0.7.5"
|
||||
version = "0.7.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3a6c9af12842a67734c9a2e355436e5d03b22383ed60cf13cd0c18fbfe3dcbcf"
|
||||
checksum = "504e3947307ac8326a5437504c517c4b56716c9d98fac0028c2acc7ca47d70ae"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"axum-core",
|
||||
|
@ -142,7 +142,7 @@ dependencies = [
|
|||
"serde_urlencoded",
|
||||
"sync_wrapper 1.0.1",
|
||||
"tokio",
|
||||
"tower 0.4.13",
|
||||
"tower",
|
||||
"tower-layer",
|
||||
"tower-service",
|
||||
"tracing",
|
||||
|
@ -150,9 +150,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "axum-core"
|
||||
version = "0.4.3"
|
||||
version = "0.4.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a15c63fd72d41492dc4f497196f5da1fb04fb7529e631d73630d1b491e47a2e3"
|
||||
checksum = "09f2bd6146b97ae3359fa0cc6d6b376d9539582c7b4220f041a33ec24c226199"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"bytes",
|
||||
|
@ -163,7 +163,7 @@ dependencies = [
|
|||
"mime",
|
||||
"pin-project-lite",
|
||||
"rustversion",
|
||||
"sync_wrapper 0.1.2",
|
||||
"sync_wrapper 1.0.1",
|
||||
"tower-layer",
|
||||
"tower-service",
|
||||
"tracing",
|
||||
|
@ -171,17 +171,17 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "backtrace"
|
||||
version = "0.3.73"
|
||||
version = "0.3.74"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a"
|
||||
checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a"
|
||||
dependencies = [
|
||||
"addr2line",
|
||||
"cc",
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"miniz_oxide",
|
||||
"object",
|
||||
"rustc-demangle",
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -235,6 +235,12 @@ version = "3.16.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c"
|
||||
|
||||
[[package]]
|
||||
name = "bytemuck"
|
||||
version = "1.19.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8334215b81e418a0a7bdb8ef0849474f40bb10c8b71f1c4ed315cff49f32494d"
|
||||
|
||||
[[package]]
|
||||
name = "byteorder"
|
||||
version = "1.5.0"
|
||||
|
@ -243,15 +249,15 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
|
|||
|
||||
[[package]]
|
||||
name = "bytes"
|
||||
version = "1.7.1"
|
||||
version = "1.7.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50"
|
||||
checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3"
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.1.14"
|
||||
version = "1.1.30"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "50d2eb3cd3d1bf4529e31c215ee6f93ec5a3d536d9f578f93d9d33ee19562932"
|
||||
checksum = "b16803a61b81d9eabb7eae2588776c4c1e584b738ede45fdbb4c972cec1e9945"
|
||||
dependencies = [
|
||||
"shlex",
|
||||
]
|
||||
|
@ -332,9 +338,9 @@ checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
|
|||
|
||||
[[package]]
|
||||
name = "cpufeatures"
|
||||
version = "0.2.13"
|
||||
version = "0.2.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "51e852e6dc9a5bed1fae92dd2375037bf2b768725bf3be87811edee3249d09ad"
|
||||
checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
@ -633,9 +639,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "futures-channel"
|
||||
version = "0.3.30"
|
||||
version = "0.3.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78"
|
||||
checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-sink",
|
||||
|
@ -643,15 +649,15 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "futures-core"
|
||||
version = "0.3.30"
|
||||
version = "0.3.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d"
|
||||
checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e"
|
||||
|
||||
[[package]]
|
||||
name = "futures-executor"
|
||||
version = "0.3.30"
|
||||
version = "0.3.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d"
|
||||
checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-task",
|
||||
|
@ -671,15 +677,15 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "futures-io"
|
||||
version = "0.3.30"
|
||||
version = "0.3.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1"
|
||||
checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6"
|
||||
|
||||
[[package]]
|
||||
name = "futures-macro"
|
||||
version = "0.3.30"
|
||||
version = "0.3.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac"
|
||||
checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -688,21 +694,21 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "futures-sink"
|
||||
version = "0.3.30"
|
||||
version = "0.3.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5"
|
||||
checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7"
|
||||
|
||||
[[package]]
|
||||
name = "futures-task"
|
||||
version = "0.3.30"
|
||||
version = "0.3.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004"
|
||||
checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988"
|
||||
|
||||
[[package]]
|
||||
name = "futures-util"
|
||||
version = "0.3.30"
|
||||
version = "0.3.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48"
|
||||
checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81"
|
||||
dependencies = [
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
|
@ -739,9 +745,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "gimli"
|
||||
version = "0.29.0"
|
||||
version = "0.31.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd"
|
||||
checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f"
|
||||
|
||||
[[package]]
|
||||
name = "h2"
|
||||
|
@ -886,9 +892,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "httparse"
|
||||
version = "1.9.4"
|
||||
version = "1.9.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9"
|
||||
checksum = "7d71d3574edd2771538b901e6549113b4006ece66150fb69c0fb6d9a2adae946"
|
||||
|
||||
[[package]]
|
||||
name = "httpdate"
|
||||
|
@ -925,9 +931,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "hyper-rustls"
|
||||
version = "0.27.2"
|
||||
version = "0.27.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5ee4be2c948921a1a5320b629c4193916ed787a7f7f293fd3f7f5a6c9de74155"
|
||||
checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333"
|
||||
dependencies = [
|
||||
"futures-util",
|
||||
"http",
|
||||
|
@ -960,9 +966,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "hyper-util"
|
||||
version = "0.1.7"
|
||||
version = "0.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cde7055719c54e36e95e8719f95883f22072a48ede39db7fc17a4e1d5281e9b9"
|
||||
checksum = "41296eb09f183ac68eec06e03cdbea2e759633d4067b2f6552fc2e009bcad08b"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"futures-channel",
|
||||
|
@ -973,16 +979,15 @@ dependencies = [
|
|||
"pin-project-lite",
|
||||
"socket2",
|
||||
"tokio",
|
||||
"tower 0.4.13",
|
||||
"tower-service",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "iana-time-zone"
|
||||
version = "0.1.60"
|
||||
version = "0.1.61"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141"
|
||||
checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220"
|
||||
dependencies = [
|
||||
"android_system_properties",
|
||||
"core-foundation-sys",
|
||||
|
@ -1065,9 +1070,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ipnet"
|
||||
version = "2.9.0"
|
||||
version = "2.10.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3"
|
||||
checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708"
|
||||
|
||||
[[package]]
|
||||
name = "is-terminal"
|
||||
|
@ -1106,9 +1111,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.158"
|
||||
version = "0.2.159"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439"
|
||||
checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5"
|
||||
|
||||
[[package]]
|
||||
name = "libsqlite3-sys"
|
||||
|
@ -1189,11 +1194,11 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
|
|||
|
||||
[[package]]
|
||||
name = "miniz_oxide"
|
||||
version = "0.7.4"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08"
|
||||
checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1"
|
||||
dependencies = [
|
||||
"adler",
|
||||
"adler2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1256,18 +1261,18 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "object"
|
||||
version = "0.36.3"
|
||||
version = "0.36.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "27b64972346851a39438c60b341ebc01bba47464ae329e55cf343eb93964efd9"
|
||||
checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.19.0"
|
||||
version = "1.20.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
|
||||
checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775"
|
||||
|
||||
[[package]]
|
||||
name = "openssl"
|
||||
|
@ -1315,9 +1320,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "parking"
|
||||
version = "2.2.0"
|
||||
version = "2.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae"
|
||||
checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba"
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot"
|
||||
|
@ -1337,7 +1342,7 @@ checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8"
|
|||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"redox_syscall 0.5.2",
|
||||
"redox_syscall",
|
||||
"smallvec",
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
@ -1356,18 +1361,18 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
|
|||
|
||||
[[package]]
|
||||
name = "pin-project"
|
||||
version = "1.1.5"
|
||||
version = "1.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3"
|
||||
checksum = "baf123a161dde1e524adf36f90bc5d8d3462824a9c43553ad07a8183161189ec"
|
||||
dependencies = [
|
||||
"pin-project-internal",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pin-project-internal"
|
||||
version = "1.1.5"
|
||||
version = "1.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965"
|
||||
checksum = "a4502d8515ca9f32f1fb543d987f63d95a14934883db45bdb48060b6b69257f8"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -1388,9 +1393,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
|
|||
|
||||
[[package]]
|
||||
name = "pkg-config"
|
||||
version = "0.3.30"
|
||||
version = "0.3.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec"
|
||||
checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2"
|
||||
|
||||
[[package]]
|
||||
name = "ppv-lite86"
|
||||
|
@ -1403,9 +1408,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "pretty_assertions"
|
||||
version = "1.4.0"
|
||||
version = "1.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "af7cee1a6c8a5b9208b3cb1061f10c0cb689087b3d8ce85fb9d2dd7a29b6ba66"
|
||||
checksum = "3ae130e2f271fbc2ac3a40fb1d07180839cdbbe443c7a27e1e3c13c5cac0116d"
|
||||
dependencies = [
|
||||
"diff",
|
||||
"yansi",
|
||||
|
@ -1447,18 +1452,18 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.86"
|
||||
version = "1.0.87"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77"
|
||||
checksum = "b3e4daa0dcf6feba26f985457cdf104d4b4256fc5a09547140f3631bb076b19a"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quinn"
|
||||
version = "0.11.3"
|
||||
version = "0.11.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b22d8e7369034b9a7132bc2008cac12f2013c8132b45e0554e6e20e2617f2156"
|
||||
checksum = "8c7c5fdde3cdae7203427dc4f0a68fe0ed09833edc525a03456b153b79828684"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"pin-project-lite",
|
||||
|
@ -1474,9 +1479,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "quinn-proto"
|
||||
version = "0.11.6"
|
||||
version = "0.11.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ba92fb39ec7ad06ca2582c0ca834dfeadcaf06ddfc8e635c80aa7e1c05315fdd"
|
||||
checksum = "fadfaed2cd7f389d0161bb73eeb07b7b78f8691047a6f3e73caaeae55310a4a6"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"rand",
|
||||
|
@ -1491,15 +1496,15 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "quinn-udp"
|
||||
version = "0.5.4"
|
||||
version = "0.5.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8bffec3605b73c6f1754535084a85229fa8a30f86014e6c81aeec4abb68b0285"
|
||||
checksum = "4fe68c2e9e1a1234e218683dbdf9f9dfcb094113c5ac2b938dfcb9bab4c4140b"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"once_cell",
|
||||
"socket2",
|
||||
"tracing",
|
||||
"windows-sys 0.52.0",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1571,27 +1576,18 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.4.1"
|
||||
version = "0.5.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c82cf8cff14456045f55ec4241383baeff27af886adb72ffb2162f99911de0fd"
|
||||
checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f"
|
||||
dependencies = [
|
||||
"bitflags 2.4.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.10.6"
|
||||
version = "1.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619"
|
||||
checksum = "38200e5ee88914975b69f657f0801b6f6dccafd44fd9326302a4aaeecfacb1d8"
|
||||
dependencies = [
|
||||
"aho-corasick 1.1.2",
|
||||
"memchr",
|
||||
|
@ -1601,9 +1597,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "regex-automata"
|
||||
version = "0.4.7"
|
||||
version = "0.4.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df"
|
||||
checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3"
|
||||
dependencies = [
|
||||
"aho-corasick 1.1.2",
|
||||
"memchr",
|
||||
|
@ -1612,15 +1608,15 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.8.4"
|
||||
version = "0.8.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b"
|
||||
checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
|
||||
|
||||
[[package]]
|
||||
name = "reqwest"
|
||||
version = "0.12.7"
|
||||
version = "0.12.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f8f4955649ef5c38cc7f9e8aa41761d48fb9677197daea9984dc54f56aad5e63"
|
||||
checksum = "f713147fbe92361e52392c73b8c9e48c04c6625bce969ef54dc901e58e042a7b"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"bytes",
|
||||
|
@ -1668,6 +1664,15 @@ dependencies = [
|
|||
"windows-registry",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rgb"
|
||||
version = "0.8.50"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "57397d16646700483b67d2dd6511d79318f9d057fdbd21a4066aeac8b41d310a"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ring"
|
||||
version = "0.17.8"
|
||||
|
@ -1709,18 +1714,18 @@ checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152"
|
|||
|
||||
[[package]]
|
||||
name = "rustc_version"
|
||||
version = "0.4.0"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366"
|
||||
checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92"
|
||||
dependencies = [
|
||||
"semver",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustix"
|
||||
version = "0.38.34"
|
||||
version = "0.38.37"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f"
|
||||
checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811"
|
||||
dependencies = [
|
||||
"bitflags 2.4.2",
|
||||
"errno",
|
||||
|
@ -1731,9 +1736,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "rustls"
|
||||
version = "0.23.12"
|
||||
version = "0.23.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c58f8c84392efc0a126acce10fa59ff7b3d2ac06ab451a33f2741989b806b044"
|
||||
checksum = "415d9944693cb90382053259f89fbb077ea730ad7273047ec63b19bc9b160ba8"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
"ring",
|
||||
|
@ -1745,9 +1750,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "rustls-native-certs"
|
||||
version = "0.7.2"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "04182dffc9091a404e0fc069ea5cd60e5b866c3adf881eff99a32d048242dffa"
|
||||
checksum = "fcaf18a4f2be7326cd874a5fa579fae794320a0f388d365dca7e480e55f83f8a"
|
||||
dependencies = [
|
||||
"openssl-probe",
|
||||
"rustls-pemfile",
|
||||
|
@ -1758,25 +1763,24 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "rustls-pemfile"
|
||||
version = "2.1.3"
|
||||
version = "2.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "196fe16b00e106300d3e45ecfcb764fa292a535d7326a29a5875c579c7417425"
|
||||
checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"rustls-pki-types",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustls-pki-types"
|
||||
version = "1.8.0"
|
||||
version = "1.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fc0a2ce646f8655401bb81e7927b812614bd5d91dbc968696be50603510fcaf0"
|
||||
checksum = "0e696e35370c65c9c541198af4543ccd580cf17fc25d8e05c5a242b202488c55"
|
||||
|
||||
[[package]]
|
||||
name = "rustls-webpki"
|
||||
version = "0.102.6"
|
||||
version = "0.102.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e6b52d4fda176fd835fdc55a835d4a89b8499cad995885a21149d5ad62f852e"
|
||||
checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9"
|
||||
dependencies = [
|
||||
"ring",
|
||||
"rustls-pki-types",
|
||||
|
@ -1797,11 +1801,11 @@ checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f"
|
|||
|
||||
[[package]]
|
||||
name = "schannel"
|
||||
version = "0.1.23"
|
||||
version = "0.1.26"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534"
|
||||
checksum = "01227be5826fa0690321a2ba6c5cd57a19cf3f6a09e76973b58e61de6ab9d1c1"
|
||||
dependencies = [
|
||||
"windows-sys 0.52.0",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1825,9 +1829,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "security-framework-sys"
|
||||
version = "2.11.1"
|
||||
version = "2.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "75da29fe9b9b08fe9d6b22b5b4bcbc75d8db3aa31e639aa56bb62e9d46bfceaf"
|
||||
checksum = "ea4a292869320c0272d7bc55a5a6aafaff59b4f63404a003887b679a2e05b4b6"
|
||||
dependencies = [
|
||||
"core-foundation-sys",
|
||||
"libc",
|
||||
|
@ -1841,9 +1845,9 @@ checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b"
|
|||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.209"
|
||||
version = "1.0.210"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "99fce0ffe7310761ca6bf9faf5115afbc19688edd00171d81b1bb1b116c63e09"
|
||||
checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
@ -1860,9 +1864,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.209"
|
||||
version = "1.0.210"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a5831b979fd7b5439637af1752d535ff49f4860c0f341d1baeb6faf0f4242170"
|
||||
checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -1871,9 +1875,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.127"
|
||||
version = "1.0.128"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8043c06d9f82bd7271361ed64f415fe5e12a77fdb52e573e7f06a516dea329ad"
|
||||
checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"memchr",
|
||||
|
@ -1990,9 +1994,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "sqlformat"
|
||||
version = "0.2.4"
|
||||
version = "0.2.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f895e3734318cc55f1fe66258926c9b910c124d47520339efecbb6c59cec7c1f"
|
||||
checksum = "7bba3a93db0cc4f7bdece8bb09e77e2e785c20bfebf79eb8340ed80708048790"
|
||||
dependencies = [
|
||||
"nom",
|
||||
"unicode_categories",
|
||||
|
@ -2000,9 +2004,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "sqlx"
|
||||
version = "0.8.1"
|
||||
version = "0.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fcfa89bea9500db4a0d038513d7a060566bfc51d46d1c014847049a45cce85e8"
|
||||
checksum = "93334716a037193fac19df402f8571269c84a00852f6a7066b5d2616dcd64d3e"
|
||||
dependencies = [
|
||||
"sqlx-core",
|
||||
"sqlx-macros",
|
||||
|
@ -2012,9 +2016,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "sqlx-core"
|
||||
version = "0.8.1"
|
||||
version = "0.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d06e2f2bd861719b1f3f0c7dbe1d80c30bf59e76cf019f07d9014ed7eefb8e08"
|
||||
checksum = "d4d8060b456358185f7d50c55d9b5066ad956956fddec42ee2e8567134a8936e"
|
||||
dependencies = [
|
||||
"atoi",
|
||||
"byteorder",
|
||||
|
@ -2055,9 +2059,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "sqlx-macros"
|
||||
version = "0.8.1"
|
||||
version = "0.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2f998a9defdbd48ed005a89362bd40dd2117502f15294f61c8d47034107dbbdc"
|
||||
checksum = "cac0692bcc9de3b073e8d747391827297e075c7710ff6276d9f7a1f3d58c6657"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -2068,9 +2072,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "sqlx-macros-core"
|
||||
version = "0.8.1"
|
||||
version = "0.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3d100558134176a2629d46cec0c8891ba0be8910f7896abfdb75ef4ab6f4e7ce"
|
||||
checksum = "1804e8a7c7865599c9c79be146dc8a9fd8cc86935fa641d3ea58e5f0688abaa5"
|
||||
dependencies = [
|
||||
"dotenvy",
|
||||
"either",
|
||||
|
@ -2093,9 +2097,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "sqlx-postgres"
|
||||
version = "0.8.1"
|
||||
version = "0.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9734dbce698c67ecf67c442f768a5e90a49b2a4d61a9f1d59f73874bd4cf0710"
|
||||
checksum = "6fa91a732d854c5d7726349bb4bb879bb9478993ceb764247660aee25f67c2f8"
|
||||
dependencies = [
|
||||
"atoi",
|
||||
"base64 0.22.1",
|
||||
|
@ -2131,9 +2135,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "sqlx-sqlite"
|
||||
version = "0.8.1"
|
||||
version = "0.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a75b419c3c1b1697833dd927bdc4c6545a620bc1bbafabd44e1efbe9afcd337e"
|
||||
checksum = "d5b2cf34a45953bfd3daaf3db0f7a7878ab9b7a6b91b422d24a7a9e4c857b680"
|
||||
dependencies = [
|
||||
"atoi",
|
||||
"flume",
|
||||
|
@ -2275,7 +2279,7 @@ dependencies = [
|
|||
"tokio",
|
||||
"tokio-stream",
|
||||
"tokio-util",
|
||||
"tower 0.5.0",
|
||||
"tower",
|
||||
"tower-http",
|
||||
"url",
|
||||
]
|
||||
|
@ -2302,6 +2306,7 @@ dependencies = [
|
|||
"pretty_env_logger",
|
||||
"rc-box",
|
||||
"reqwest",
|
||||
"rgb",
|
||||
"ron",
|
||||
"serde",
|
||||
"serde_json",
|
||||
|
@ -2341,9 +2346,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "tempfile"
|
||||
version = "3.12.0"
|
||||
version = "3.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64"
|
||||
checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"fastrand",
|
||||
|
@ -2363,18 +2368,18 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.63"
|
||||
version = "1.0.64"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724"
|
||||
checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84"
|
||||
dependencies = [
|
||||
"thiserror-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "1.0.63"
|
||||
version = "1.0.64"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261"
|
||||
checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -2398,9 +2403,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
|||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.39.3"
|
||||
version = "1.40.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9babc99b9923bfa4804bd74722ff02c0381021eafa4db9949217e3be8e84fff5"
|
||||
checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998"
|
||||
dependencies = [
|
||||
"backtrace",
|
||||
"bytes",
|
||||
|
@ -2447,9 +2452,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "tokio-stream"
|
||||
version = "0.1.15"
|
||||
version = "0.1.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af"
|
||||
checksum = "4f4e6ce100d0eb49a2734f8c0812bcd324cf357d21810932c5df6b96ef2b86f1"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"pin-project-lite",
|
||||
|
@ -2458,9 +2463,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "tokio-util"
|
||||
version = "0.7.11"
|
||||
version = "0.7.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1"
|
||||
checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"futures-core",
|
||||
|
@ -2471,30 +2476,20 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "tower"
|
||||
version = "0.4.13"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c"
|
||||
checksum = "2873938d487c3cfb9aed7546dc9f2711d867c9f90c46b889989a2cb84eba6b4f"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-util",
|
||||
"pin-project",
|
||||
"pin-project-lite",
|
||||
"sync_wrapper 0.1.2",
|
||||
"tokio",
|
||||
"tower-layer",
|
||||
"tower-service",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tower"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "36b837f86b25d7c0d7988f00a54e74739be6477f2aac6201b8f429a7569991b7"
|
||||
dependencies = [
|
||||
"tower-layer",
|
||||
"tower-service",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tower-http"
|
||||
version = "0.5.2"
|
||||
|
@ -2579,30 +2574,30 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "unicode-bidi"
|
||||
version = "0.3.15"
|
||||
version = "0.3.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75"
|
||||
checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.12"
|
||||
version = "1.0.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
|
||||
checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-normalization"
|
||||
version = "0.1.23"
|
||||
version = "0.1.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5"
|
||||
checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956"
|
||||
dependencies = [
|
||||
"tinyvec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-properties"
|
||||
version = "0.1.2"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "52ea75f83c0137a9b98608359a5f1af8144876eb67bcb1ce837368e906a9f524"
|
||||
checksum = "e70f2a8b45122e719eb623c01822704c4e0907e7e426a05927e1a1cfff5b75d0"
|
||||
|
||||
[[package]]
|
||||
name = "unicode_categories"
|
||||
|
@ -2678,9 +2673,9 @@ checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b"
|
|||
|
||||
[[package]]
|
||||
name = "wasm-bindgen"
|
||||
version = "0.2.93"
|
||||
version = "0.2.95"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5"
|
||||
checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"once_cell",
|
||||
|
@ -2689,9 +2684,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-backend"
|
||||
version = "0.2.93"
|
||||
version = "0.2.95"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b"
|
||||
checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358"
|
||||
dependencies = [
|
||||
"bumpalo",
|
||||
"log",
|
||||
|
@ -2716,9 +2711,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro"
|
||||
version = "0.2.93"
|
||||
version = "0.2.95"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf"
|
||||
checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"wasm-bindgen-macro-support",
|
||||
|
@ -2726,9 +2721,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro-support"
|
||||
version = "0.2.93"
|
||||
version = "0.2.95"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836"
|
||||
checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -2739,15 +2734,15 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-shared"
|
||||
version = "0.2.93"
|
||||
version = "0.2.95"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484"
|
||||
checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d"
|
||||
|
||||
[[package]]
|
||||
name = "wasm-streams"
|
||||
version = "0.4.0"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b65dc4c90b63b118468cf747d8bf3566c1913ef60be765b5730ead9e0a3ba129"
|
||||
checksum = "4e072d4e72f700fb3443d8fe94a39315df013eef1104903cdb0a2abd322bbecd"
|
||||
dependencies = [
|
||||
"futures-util",
|
||||
"js-sys",
|
||||
|
@ -2768,20 +2763,20 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "webpki-roots"
|
||||
version = "0.26.3"
|
||||
version = "0.26.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bd7c23921eeb1713a4e851530e9b9756e4fb0e89978582942612524cf09f01cd"
|
||||
checksum = "841c67bff177718f1d4dfefde8d8f0e78f9b6589319ba88312f567fc5841a958"
|
||||
dependencies = [
|
||||
"rustls-pki-types",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "whoami"
|
||||
version = "1.5.1"
|
||||
version = "1.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a44ab49fad634e88f55bf8f9bb3abd2f27d7204172a112c7c9987e01c1c94ea9"
|
||||
checksum = "372d5b87f58ec45c384ba03563b03544dc5fadc3983e434b286913f5b4a9bb6d"
|
||||
dependencies = [
|
||||
"redox_syscall 0.4.1",
|
||||
"redox_syscall",
|
||||
"wasite",
|
||||
]
|
||||
|
||||
|
@ -2791,7 +2786,7 @@ version = "0.1.9"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
|
||||
dependencies = [
|
||||
"windows-sys 0.48.0",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2998,9 +2993,9 @@ checksum = "9d422e8e38ec76e2f06ee439ccc765e9c6a9638b9e7c9f2e8255e4d41e8bd852"
|
|||
|
||||
[[package]]
|
||||
name = "yansi"
|
||||
version = "0.5.1"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec"
|
||||
checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049"
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy"
|
||||
|
|
|
@ -42,6 +42,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- Add `BusinessMessagesDeleted` struct
|
||||
- Add `BusinessConnection`, `BusinessMessage`, `EditedBusinessMessage` and `DeletedBusinessMessages` variants to `UpdateKind` enum
|
||||
|
||||
- `ApiError::BotKickedFromChannel` ([#1157][pr1157])
|
||||
|
||||
[pr1157]: https://github.com/teloxide/teloxide/pull/1157
|
||||
|
||||
### Changed
|
||||
|
||||
- `MaybeAnonymousUser` type introduced, which replaced `PollAnswer::voter: Voter` and `MessageReactionUpdated::{user, actor_chat}` in `MessageReactionUpdated`([#1134][pr1134])
|
||||
|
@ -49,6 +53,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- MSRV (Minimal Supported Rust Version) was bumped from `1.70.0` to `1.80.0`
|
||||
- Some dependencies was bumped: `reqwest` to `0.12.7` and `ron` to `0.8.1`
|
||||
- `tokio` version was explicitly specified as `1.39` and feature `io-util` was enabled for it
|
||||
- `[u8; 3]` sometimes used for RGB values was replaced with dedicated `Rgb` struct: ([#1151][pr1151])
|
||||
- `serde_rgb` module from `types.rs` file was removed
|
||||
- `CreateForumTopic`, `ForumTopicCreated` and `ForumTopic` structs now use `Rgb` instead of `[u8; 3]` for `icon_color` field
|
||||
- Added `rgb` crate dependency to Cargo.toml
|
||||
- Added `Rgb` struct with `From` implementation for `RGB8` type from popular `rgb` crate
|
||||
|
||||
- Support for TBA 7.2 ([#1146](pr1146))
|
||||
- Remove `flags` field from `StickerSet` struct
|
||||
|
@ -56,10 +65,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- Wrap `Public` variant of `ChatKind` in `Box`
|
||||
- Replaced `user_ids` with `users` in `UsersShared` struct
|
||||
|
||||
- Remove a useless generic type in the `KeyboardMarkup::selective` function ([#1176][pr1176])
|
||||
|
||||
[pr1131]: https://github.com/teloxide/teloxide/pull/1131
|
||||
[pr1134]: https://github.com/teloxide/teloxide/pull/1134
|
||||
[pr1146]: https://github.com/teloxide/teloxide/pull/1146
|
||||
[pr1147]: https://github.com/teloxide/teloxide/pull/1147
|
||||
[pr1151]: https://github.com/teloxide/teloxide/pull/1151
|
||||
[pr1176]: https://github.com/teloxide/teloxide/pull/1176
|
||||
|
||||
### Removed
|
||||
|
||||
|
|
|
@ -76,6 +76,7 @@ rc-box = "1.1.1"
|
|||
chrono = { version = "0.4.32", default-features = false }
|
||||
either = "1.6.1"
|
||||
bitflags = { version = "1.2" }
|
||||
rgb = "0.8.48"
|
||||
|
||||
vecrem = { version = "0.1", optional = true }
|
||||
|
||||
|
|
|
@ -2754,9 +2754,11 @@ Schema(
|
|||
),
|
||||
Param(
|
||||
name: "icon_color",
|
||||
// FIXME: use an Rgb or something
|
||||
ty: u32,
|
||||
descr: Doc(md: "Color of the topic icon in RGB format. Currently, must be one of 7322096 (0x6FB9F0), 16766590 (0xFFD67E), 13338331 (0xCB86DB), 9367192 (0x8EEE98), 16749490 (0xFF93B2), or 16478047 (0xFB6F5F)")
|
||||
ty: RawTy("Rgb"),
|
||||
descr: Doc(
|
||||
md: "Color of the topic icon in RGB format. Currently, must be one of 7322096 (`0x6FB9F0`), 16766590 (`0xFFD67E`), 13338331 (`0xCB86DB`), 9367192 (`0x8EEE98`), 16749490 (`0xFF93B2`), or 16478047 (`0xFB6F5F`). To construct color from these values use [`Rgb::from_u32`]",
|
||||
md_links: {"`Rgb::from_u32`": "crate::types::Rgb::from_u32"}
|
||||
)
|
||||
),
|
||||
Param(
|
||||
name: "icon_custom_emoji_id",
|
||||
|
|
|
@ -671,7 +671,7 @@ trait ErasableRequester<'a> {
|
|||
&self,
|
||||
chat_id: Recipient,
|
||||
name: String,
|
||||
icon_color: u32,
|
||||
icon_color: Rgb,
|
||||
icon_custom_emoji_id: String,
|
||||
) -> ErasedRequest<'a, CreateForumTopic, Self::Err>;
|
||||
|
||||
|
@ -1506,7 +1506,7 @@ where
|
|||
&self,
|
||||
chat_id: Recipient,
|
||||
name: String,
|
||||
icon_color: u32,
|
||||
icon_color: Rgb,
|
||||
icon_custom_emoji_id: String,
|
||||
) -> ErasedRequest<'a, CreateForumTopic, Self::Err> {
|
||||
Requester::create_forum_topic(self, chat_id, name, icon_color, icon_custom_emoji_id).erase()
|
||||
|
|
|
@ -6,7 +6,7 @@ use crate::{
|
|||
requests::{JsonRequest, MultipartRequest},
|
||||
types::{
|
||||
BotCommand, BusinessConnectionId, ChatId, ChatPermissions, InlineQueryResult, InputFile,
|
||||
InputMedia, InputSticker, LabeledPrice, MessageId, Recipient, StickerFormat, ThreadId,
|
||||
InputMedia, InputSticker, LabeledPrice, MessageId, Recipient, Rgb, StickerFormat, ThreadId,
|
||||
UserId,
|
||||
},
|
||||
Bot,
|
||||
|
@ -686,7 +686,7 @@ impl Requester for Bot {
|
|||
&self,
|
||||
chat_id: C,
|
||||
name: N,
|
||||
icon_color: u32,
|
||||
icon_color: Rgb,
|
||||
icon_custom_emoji_id: I,
|
||||
) -> Self::CreateForumTopic
|
||||
where
|
||||
|
|
|
@ -644,6 +644,15 @@ impl_api_error! {
|
|||
/// [`SendMessage`]: crate::payloads::SendMessage
|
||||
BotKickedFromSupergroup = "Forbidden: bot was kicked from the supergroup chat",
|
||||
|
||||
/// Occurs when bot tries to do something in a channel the bot was
|
||||
/// kicked from.
|
||||
///
|
||||
/// May happen in methods:
|
||||
/// 1. [`SendMessage`]
|
||||
///
|
||||
/// [`SendMessage`]: crate::payloads::SendMessage
|
||||
BotKickedFromChannel = "Forbidden: bot was kicked from the channel chat",
|
||||
|
||||
/// Occurs when bot tries to send a message to a deactivated user (i.e. a
|
||||
/// user that was banned by telegram).
|
||||
///
|
||||
|
|
|
@ -949,11 +949,11 @@ macro_rules! requester_forward {
|
|||
(@method create_forum_topic $body:ident $ty:ident) => {
|
||||
type CreateForumTopic = $ty![CreateForumTopic];
|
||||
|
||||
fn create_forum_topic<C, N, I>(&self, chat_id: C, name: N, icon_color: u32, icon_custom_emoji_id: I) -> Self::CreateForumTopic where C: Into<Recipient>,
|
||||
fn create_forum_topic<C, N, I>(&self, chat_id: C, name: N, icon_color: Rgb, icon_custom_emoji_id: I) -> Self::CreateForumTopic where C: Into<Recipient>,
|
||||
N: Into<String>,
|
||||
I: Into<String> {
|
||||
let this = self;
|
||||
$body!(create_forum_topic this (chat_id: C, name: N, icon_color: u32, icon_custom_emoji_id: I))
|
||||
$body!(create_forum_topic this (chat_id: C, name: N, icon_color: Rgb, icon_custom_emoji_id: I))
|
||||
}
|
||||
};
|
||||
(@method edit_forum_topic $body:ident $ty:ident) => {
|
||||
|
|
|
@ -223,6 +223,9 @@ fn params(params: impl Iterator<Item = impl Borrow<Param>>) -> String {
|
|||
{
|
||||
"\n #[serde(flatten)]"
|
||||
}
|
||||
Type::ArrayOf(b) if **b == Type::RawTy("MessageId".to_string()) => {
|
||||
"\n #[serde(with = \"crate::types::vec_msg_id_as_vec_int\")]"
|
||||
}
|
||||
_ => "",
|
||||
};
|
||||
let with = match ty {
|
||||
|
|
|
@ -17,6 +17,7 @@ impl_payload! {
|
|||
/// Unique identifier for the chat where the original message was sent (or channel username in the format `@channelusername`)
|
||||
pub from_chat_id: Recipient [into],
|
||||
/// Identifiers of 1-100 messages in the chat _from\_chat\_id_ to copy. The identifiers must be specified in a strictly increasing order.
|
||||
#[serde(with = "crate::types::vec_msg_id_as_vec_int")]
|
||||
pub message_ids: Vec<MessageId> [collect],
|
||||
}
|
||||
optional {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::types::{ForumTopic, Recipient};
|
||||
use crate::types::{ForumTopic, Recipient, Rgb};
|
||||
|
||||
impl_payload! {
|
||||
/// Use this method to create a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the _can\_manage\_topics_ administrator rights. Returns information about the created topic as a `ForumTopic` object.
|
||||
|
@ -13,8 +13,10 @@ impl_payload! {
|
|||
pub chat_id: Recipient [into],
|
||||
/// Topic name, 1-128 characters
|
||||
pub name: String [into],
|
||||
/// Color of the topic icon in RGB format. Currently, must be one of 7322096 (0x6FB9F0), 16766590 (0xFFD67E), 13338331 (0xCB86DB), 9367192 (0x8EEE98), 16749490 (0xFF93B2), or 16478047 (0xFB6F5F)
|
||||
pub icon_color: u32,
|
||||
/// Color of the topic icon in RGB format. Currently, must be one of 7322096 (`0x6FB9F0`), 16766590 (`0xFFD67E`), 13338331 (`0xCB86DB`), 9367192 (`0x8EEE98`), 16749490 (`0xFF93B2`), or 16478047 (`0xFB6F5F`). To construct color from these values use [`Rgb::from_u32`]
|
||||
///
|
||||
/// [`Rgb::from_u32`]: crate::types::Rgb::from_u32
|
||||
pub icon_color: Rgb,
|
||||
/// Unique identifier of the custom emoji shown as the topic icon. Use `getForumTopicIconStickers` to get all allowed custom emoji identifiers.
|
||||
pub icon_custom_emoji_id: String [into],
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ impl_payload! {
|
|||
/// Identifiers of 1-100 messages to delete. See [`DeleteMessage`] for limitations on which messages can be deleted
|
||||
///
|
||||
/// [`DeleteMessage`]: crate::payloads::DeleteMessage
|
||||
#[serde(with = "crate::types::vec_msg_id_as_vec_int")]
|
||||
pub message_ids: Vec<MessageId> [collect],
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ impl_payload! {
|
|||
/// Unique identifier for the chat where the original message was sent (or channel username in the format `@channelusername`)
|
||||
pub from_chat_id: Recipient [into],
|
||||
/// A JSON-serialized list of 1-100 identifiers of messages in the chat _from\_chat\_id_ to forward. The identifiers must be specified in a strictly increasing order.
|
||||
#[serde(with = "crate::types::vec_msg_id_as_vec_int")]
|
||||
pub message_ids: Vec<MessageId> [collect],
|
||||
}
|
||||
optional {
|
||||
|
|
|
@ -702,7 +702,7 @@ pub trait Requester {
|
|||
&self,
|
||||
chat_id: C,
|
||||
name: N,
|
||||
icon_color: u32,
|
||||
icon_color: Rgb,
|
||||
icon_custom_emoji_id: I,
|
||||
) -> Self::CreateForumTopic
|
||||
where
|
||||
|
|
|
@ -374,6 +374,17 @@ impl Serializer for PartSerializer {
|
|||
Ok(JsonPartSerializer { buf: String::new(), state: PartSerializerStructState::Empty })
|
||||
}
|
||||
|
||||
fn serialize_newtype_struct<T: ?Sized>(
|
||||
self,
|
||||
_: &'static str,
|
||||
value: &T,
|
||||
) -> Result<Self::Ok, Self::Error>
|
||||
where
|
||||
T: Serialize,
|
||||
{
|
||||
value.serialize(self)
|
||||
}
|
||||
|
||||
// Unimplemented
|
||||
|
||||
fn serialize_none(self) -> Result<Self::Ok, Self::Error> {
|
||||
|
@ -391,17 +402,6 @@ impl Serializer for PartSerializer {
|
|||
unimplemented!()
|
||||
}
|
||||
|
||||
fn serialize_newtype_struct<T: ?Sized>(
|
||||
self,
|
||||
_: &'static str,
|
||||
_: &T,
|
||||
) -> Result<Self::Ok, Self::Error>
|
||||
where
|
||||
T: Serialize,
|
||||
{
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn serialize_newtype_variant<T: ?Sized>(
|
||||
self,
|
||||
_name: &'static str,
|
||||
|
|
|
@ -128,6 +128,7 @@ pub use reply_markup::*;
|
|||
pub use reply_parameters::*;
|
||||
pub use request_id::*;
|
||||
pub use response_parameters::*;
|
||||
pub use rgb::*;
|
||||
pub use sent_web_app_message::*;
|
||||
pub use shared_user::*;
|
||||
pub use shipping_address::*;
|
||||
|
@ -262,6 +263,7 @@ mod reply_markup;
|
|||
mod reply_parameters;
|
||||
mod request_id;
|
||||
mod response_parameters;
|
||||
mod rgb;
|
||||
mod sent_web_app_message;
|
||||
mod shared_user;
|
||||
mod shipping_address;
|
||||
|
@ -545,66 +547,34 @@ pub(crate) mod option_msg_id_as_int {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) mod serde_rgb {
|
||||
use serde::{de::Visitor, Deserializer, Serializer};
|
||||
pub(crate) mod vec_msg_id_as_vec_int {
|
||||
use crate::types::MessageId;
|
||||
|
||||
pub fn serialize<S: Serializer>(&this: &[u8; 3], s: S) -> Result<S::Ok, S::Error> {
|
||||
s.serialize_u32(to_u32(this))
|
||||
}
|
||||
use serde::{ser::SerializeSeq, Serializer};
|
||||
|
||||
pub fn deserialize<'de, D: Deserializer<'de>>(d: D) -> Result<[u8; 3], D::Error> {
|
||||
struct V;
|
||||
|
||||
impl Visitor<'_> for V {
|
||||
type Value = [u8; 3];
|
||||
|
||||
fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
formatter.write_str("an integer represeting an RGB color")
|
||||
}
|
||||
|
||||
fn visit_u32<E>(self, v: u32) -> Result<Self::Value, E>
|
||||
where
|
||||
E: serde::de::Error,
|
||||
{
|
||||
Ok(from_u32(v))
|
||||
}
|
||||
|
||||
fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
|
||||
where
|
||||
E: serde::de::Error,
|
||||
{
|
||||
self.visit_u32(v.try_into().map_err(|_| E::custom("rgb value doesn't fit u32"))?)
|
||||
}
|
||||
pub(crate) fn serialize<S>(msg_ids: &Vec<MessageId>, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: Serializer,
|
||||
{
|
||||
let mut seq = serializer.serialize_seq(Some(msg_ids.len()))?;
|
||||
for e in msg_ids {
|
||||
seq.serialize_element(&e.0)?;
|
||||
}
|
||||
d.deserialize_u32(V)
|
||||
}
|
||||
|
||||
fn to_u32([r, g, b]: [u8; 3]) -> u32 {
|
||||
u32::from_be_bytes([0, r, g, b])
|
||||
}
|
||||
|
||||
fn from_u32(rgb: u32) -> [u8; 3] {
|
||||
let [_, r, g, b] = rgb.to_be_bytes();
|
||||
[r, g, b]
|
||||
seq.end()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn bytes() {
|
||||
assert_eq!(to_u32([0xAA, 0xBB, 0xCC]), 0x00AABBCC);
|
||||
assert_eq!(from_u32(0x00AABBCC), [0xAA, 0xBB, 0xCC]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn json() {
|
||||
#[derive(Debug, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
|
||||
fn test() {
|
||||
#[derive(serde::Serialize)]
|
||||
struct Struct {
|
||||
#[serde(with = "self")]
|
||||
color: [u8; 3],
|
||||
#[serde(with = "crate::types::vec_msg_id_as_vec_int")]
|
||||
msg_ids: Vec<MessageId>,
|
||||
}
|
||||
|
||||
let json = format!(r#"{{"color":{}}}"#, 0x00AABBCC);
|
||||
let Struct { color } = serde_json::from_str(&json).unwrap();
|
||||
|
||||
assert_eq!(color, [0xAA, 0xBB, 0xCC])
|
||||
{
|
||||
let s = Struct { msg_ids: vec![MessageId(1), MessageId(2)] };
|
||||
let json = serde_json::to_string(&s).unwrap();
|
||||
assert_eq!(json, "{\"msg_ids\":[1,2]}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use crate::types::ThreadId;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::types::{Rgb, ThreadId};
|
||||
|
||||
/// This object represents a forum topic.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#forumtopiccreated).
|
||||
|
@ -16,9 +16,7 @@ pub struct ForumTopic {
|
|||
pub name: String,
|
||||
|
||||
/// Color of the topic icon in RGB format.
|
||||
// FIXME: use/add a specialized rgb color type?
|
||||
#[serde(with = "crate::types::serde_rgb")]
|
||||
pub icon_color: [u8; 3],
|
||||
pub icon_color: Rgb,
|
||||
|
||||
/// Unique identifier of the custom emoji shown as the topic icon.
|
||||
// FIXME: CustomEmojiId
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::types::Rgb;
|
||||
|
||||
/// This object represents a service message about a new forum topic created in
|
||||
/// the chat.
|
||||
///
|
||||
|
@ -11,9 +13,7 @@ pub struct ForumTopicCreated {
|
|||
pub name: String,
|
||||
|
||||
/// Color of the topic icon in RGB format.
|
||||
// FIXME: use/add a specialized rgb color type?
|
||||
#[serde(with = "crate::types::serde_rgb")]
|
||||
pub icon_color: [u8; 3],
|
||||
pub icon_color: Rgb,
|
||||
|
||||
/// Unique identifier of the custom emoji shown as the topic icon.
|
||||
// FIXME: CustomEmojiId
|
||||
|
@ -22,7 +22,7 @@ pub struct ForumTopicCreated {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::types::ForumTopicCreated;
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn deserialization() {
|
||||
|
@ -32,7 +32,7 @@ mod tests {
|
|||
let event = serde_json::from_str::<ForumTopicCreated>(json).unwrap();
|
||||
|
||||
assert_eq!(event.name, "???");
|
||||
assert_eq!(event.icon_color, [0x8E, 0xEE, 0x98]);
|
||||
assert_eq!(event.icon_color, Rgb { r: 0x8E, g: 0xEE, b: 0x98 });
|
||||
assert_eq!(event.icon_custom_emoji_id.as_deref(), Some("5312536423851630001"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ pub struct InlineQueryResultsButton {
|
|||
}
|
||||
|
||||
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
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
|
||||
|
@ -44,3 +45,19 @@ pub enum InlineQueryResultsButtonKind {
|
|||
/// [switch_inline]: https://core.telegram.org/bots/api#inlinekeyboardmarkup
|
||||
StartParameter(String),
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::types::{InlineQueryResultsButton, InlineQueryResultsButtonKind};
|
||||
|
||||
#[test]
|
||||
fn inline_query_results_button() {
|
||||
let button = InlineQueryResultsButton {
|
||||
text: "test".into(),
|
||||
kind: InlineQueryResultsButtonKind::StartParameter("bot".into()),
|
||||
};
|
||||
let expected = r#"{"text":"test","start_parameter":"bot"}"#;
|
||||
let actual = serde_json::to_string(&button).unwrap();
|
||||
assert_eq!(expected, actual);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1816,6 +1816,13 @@ impl Message {
|
|||
}
|
||||
}
|
||||
|
||||
/// Implemented for syntax sugar, see issue <https://github.com/teloxide/teloxide/issues/1143>
|
||||
impl From<Message> for MessageId {
|
||||
fn from(message: Message) -> MessageId {
|
||||
message.id
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use chrono::DateTime;
|
||||
|
|
|
@ -125,7 +125,7 @@ impl KeyboardMarkup {
|
|||
/// Sets [`selective`] to `true`.
|
||||
///
|
||||
/// [`selective`]: KeyboardMarkup::selective
|
||||
pub fn selective<T>(self) -> Self {
|
||||
pub fn selective(self) -> Self {
|
||||
Self { selective: true, ..self }
|
||||
}
|
||||
}
|
||||
|
@ -146,6 +146,23 @@ mod tests {
|
|||
"selective": false
|
||||
}
|
||||
"#;
|
||||
serde_json::from_str::<KeyboardMarkup>(data).unwrap();
|
||||
assert!(serde_json::from_str::<KeyboardMarkup>(data).is_ok())
|
||||
}
|
||||
#[test]
|
||||
fn serialize() {
|
||||
let keyboard = vec![vec![
|
||||
KeyboardButton::new("a"),
|
||||
KeyboardButton::new("b"),
|
||||
KeyboardButton::new("c"),
|
||||
KeyboardButton::new("d"),
|
||||
]];
|
||||
let keyboard_markup = KeyboardMarkup::new(keyboard)
|
||||
.persistent()
|
||||
.resize_keyboard()
|
||||
.selective()
|
||||
.one_time_keyboard();
|
||||
let expected = r#"{"keyboard":[[{"text":"a"},{"text":"b"},{"text":"c"},{"text":"d"}]],"is_persistent":true,"resize_keyboard":true,"one_time_keyboard":true,"selective":true}"#;
|
||||
|
||||
assert!(serde_json::ser::to_string(&keyboard_markup).is_ok_and(|s| s.eq(expected)));
|
||||
}
|
||||
}
|
||||
|
|
113
crates/teloxide-core/src/types/rgb.rs
Normal file
113
crates/teloxide-core/src/types/rgb.rs
Normal file
|
@ -0,0 +1,113 @@
|
|||
use rgb::RGB8;
|
||||
use serde::{de::Visitor, Deserialize, Serialize};
|
||||
|
||||
/// RGB color format
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
pub struct Rgb {
|
||||
pub r: u8,
|
||||
pub g: u8,
|
||||
pub b: u8,
|
||||
}
|
||||
|
||||
impl Rgb {
|
||||
/// Convert a [`Rgb`] struct into a big endian `u32` representing the RGB
|
||||
/// color.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```
|
||||
/// use teloxide_core::types::Rgb;
|
||||
/// assert_eq!(Rgb { r: 0xAA, g: 0xBB, b: 0xCC }.to_u32(), 0xAABBCC);
|
||||
/// ```
|
||||
///
|
||||
/// [`Rgb`]: Rgb
|
||||
pub fn to_u32(self) -> u32 {
|
||||
u32::from_be_bytes([0, self.r, self.g, self.b])
|
||||
}
|
||||
|
||||
/// Convert a big endian `u32` representing the RGB color into a [`Rgb`]
|
||||
/// struct.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```
|
||||
/// use teloxide_core::types::Rgb;
|
||||
/// assert_eq!(Rgb::from_u32(0xAABBCC), Rgb { r: 0xAA, g: 0xBB, b: 0xCC });
|
||||
/// ```
|
||||
///
|
||||
/// [`Rgb`]: Rgb
|
||||
pub fn from_u32(rgb: u32) -> Self {
|
||||
let [_, r, g, b] = rgb.to_be_bytes();
|
||||
Rgb { r, g, b }
|
||||
}
|
||||
}
|
||||
|
||||
impl Serialize for Rgb {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: serde::Serializer,
|
||||
{
|
||||
serializer.serialize_u32(self.to_u32())
|
||||
}
|
||||
}
|
||||
|
||||
impl<'de> Deserialize<'de> for Rgb {
|
||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||
where
|
||||
D: serde::Deserializer<'de>,
|
||||
{
|
||||
struct V;
|
||||
|
||||
impl Visitor<'_> for V {
|
||||
type Value = Rgb;
|
||||
|
||||
fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
formatter.write_str("an integer represeting an RGB color")
|
||||
}
|
||||
|
||||
fn visit_u32<E>(self, v: u32) -> Result<Self::Value, E>
|
||||
where
|
||||
E: serde::de::Error,
|
||||
{
|
||||
Ok(Self::Value::from_u32(v))
|
||||
}
|
||||
|
||||
fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
|
||||
where
|
||||
E: serde::de::Error,
|
||||
{
|
||||
self.visit_u32(v.try_into().map_err(|_| E::custom("rgb value doesn't fit u32"))?)
|
||||
}
|
||||
}
|
||||
|
||||
deserializer.deserialize_u32(V)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<RGB8> for Rgb {
|
||||
fn from(color: RGB8) -> Self {
|
||||
Rgb { r: color.r, g: color.g, b: color.b }
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn json() {
|
||||
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
struct Struct {
|
||||
color: Rgb,
|
||||
}
|
||||
|
||||
let json = format!(r#"{{"color":{}}}"#, 0x00AABBCC);
|
||||
let Struct { color } = serde_json::from_str(&json).unwrap();
|
||||
|
||||
assert_eq!(color, Rgb { r: 0xAA, g: 0xBB, b: 0xCC })
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@ use std::error::Error;
|
|||
use teloxide::{
|
||||
payloads::SendMessageSetters,
|
||||
prelude::*,
|
||||
sugar::bot::BotMessagesExt,
|
||||
types::{
|
||||
InlineKeyboardButton, InlineKeyboardMarkup, InlineQueryResultArticle, InputMessageContent,
|
||||
InputMessageContentText, Me,
|
||||
|
@ -107,17 +108,17 @@ async fn inline_query_handler(
|
|||
/// **IMPORTANT**: do not send privacy-sensitive data this way!!!
|
||||
/// Anyone can read data stored in the callback button.
|
||||
async fn callback_handler(bot: Bot, q: CallbackQuery) -> Result<(), Box<dyn Error + Send + Sync>> {
|
||||
if let Some(version) = q.data {
|
||||
if let Some(ref version) = q.data {
|
||||
let text = format!("You chose: {version}");
|
||||
|
||||
// Tell telegram that we've seen this query, to remove 🕑 icons from the
|
||||
// clients. You could also use `answer_callback_query`'s optional
|
||||
// parameters to tweak what happens on the client side.
|
||||
bot.answer_callback_query(q.id).await?;
|
||||
bot.answer_callback_query(&q.id).await?;
|
||||
|
||||
// Edit text of the message to which the buttons were attached
|
||||
if let Some(message) = q.message {
|
||||
bot.edit_message_text(message.chat().id, message.id(), text).await?;
|
||||
if let Some(message) = q.regular_message() {
|
||||
bot.edit_text(message, text).await?;
|
||||
} else if let Some(id) = q.inline_message_id {
|
||||
bot.edit_message_text_inline(id, text).await?;
|
||||
}
|
||||
|
|
|
@ -4,9 +4,7 @@
|
|||
use rand::Rng;
|
||||
|
||||
use teloxide::{
|
||||
dispatching::HandlerExt,
|
||||
prelude::*,
|
||||
types::{Dice, ReplyParameters},
|
||||
dispatching::HandlerExt, prelude::*, sugar::request::RequestReplyExt, types::Dice,
|
||||
utils::command::BotCommands,
|
||||
};
|
||||
|
||||
|
@ -84,7 +82,7 @@ async fn main() {
|
|||
// filter only messages with dices.
|
||||
Message::filter_dice().endpoint(|bot: Bot, msg: Message, dice: Dice| async move {
|
||||
bot.send_message(msg.chat.id, format!("Dice value: {}", dice.value))
|
||||
.reply_parameters(ReplyParameters::new(msg.id))
|
||||
.reply_to(msg)
|
||||
.await?;
|
||||
Ok(())
|
||||
}),
|
||||
|
|
|
@ -140,6 +140,7 @@ pub mod prelude;
|
|||
#[cfg(feature = "ctrlc_handler")]
|
||||
pub mod repls;
|
||||
pub mod stop;
|
||||
pub mod sugar;
|
||||
pub mod update_listeners;
|
||||
pub mod utils;
|
||||
|
||||
|
|
4
crates/teloxide/src/sugar.rs
Normal file
4
crates/teloxide/src/sugar.rs
Normal file
|
@ -0,0 +1,4 @@
|
|||
//! Some syntax sugar support for TBA functionality.
|
||||
|
||||
pub mod bot;
|
||||
pub mod request;
|
191
crates/teloxide/src/sugar/bot.rs
Normal file
191
crates/teloxide/src/sugar/bot.rs
Normal file
|
@ -0,0 +1,191 @@
|
|||
//! Additions to [`Bot`].
|
||||
//!
|
||||
//! [`Bot`]: crate::Bot
|
||||
use crate::{prelude::*, types::*};
|
||||
use teloxide_core::{
|
||||
payloads::*,
|
||||
requests::{JsonRequest, MultipartRequest},
|
||||
};
|
||||
|
||||
/// Syntax sugar for [`Message`] manipulations.
|
||||
///
|
||||
/// [`Message`]: crate::types::Message
|
||||
pub trait BotMessagesExt {
|
||||
/// This function is the same as [`Bot::forward_message`],
|
||||
/// but can take in [`Message`] to forward it.
|
||||
///
|
||||
/// [`Bot::forward_message`]: crate::Bot::forward_message
|
||||
/// [`Message`]: crate::types::Message
|
||||
fn forward<C>(&self, to_chat_id: C, message: &Message) -> JsonRequest<ForwardMessage>
|
||||
where
|
||||
C: Into<Recipient>;
|
||||
|
||||
/// This function is the same as [`Bot::edit_message_live_location`],
|
||||
/// but can take in [`Message`] to edit it.
|
||||
///
|
||||
/// [`Bot::edit_message_live_location`]: crate::Bot::edit_message_live_location
|
||||
/// [`Message`]: crate::types::Message
|
||||
fn edit_live_location(
|
||||
&self,
|
||||
message: &Message,
|
||||
latitude: f64,
|
||||
longitude: f64,
|
||||
) -> JsonRequest<EditMessageLiveLocation>;
|
||||
|
||||
/// This function is the same as [`Bot::stop_message_live_location`],
|
||||
/// but can take in [`Message`] to stop the live location in it.
|
||||
///
|
||||
/// [`Bot::stop_message_live_location`]: crate::Bot::stop_message_live_location
|
||||
/// [`Message`]: crate::types::Message
|
||||
fn stop_live_location(&self, message: &Message) -> JsonRequest<StopMessageLiveLocation>;
|
||||
|
||||
/// This function is the same as [`Bot::set_message_reaction`],
|
||||
/// but can take in [`Message`] to set a reaction on it.
|
||||
///
|
||||
/// [`Bot::set_message_reaction`]: crate::Bot::set_message_reaction
|
||||
/// [`Message`]: crate::types::Message
|
||||
fn set_reaction(&self, message: &Message) -> JsonRequest<SetMessageReaction>;
|
||||
|
||||
/// This function is the same as [`Bot::pin_chat_message`],
|
||||
/// but can take in [`Message`] to pin it.
|
||||
///
|
||||
/// [`Bot::pin_chat_message`]: crate::Bot::pin_chat_message
|
||||
/// [`Message`]: crate::types::Message
|
||||
fn pin(&self, message: &Message) -> JsonRequest<PinChatMessage>;
|
||||
|
||||
/// This function is the same as [`Bot::unpin_chat_message`],
|
||||
/// but can take in [`Message`] to unpin it.
|
||||
///
|
||||
/// [`Bot::unpin_chat_message`]: crate::Bot::unpin_chat_message
|
||||
/// [`Message`]: crate::types::Message
|
||||
fn unpin(&self, message: &Message) -> JsonRequest<UnpinChatMessage>;
|
||||
|
||||
/// This function is the same as [`Bot::edit_message_text`],
|
||||
/// but can take in [`Message`] to edit it.
|
||||
///
|
||||
/// [`Bot::edit_message_text`]: crate::Bot::edit_message_text
|
||||
/// [`Message`]: crate::types::Message
|
||||
fn edit_text<T>(&self, message: &Message, text: T) -> JsonRequest<EditMessageText>
|
||||
where
|
||||
T: Into<String>;
|
||||
|
||||
/// This function is the same as [`Bot::edit_message_caption`],
|
||||
/// but can take in [`Message`] to edit it.
|
||||
///
|
||||
/// [`Bot::edit_message_caption`]: crate::Bot::edit_message_caption
|
||||
/// [`Message`]: crate::types::Message
|
||||
fn edit_caption(&self, message: &Message) -> JsonRequest<EditMessageCaption>;
|
||||
|
||||
/// This function is the same as [`Bot::edit_message_media`],
|
||||
/// but can take in [`Message`] to edit it.
|
||||
///
|
||||
/// [`Bot::edit_message_media`]: crate::Bot::edit_message_media
|
||||
/// [`Message`]: crate::types::Message
|
||||
fn edit_media(
|
||||
&self,
|
||||
message: &Message,
|
||||
media: InputMedia,
|
||||
) -> MultipartRequest<EditMessageMedia>;
|
||||
|
||||
/// This function is the same as [`Bot::edit_message_reply_markup`],
|
||||
/// but can take in [`Message`] to edit it.
|
||||
///
|
||||
/// [`Bot::edit_message_reply_markup`]: crate::Bot::edit_message_reply_markup
|
||||
/// [`Message`]: crate::types::Message
|
||||
fn edit_reply_markup(&self, message: &Message) -> JsonRequest<EditMessageReplyMarkup>;
|
||||
|
||||
/// This function is the same as [`Bot::stop_poll`],
|
||||
/// but can take in [`Message`] to stop the poll in it.
|
||||
///
|
||||
/// [`Bot::stop_poll`]: crate::Bot::stop_poll
|
||||
/// [`Message`]: crate::types::Message
|
||||
fn stop_poll_message(&self, message: &Message) -> JsonRequest<StopPoll>;
|
||||
|
||||
/// This function is the same as [`Bot::delete_message`],
|
||||
/// but can take in [`Message`] to delete it.
|
||||
///
|
||||
/// [`Bot::delete_message`]: crate::Bot::delete_message
|
||||
/// [`Message`]: crate::types::Message
|
||||
fn delete(&self, message: &Message) -> JsonRequest<DeleteMessage>;
|
||||
|
||||
/// This function is the same as [`Bot::copy_message`],
|
||||
/// but can take in [`Message`] to copy it.
|
||||
///
|
||||
/// [`Bot::copy_messages`]: crate::Bot::copy_message
|
||||
/// [`Message`]: crate::types::Message
|
||||
fn copy<C>(&self, to_chat_id: C, message: &Message) -> JsonRequest<CopyMessage>
|
||||
where
|
||||
C: Into<Recipient>;
|
||||
}
|
||||
|
||||
impl BotMessagesExt for Bot {
|
||||
fn forward<C>(&self, to_chat_id: C, message: &Message) -> JsonRequest<ForwardMessage>
|
||||
where
|
||||
C: Into<Recipient>,
|
||||
{
|
||||
self.forward_message(to_chat_id, message.chat.id, message.id)
|
||||
}
|
||||
|
||||
fn edit_live_location(
|
||||
&self,
|
||||
message: &Message,
|
||||
latitude: f64,
|
||||
longitude: f64,
|
||||
) -> JsonRequest<EditMessageLiveLocation> {
|
||||
self.edit_message_live_location(message.chat.id, message.id, latitude, longitude)
|
||||
}
|
||||
|
||||
fn stop_live_location(&self, message: &Message) -> JsonRequest<StopMessageLiveLocation> {
|
||||
self.stop_message_live_location(message.chat.id, message.id)
|
||||
}
|
||||
|
||||
fn set_reaction(&self, message: &Message) -> JsonRequest<SetMessageReaction> {
|
||||
self.set_message_reaction(message.chat.id, message.id)
|
||||
}
|
||||
|
||||
fn pin(&self, message: &Message) -> JsonRequest<PinChatMessage> {
|
||||
self.pin_chat_message(message.chat.id, message.id)
|
||||
}
|
||||
|
||||
fn unpin(&self, message: &Message) -> JsonRequest<UnpinChatMessage> {
|
||||
self.unpin_chat_message(message.chat.id).message_id(message.id)
|
||||
}
|
||||
|
||||
fn edit_text<T>(&self, message: &Message, text: T) -> JsonRequest<EditMessageText>
|
||||
where
|
||||
T: Into<String>,
|
||||
{
|
||||
self.edit_message_text(message.chat.id, message.id, text)
|
||||
}
|
||||
|
||||
fn edit_caption(&self, message: &Message) -> JsonRequest<EditMessageCaption> {
|
||||
self.edit_message_caption(message.chat.id, message.id)
|
||||
}
|
||||
|
||||
fn edit_media(
|
||||
&self,
|
||||
message: &Message,
|
||||
media: InputMedia,
|
||||
) -> MultipartRequest<EditMessageMedia> {
|
||||
self.edit_message_media(message.chat.id, message.id, media)
|
||||
}
|
||||
|
||||
fn edit_reply_markup(&self, message: &Message) -> JsonRequest<EditMessageReplyMarkup> {
|
||||
self.edit_message_reply_markup(message.chat.id, message.id)
|
||||
}
|
||||
|
||||
fn stop_poll_message(&self, message: &Message) -> JsonRequest<StopPoll> {
|
||||
self.stop_poll(message.chat.id, message.id)
|
||||
}
|
||||
|
||||
fn delete(&self, message: &Message) -> JsonRequest<DeleteMessage> {
|
||||
self.delete_message(message.chat.id, message.id)
|
||||
}
|
||||
|
||||
fn copy<C>(&self, to_chat_id: C, message: &Message) -> JsonRequest<CopyMessage>
|
||||
where
|
||||
C: Into<Recipient>,
|
||||
{
|
||||
self.copy_message(to_chat_id, message.chat.id, message.id)
|
||||
}
|
||||
}
|
155
crates/teloxide/src/sugar/request.rs
Normal file
155
crates/teloxide/src/sugar/request.rs
Normal file
|
@ -0,0 +1,155 @@
|
|||
//! Additions to [`JsonRequest`] and [`MultipartRequest`].
|
||||
//!
|
||||
//! [`JsonRequest`]: teloxide_core::requests::JsonRequest
|
||||
//! [`MultipartRequest`]: teloxide_core::requests::MultipartRequest
|
||||
|
||||
use teloxide_core::{
|
||||
payloads::*,
|
||||
requests::{JsonRequest, MultipartRequest},
|
||||
types::*,
|
||||
};
|
||||
|
||||
macro_rules! impl_request_reply_ext {
|
||||
($($t:ty),*) => {
|
||||
$(
|
||||
impl RequestReplyExt for $t {
|
||||
fn reply_to<M>(self, message_id: M) -> Self
|
||||
where
|
||||
M: Into<MessageId>,
|
||||
Self: Sized,
|
||||
{
|
||||
self.reply_parameters(ReplyParameters::new(message_id.into()))
|
||||
}
|
||||
}
|
||||
)*
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! impl_request_link_preview_ext {
|
||||
($($t:ty),*) => {
|
||||
$(
|
||||
impl RequestLinkPreviewExt for $t {
|
||||
fn disable_link_preview(self, is_disabled: bool) -> Self
|
||||
where
|
||||
Self: Sized
|
||||
{
|
||||
let link_preview_options = LinkPreviewOptions {
|
||||
is_disabled,
|
||||
url: None,
|
||||
prefer_small_media: false,
|
||||
prefer_large_media: false,
|
||||
show_above_text: false,
|
||||
};
|
||||
self.link_preview_options(link_preview_options)
|
||||
}
|
||||
}
|
||||
)*
|
||||
};
|
||||
}
|
||||
|
||||
/// `.reply_to(msg)` syntax sugar for requests.
|
||||
pub trait RequestReplyExt {
|
||||
/// Replaces `.reply_parameters(ReplyParameters::new(msg.id))`
|
||||
/// with `.reply_to(msg.id)` or `.reply_to(msg)`
|
||||
fn reply_to<M>(self, message_id: M) -> Self
|
||||
where
|
||||
M: Into<MessageId>,
|
||||
Self: Sized;
|
||||
}
|
||||
|
||||
/// `.disable_link_preview(is_disabled)` syntax sugar for requests.
|
||||
pub trait RequestLinkPreviewExt {
|
||||
/// Replaces
|
||||
/// `.link_preview_options(LinkPreviewOptions {
|
||||
/// is_disabled: true,
|
||||
/// url: None,
|
||||
/// prefer_small_media: false,
|
||||
/// prefer_large_media: false,
|
||||
/// show_above_text: false
|
||||
/// };)`
|
||||
///
|
||||
/// with `.disable_link_preview(true)`.
|
||||
fn disable_link_preview(self, is_disabled: bool) -> Self
|
||||
where
|
||||
Self: Sized;
|
||||
}
|
||||
|
||||
impl_request_reply_ext! {
|
||||
JsonRequest<SendDice>,
|
||||
JsonRequest<SendInvoice>,
|
||||
JsonRequest<SendPoll>,
|
||||
JsonRequest<SendContact>,
|
||||
JsonRequest<SendGame>,
|
||||
JsonRequest<SendVenue>,
|
||||
JsonRequest<SendLocation>,
|
||||
JsonRequest<CopyMessage>,
|
||||
JsonRequest<SendMessage>,
|
||||
MultipartRequest<SendSticker>,
|
||||
MultipartRequest<SendMediaGroup>,
|
||||
MultipartRequest<SendAnimation>,
|
||||
MultipartRequest<SendVideoNote>,
|
||||
MultipartRequest<SendVideo>,
|
||||
MultipartRequest<SendDocument>,
|
||||
MultipartRequest<SendAudio>,
|
||||
MultipartRequest<SendVoice>,
|
||||
MultipartRequest<SendPhoto>
|
||||
}
|
||||
|
||||
impl_request_link_preview_ext! {
|
||||
JsonRequest<SendMessage>,
|
||||
JsonRequest<EditMessageText>
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::ops::Deref;
|
||||
|
||||
use super::*;
|
||||
use teloxide_core::{prelude::Requester, Bot};
|
||||
|
||||
#[test]
|
||||
fn test_reply_to() {
|
||||
let bot = Bot::new("TOKEN");
|
||||
|
||||
let real_reply_req = bot
|
||||
.send_message(ChatId(1234), "test")
|
||||
.reply_parameters(ReplyParameters::new(MessageId(1)));
|
||||
let sugar_reply_req = bot.send_message(ChatId(1234), "test").reply_to(MessageId(1));
|
||||
|
||||
assert_eq!(real_reply_req.deref(), sugar_reply_req.deref())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_reply_to_multipart() {
|
||||
let bot = Bot::new("TOKEN");
|
||||
let document = InputFile::memory("hello world!");
|
||||
|
||||
let real_reply_req = bot
|
||||
.send_document(ChatId(1234), document.clone())
|
||||
.reply_parameters(ReplyParameters::new(MessageId(1)));
|
||||
let sugar_reply_req = bot.send_document(ChatId(1234), document).reply_to(MessageId(1));
|
||||
|
||||
assert_eq!(
|
||||
real_reply_req.deref().reply_parameters,
|
||||
sugar_reply_req.deref().reply_parameters
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_disable_link_preview() {
|
||||
let link_preview_options = LinkPreviewOptions {
|
||||
is_disabled: true,
|
||||
url: None,
|
||||
prefer_small_media: false,
|
||||
prefer_large_media: false,
|
||||
show_above_text: false,
|
||||
};
|
||||
let bot = Bot::new("TOKEN");
|
||||
|
||||
let real_link_req =
|
||||
bot.send_message(ChatId(1234), "test").link_preview_options(link_preview_options);
|
||||
let sugar_link_req = bot.send_message(ChatId(1234), "test").disable_link_preview(true);
|
||||
|
||||
assert_eq!(real_link_req.deref(), sugar_link_req.deref())
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue