From 99f5e64eaa52b9768b427c945da131504e98669a Mon Sep 17 00:00:00 2001 From: David Thomas Date: Tue, 28 Nov 2023 14:13:50 +0000 Subject: [PATCH] Use serenity 0.12, songbird 4.0, and poise 'current' --- Cargo.lock | 322 ++++++++++++++++++++++----------------- Cargo.toml | 16 +- src/commands/help.rs | 4 +- src/commands/other.rs | 2 +- src/commands/settings.rs | 32 ++-- src/errors.rs | 15 +- src/events/mod.rs | 36 ++--- src/main.rs | 12 +- src/traits.rs | 17 +-- 9 files changed, 242 insertions(+), 214 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5a4c974f..562c7508 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -105,6 +105,16 @@ dependencies = [ "num-traits", ] +[[package]] +name = "atomic-write-file" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ae364a6c1301604bbc6dfbf8c385c47ff82301dd01eef506195a029196d8d04" +dependencies = [ + "nix", + "rand", +] + [[package]] name = "audiopus" version = "0.3.0-rc.0" @@ -265,7 +275,7 @@ dependencies = [ "iana-time-zone", "num-traits", "serde", - "windows-targets", + "windows-targets 0.48.5", ] [[package]] @@ -288,16 +298,6 @@ dependencies = [ "cc", ] -[[package]] -name = "command_attr" -version = "0.5.0" -source = "git+https://github.com/GnomedDev/serenity?branch=typesize#45e8aa2c86028a1b172c405b4d4c267c10fc1beb" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "const_format" version = "0.2.32" @@ -448,9 +448,9 @@ dependencies = [ [[package]] name = "darling" -version = "0.14.4" +version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b750cb3417fd1b327431a470f388520309479ab0bf5e323505daf0290cd3850" +checksum = "0209d94da627ab5605dcccf08bb18afa5009cfbef48d8a8b7d7bdbc79be25c5e" dependencies = [ "darling_core", "darling_macro", @@ -458,27 +458,27 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.14.4" +version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "109c1ca6e6b7f82cc233a97004ea8ed7ca123a9af07a8230878fcfda9b158bf0" +checksum = "177e3443818124b357d8e76f53be906d60937f0d3a90773a664fa63fa253e621" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", "strsim", - "syn 1.0.109", + "syn 2.0.39", ] [[package]] name = "darling_macro" -version = "0.14.4" +version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4aab4dbc9f7611d8b55048a3a16d2d010c2c8334e46304b40ac1cc14bf3b48e" +checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" dependencies = [ "darling_core", "quote", - "syn 1.0.109", + "syn 2.0.39", ] [[package]] @@ -497,9 +497,9 @@ dependencies = [ [[package]] name = "data-encoding" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308" +checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5" [[package]] name = "deranged" @@ -674,12 +674,12 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f258a7194e7f7c2a7837a8913aeab7fd8c383457034fa20ce4dd3dcb813e8eb8" +checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" dependencies = [ "libc", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -699,7 +699,7 @@ checksum = "136d1b5283a1ab77bd9257427ffd09d8667ced0570b6f938942bc7568ed5b943" dependencies = [ "cfg-if", "home", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -750,9 +750,9 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "form_urlencoded" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" dependencies = [ "percent-encoding", ] @@ -915,9 +915,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.28.0" +version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" +checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" [[package]] name = "glob" @@ -946,9 +946,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.14.2" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" dependencies = [ "ahash", "allocator-api2", @@ -1008,7 +1008,7 @@ version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" dependencies = [ - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -1114,9 +1114,9 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "idna" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" dependencies = [ "unicode-bidi", "unicode-normalization", @@ -1173,9 +1173,9 @@ checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "js-sys" -version = "0.3.65" +version = "0.3.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54c0c35952f67de54bb584e9fd912b3023117cbafc0a77d8f3dee1fb5f572fe8" +checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca" dependencies = [ "wasm-bindgen", ] @@ -1186,12 +1186,6 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -[[package]] -name = "levenshtein" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db13adb97ab515a3691f56e4dbab09283d0b86cb45abd991d8634a9d6f501760" - [[package]] name = "libc" version = "0.2.150" @@ -1332,7 +1326,7 @@ checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0" dependencies = [ "libc", "wasi", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -1344,6 +1338,17 @@ dependencies = [ "getrandom", ] +[[package]] +name = "nix" +version = "0.27.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053" +dependencies = [ + "bitflags 2.4.1", + "cfg-if", + "libc", +] + [[package]] name = "no-std-net" version = "0.6.0" @@ -1495,7 +1500,7 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "windows-targets", + "windows-targets 0.48.5", ] [[package]] @@ -1506,9 +1511,9 @@ checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" [[package]] name = "percent-encoding" -version = "2.3.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pin-project" @@ -1580,31 +1585,29 @@ dependencies = [ [[package]] name = "poise" -version = "0.5.5" -source = "git+https://github.com/serenity-rs/poise?branch=serenity-next#7844c03365bcf7024671c078a254a2159fd8b556" +version = "0.5.7" +source = "git+https://github.com/serenity-rs/poise?branch=current#835a016f0e511c9b5d74f5c32b9ae151001347cd" dependencies = [ "async-trait", "derivative", - "futures-core", "futures-util", - "log", - "once_cell", "parking_lot", "poise_macros", "regex", "serenity", "tokio", + "tracing", ] [[package]] name = "poise_macros" -version = "0.5.5" -source = "git+https://github.com/serenity-rs/poise?branch=serenity-next#7844c03365bcf7024671c078a254a2159fd8b556" +version = "0.5.7" +source = "git+https://github.com/serenity-rs/poise?branch=current#835a016f0e511c9b5d74f5c32b9ae151001347cd" dependencies = [ "darling", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.39", ] [[package]] @@ -1641,9 +1644,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.69" +version = "1.0.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" +checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b" dependencies = [ "unicode-ident", ] @@ -1819,7 +1822,7 @@ dependencies = [ "wasm-bindgen-futures", "wasm-streams", "web-sys", - "webpki-roots 0.25.2", + "webpki-roots", "winreg", ] @@ -1849,7 +1852,7 @@ dependencies = [ "libc", "spin 0.9.8", "untrusted 0.9.0", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -1904,7 +1907,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -2011,7 +2014,7 @@ version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" dependencies = [ - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -2164,8 +2167,9 @@ dependencies = [ [[package]] name = "serenity" -version = "0.12.0-rc" -source = "git+https://github.com/GnomedDev/serenity?branch=typesize#45e8aa2c86028a1b172c405b4d4c267c10fc1beb" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "385647faa24a889929028973650a4f158fb1b4272b2fcf94feb9fcc3c009e813" dependencies = [ "arrayvec", "async-trait", @@ -2173,12 +2177,10 @@ dependencies = [ "bitflags 2.4.1", "bytes", "chrono", - "command_attr", "dashmap", "flate2", "futures", "fxhash", - "levenshtein", "mime_guess", "parking_lot", "percent-encoding", @@ -2186,7 +2188,6 @@ dependencies = [ "secrecy", "serde", "serde_json", - "static_assertions", "time", "tokio", "tokio-tungstenite 0.20.1", @@ -2194,13 +2195,13 @@ dependencies = [ "typemap_rev", "typesize", "url", - "uwl", ] [[package]] name = "serenity-voice-model" -version = "0.1.1" -source = "git+https://github.com/GnomedDev/serenity?branch=typesize#45e8aa2c86028a1b172c405b4d4c267c10fc1beb" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "593682f6155d07c8b331b3d1060f5aab7e6796caca9f2f66bd9e6855c880e06b" dependencies = [ "bitflags 2.4.1", "num-traits", @@ -2296,13 +2297,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" dependencies = [ "libc", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] name = "songbird" -version = "0.4.0-rc" -source = "git+https://github.com/serenity-rs/songbird?branch=next#38096163ab5b5719a80b4f3f4f3063b1d42fc360" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b905d2cdd4becf0e643a4aa5491cdfe8f193d5676b5bae7c0460e0e3c6358d63" dependencies = [ "async-trait", "audiopus", @@ -2370,9 +2372,9 @@ dependencies = [ [[package]] name = "sqlx" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e50c216e3624ec8e7ecd14c6a6a6370aad6ee5d8cfc3ab30b5162eeeef2ed33" +checksum = "dba03c279da73694ef99763320dea58b51095dfe87d001b1d4b5fe78ba8763cf" dependencies = [ "sqlx-core", "sqlx-macros", @@ -2381,9 +2383,9 @@ dependencies = [ [[package]] name = "sqlx-core" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d6753e460c998bbd4cd8c6f0ed9a64346fcca0723d6e75e52fdc351c5d2169d" +checksum = "d84b0a3c3739e220d94b3239fd69fb1f74bc36e16643423bd99de3b43c21bfbd" dependencies = [ "ahash", "atoi", @@ -2419,14 +2421,14 @@ dependencies = [ "tokio-stream", "tracing", "url", - "webpki-roots 0.24.0", + "webpki-roots", ] [[package]] name = "sqlx-macros" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a793bb3ba331ec8359c1853bd39eed32cdd7baaf22c35ccf5c92a7e8d1189ec" +checksum = "89961c00dc4d7dffb7aee214964b065072bff69e36ddb9e2c107541f75e4f2a5" dependencies = [ "proc-macro2", "quote", @@ -2437,10 +2439,11 @@ dependencies = [ [[package]] name = "sqlx-macros-core" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a4ee1e104e00dedb6aa5ffdd1343107b0a4702e862a84320ee7cc74782d96fc" +checksum = "d0bd4519486723648186a08785143599760f7cc81c52334a55d6a83ea1e20841" dependencies = [ + "atomic-write-file", "dotenvy", "either", "heck", @@ -2461,9 +2464,9 @@ dependencies = [ [[package]] name = "sqlx-postgres" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb7ae0e6a97fb3ba33b23ac2671a5ce6e3cabe003f451abd5a56e7951d975624" +checksum = "d6ac0ac3b7ccd10cc96c7ab29791a7dd236bd94021f31eec7ba3d46a74aa1c24" dependencies = [ "atoi", "base64 0.21.5", @@ -2498,12 +2501,6 @@ dependencies = [ "whoami", ] -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - [[package]] name = "streamcatcher" version = "1.0.1" @@ -2677,9 +2674,9 @@ dependencies = [ [[package]] name = "sysinfo" -version = "0.29.10" +version = "0.29.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a18d114d420ada3a891e6bc8e96a2023402203296a47cdd65083377dad18ba5" +checksum = "cd727fc423c2060f6c92d9534cef765c65a6ed3f428a03d7def74a8c4348e666" dependencies = [ "cfg-if", "core-foundation-sys", @@ -2727,7 +2724,7 @@ dependencies = [ "fastrand", "redox_syscall", "rustix", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -2820,7 +2817,7 @@ dependencies = [ "signal-hook-registry", "socket2 0.5.5", "tokio-macros", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -2894,7 +2891,7 @@ dependencies = [ "tokio", "tokio-rustls 0.24.1", "tungstenite 0.20.1", - "webpki-roots 0.25.2", + "webpki-roots", ] [[package]] @@ -3035,9 +3032,9 @@ dependencies = [ [[package]] name = "triomphe" -version = "0.1.9" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eee8098afad3fb0c54a9007aab6804558410503ad676d4633f9c2559a00ac0f" +checksum = "d0c5a71827ac326072b6405552093e2ad2accd25a32fd78d4edc82d98c7f2409" [[package]] name = "try-lock" @@ -3242,9 +3239,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" +checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" dependencies = [ "form_urlencoded", "idna", @@ -3267,12 +3264,6 @@ dependencies = [ "getrandom", ] -[[package]] -name = "uwl" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4bf03e0ca70d626ecc4ba6b0763b934b6f2976e8c744088bb3c1d646fbb1ad0" - [[package]] name = "valuable" version = "0.1.0" @@ -3312,9 +3303,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.88" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7daec296f25a1bae309c0cd5c29c4b260e510e6d813c286b19eaadf409d40fce" +checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -3322,9 +3313,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.88" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e397f4664c0e4e428e8313a469aaa58310d302159845980fd23b0f22a847f217" +checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826" dependencies = [ "bumpalo", "log", @@ -3337,9 +3328,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.38" +version = "0.4.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9afec9963e3d0994cac82455b2b3502b81a7f40f9a0d32181f7528d9f4b43e02" +checksum = "ac36a15a220124ac510204aec1c3e5db8a22ab06fd6706d881dc6149f8ed9a12" dependencies = [ "cfg-if", "js-sys", @@ -3349,9 +3340,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.88" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5961017b3b08ad5f3fe39f1e79877f8ee7c23c5e5fd5eb80de95abc41f1f16b2" +checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3359,9 +3350,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.88" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5353b8dab669f5e10f5bd76df26a9360c748f054f862ff5f3f8aae0c7fb3907" +checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" dependencies = [ "proc-macro2", "quote", @@ -3372,9 +3363,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.88" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d046c5d029ba91a1ed14da14dca44b68bf2f124cfbaf741c54151fdb3e0750b" +checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f" [[package]] name = "wasm-streams" @@ -3411,18 +3402,9 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.24.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b291546d5d9d1eab74f069c77749f2cb8504a12caa20f0f2de93ddbf6f411888" -dependencies = [ - "rustls-webpki", -] - -[[package]] -name = "webpki-roots" -version = "0.25.2" +version = "0.25.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc" +checksum = "1778a42e8b3b90bff8d0f5032bf22250792889a5cdc752aa0020c84abe3aaf10" [[package]] name = "whoami" @@ -3467,7 +3449,7 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" dependencies = [ - "windows-targets", + "windows-targets 0.48.5", ] [[package]] @@ -3476,7 +3458,7 @@ version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" dependencies = [ - "windows-targets", + "windows-targets 0.48.5", ] [[package]] @@ -3485,7 +3467,16 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets", + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.0", ] [[package]] @@ -3494,13 +3485,28 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +dependencies = [ + "windows_aarch64_gnullvm 0.52.0", + "windows_aarch64_msvc 0.52.0", + "windows_i686_gnu 0.52.0", + "windows_i686_msvc 0.52.0", + "windows_x86_64_gnu 0.52.0", + "windows_x86_64_gnullvm 0.52.0", + "windows_x86_64_msvc 0.52.0", ] [[package]] @@ -3509,42 +3515,84 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" + [[package]] name = "windows_aarch64_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" + [[package]] name = "windows_i686_gnu" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" +[[package]] +name = "windows_i686_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" + [[package]] name = "windows_i686_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" +[[package]] +name = "windows_i686_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" + [[package]] name = "windows_x86_64_gnu" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" + [[package]] name = "windows_x86_64_gnullvm" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" + [[package]] name = "windows_x86_64_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" + [[package]] name = "winnow" version = "0.5.19" @@ -3561,7 +3609,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" dependencies = [ "cfg-if", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 4e9d678e..cf0d9793 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -56,26 +56,16 @@ version = "5" default-features = false [dependencies.serenity_feature_only] -git = "https://github.com/GnomedDev/serenity" features = ["unstable_discord_api", "typesize"] default-features = false package = "serenity" -branch = "typesize" +version = "0.12.0" [dependencies.poise] git = "https://github.com/serenity-rs/poise" features = ["cache"] -branch = "serenity-next" +branch = "current" [dependencies.songbird] -git = "https://github.com/serenity-rs/songbird" +version = "0.4" features = ["builtin-queue"] -branch = "next" - -[patch.crates-io] -serenity = { git = "https://github.com/GnomedDev/serenity", branch = "typesize" } -serenity-voice-model = { git = "https://github.com/GnomedDev/serenity", branch = "typesize" } - -[patch."https://github.com/serenity-rs/serenity"] -serenity = { git = "https://github.com/GnomedDev/serenity", branch = "typesize" } -serenity-voice-model = { git = "https://github.com/GnomedDev/serenity", branch = "typesize" } diff --git a/src/commands/help.rs b/src/commands/help.rs index 176740cc..009834d3 100644 --- a/src/commands/help.rs +++ b/src/commands/help.rs @@ -51,7 +51,7 @@ fn get_command_mapping(commands: &[Command]) -> IndexMap<&str, Vec<&Command>> { fn format_params(buf: &mut String, command: &Command) { for p in &command.parameters { - let name = p.name.as_deref().unwrap_or("unnamed"); + let name = &p.name; if p.required { write!(buf, " <{name}>").unwrap(); } else { @@ -206,7 +206,7 @@ pub async fn command_func(ctx: Context<'_>, command: Option<&str>) -> CommandRes if !command_obj.parameters.is_empty() { msg.push_str(ctx.gettext("__**Parameter Descriptions**__\n")); command_obj.parameters.iter().for_each(|p| { - let name = p.name.as_deref().unwrap_or_else(|| ctx.gettext("unnamed")); + let name = &p.name; let description = p .description .as_deref() diff --git a/src/commands/other.rs b/src/commands/other.rs index 37233228..e76f8121 100644 --- a/src/commands/other.rs +++ b/src/commands/other.rs @@ -192,7 +192,7 @@ pub async fn tts_speak_as( context_menu_command = "Speak with your voice!" )] pub async fn tts_speak(ctx: ApplicationContext<'_>, message: serenity::Message) -> CommandResult { - _tts(ctx.into(), ctx.interaction.user(), &message.content).await + _tts(ctx.into(), &ctx.interaction.user, &message.content).await } /// Shows various different stats diff --git a/src/commands/settings.rs b/src/commands/settings.rs index f094e91d..c27a9c66 100644 --- a/src/commands/settings.rs +++ b/src/commands/settings.rs @@ -347,10 +347,10 @@ impl<'a> MenuPaginator<'a> { async fn voice_autocomplete( ctx: ApplicationContext<'_>, searching: &str, -) -> Vec> { +) -> Vec { let Ok((_, mode)) = ctx .data - .parse_user_or_guild(ctx.interaction.user().id, ctx.interaction.guild_id()) + .parse_user_or_guild(ctx.interaction.user.id, ctx.interaction.guild_id) .await else { return Vec::new(); @@ -360,11 +360,7 @@ async fn voice_autocomplete( let (mut i1, mut i2, mut i3, mut i4); let voices: &mut dyn Iterator = match mode { TTSMode::gTTS => { - i1 = data - .gtts_voices - .iter() - .map(|(k, v)| (k.clone(), v.clone())) - .map(|(value, name)| poise::AutocompleteChoice::new_with_value(name, value)); + i1 = data.gtts_voices.iter().map(|(k, v)| (k.clone(), v.clone())); &mut i1 } TTSMode::eSpeak => { @@ -372,12 +368,12 @@ async fn voice_autocomplete( .espeak_voices .iter() .cloned() - .map(poise::AutocompleteChoice::from); + .map(|voice| (voice.clone(), voice)); &mut i2 } TTSMode::Polly => { i3 = data.polly_voices.values().map(|voice| { - poise::AutocompleteChoice::new_with_value( + ( format!( "{} - {} ({})", voice.name, voice.language_name, voice.gender @@ -390,7 +386,7 @@ async fn voice_autocomplete( TTSMode::gCloud => { i4 = data.gcloud_voices.iter().flat_map(|(language, variants)| { variants.iter().map(move |(variant, gender)| { - poise::AutocompleteChoice::new_with_value( + ( format!("{language} {variant} ({gender})"), format!("{language} {variant}"), ) @@ -402,30 +398,34 @@ async fn voice_autocomplete( let searching_lower = searching.to_lowercase(); let mut voices: Vec<_> = voices - .map(|choice| (choice.label.to_lowercase(), choice)) + .map(|(label, value)| (label.to_lowercase(), value)) .collect(); voices.sort_by_cached_key(|(label, _)| strsim::levenshtein(label, &searching_lower)); voices.sort_by_key(|(label, _)| !label.contains(&searching_lower)); - voices.into_iter().map(|(_, choice)| choice).collect() + voices + .into_iter() + .map(|(label, value)| serenity::AutocompleteChoice::new(label, value)) + .collect() } #[allow(clippy::unused_async)] async fn translation_languages_autocomplete( ctx: ApplicationContext<'_>, searching: &str, -) -> Vec> { +) -> impl Iterator { let mut filtered_languages = ctx .data .translation_languages .iter() .filter(|(_, name)| name.starts_with(searching)) .map(|(value, name)| (value.clone(), name.clone())) - .map(|(value, name)| poise::AutocompleteChoice::new_with_value(name, value)) .collect::>(); - filtered_languages.sort_by_key(|choice| strsim::levenshtein(&choice.label, searching)); + filtered_languages.sort_by_key(|(label, _)| strsim::levenshtein(label, searching)); filtered_languages + .into_iter() + .map(|(label, value)| serenity::AutocompleteChoice::new(label, value)) } async fn bool_button(ctx: Context<'_>, value: Option) -> Result, Error> { @@ -1438,7 +1438,7 @@ Just do `/join` and start talking! ctx.gettext("Okay, didn't set up update announcements.") }; - ctx.send(poise::CreateReply::new().content(reply).ephemeral(true)) + ctx.send(poise::CreateReply::default().content(reply).ephemeral(true)) .await?; Ok(()) diff --git a/src/errors.rs b/src/errors.rs index 758e3a70..7df46704 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -466,6 +466,7 @@ pub async fn handle(error: poise::FrameworkError<'_, Data, Error>) -> Result<()> } poise::FrameworkError::EventHandler { + ctx, error, event, framework, @@ -477,27 +478,27 @@ pub async fn handle(error: poise::FrameworkError<'_, Data, Error>) -> Result<()> } match event { - Event::Message { ctx, new_message } => { + Event::Message { new_message } => { handle_message(ctx, framework, new_message, Err(error)).await?; } - Event::GuildMemberAddition { ctx, new_member } => { + Event::GuildMemberAddition { new_member } => { handle_member(ctx, framework, new_member, Err(error)).await?; } - Event::GuildCreate { ctx, guild, .. } => { + Event::GuildCreate { guild, .. } => { handle_guild("GuildCreate", ctx, framework, Some(guild), Err(error)).await?; } - Event::GuildDelete { ctx, full, .. } => { + Event::GuildDelete { full, .. } => { handle_guild("GuildDelete", ctx, framework, full.as_ref(), Err(error)).await?; } - Event::VoiceStateUpdate { ctx, .. } => { + Event::VoiceStateUpdate { .. } => { handle_unexpected_default(ctx, framework, "VoiceStateUpdate", Err(error)) .await?; } - Event::InteractionCreate { ctx, .. } => { + Event::InteractionCreate { .. } => { handle_unexpected_default(ctx, framework, "InteractionCreate", Err(error)) .await?; } - Event::Ready { ctx, .. } => { + Event::Ready { .. } => { handle_unexpected_default(ctx, framework, "Ready", Err(error)).await?; } _ => { diff --git a/src/events/mod.rs b/src/events/mod.rs index 42038062..b31e6c3b 100644 --- a/src/events/mod.rs +++ b/src/events/mod.rs @@ -21,39 +21,33 @@ use serenity::FullEvent as Event; use crate::structs::{FrameworkContext, Result}; -pub async fn listen(framework_ctx: FrameworkContext<'_>, event: &Event) -> Result<()> { +pub async fn listen( + ctx: &serenity::Context, + event: &Event, + framework_ctx: FrameworkContext<'_>, +) -> Result<()> { let data = framework_ctx.user_data; match event { - Event::Message { ctx, new_message } => message(framework_ctx, ctx, new_message).await, - Event::GuildCreate { ctx, guild, is_new } => guild_create(ctx, data, guild, *is_new).await, - Event::Ready { - ctx, - data_about_bot, - } => ready(framework_ctx, ctx, data_about_bot).await, - Event::GuildDelete { - ctx, - incomplete, - full, - } => guild_delete(ctx, data, incomplete, full.as_ref()).await, - Event::GuildMemberAddition { ctx, new_member } => { + Event::Message { new_message } => message(framework_ctx, ctx, new_message).await, + Event::GuildCreate { guild, is_new } => guild_create(ctx, data, guild, *is_new).await, + Event::Ready { data_about_bot } => ready(framework_ctx, ctx, data_about_bot).await, + Event::GuildDelete { incomplete, full } => { + guild_delete(ctx, data, incomplete, full.as_ref()).await + } + Event::GuildMemberAddition { new_member } => { guild_member_addition(ctx, data, new_member).await } Event::GuildMemberRemoval { - ctx, guild_id, user, member_data_if_available: _, } => guild_member_removal(ctx, data, *guild_id, user).await, - Event::VoiceStateUpdate { ctx, old, new } => { + Event::VoiceStateUpdate { old, new } => { voice_state_update(ctx, data, old.as_ref(), new).await } - Event::ChannelDelete { - ctx: _, - channel, - messages: _, - } => channel_delete(data, channel).await, - Event::InteractionCreate { ctx, interaction } => { + Event::ChannelDelete { channel, .. } => channel_delete(data, channel).await, + Event::InteractionCreate { interaction } => { interaction_create(framework_ctx, ctx, interaction).await } Event::Resume { .. } => { diff --git a/src/main.rs b/src/main.rs index 0ca1d6a6..d9d62c71 100644 --- a/src/main.rs +++ b/src/main.rs @@ -342,7 +342,7 @@ async fn _main(start_time: std::time::SystemTime) -> Result<()> { let framework_options = poise::FrameworkOptions { commands: commands::commands(), - event_handler: |event, ctx, _| Box::pin(events::listen(ctx, event)), + event_handler: |ctx, event, fw_ctx, _| Box::pin(events::listen(ctx, event, fw_ctx)), on_error: |error| { Box::pin(async move { let res = errors::handle(error).await; @@ -362,11 +362,9 @@ async fn _main(start_time: std::time::SystemTime) -> Result<()> { analytics_handler.log( Cow::Borrowed(match ctx { poise::Context::Prefix(_) => "command", - poise::Context::Application(ctx) => match ctx.interaction { - poise::CommandOrAutocompleteInteraction::Autocomplete(_) => { - "autocomplete" - } - poise::CommandOrAutocompleteInteraction::Command(_) => "slash_command", + poise::Context::Application(ctx) => match ctx.interaction_type { + poise::CommandInteractionType::Autocomplete => "autocomplete", + poise::CommandInteractionType::Command => "slash_command", }, }), false, @@ -480,7 +478,7 @@ async fn _main(start_time: std::time::SystemTime) -> Result<()> { async fn premium_command_check(ctx: Context<'_>) -> Result { if let Context::Application(ctx) = ctx { - if let poise::CommandOrAutocompleteInteraction::Autocomplete(_) = ctx.interaction { + if ctx.interaction_type == poise::CommandInteractionType::Autocomplete { // Ignore the premium check during autocomplete. return Ok(true); } diff --git a/src/traits.rs b/src/traits.rs index d3c00a9b..104fc949 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -49,16 +49,13 @@ impl PoiseContextExt for Context<'_> { fn current_catalog(&self) -> Option<&gettext::Catalog> { if let poise::Context::Application(ctx) = self { - if let poise::CommandOrAutocompleteInteraction::Command(interaction) = ctx.interaction { - return ctx - .data - .translations - .get(match interaction.locale.as_str() { - "ko" => "ko-KR", - "pt-BR" => "pt", - l => l, - }); - } + ctx.data + .translations + .get(match ctx.interaction.locale.as_str() { + "ko" => "ko-KR", + "pt-BR" => "pt", + l => l, + }); }; None