From 118832036ef47a00fb6e5298b5c66e37bcb67513 Mon Sep 17 00:00:00 2001 From: trivernis Date: Sat, 15 Oct 2022 14:10:07 +0200 Subject: [PATCH] Remove lavalink dependencies and update to new serenity --- Cargo.lock | 1039 +++++++++++-------------- Cargo.toml | 9 +- bot-coreutils/Cargo.toml | 4 +- bot-coreutils/src/process.rs | 2 +- bot-database/Cargo.toml | 8 +- bot-database/migration/Cargo.toml | 3 +- bot-database/migration/src/main.rs | 2 +- src/client.rs | 29 +- src/commands/misc/add_media.rs | 4 +- src/commands/misc/clear.rs | 4 +- src/commands/misc/help.rs | 1 + src/commands/misc/mod.rs | 20 +- src/commands/misc/reset_lavalink.rs | 40 - src/commands/misc/stats.rs | 2 +- src/commands/music/clear_queue.rs | 6 +- src/commands/music/current.rs | 2 +- src/commands/music/equalize.rs | 62 -- src/commands/music/equalizer.rs | 33 - src/commands/music/join.rs | 6 +- src/commands/music/leave.rs | 8 +- src/commands/music/lyrics.rs | 2 +- src/commands/music/mod.rs | 9 +- src/commands/music/move_song.rs | 6 +- src/commands/music/pause.rs | 6 +- src/commands/music/play.rs | 2 +- src/commands/music/play_next.rs | 2 +- src/commands/music/playlists.rs | 2 +- src/commands/music/queue.rs | 2 +- src/commands/music/remove_song.rs | 6 +- src/commands/music/save_playlist.rs | 2 +- src/commands/music/shuffle.rs | 6 +- src/commands/music/skip.rs | 6 +- src/commands/settings/get.rs | 2 +- src/commands/settings/set.rs | 2 +- src/commands/weeb/theme.rs | 4 +- src/handler.rs | 18 +- src/messages/gifs.rs | 2 +- src/messages/inspirobot.rs | 8 +- src/messages/mod.rs | 2 +- src/messages/music/equalizer.rs | 262 ------- src/messages/music/mod.rs | 1 - src/messages/music/no_voicechannel.rs | 4 +- src/messages/music/now_playing.rs | 6 +- src/messages/music/queue.rs | 2 +- src/messages/sauce.rs | 2 +- src/messages/theme.rs | 4 +- src/messages/xkcd.rs | 4 +- src/providers/music/lavalink.rs | 53 -- src/providers/music/mod.rs | 2 +- src/providers/music/player.rs | 111 ++- src/providers/music/player_events.rs | 30 + src/providers/music/queue.rs | 2 - src/utils/error.rs | 9 +- src/utils/mod.rs | 33 +- 54 files changed, 636 insertions(+), 1262 deletions(-) delete mode 100644 src/commands/misc/reset_lavalink.rs delete mode 100644 src/commands/music/equalize.rs delete mode 100644 src/commands/music/equalizer.rs delete mode 100644 src/messages/music/equalizer.rs delete mode 100644 src/providers/music/lavalink.rs create mode 100644 src/providers/music/player_events.rs diff --git a/Cargo.lock b/Cargo.lock index 7bde0e5..d8296b0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -21,7 +21,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b613b8e1e3cf911a086f53f03bf286f52fd7a7258e4fa606f0ef220d39d8877" dependencies = [ "generic-array", - "rand_core 0.6.3", + "rand_core 0.6.4", ] [[package]] @@ -30,16 +30,16 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" dependencies = [ - "getrandom 0.2.6", + "getrandom 0.2.7", "once_cell", "version_check", ] [[package]] name = "aho-corasick" -version = "0.7.18" +version = "0.7.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" +checksum = "b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e" dependencies = [ "memchr", ] @@ -71,24 +71,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "ansi_term" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" -dependencies = [ - "winapi", -] - -[[package]] -name = "arrayvec" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" -dependencies = [ - "nodrop", -] - [[package]] name = "arrayvec" version = "0.7.2" @@ -101,7 +83,7 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d194fd3896e9f9ec7a7add72608ea04e03a0dd2dc785d2d0a68c76182d7d1174" dependencies = [ - "base64 0.13.0", + "base64", "chrono", "futures-util", "isocountry", @@ -128,9 +110,9 @@ dependencies = [ [[package]] name = "async-channel" -version = "1.6.1" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2114d64672151c0c5eaa5e131ec84a74f06e1e559830dabba01ca30605d66319" +checksum = "e14485364214912d3b19cc3435dde4df66065127f05fa0d75c712f36f12c2f28" dependencies = [ "concurrent-queue", "event-listener", @@ -153,9 +135,9 @@ dependencies = [ [[package]] name = "async-global-executor" -version = "2.1.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd8b508d585e01084059b60f06ade4cb7415cd2e4084b71dd1cb44e7d3fb9880" +checksum = "0da5b41ee986eed3f524c380e6d64965aea573882a8907682ad100f7859305ca" dependencies = [ "async-channel", "async-executor", @@ -169,10 +151,11 @@ dependencies = [ [[package]] name = "async-io" -version = "1.7.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5e18f61464ae81cde0a23e713ae8fd299580c54d697a35820cfd0625b8b0e07" +checksum = "83e21f3a490c72b3b0cf44962180e60045de2925d8dff97918f7ee43c8f637c7" dependencies = [ + "autocfg", "concurrent-queue", "futures-lite", "libc", @@ -197,9 +180,9 @@ dependencies = [ [[package]] name = "async-std" -version = "1.11.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52580991739c5cdb36cde8b2a516371c0a3b70dda36d916cc08b82372916808c" +checksum = "62565bb4402e926b29953c785397c6dc0391b7b446e45008b0049eb43cec6f5d" dependencies = [ "async-attributes", "async-channel", @@ -215,7 +198,6 @@ dependencies = [ "kv-log-macro", "log", "memchr", - "num_cpus", "once_cell", "pin-project-lite", "pin-utils", @@ -246,53 +228,21 @@ dependencies = [ [[package]] name = "async-task" -version = "4.2.0" +version = "4.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30696a84d817107fc028e049980e09d5e140e8da8f1caeb17e8e950658a3cea9" +checksum = "7a40729d2133846d9ed0ea60a8b9541bccddab49cd30f0715a1da672fe9a2524" [[package]] name = "async-trait" -version = "0.1.56" +version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96cf8829f67d2eab0b2dfa42c5d0ef737e0724e4a82b01b3e292456202b19716" +checksum = "76464446b8bc32758d7e88ee1a804d9914cd9b1cb264c029899680b0be29826f" dependencies = [ "proc-macro2", "quote", "syn", ] -[[package]] -name = "async-tungstenite" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7cc5408453d37e2b1c6f01d8078af1da58b6cfa6a80fa2ede3bd2b9a6ada9c4" -dependencies = [ - "futures-io", - "futures-util", - "log", - "native-tls", - "pin-project", - "tokio", - "tokio-native-tls", - "tungstenite 0.11.1", -] - -[[package]] -name = "async-tungstenite" -version = "0.16.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5682ea0913e5c20780fe5785abacb85a411e7437bf52a1bedb93ddb3972cb8dd" -dependencies = [ - "futures-io", - "futures-util", - "log", - "native-tls", - "pin-project-lite", - "tokio", - "tokio-native-tls", - "tungstenite 0.16.0", -] - [[package]] name = "async-tungstenite" version = "0.17.2" @@ -302,10 +252,12 @@ dependencies = [ "futures-io", "futures-util", "log", + "native-tls", "pin-project-lite", "tokio", + "tokio-native-tls", "tokio-rustls", - "tungstenite 0.17.3", + "tungstenite", "webpki-roots", ] @@ -374,12 +326,6 @@ dependencies = [ "syn", ] -[[package]] -name = "base64" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" - [[package]] name = "base64" version = "0.13.0" @@ -388,9 +334,9 @@ checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" [[package]] name = "bit-set" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e11e16035ea35e4e5997b393eacbf6f63983188f7a2ad25bfb13465f5ad59de" +checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" dependencies = [ "bit-vec", ] @@ -409,18 +355,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "block-buffer" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" -dependencies = [ - "generic-array", -] - -[[package]] -name = "block-buffer" -version = "0.10.2" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bf7fe51849ea569fd452f37822f606a5cabb684dc918707a0193fd4664ff324" +checksum = "69cce20737498f97b993470a6e536b8523f0af7892a4f928cceb1ac5e52ebe7e" dependencies = [ "generic-array", ] @@ -464,9 +401,9 @@ dependencies = [ [[package]] name = "build-time" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1903cc3455e5cc187bd0e2cacad7de3b3fd8352b71c538039c3813bc713b2a40" +checksum = "b516fccffbcd4c007256d0d620522ea9fcc6f008c9ebb7173eeb349dfcf99786" dependencies = [ "chrono", "once_cell", @@ -477,9 +414,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.10.0" +version = "3.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37ccbd214614c6783386c1af30caf03192f17891059cecc394b4fb119e363de3" +checksum = "c1ad822118d20d2c234f427000d5acc36eabe1e29a348c89b63dd60b13f28e5d" [[package]] name = "bytemuck" @@ -495,15 +432,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38" - -[[package]] -name = "bytes" -version = "1.1.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" +checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db" [[package]] name = "cache-padded" @@ -541,24 +472,24 @@ dependencies = [ [[package]] name = "chrono-tz" -version = "0.6.1" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58549f1842da3080ce63002102d5bc954c7bc843d4f47818e642abdc36253552" +checksum = "29c39203181991a7dd4343b8005bd804e7a9a37afb8ac070e43771e8c820bbde" dependencies = [ "chrono", "chrono-tz-build", - "phf 0.10.1", + "phf 0.11.1", ] [[package]] name = "chrono-tz-build" -version = "0.0.2" +version = "0.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db058d493fb2f65f41861bfed7e3fe6335264a9f0f92710cab5bdf01fef09069" +checksum = "6f509c3a87b33437b05e2458750a0700e5bdd6956176773e6c7d6dd15a283a0c" dependencies = [ "parse-zoneinfo", - "phf 0.10.1", - "phf_codegen 0.10.0", + "phf 0.11.1", + "phf_codegen 0.11.1", ] [[package]] @@ -618,6 +549,16 @@ dependencies = [ "cc", ] +[[package]] +name = "codespan-reporting" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" +dependencies = [ + "termcolor", + "unicode-width", +] + [[package]] name = "command_attr" version = "0.4.1" @@ -631,9 +572,9 @@ dependencies = [ [[package]] name = "concurrent-queue" -version = "1.2.2" +version = "1.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30ed07550be01594c6026cff2a1d7fe9c8f683caa798e12b68694ac9e88286a3" +checksum = "af4780a44ab5696ea9e28294517f1fffb421a83a25af521333c838635509db9c" dependencies = [ "cache-padded", ] @@ -662,9 +603,9 @@ checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" [[package]] name = "cpufeatures" -version = "0.2.2" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59a6001667ab124aebae2a495118e11d30984c3a653e99d86d58971708cf5e4b" +checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320" dependencies = [ "libc", ] @@ -695,9 +636,9 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.4" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aaa7bd5fb665c6864b5f963dd9097905c54125909c7aa94c9e18507cdbe6c53" +checksum = "c2dd04ddaf88237dc3b8d8f9a3c1004b506b54b3313403944054d23c0870c521" dependencies = [ "cfg-if", "crossbeam-utils", @@ -705,9 +646,9 @@ dependencies = [ [[package]] name = "crossbeam-deque" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e" +checksum = "715e8152b692bba2d374b53d4875445368fdf21a94751410af607a5ac677d1fc" dependencies = [ "cfg-if", "crossbeam-epoch", @@ -716,23 +657,22 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.8" +version = "0.9.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1145cf131a2c6ba0615079ab6a638f7e1973ac9c2634fcbeaaad6114246efe8c" +checksum = "f916dfc5d356b0ed9dae65f1db9fc9770aa2851d2662b988ccf4fe3516e86348" dependencies = [ "autocfg", "cfg-if", "crossbeam-utils", - "lazy_static", "memoffset", "scopeguard", ] [[package]] name = "crossbeam-queue" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f25d8400f4a7a5778f0e4e52384a48cbd9b5c495d110786187fc750075277a2" +checksum = "1cd42583b04998a5363558e5f9291ee5a5ff6b49944332103f251e7479a82aa7" dependencies = [ "cfg-if", "crossbeam-utils", @@ -740,19 +680,18 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.8" +version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bf124c720b7686e3c2663cf54062ab0f68a88af2fb6a030e87e30bf721fcb38" +checksum = "edbafec5fa1f196ca66527c1b12c2ec4745ca14b50f1ad8f9f6f720b55d11fac" dependencies = [ "cfg-if", - "lazy_static", ] [[package]] name = "crypto-common" -version = "0.1.3" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57952ca27b5e3606ff4dd79b0020231aaf9d6aa76dc05fd30137538c50bd3ce8" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ "generic-array", "typenum", @@ -787,33 +726,68 @@ dependencies = [ [[package]] name = "ctor" -version = "0.1.22" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f877be4f7c9f246b183111634f75baa039715e3f46ce860677d3b19a69fb229c" +checksum = "cdffe87e1d521a10f9696f833fe502293ea446d7f256c06128293a4119bdf4cb" dependencies = [ "quote", "syn", ] [[package]] -name = "dashmap" -version = "4.0.2" +name = "cxx" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e77a43b28d0668df09411cb0bc9a8c2adc40f9a048afe863e05fd43251e8e39c" +checksum = "19f39818dcfc97d45b03953c1292efc4e80954e1583c4aa770bac1383e2310a4" dependencies = [ - "cfg-if", - "num_cpus", + "cc", + "cxxbridge-flags", + "cxxbridge-macro", + "link-cplusplus", +] + +[[package]] +name = "cxx-build" +version = "1.0.78" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e580d70777c116df50c390d1211993f62d40302881e54d4b79727acb83d0199" +dependencies = [ + "cc", + "codespan-reporting", + "once_cell", + "proc-macro2", + "quote", + "scratch", + "syn", +] + +[[package]] +name = "cxxbridge-flags" +version = "1.0.78" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56a46460b88d1cec95112c8c363f0e2c39afdb237f60583b0b36343bf627ea9c" + +[[package]] +name = "cxxbridge-macro" +version = "1.0.78" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "747b608fecf06b0d72d440f27acc99288207324b793be2c17991839f3d4995ea" +dependencies = [ + "proc-macro2", + "quote", + "syn", ] [[package]] name = "dashmap" -version = "5.3.4" +version = "5.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3495912c9c1ccf2e18976439f4443f3fee0fd61f424ff99fde6a66b15ecb448f" +checksum = "907076dfda823b0b36d2a1bb5f90c96660a5bbcd7729e10727f07858f22c4edc" dependencies = [ "cfg-if", - "hashbrown 0.12.3", + "hashbrown", "lock_api", + "once_cell", "parking_lot_core 0.9.3", "serde", ] @@ -844,20 +818,11 @@ dependencies = [ [[package]] name = "digest" -version = "0.9.0" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +checksum = "adfbc57365a37acbd2ebf2b64d7e69bb766e2fea813521ed536f5d0520dcf86c" dependencies = [ - "generic-array", -] - -[[package]] -name = "digest" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2fb860ca6fafa5552fb6d0e816a69c8e49f0908bf524e30a90d97c85892d506" -dependencies = [ - "block-buffer 0.10.2", + "block-buffer", "crypto-common", "subtle", ] @@ -930,9 +895,9 @@ checksum = "3a68a4904193147e0a8dec3314640e6db742afd5f6e634f428a6af230d9b3591" [[package]] name = "either" -version = "1.6.1" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" +checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" [[package]] name = "encoding_rs" @@ -954,9 +919,9 @@ dependencies = [ [[package]] name = "event-listener" -version = "2.5.2" +version = "2.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77f3309417938f28bf8228fcff79a4a37103981e3e186d2ccd19c74b38f4eb71" +checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" [[package]] name = "fallible-iterator" @@ -966,9 +931,9 @@ checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" [[package]] name = "fastrand" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf" +checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499" dependencies = [ "instant", ] @@ -985,15 +950,15 @@ dependencies = [ [[package]] name = "flume" -version = "0.10.12" +version = "0.10.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "843c03199d0c0ca54bc1ea90ac0d507274c28abcc4f691ae8b4eaa375087c76a" +checksum = "1657b4441c3403d9f7b3409e47575237dac27b1b5726df654a6ecbf92f0f7577" dependencies = [ "futures-core", "futures-sink", "nanorand", "pin-project", - "spin 0.9.3", + "spin 0.9.4", ] [[package]] @@ -1019,11 +984,10 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "form_urlencoded" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" +checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" dependencies = [ - "matches", "percent-encoding", ] @@ -1039,9 +1003,9 @@ dependencies = [ [[package]] name = "futures" -version = "0.3.21" +version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f73fe65f54d1e12b726f517d3e2135ca3125a437b6d998caf1962961f7172d9e" +checksum = "7f21eda599937fba36daeb58a22e8f5cee2d14c4a17b5b7739c7c8e5e3b8230c" dependencies = [ "futures-channel", "futures-core", @@ -1054,9 +1018,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.21" +version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3083ce4b914124575708913bca19bfe887522d6e2e6d0952943f5eac4a74010" +checksum = "30bdd20c28fadd505d0fd6712cdfcb0d4b5648baf45faef7f852afb2399bb050" dependencies = [ "futures-core", "futures-sink", @@ -1064,15 +1028,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.21" +version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c09fd04b7e4073ac7156a9539b57a484a8ea920f79c7c675d05d289ab6110d3" +checksum = "4e5aa3de05362c3fb88de6531e6296e85cde7739cccad4b9dfeeb7f6ebce56bf" [[package]] name = "futures-executor" -version = "0.3.21" +version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9420b90cfa29e327d0429f19be13e7ddb68fa1cccb09d65e5706b8c7a749b8a6" +checksum = "9ff63c23854bee61b6e9cd331d523909f238fc7636290b96826e9cfa5faa00ab" dependencies = [ "futures-core", "futures-task", @@ -1092,9 +1056,9 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.21" +version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc4045962a5a5e935ee2fdedaa4e08284547402885ab326734432bed5d12966b" +checksum = "bbf4d2a7a308fd4578637c0b17c7e1c7ba127b8f6ba00b29f717e9655d85eb68" [[package]] name = "futures-lite" @@ -1113,9 +1077,9 @@ dependencies = [ [[package]] name = "futures-macro" -version = "0.3.21" +version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33c1e13800337f4d4d7a316bf45a567dbcb6ffe087f16424852d97e97a91f512" +checksum = "42cd15d1c7456c04dbdf7e88bcd69760d74f3a798d6444e16974b505b0e62f17" dependencies = [ "proc-macro2", "quote", @@ -1124,21 +1088,21 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.21" +version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21163e139fa306126e6eedaf49ecdb4588f939600f0b1e770f4205ee4b7fa868" +checksum = "21b20ba5a92e727ba30e72834706623d94ac93a725410b6a6b6fbc1b07f7ba56" [[package]] name = "futures-task" -version = "0.3.21" +version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57c66a976bf5909d801bbef33416c41372779507e7a6b3a5e25e4749c58f776a" +checksum = "a6508c467c73851293f390476d4491cf4d227dbabcd4170f3bb6044959b294f1" [[package]] name = "futures-util" -version = "0.3.21" +version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8b7abd5d659d9b90c8cba917f6ec750a74e2dc23902ef9cd4cc8c8b22e6036a" +checksum = "44fb6cb1be61cc1d2e43b262516aafcf63b241cffdb1d3fa115f91d9c7b09c90" dependencies = [ "futures-channel", "futures-core", @@ -1176,9 +1140,9 @@ dependencies = [ [[package]] name = "generic-array" -version = "0.14.5" +version = "0.14.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803" +checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9" dependencies = [ "typenum", "version_check", @@ -1206,14 +1170,14 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9be70c98951c83b8d2f8f60d7065fa6d5146873094452a1008da8c2f1e4205ad" +checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" dependencies = [ "cfg-if", "js-sys", "libc", - "wasi 0.10.0+wasi-snapshot-preview1", + "wasi 0.11.0+wasi-snapshot-preview1", "wasm-bindgen", ] @@ -1231,11 +1195,11 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.13" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37a82c6d637fc9515a4694bbf1cb2457b79d81ce52b3108bdeea58b07dd34a57" +checksum = "5ca32592cf21ac7ccab1825cd87f6c9b3d9022c44d086172ed0966bec8af30be" dependencies = [ - "bytes 1.1.0", + "bytes", "fnv", "futures-core", "futures-sink", @@ -1248,12 +1212,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "hashbrown" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" - [[package]] name = "hashbrown" version = "0.12.3" @@ -1269,7 +1227,7 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69fe1fcf8b4278d860ad0548329f892a3631fb63f82574df68275f34cdbe0ffa" dependencies = [ - "hashbrown 0.12.3", + "hashbrown", ] [[package]] @@ -1320,7 +1278,7 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "digest 0.10.3", + "digest", ] [[package]] @@ -1343,9 +1301,9 @@ version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399" dependencies = [ - "bytes 1.1.0", + "bytes", "fnv", - "itoa 1.0.2", + "itoa 1.0.4", ] [[package]] @@ -1354,16 +1312,16 @@ version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" dependencies = [ - "bytes 1.1.0", + "bytes", "http", "pin-project-lite", ] [[package]] name = "httparse" -version = "1.7.1" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "496ce29bb5a52785b44e0f7ca2847ae0bb839c9bd28f69acac9b99d461c0c04c" +checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" [[package]] name = "httpdate" @@ -1373,11 +1331,11 @@ checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" [[package]] name = "hyper" -version = "0.14.19" +version = "0.14.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42dc3c131584288d375f2d07f822b0cb012d8c6fb899a5b9fdb3cb7eb9b6004f" +checksum = "02c929dc5c39e335a03c405292728118860721b10190d98c2a0f0efd5baafbac" dependencies = [ - "bytes 1.1.0", + "bytes", "futures-channel", "futures-core", "futures-util", @@ -1386,7 +1344,7 @@ dependencies = [ "http-body", "httparse", "httpdate", - "itoa 1.0.2", + "itoa 1.0.4", "pin-project-lite", "socket2", "tokio", @@ -1414,7 +1372,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ - "bytes 1.1.0", + "bytes", "hyper", "native-tls", "tokio", @@ -1423,24 +1381,34 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.50" +version = "0.1.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd911b35d940d2bd0bea0f9100068e5b97b51a1cbe13d13382f132e0365257a0" +checksum = "f5a6ef98976b22b3b7f2f3a806f858cb862044cfa66805aa3ad84cb3d3b785ed" dependencies = [ "android_system_properties", "core-foundation-sys", + "iana-time-zone-haiku", "js-sys", "wasm-bindgen", "winapi", ] +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fde6edd6cef363e9359ed3c98ba64590ba9eecba2293eb5a723ab32aee8926aa" +dependencies = [ + "cxx", + "cxx-build", +] + [[package]] name = "idna" -version = "0.2.3" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" +checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" dependencies = [ - "matches", "unicode-bidi", "unicode-normalization", ] @@ -1466,21 +1434,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.8.2" +version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6012d540c5baa3589337a98ce73408de9b5a25ec9fc2c6fd6be8f0d39e0ca5a" +checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" dependencies = [ "autocfg", - "hashbrown 0.11.2", -] - -[[package]] -name = "input_buffer" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19a8a95243d5a0398cae618ec29477c6e3cb631152be5c19481f80bc71559754" -dependencies = [ - "bytes 0.5.6", + "hashbrown", ] [[package]] @@ -1519,9 +1478,9 @@ dependencies = [ [[package]] name = "itertools" -version = "0.10.3" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" dependencies = [ "either", ] @@ -1534,15 +1493,15 @@ checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" [[package]] name = "itoa" -version = "1.0.2" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d" +checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc" [[package]] name = "js-sys" -version = "0.3.57" +version = "0.3.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "671a26f820db17c2a2750743f1dd03bafd15b98c9f30c7c2628c024c05d73397" +checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47" dependencies = [ "wasm-bindgen", ] @@ -1556,31 +1515,6 @@ dependencies = [ "log", ] -[[package]] -name = "lavalink-rs" -version = "0.9.0-rc.3" -source = "git+https://gitlab.com/vicky5124/lavalink-rs/?rev=2487c295#2487c2953c7af2fb3515f4cf6b3a593147c14728" -dependencies = [ - "async-trait", - "async-tungstenite 0.16.1", - "dashmap 4.0.2", - "futures", - "http", - "parking_lot 0.12.1", - "regex", - "reqwest", - "serde", - "serde-aux", - "serde_json", - "serenity 0.10.10", - "songbird 0.2.2", - "tokio", - "tokio-native-tls", - "tracing", - "typemap_rev 0.1.5", - "version_check", -] - [[package]] name = "lazy_static" version = "1.4.0" @@ -1595,15 +1529,24 @@ checksum = "db13adb97ab515a3691f56e4dbab09283d0b86cb45abd991d8634a9d6f501760" [[package]] name = "libc" -version = "0.2.126" +version = "0.2.135" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" +checksum = "68783febc7782c6c5cb401fbda4de5a9898be1762314da0bb2c10ced61f18b0c" + +[[package]] +name = "link-cplusplus" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9272ab7b96c9046fbc5bc56c06c117cb639fe2d509df0c421cad82d2915cf369" +dependencies = [ + "cc", +] [[package]] name = "lock_api" -version = "0.4.7" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53" +checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" dependencies = [ "autocfg", "scopeguard", @@ -1683,11 +1626,11 @@ checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" [[package]] name = "md-5" -version = "0.10.1" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "658646b21e0b72f7866c7038ab086d3d5e1cd6271f060fd37defb241949d0582" +checksum = "6365506850d44bff6e2fbcb5176cf63650e48bd45ef2fe2665ae1570e0f4b9ca" dependencies = [ - "digest 0.10.3", + "digest", ] [[package]] @@ -1710,6 +1653,7 @@ name = "migration" version = "0.1.0" dependencies = [ "sea-orm-migration", + "tokio", ] [[package]] @@ -1751,18 +1695,18 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.5.3" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f5c75688da582b8ffc1f1799e9db273f32133c49e048f614d22ec3256773ccc" +checksum = "96590ba8f175222643a85693f33d26e9c8a015f599c216509b1a6894af675d34" dependencies = [ "adler", ] [[package]] name = "mio" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "713d550d9b44d89174e066b7a6217ae06234c10cb47819a88290d2b353c31799" +checksum = "57ee1c23c7c63b0c9250c339ffdc69255f110b298b901b9f6c82547b7b87caaf" dependencies = [ "libc", "log", @@ -1776,7 +1720,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" dependencies = [ - "getrandom 0.2.6", + "getrandom 0.2.7", ] [[package]] @@ -1828,6 +1772,16 @@ dependencies = [ "winapi", ] +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + [[package]] name = "num-bigint" version = "0.4.3" @@ -1888,9 +1842,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.12.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7709cef83f0c1f58f666e746a08b21e0085f7440fa6a29cc194d68aac97a4225" +checksum = "e82dad04139b71a90c080c8463fe0dc7902db5192d939bd0950f074d014339e1" [[package]] name = "opaque-debug" @@ -1900,9 +1854,9 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openssl" -version = "0.10.40" +version = "0.10.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb81a6430ac911acb25fe5ac8f1d2af1b4ea8a4fdfda0f1ee4292af2e2d8eb0e" +checksum = "12fc0523e3bd51a692c8850d075d74dc062ccf251c0110668cbd921917118a13" dependencies = [ "bitflags", "cfg-if", @@ -1932,9 +1886,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.74" +version = "0.9.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "835363342df5fba8354c5b453325b110ffd54044e588c539cf2f20a8014e4cb1" +checksum = "5230151e44c0f05157effb743e8d517472843121cf9243e8b81393edb5acd9ce" dependencies = [ "autocfg", "cc", @@ -1960,20 +1914,19 @@ checksum = "9ff7415e9ae3fff1225851df9e0d9e4e5479f947619774677a63572e55e80eff" [[package]] name = "ouroboros" -version = "0.15.0" +version = "0.15.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f31a3b678685b150cba82b702dcdc5e155893f63610cf388d30cd988d4ca2bf" +checksum = "dfbb50b356159620db6ac971c6d5c9ab788c9cc38a6f49619fca2a27acb062ca" dependencies = [ "aliasable", "ouroboros_macro", - "stable_deref_trait", ] [[package]] name = "ouroboros_macro" -version = "0.15.0" +version = "0.15.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "084fd65d5dd8b3772edccb5ffd1e4b7eba43897ecd0f9401e330e8c542959408" +checksum = "4a0d9d1a6191c4f391f87219d1ea42b23f09ee84d64763cd05ee6ea88d9f384d" dependencies = [ "Inflector", "proc-macro-error", @@ -1982,6 +1935,12 @@ dependencies = [ "syn", ] +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + [[package]] name = "parking" version = "2.0.0" @@ -2047,15 +2006,15 @@ dependencies = [ [[package]] name = "paste" -version = "1.0.7" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c520e05135d6e763148b6426a837e239041653ba7becd2e538c076c738025fc" +checksum = "b1de2e551fb905ac83f73f7aedf2f0cb4a0da7e35efa24a202a936269f1f18e1" [[package]] name = "percent-encoding" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" +checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" [[package]] name = "phf" @@ -2070,11 +2029,11 @@ dependencies = [ [[package]] name = "phf" -version = "0.10.1" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fabbf1ead8a5bcbc20f5f8b939ee3f5b0f6f281b6ad3468b84656b658b455259" +checksum = "928c6535de93548188ef63bb7c4036bd415cd8f36ad25af44b9789b2ee72a48c" dependencies = [ - "phf_shared 0.10.0", + "phf_shared 0.11.1", ] [[package]] @@ -2089,12 +2048,12 @@ dependencies = [ [[package]] name = "phf_codegen" -version = "0.10.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb1c3a8bc4dd4e5cfce29b44ffc14bedd2ee294559a294e2a4d4c9e9a6a13cd" +checksum = "a56ac890c5e3ca598bbdeaa99964edb5b0258a583a9eb6ef4e89fc85d9224770" dependencies = [ - "phf_generator 0.10.0", - "phf_shared 0.10.0", + "phf_generator 0.11.1", + "phf_shared 0.11.1", ] [[package]] @@ -2117,6 +2076,16 @@ dependencies = [ "rand 0.8.5", ] +[[package]] +name = "phf_generator" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1181c94580fa345f50f19d738aaa39c0ed30a600d95cb2d3e23f94266f14fbf" +dependencies = [ + "phf_shared 0.11.1", + "rand 0.8.5", +] + [[package]] name = "phf_macros" version = "0.8.0" @@ -2145,6 +2114,15 @@ name = "phf_shared" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" +dependencies = [ + "siphasher", +] + +[[package]] +name = "phf_shared" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1fb5f6f826b772a8d4c0394209441e7d37cbbb967ae9c7e0e8134365c9ee676" dependencies = [ "siphasher", "uncased", @@ -2152,18 +2130,18 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.0.10" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58ad3879ad3baf4e44784bc6a718a8698867bb991f8ce24d1bcbe2cfb4c3a75e" +checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.0.10" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "744b6f092ba29c3650faf274db506afd39944f48420f6c86b17cfe0ee1cb36bb" +checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55" dependencies = [ "proc-macro2", "quote", @@ -2217,10 +2195,11 @@ dependencies = [ [[package]] name = "polling" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "685404d509889fade3e86fe3a5803bca2ec09b0c0778d5ada6ec8bf7a8de5259" +checksum = "899b00b9c8ab553c743b3e11e87c5c7d423b2a2de229ba95b24a756344748011" dependencies = [ + "autocfg", "cfg-if", "libc", "log", @@ -2245,9 +2224,9 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "878c6cbf956e03af9aa8204b407b9cbf47c072164800aa918c516cd4b056c50c" dependencies = [ - "base64 0.13.0", + "base64", "byteorder", - "bytes 1.1.0", + "bytes", "fallible-iterator", "hmac", "md-5", @@ -2263,14 +2242,14 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73d946ec7d256b04dfadc4e6a3292324e6f417124750fc5c0950f981b703a0f1" dependencies = [ - "bytes 1.1.0", + "bytes", "chrono", "fallible-iterator", "postgres-protocol", "serde", "serde_json", - "time 0.3.14", - "uuid 1.1.2", + "time 0.3.15", + "uuid 1.2.1", ] [[package]] @@ -2317,18 +2296,18 @@ checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" [[package]] name = "proc-macro2" -version = "1.0.39" +version = "1.0.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c54b25569025b7fc9651de43004ae593a75ad88543b17178aa5e1b9c4f15f56f" +checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.18" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1" +checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" dependencies = [ "proc-macro2", ] @@ -2355,7 +2334,7 @@ checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", "rand_chacha 0.3.1", - "rand_core 0.6.3", + "rand_core 0.6.4", ] [[package]] @@ -2375,7 +2354,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core 0.6.3", + "rand_core 0.6.4", ] [[package]] @@ -2389,11 +2368,11 @@ dependencies = [ [[package]] name = "rand_core" -version = "0.6.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.6", + "getrandom 0.2.7", ] [[package]] @@ -2440,9 +2419,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.2.13" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" dependencies = [ "bitflags", ] @@ -2453,16 +2432,16 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" dependencies = [ - "getrandom 0.2.6", + "getrandom 0.2.7", "redox_syscall", "thiserror", ] [[package]] name = "regex" -version = "1.5.6" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d83f127d94bdbcda4c8cc2e50f6f84f4b611f69c902699ca385a39c3a75f9ff1" +checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" dependencies = [ "aho-corasick", "memchr", @@ -2480,9 +2459,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.26" +version = "0.6.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49b3de9ec5dc0a3417da371aab17d729997c15010e7fd24ff707773a33bddb64" +checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" [[package]] name = "remove_dir_all" @@ -2495,12 +2474,12 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.11" +version = "0.11.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b75aa69a3f06bbcc66ede33af2af253c6f7a86b1ca0033f60c580a27074fbf92" +checksum = "431949c384f4e2ae07605ccaa56d1d9d2ecdb5cadd4f9577ccfab29f2e5149fc" dependencies = [ - "base64 0.13.0", - "bytes 1.1.0", + "base64", + "bytes", "encoding_rs", "futures-core", "futures-util", @@ -2512,11 +2491,11 @@ dependencies = [ "hyper-tls", "ipnet", "js-sys", - "lazy_static", "log", "mime", "mime_guess", "native-tls", + "once_cell", "percent-encoding", "pin-project-lite", "rustls", @@ -2554,11 +2533,11 @@ dependencies = [ [[package]] name = "rust_decimal" -version = "1.24.0" +version = "1.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2ee7337df68898256ad0d4af4aad178210d9e44d2ff900ce44064a97cd86530" +checksum = "ee9164faf726e4f3ece4978b25ca877ddc6802fa77f38cdccb32c7f805ecd70c" dependencies = [ - "arrayvec 0.7.2", + "arrayvec", "num-traits 0.2.15", "serde", ] @@ -2578,7 +2557,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver 1.0.9", + "semver 1.0.14", ] [[package]] @@ -2605,24 +2584,24 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7522c9de787ff061458fe9a829dc790a3f5b22dc571694fc5883f448b94d9a9" +checksum = "0864aeff53f8c05aa08d86e5ef839d3dfcf07aeba2db32f12db0ef716e87bd55" dependencies = [ - "base64 0.13.0", + "base64", ] [[package]] name = "rustversion" -version = "1.0.6" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2cc38e8fa666e2de3c4aba7edeb5ffc5246c1c2ed0e3d17e560aeeba736b23f" +checksum = "97477e48b4cf8603ad5f7aaf897467cf42ab4218a38ef76fb14c2d6773a6d6a8" [[package]] name = "ryu" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695" +checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" [[package]] name = "salsa20" @@ -2688,6 +2667,12 @@ dependencies = [ "tendril", ] +[[package]] +name = "scratch" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8132065adcfd6e02db789d9285a0deb2f3fcb04002865ab67d5fb103533898" + [[package]] name = "sct" version = "0.7.0" @@ -2700,9 +2685,9 @@ dependencies = [ [[package]] name = "sea-orm" -version = "0.9.2" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "089dcca5d2c8393f5f21c7f7b0d84062839c3264ba62dcc0043eb207862e13a1" +checksum = "84c7282fc3d7f79f6c5bd57e603319862fc778bf74118c0ce2a0dc82d9141dee" dependencies = [ "async-stream", "async-trait", @@ -2719,17 +2704,17 @@ dependencies = [ "serde", "serde_json", "sqlx", - "time 0.3.14", + "time 0.3.15", "tracing", "url", - "uuid 1.1.2", + "uuid 1.2.1", ] [[package]] name = "sea-orm-cli" -version = "0.9.2" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cefd2d8878bd7e8b7313f036725fa3d08585d101fb1bf3adca7fc13f553f906" +checksum = "de07b4a0fc83b1b7ef8a2fe5d42c2662b1c60315446e6ebb4151a301c35fe484" dependencies = [ "async-std", "chrono", @@ -2744,9 +2729,9 @@ dependencies = [ [[package]] name = "sea-orm-macros" -version = "0.9.2" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d9708f945febe8625ccb0334654b97d1a1a0bffa0473d86e6108ad13f79bd5" +checksum = "f96b8a479d25d8110751a0511265556dd9139bc11e342357a98e60910fbb07e3" dependencies = [ "bae", "heck 0.3.3", @@ -2757,9 +2742,9 @@ dependencies = [ [[package]] name = "sea-orm-migration" -version = "0.9.2" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70a28587780fbae5c414a62bf0b32405f9da2e000d94f426abf214b2b2e68631" +checksum = "f80e3ebbc654c1915686898de119d33a449a9512567009df0a3e95b1afe4e36c" dependencies = [ "async-trait", "clap", @@ -2773,9 +2758,9 @@ dependencies = [ [[package]] name = "sea-query" -version = "0.26.3" +version = "0.26.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6a1de9d0334895f7eb51bd1603c3c9f6737413f905a134001f1e198f43bfd70" +checksum = "15e36a9680854b4e5d2ea5230f94e7ef81562260905b770fe20c3df9b3e7a536" dependencies = [ "chrono", "postgres-types", @@ -2783,8 +2768,8 @@ dependencies = [ "sea-query-derive", "sea-query-driver", "serde_json", - "time 0.3.14", - "uuid 1.1.2", + "time 0.3.15", + "uuid 1.2.1", ] [[package]] @@ -2858,9 +2843,9 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.6.1" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dc14f172faf8a0194a3aded622712b0de276821addc574fa54fc0a1167e10dc" +checksum = "2bc1bb97804af6631813c55739f771071e0f2ed33ee20b68c86ec505d906356c" dependencies = [ "bitflags", "core-foundation", @@ -2921,9 +2906,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.9" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cb243bdfdb5936c8dc3c45762a19d12ab4550cdc753bc247637d4ec35a040fd" +checksum = "e25dfac463d778e353db5be2449d1cce89bd6fd23c9f1ea21310ce6e5a1b29c4" [[package]] name = "semver-parser" @@ -2933,24 +2918,13 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.138" +version = "1.0.145" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1578c6245786b9d168c5447eeacfb96856573ca56c9d68fdcf394be134882a47" +checksum = "728eb6351430bccb993660dfffc5a72f91ccc1295abaa8ce19b27ebe4f75568b" dependencies = [ "serde_derive", ] -[[package]] -name = "serde-aux" -version = "3.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93abf9799c576f004252b2a05168d58527fb7c54de12e94b4d12fe3475ffad24" -dependencies = [ - "chrono", - "serde", - "serde_json", -] - [[package]] name = "serde-value" version = "0.7.0" @@ -2963,9 +2937,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.138" +version = "1.0.145" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "023e9b1467aef8a10fb88f25611870ada9800ef7e22afce356bb0d2387b6f27c" +checksum = "81fa1584d3d1bcacd84c277a0dfe21f5b0f6accf4a23d04d4c6d61f1af522b4c" dependencies = [ "proc-macro2", "quote", @@ -2974,11 +2948,11 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.81" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b7ce2b32a1aed03c558dc61a5cd328f15aff2dbc17daad8fb8af04d2100e15c" +checksum = "41feea4228a6f1cd09ec7a3593a682276702cd67b5273544757dae23c096f074" dependencies = [ - "itoa 1.0.2", + "itoa 1.0.4", "ryu", "serde", ] @@ -2994,9 +2968,9 @@ dependencies = [ [[package]] name = "serde_repr" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2ad84e47328a31223de7fed7a4f5087f2d6ddfe586cf3ca25b7a165bc0a5aed" +checksum = "1fe39d9fbb0ebf5eb2c7cb7e2a47e4f462fad1379f1166b8ae49ad9eae89a7ca" dependencies = [ "proc-macro2", "quote", @@ -3010,35 +2984,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" dependencies = [ "form_urlencoded", - "itoa 1.0.2", + "itoa 1.0.4", "ryu", "serde", ] -[[package]] -name = "serenity" -version = "0.10.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dde86919535c6047e055d512641c5241320c01cb8fee54f1e5ba77c939a0ec23" -dependencies = [ - "async-trait", - "async-tungstenite 0.11.0", - "base64 0.13.0", - "bitflags", - "bytes 1.1.0", - "chrono", - "flate2", - "futures", - "percent-encoding", - "reqwest", - "serde", - "serde_json", - "tokio", - "tracing", - "typemap_rev 0.1.5", - "url", -] - [[package]] name = "serenity" version = "0.11.5" @@ -3046,14 +2996,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "82fd5e7b5858ad96e99d440138f34f5b98e1b959ebcd3a1036203b30e78eb788" dependencies = [ "async-trait", - "async-tungstenite 0.17.2", - "base64 0.13.0", + "async-tungstenite", + "base64", "bitflags", - "bytes 1.1.0", + "bytes", "cfg-if", "chrono", "command_attr", - "dashmap 5.3.4", + "dashmap", "flate2", "futures", "levenshtein", @@ -3066,7 +3016,7 @@ dependencies = [ "serde-value", "serde_json", "static_assertions", - "time 0.3.14", + "time 0.3.15", "tokio", "tracing", "typemap_rev 0.1.5", @@ -3075,15 +3025,13 @@ dependencies = [ ] [[package]] -name = "serenity-rich-interaction" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6180e15ef1dbd442a7eb0deeb209913e1b04d4fdeb110cb8bc7c287d5b3d1cfd" +name = "serenity-additions" +version = "0.3.2" dependencies = [ - "dashmap 5.3.4", + "dashmap", "futures", "serde_json", - "serenity 0.10.10", + "serenity", "thiserror", "tokio", "tracing", @@ -3112,19 +3060,6 @@ dependencies = [ "stable_deref_trait", ] -[[package]] -name = "sha-1" -version = "0.9.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99cd6713db3cf16b6c84e06321e049a9b9f699826e16096d23bbcc44d15d51a6" -dependencies = [ - "block-buffer 0.9.0", - "cfg-if", - "cpufeatures", - "digest 0.9.0", - "opaque-debug", -] - [[package]] name = "sha-1" version = "0.10.0" @@ -3133,29 +3068,29 @@ checksum = "028f48d513f9678cda28f6e4064755b3fbb2af6acd672f2c209b62323f7aea0f" dependencies = [ "cfg-if", "cpufeatures", - "digest 0.10.3", + "digest", ] [[package]] name = "sha1" -version = "0.10.4" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "006769ba83e921b3085caa8334186b00cf92b4cb1a6cf4632fbccc8eff5c7549" +checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" dependencies = [ "cfg-if", "cpufeatures", - "digest 0.10.3", + "digest", ] [[package]] name = "sha2" -version = "0.10.2" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55deaec60f81eefe3cce0dc50bda92d6d8e88f2a27df7c5033b42afeb1ed2676" +checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" dependencies = [ "cfg-if", "cpufeatures", - "digest 0.10.3", + "digest", ] [[package]] @@ -3184,45 +3119,29 @@ checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de" [[package]] name = "slab" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb703cfe953bccee95685111adeedb76fabe4e97549a58d16f03ea7b9367bb32" +checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef" +dependencies = [ + "autocfg", +] [[package]] name = "smallvec" -version = "1.8.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" +checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" [[package]] name = "socket2" -version = "0.4.4" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66d72b759436ae32898a2af0a14218dbf55efde3feeb170eb623637db85ee1e0" +checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd" dependencies = [ "libc", "winapi", ] -[[package]] -name = "songbird" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "324223cec5772b4374bf82579c884ae3269fb53eb101aca25f8bf41312ab19fc" -dependencies = [ - "dashmap 4.0.2", - "flume", - "futures", - "parking_lot 0.11.2", - "pin-project", - "serde", - "serde_json", - "symphonia-core 0.2.0", - "tokio", - "tracing", - "tracing-futures", -] - [[package]] name = "songbird" version = "0.3.0" @@ -3230,10 +3149,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4c965f6625a2653e0733abfe217679562eb8c4787f000f4f13047541a444217" dependencies = [ "async-trait", - "async-tungstenite 0.17.2", + "async-tungstenite", "audiopus", "byteorder", - "dashmap 5.3.4", + "dashmap", "derivative", "discortp", "flume", @@ -3243,10 +3162,10 @@ dependencies = [ "rand 0.8.5", "serde", "serde_json", - "serenity 0.11.5", + "serenity", "serenity-voice-model", "streamcatcher", - "symphonia-core 0.5.1", + "symphonia-core", "tokio", "tracing", "tracing-futures", @@ -3264,9 +3183,9 @@ checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" [[package]] name = "spin" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c530c2b0d0bf8b69304b39fe2001993e267461948b890cd037d8ad4293fa1a0d" +checksum = "7f6002a767bff9e83f8eeecf883ecb8011875a21ae8da43bffb817a57e78cc09" dependencies = [ "lock_api", ] @@ -3300,10 +3219,10 @@ checksum = "dcbc16ddba161afc99e14d1713a453747a2b07fc097d2009f4c300ec99286105" dependencies = [ "ahash", "atoi", - "base64 0.13.0", + "base64", "bitflags", "byteorder", - "bytes 1.1.0", + "bytes", "chrono", "crc", "crossbeam-queue", @@ -3320,7 +3239,7 @@ dependencies = [ "hkdf", "hmac", "indexmap", - "itoa 1.0.2", + "itoa 1.0.4", "libc", "log", "md-5", @@ -3340,10 +3259,10 @@ dependencies = [ "sqlx-rt", "stringprep", "thiserror", - "time 0.3.14", + "time 0.3.15", "tokio-stream", "url", - "uuid 1.1.2", + "uuid 1.2.1", "whoami", ] @@ -3456,26 +3375,13 @@ version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" -[[package]] -name = "symphonia-core" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e32b956473d98c601dac257fab8a7700d42e49fdd7a33432dd5dc7fdd2448dd" -dependencies = [ - "arrayvec 0.4.12", - "bitflags", - "byteorder", - "lazy_static", - "log", -] - [[package]] name = "symphonia-core" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "199a6417cd4115bac79289b64b859358ea050b7add0ceb364dc991f628c5b347" dependencies = [ - "arrayvec 0.7.2", + "arrayvec", "bitflags", "bytemuck", "lazy_static", @@ -3484,9 +3390,9 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.96" +version = "1.0.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0748dd251e24453cb8717f0354206b91557e4ec8703673a4b30208f2abaf1ebf" +checksum = "3fcd952facd492f9be3ef0d0b7032a6e442ee9b361d4acc2b1d0c4aaa5f613a1" dependencies = [ "proc-macro2", "quote", @@ -3556,18 +3462,18 @@ checksum = "8eaa81235c7058867fa8c0e7314f33dcce9c215f535d1913822a2b3f5e289f3c" [[package]] name = "thiserror" -version = "1.0.31" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a" +checksum = "10deb33631e3c9018b9baf9dcbbc4f737320d2b576bac10f6aefa048fa407e3e" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.31" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a" +checksum = "982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb" dependencies = [ "proc-macro2", "quote", @@ -3596,11 +3502,11 @@ dependencies = [ [[package]] name = "time" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c3f9a28b618c3a6b9251b6908e9c99e04b9e5c02e6581ccbb67d59c34ef7f9b" +checksum = "d634a985c4d4238ec39cacaed2e7ae552fbd3c476b552c1deac3021b7d7eaf0c" dependencies = [ - "itoa 1.0.2", + "itoa 1.0.4", "libc", "num_threads", "serde", @@ -3641,7 +3547,6 @@ dependencies = [ "chrono-tz", "dotenv", "futures", - "lavalink-rs", "lazy_static", "minecraft-data-rs", "rand 0.8.5", @@ -3652,9 +3557,9 @@ dependencies = [ "serde", "serde_derive", "serde_json", - "serenity 0.11.5", - "serenity-rich-interaction", - "songbird 0.3.0", + "serenity", + "serenity-additions", + "songbird", "sysinfo", "thiserror", "tokio", @@ -3668,20 +3573,21 @@ dependencies = [ [[package]] name = "tokio" -version = "1.19.2" +version = "1.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c51a52ed6686dd62c320f9b89299e9dfb46f730c7a48e635c19f21d116cb1439" +checksum = "a9e03c497dc955702ba729190dc4aac6f2a0ce97f913e5b1b5912fc5039d9099" dependencies = [ - "bytes 1.1.0", + "autocfg", + "bytes", "libc", "memchr", "mio", "num_cpus", - "once_cell", "pin-project-lite", "signal-hook-registry", "socket2", "tokio-macros", + "tracing", "winapi", ] @@ -3719,9 +3625,9 @@ dependencies = [ [[package]] name = "tokio-stream" -version = "0.1.9" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df54d54117d6fdc4e4fea40fe1e4e566b3505700e148a6827e59b34b0d2600d9" +checksum = "d660770404473ccd7bc9f8b28494a811bc18542b915c0855c51e8f419d5223ce" dependencies = [ "futures-core", "pin-project-lite", @@ -3730,11 +3636,11 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc463cd8deddc3770d20f9852143d50bf6094e640b485cb2e189a2099085ff45" +checksum = "0bb2e075f03b3d66d8d8785356224ba688d2906a371015e225beeb65ca92c740" dependencies = [ - "bytes 1.1.0", + "bytes", "futures-core", "futures-sink", "pin-project-lite", @@ -3744,15 +3650,15 @@ dependencies = [ [[package]] name = "tower-service" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" [[package]] name = "tracing" -version = "0.1.35" +version = "0.1.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a400e31aa60b9d44a52a8ee0343b5b18566b03a8321e0d321f695cf56e940160" +checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" dependencies = [ "cfg-if", "log", @@ -3763,9 +3669,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.21" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc6b8ad3567499f98a1db7a752b07a7c8c7c7c34c332ec00effb2b0027974b7c" +checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a" dependencies = [ "proc-macro2", "quote", @@ -3774,9 +3680,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.28" +version = "0.1.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b7358be39f2f274f322d2aaed611acc57f382e8eb1e5b48cb9ae30933495ce7" +checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" dependencies = [ "once_cell", "valuable", @@ -3805,13 +3711,13 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.11" +version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bc28f93baff38037f64e6f43d34cfa1605f27a49c34e8a04c5e78b0babf2596" +checksum = "a6176eae26dd70d0c919749377897b54a9276bd7061339665dd68777926b5a70" dependencies = [ - "ansi_term", - "lazy_static", "matchers", + "nu-ansi-term", + "once_cell", "regex", "sharded-slab", "smallvec", @@ -3837,61 +3743,22 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" -[[package]] -name = "tungstenite" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0308d80d86700c5878b9ef6321f020f29b1bb9d5ff3cab25e75e23f3a492a23" -dependencies = [ - "base64 0.12.3", - "byteorder", - "bytes 0.5.6", - "http", - "httparse", - "input_buffer", - "log", - "native-tls", - "rand 0.7.3", - "sha-1 0.9.8", - "url", - "utf-8", -] - -[[package]] -name = "tungstenite" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ad3713a14ae247f22a728a0456a545df14acf3867f905adff84be99e23b3ad1" -dependencies = [ - "base64 0.13.0", - "byteorder", - "bytes 1.1.0", - "http", - "httparse", - "log", - "native-tls", - "rand 0.8.5", - "sha-1 0.9.8", - "thiserror", - "url", - "utf-8", -] - [[package]] name = "tungstenite" version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e27992fd6a8c29ee7eef28fc78349aa244134e10ad447ce3b9f0ac0ed0fa4ce0" dependencies = [ - "base64 0.13.0", + "base64", "byteorder", - "bytes 1.1.0", + "bytes", "http", "httparse", "log", + "native-tls", "rand 0.8.5", "rustls", - "sha-1 0.10.0", + "sha-1", "thiserror", "url", "utf-8", @@ -3942,30 +3809,30 @@ checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" [[package]] name = "unicode-ident" -version = "1.0.0" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d22af068fba1eb5edcb4aea19d382b2a3deb4c8f9d475c589b6ada9e0fd493ee" +checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3" [[package]] name = "unicode-normalization" -version = "0.1.19" +version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" dependencies = [ "tinyvec", ] [[package]] name = "unicode-segmentation" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e8820f5d777f6224dc4be3632222971ac30164d4a258d595640799554ebfd99" +checksum = "0fdbf052a0783de01e944a6ce7a8cb939e295b1e7be835a1112c3b9a7f047a5a" [[package]] name = "unicode-width" -version = "0.1.9" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" +checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" [[package]] name = "unicode_categories" @@ -3991,22 +3858,21 @@ checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" [[package]] name = "url" -version = "2.2.2" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" +checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" dependencies = [ "form_urlencoded", "idna", - "matches", "percent-encoding", "serde", ] [[package]] name = "urlencoding" -version = "2.1.0" +version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b90931029ab9b034b300b797048cf23723400aa757e8a2bfb9d748102f9821" +checksum = "e8db7427f936968176eaa7cdf81b7f98b980b18495ec28f1b5791ac3bfe3eea9" [[package]] name = "utf-8" @@ -4020,16 +3886,16 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" dependencies = [ - "getrandom 0.2.6", + "getrandom 0.2.7", ] [[package]] name = "uuid" -version = "1.1.2" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd6469f4314d5f1ffec476e05f17cc9a78bc7a27a6a857842170bdf8d6f98d2f" +checksum = "feb41e78f93363bb2df8b0e86a2ca30eed7806ea16ea0c790d757cf93f79be83" dependencies = [ - "getrandom 0.2.6", + "getrandom 0.2.7", "serde", ] @@ -4103,9 +3969,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.80" +version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27370197c907c55e3f1a9fbe26f44e937fe6451368324e009cba39e139dc08ad" +checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -4113,13 +3979,13 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.80" +version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53e04185bfa3a779273da532f5025e33398409573f348985af9a1cbf3774d3f4" +checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142" dependencies = [ "bumpalo", - "lazy_static", "log", + "once_cell", "proc-macro2", "quote", "syn", @@ -4128,9 +3994,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.30" +version = "0.4.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f741de44b75e14c35df886aff5f1eb73aa114fa5d4d00dcd37b5e01259bf3b2" +checksum = "23639446165ca5a5de86ae1d8896b737ae80319560fbaa4c2887b7da6e7ebd7d" dependencies = [ "cfg-if", "js-sys", @@ -4140,9 +4006,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.80" +version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17cae7ff784d7e83a2fe7611cfe766ecf034111b49deb850a3dc7699c08251f5" +checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4150,9 +4016,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.80" +version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99ec0dc7a4756fffc231aab1b9f2f578d23cd391390ab27f952ae0c9b3ece20b" +checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" dependencies = [ "proc-macro2", "quote", @@ -4163,15 +4029,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.80" +version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d554b7f530dee5964d9a9468d95c1f8b8acae4f282807e7d27d4b03099a46744" +checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" [[package]] name = "web-sys" -version = "0.3.57" +version = "0.3.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b17e741662c70c8bd24ac5c5b18de314a2c26c32bf8346ee1e6f53de919c283" +checksum = "bcda906d8be16e728fd5adc5b729afad4e444e106ab28cd1c7256e54fa61510f" dependencies = [ "js-sys", "wasm-bindgen", @@ -4189,9 +4055,9 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.22.3" +version = "0.22.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d8de8415c823c8abd270ad483c6feeac771fad964890779f9a8cb24fbbc1bf" +checksum = "368bfe657969fb01238bb756d351dcade285e0f6fcbd36dcb23359a5169975be" dependencies = [ "webpki", ] @@ -4207,10 +4073,11 @@ dependencies = [ [[package]] name = "whoami" -version = "1.2.1" +version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524b58fa5a20a2fb3014dd6358b70e6579692a56ef6fce928834e488f42f65e8" +checksum = "d6631b6a2fd59b1841b622e8f1a7ad241ef0a46f2d580464ce8140ac94cbd571" dependencies = [ + "bumpalo", "wasm-bindgen", "web-sys", ] @@ -4375,7 +4242,7 @@ checksum = "e68bcb965d6c650091450b95cea12f07dcd299a01c15e2f9433b0813ea3c0886" dependencies = [ "aead", "poly1305", - "rand_core 0.6.3", + "rand_core 0.6.4", "salsa20", "subtle", "zeroize", diff --git a/Cargo.toml b/Cargo.toml index 2fe481e..c49643a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -42,14 +42,11 @@ animethemes-rs = "0.4.4" build-time = "0.1.1" tracing-subscriber = { version = "0.3.11", features = ["env-filter"] } tracing = "0.1.34" -serenity-rich-interaction= "0.3.1" +serenity-additions = "0.3.2" [dependencies.tokio] version = "1.19.2" features = ["macros", "rt-multi-thread"] -[dependencies.lavalink-rs] -git = "https://gitlab.com/vicky5124/lavalink-rs/" -rev = "2487c295" -features=["native", "serenity", "songbird", "tracing-log"] -default-features = false +[patch.crates-io] +serenity-additions = { path = "../serenity-additions" } diff --git a/bot-coreutils/Cargo.toml b/bot-coreutils/Cargo.toml index 876272b..725432b 100644 --- a/bot-coreutils/Cargo.toml +++ b/bot-coreutils/Cargo.toml @@ -7,8 +7,8 @@ edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -tokio = { version = "1.19.2", features = ["process", "io-util"] } +tokio = { version = "1.21.2", features = ["process", "io-util"] } log = "0.4.17" -url = "2.2.2" +url = "2.3.1" mime_guess = "2.0.4" rand = "0.8.5" diff --git a/bot-coreutils/src/process.rs b/bot-coreutils/src/process.rs index dcf70fd..c4b318f 100644 --- a/bot-coreutils/src/process.rs +++ b/bot-coreutils/src/process.rs @@ -11,7 +11,7 @@ pub async fn run_command_async(command: &str, args: &[&str]) -> io::Result BotResult { let token = env::var("BOT_TOKEN").map_err(|_| BotError::MissingToken)?; let database = get_database().await?; - let client = Client::builder(token) - .register_rich_interactions_with(get_raw_event_handler()) + let client = Client::builder(token, GatewayIntents::all()) + .register_serenity_additions_with(get_raw_event_handler()) .event_handler(Handler) .framework(get_framework().await) .register_songbird() @@ -34,15 +34,6 @@ pub async fn get_client() -> BotResult { .type_map_insert::(database) .type_map_insert::(HashMap::new()) .await?; - let data = client.data.clone(); - - let current_application = client - .cache_and_http - .http - .get_current_application_info() - .await?; - - utils::initialize_lavalink(data, current_application).await?; Ok(client) } @@ -124,7 +115,7 @@ async fn before_hook(ctx: &Context, msg: &Message, _: &str) -> bool { } #[hook] -async fn dispatch_error(ctx: &Context, msg: &Message, error: DispatchError) { +async fn dispatch_error(ctx: &Context, msg: &Message, error: DispatchError, command_name: &str) { match error { DispatchError::Ratelimited(info) => { if info.is_first_try { @@ -140,13 +131,19 @@ async fn dispatch_error(ctx: &Context, msg: &Message, error: DispatchError) { DispatchError::OnlyForDM => { let _ = msg .channel_id - .say(&ctx.http, "This command only works via DM") + .say( + &ctx.http, + format!("The command {command_name} only works via DM"), + ) .await; } DispatchError::OnlyForGuilds => { let _ = msg .channel_id - .say(&ctx.http, "This command only works on servers") + .say( + &ctx.http, + format!("The command {command_name} only works on servers"), + ) .await; } DispatchError::NotEnoughArguments { min, given } => { diff --git a/src/commands/misc/add_media.rs b/src/commands/misc/add_media.rs index 82d7721..4270536 100644 --- a/src/commands/misc/add_media.rs +++ b/src/commands/misc/add_media.rs @@ -4,8 +4,8 @@ use serenity::client::Context; use serenity::framework::standard::macros::command; use serenity::framework::standard::{Args, CommandResult}; use serenity::model::channel::Message; -use serenity_rich_interaction::core::SHORT_TIMEOUT; -use serenity_rich_interaction::ephemeral_message::EphemeralMessage; +use serenity_additions::core::SHORT_TIMEOUT; +use serenity_additions::ephemeral_message::EphemeralMessage; #[command] #[description("Adds media to the database")] diff --git a/src/commands/misc/clear.rs b/src/commands/misc/clear.rs index 2399210..3a3a5fd 100644 --- a/src/commands/misc/clear.rs +++ b/src/commands/misc/clear.rs @@ -4,8 +4,8 @@ use serenity::framework::standard::macros::command; use serenity::framework::standard::{Args, CommandResult}; use serenity::model::channel::Message; use serenity::Result as SerenityResult; -use serenity_rich_interaction::core::SHORT_TIMEOUT; -use serenity_rich_interaction::ephemeral_message::EphemeralMessage; +use serenity_additions::core::SHORT_TIMEOUT; +use serenity_additions::ephemeral_message::EphemeralMessage; #[command] #[description("Clears the chat (maximum 100 messages)")] diff --git a/src/commands/misc/help.rs b/src/commands/misc/help.rs index b728e65..ddae30c 100644 --- a/src/commands/misc/help.rs +++ b/src/commands/misc/help.rs @@ -19,6 +19,7 @@ pub async fn help( groups: &[&'static CommandGroup], owners: HashSet, ) -> CommandResult { + tracing::debug!("Help"); let _ = help_commands::with_embeds(ctx, msg, args, help_options, groups, owners).await; handle_autodelete(ctx, msg).await?; Ok(()) diff --git a/src/commands/misc/mod.rs b/src/commands/misc/mod.rs index 968e5f1..50bb55d 100644 --- a/src/commands/misc/mod.rs +++ b/src/commands/misc/mod.rs @@ -10,7 +10,6 @@ use pain::PAIN_COMMAND; use party::PARTY_COMMAND; use ping::PING_COMMAND; use qalc::QALC_COMMAND; -use reset_lavalink::RESET_LAVALINK_COMMAND; use shutdown::SHUTDOWN_COMMAND; use stats::STATS_COMMAND; use time::TIME_COMMAND; @@ -28,7 +27,6 @@ mod pain; mod party; mod ping; mod qalc; -mod reset_lavalink; mod shutdown; mod stats; mod time; @@ -37,21 +35,7 @@ mod xkcd; #[group] #[commands( - ping, - stats, - shutdown, - time, - timezones, - qalc, - about, - add_media, - media, - pain, - clear, - xkcd, - fuck, - party, - inspirobot, - reset_lavalink + ping, stats, shutdown, time, timezones, qalc, about, add_media, media, pain, clear, xkcd, fuck, + party, inspirobot )] pub struct Misc; diff --git a/src/commands/misc/reset_lavalink.rs b/src/commands/misc/reset_lavalink.rs deleted file mode 100644 index d8ad762..0000000 --- a/src/commands/misc/reset_lavalink.rs +++ /dev/null @@ -1,40 +0,0 @@ -use serenity::client::Context; -use serenity::framework::standard::macros::command; -use serenity::framework::standard::CommandResult; -use serenity::model::channel::Message; - -use crate::commands::common::handle_autodelete; -use crate::providers::music::lavalink::Lavalink; -use crate::utils::initialize_lavalink; -use serenity_rich_interaction::core::SHORT_TIMEOUT; -use serenity_rich_interaction::ephemeral_message::EphemeralMessage; -use std::mem; -use std::sync::Arc; - -#[command] -#[description("Resets the lavalink connection")] -#[aliases("reconnect_lavalink", "reset-lavalink", "reconnect-lavalink")] -#[num_args(0)] -#[owners_only] -async fn reset_lavalink(ctx: &Context, msg: &Message) -> CommandResult { - let app_info = ctx.http.get_current_application_info().await?; - destroy_lavalink(ctx).await; - - initialize_lavalink(Arc::clone(&ctx.data), app_info).await?; - - EphemeralMessage::create(&ctx.http, msg.channel_id, SHORT_TIMEOUT, |m| { - m.content("Reconnected to lavalink") - }) - .await?; - handle_autodelete(ctx, msg).await?; - - Ok(()) -} - -async fn destroy_lavalink(ctx: &Context) { - let mut data = ctx.data.write().await; - { - let lava_client = data.remove::().unwrap(); - mem::drop(lava_client); - } -} diff --git a/src/commands/misc/stats.rs b/src/commands/misc/stats.rs index 067f92d..482a327 100644 --- a/src/commands/misc/stats.rs +++ b/src/commands/misc/stats.rs @@ -33,7 +33,7 @@ async fn stats(ctx: &Context, msg: &Message) -> CommandResult { let uptime = own_process.run_time(); let uptime = ChronoDuration::from_std(Duration::from_secs(uptime)).unwrap(); let total_commands_executed = database.get_total_commands_statistic().await?; - let shard_count = ctx.cache.shard_count().await; + let shard_count = ctx.cache.shard_count(); let discord_info = format!( r#" diff --git a/src/commands/music/clear_queue.rs b/src/commands/music/clear_queue.rs index 03c3402..98cd986 100644 --- a/src/commands/music/clear_queue.rs +++ b/src/commands/music/clear_queue.rs @@ -6,8 +6,8 @@ use serenity::model::channel::Message; use crate::commands::common::handle_autodelete; use crate::commands::music::{get_music_player_for_guild, DJ_CHECK}; use crate::messages::music::no_voicechannel::create_no_voicechannel_message; -use serenity_rich_interaction::core::SHORT_TIMEOUT; -use serenity_rich_interaction::ephemeral_message::EphemeralMessage; +use serenity_additions::core::SHORT_TIMEOUT; +use serenity_additions::ephemeral_message::EphemeralMessage; #[command] #[only_in(guilds)] @@ -17,7 +17,7 @@ use serenity_rich_interaction::ephemeral_message::EphemeralMessage; #[bucket("general")] #[checks(DJ)] async fn clear_queue(ctx: &Context, msg: &Message) -> CommandResult { - let guild = msg.guild(&ctx.cache).await.unwrap(); + let guild = msg.guild(&ctx.cache).unwrap(); tracing::debug!("Clearing queue for guild {}", guild.id); let player = if let Some(player) = get_music_player_for_guild(ctx, guild.id).await { diff --git a/src/commands/music/current.rs b/src/commands/music/current.rs index 7cb70bd..fad4897 100644 --- a/src/commands/music/current.rs +++ b/src/commands/music/current.rs @@ -15,7 +15,7 @@ use crate::messages::music::now_playing::create_now_playing_msg; #[aliases("nowplaying", "np")] #[bucket("general")] async fn current(ctx: &Context, msg: &Message) -> CommandResult { - let guild = msg.guild(&ctx.cache).await.unwrap(); + let guild = msg.guild(&ctx.cache).unwrap(); tracing::debug!("Displaying current song for queue in {}", guild.id); let player = if let Some(player) = get_music_player_for_guild(ctx, guild.id).await { diff --git a/src/commands/music/equalize.rs b/src/commands/music/equalize.rs deleted file mode 100644 index 764f314..0000000 --- a/src/commands/music/equalize.rs +++ /dev/null @@ -1,62 +0,0 @@ -use serenity::framework::standard::macros::command; -use serenity::framework::standard::{Args, CommandError, CommandResult}; -use serenity::model::channel::Message; -use serenity::prelude::*; - -use crate::commands::common::handle_autodelete; -use crate::commands::music::{get_music_player_for_guild, DJ_CHECK}; -use crate::messages::music::no_voicechannel::create_no_voicechannel_message; -use serenity_rich_interaction::core::{MEDIUM_TIMEOUT, SHORT_TIMEOUT}; -use serenity_rich_interaction::ephemeral_message::EphemeralMessage; - -#[command] -#[only_in(guilds)] -#[description("Loads an equalizer preset")] -#[usage("")] -#[num_args(1)] -#[example("bass")] -#[bucket("general")] -#[checks(DJ)] -async fn equalize(ctx: &Context, msg: &Message, mut args: Args) -> CommandResult { - let guild = msg.guild(&ctx.cache).await.unwrap(); - tracing::debug!("Changing equalizer for {}", guild.id); - let preset = args.single::().unwrap(); - - let player = if let Some(player) = get_music_player_for_guild(ctx, guild.id).await { - player - } else { - return create_no_voicechannel_message(&ctx.http, msg.channel_id) - .await - .map_err(CommandError::from); - }; - - let bands = match preset.to_lowercase().as_str() { - "metal" => lavalink_rs::EQ_METAL, - "boost" => lavalink_rs::EQ_BOOST, - "base" => lavalink_rs::EQ_BASE, - "piano" => lavalink_rs::EQ_PIANO, - _ => { - EphemeralMessage::create(&ctx.http, msg.channel_id, MEDIUM_TIMEOUT, |m| { - m.content(format!( - "Unknown preset '{}'. Available are 'metal', 'boost', 'base' and 'piano'", - preset - )) - }) - .await?; - handle_autodelete(ctx, msg).await?; - return Ok(()); - } - }; - { - let mut player = player.lock().await; - player.equalize_all(bands).await?; - } - EphemeralMessage::create(&ctx.http, msg.channel_id, SHORT_TIMEOUT, |m| { - m.content(format!("๐ŸŽ›๏ธ Changed equalizer to '{}'", preset)) - }) - .await?; - - handle_autodelete(ctx, msg).await?; - - Ok(()) -} diff --git a/src/commands/music/equalizer.rs b/src/commands/music/equalizer.rs deleted file mode 100644 index 10a07d4..0000000 --- a/src/commands/music/equalizer.rs +++ /dev/null @@ -1,33 +0,0 @@ -use serenity::framework::standard::macros::command; -use serenity::framework::standard::{CommandError, CommandResult}; -use serenity::model::channel::Message; -use serenity::prelude::*; - -use crate::commands::common::handle_autodelete; -use crate::commands::music::{get_music_player_for_guild, DJ_CHECK}; -use crate::messages::music::equalizer::create_equalizer_message; -use crate::messages::music::no_voicechannel::create_no_voicechannel_message; - -#[command] -#[only_in(guilds)] -#[description("Displays the equalizer for the music player")] -#[usage("")] -#[bucket("general")] -#[checks(DJ)] -async fn equalizer(ctx: &Context, msg: &Message) -> CommandResult { - let guild = msg.guild(&ctx.cache).await.unwrap(); - tracing::debug!("Displaying equalizer for guild {}", guild.id); - - let player = if let Some(player) = get_music_player_for_guild(ctx, guild.id).await { - player - } else { - return create_no_voicechannel_message(&ctx.http, msg.channel_id) - .await - .map_err(CommandError::from); - }; - - create_equalizer_message(&ctx, msg.channel_id, player).await?; - handle_autodelete(ctx, msg).await?; - - Ok(()) -} diff --git a/src/commands/music/join.rs b/src/commands/music/join.rs index a7927c2..e1fd1ce 100644 --- a/src/commands/music/join.rs +++ b/src/commands/music/join.rs @@ -7,8 +7,8 @@ use crate::commands::common::handle_autodelete; use crate::commands::music::{get_channel_for_author, get_music_player_for_guild, is_dj}; use crate::providers::music::player::MusicPlayer; use serenity::model::id::ChannelId; -use serenity_rich_interaction::core::SHORT_TIMEOUT; -use serenity_rich_interaction::ephemeral_message::EphemeralMessage; +use serenity_additions::core::SHORT_TIMEOUT; +use serenity_additions::ephemeral_message::EphemeralMessage; #[command] #[only_in(guilds)] @@ -16,7 +16,7 @@ use serenity_rich_interaction::ephemeral_message::EphemeralMessage; #[usage("")] #[bucket("general")] async fn join(ctx: &Context, msg: &Message, mut args: Args) -> CommandResult { - let guild = msg.guild(&ctx.cache).await.unwrap(); + let guild = msg.guild(&ctx.cache).unwrap(); let channel_id = if let Ok(arg) = args.single::() { if is_dj(ctx, guild.id, &msg.author).await? { ChannelId(arg) diff --git a/src/commands/music/leave.rs b/src/commands/music/leave.rs index 456d9da..dc5dd4f 100644 --- a/src/commands/music/leave.rs +++ b/src/commands/music/leave.rs @@ -6,8 +6,8 @@ use serenity::model::channel::Message; use crate::commands::common::handle_autodelete; use crate::commands::music::DJ_CHECK; use crate::utils::context_data::MusicPlayers; -use serenity_rich_interaction::core::SHORT_TIMEOUT; -use serenity_rich_interaction::ephemeral_message::EphemeralMessage; +use serenity_additions::core::SHORT_TIMEOUT; +use serenity_additions::ephemeral_message::EphemeralMessage; #[command] #[only_in(guilds)] @@ -17,13 +17,13 @@ use serenity_rich_interaction::ephemeral_message::EphemeralMessage; #[bucket("general")] #[checks(DJ)] async fn leave(ctx: &Context, msg: &Message) -> CommandResult { - let guild = msg.guild(&ctx.cache).await.unwrap(); + let guild = msg.guild(&ctx.cache).unwrap(); tracing::debug!("Leave request received for guild {}", guild.id); let manager = songbird::get(ctx).await.unwrap(); if let Some(handler) = manager.get(guild.id) { let mut handler_lock = handler.lock().await; - let _ = handler_lock.leave().await; + handler_lock.leave().await?; } let mut data = ctx.data.write().await; diff --git a/src/commands/music/lyrics.rs b/src/commands/music/lyrics.rs index 1a6ca2b..9628fa5 100644 --- a/src/commands/music/lyrics.rs +++ b/src/commands/music/lyrics.rs @@ -13,7 +13,7 @@ use crate::messages::music::no_voicechannel::create_no_voicechannel_message; #[usage("")] #[bucket("general")] async fn lyrics(ctx: &Context, msg: &Message) -> CommandResult { - let guild = msg.guild(&ctx.cache).await.unwrap(); + let guild = msg.guild(&ctx.cache).unwrap(); tracing::debug!("Fetching lyrics for song playing in {}", guild.id); let player = if let Some(player) = get_music_player_for_guild(ctx, guild.id).await { diff --git a/src/commands/music/mod.rs b/src/commands/music/mod.rs index d37a830..071a314 100644 --- a/src/commands/music/mod.rs +++ b/src/commands/music/mod.rs @@ -18,8 +18,6 @@ use youtube_metadata::get_video_information; use clear_queue::CLEAR_QUEUE_COMMAND; use current::CURRENT_COMMAND; -use equalize::EQUALIZE_COMMAND; -use equalizer::EQUALIZER_COMMAND; use join::JOIN_COMMAND; use leave::LEAVE_COMMAND; use lyrics::LYRICS_COMMAND; @@ -43,8 +41,6 @@ use crate::utils::error::{BotError, BotResult}; mod clear_queue; mod current; -mod equalize; -mod equalizer; mod join; mod leave; mod lyrics; @@ -75,9 +71,7 @@ mod skip; playlists, lyrics, move_song, - remove_song, - equalizer, - equalize + remove_song )] pub struct Music; @@ -257,7 +251,6 @@ pub async fn check_dj( ) -> Result<(), Reason> { let guild = msg .guild(&ctx.cache) - .await .ok_or(Reason::Log("Not in a guild".to_string()))?; if is_dj(ctx, guild.id, &msg.author) diff --git a/src/commands/music/move_song.rs b/src/commands/music/move_song.rs index ccea76c..28a37d9 100644 --- a/src/commands/music/move_song.rs +++ b/src/commands/music/move_song.rs @@ -5,8 +5,8 @@ use serenity::client::Context; use serenity::framework::standard::macros::command; use serenity::framework::standard::{Args, CommandError, CommandResult}; use serenity::model::channel::Message; -use serenity_rich_interaction::core::SHORT_TIMEOUT; -use serenity_rich_interaction::ephemeral_message::EphemeralMessage; +use serenity_additions::core::SHORT_TIMEOUT; +use serenity_additions::ephemeral_message::EphemeralMessage; #[command] #[description("Moves a song in the queue from one position to a new one")] @@ -18,7 +18,7 @@ use serenity_rich_interaction::ephemeral_message::EphemeralMessage; #[aliases("mvs", "movesong", "move-song")] #[checks(DJ)] async fn move_song(ctx: &Context, msg: &Message, mut args: Args) -> CommandResult { - let guild = msg.guild(&ctx.cache).await.unwrap(); + let guild = msg.guild(&ctx.cache).unwrap(); tracing::debug!("Moving song for guild {}", guild.id); let pos1 = args.single::()?; diff --git a/src/commands/music/pause.rs b/src/commands/music/pause.rs index 34099aa..1b57e7d 100644 --- a/src/commands/music/pause.rs +++ b/src/commands/music/pause.rs @@ -6,8 +6,8 @@ use serenity::prelude::*; use crate::commands::common::handle_autodelete; use crate::commands::music::{get_music_player_for_guild, DJ_CHECK}; use crate::messages::music::no_voicechannel::create_no_voicechannel_message; -use serenity_rich_interaction::core::SHORT_TIMEOUT; -use serenity_rich_interaction::ephemeral_message::EphemeralMessage; +use serenity_additions::core::SHORT_TIMEOUT; +use serenity_additions::ephemeral_message::EphemeralMessage; #[command] #[only_in(guilds)] @@ -16,7 +16,7 @@ use serenity_rich_interaction::ephemeral_message::EphemeralMessage; #[bucket("general")] #[checks(DJ)] async fn pause(ctx: &Context, msg: &Message) -> CommandResult { - let guild = msg.guild(&ctx.cache).await.unwrap(); + let guild = msg.guild(&ctx.cache).unwrap(); tracing::debug!("Pausing playback for guild {}", guild.id); let player = if let Some(player) = get_music_player_for_guild(ctx, guild.id).await { diff --git a/src/commands/music/play.rs b/src/commands/music/play.rs index 164247e..ef1b241 100644 --- a/src/commands/music/play.rs +++ b/src/commands/music/play.rs @@ -22,7 +22,7 @@ use std::sync::Arc; async fn play(ctx: &Context, msg: &Message, args: Args) -> CommandResult { let query = args.message(); - let guild = msg.guild(&ctx.cache).await.unwrap(); + let guild = msg.guild(&ctx.cache).unwrap(); tracing::debug!("Play request received for guild {}", guild.id); let mut player = get_music_player_for_guild(ctx, guild.id).await; diff --git a/src/commands/music/play_next.rs b/src/commands/music/play_next.rs index b8cb4d5..e57e361 100644 --- a/src/commands/music/play_next.rs +++ b/src/commands/music/play_next.rs @@ -22,7 +22,7 @@ use std::sync::Arc; async fn play_next(ctx: &Context, msg: &Message, args: Args) -> CommandResult { let query = args.message(); - let guild = msg.guild(&ctx.cache).await.unwrap(); + let guild = msg.guild(&ctx.cache).unwrap(); tracing::debug!("Playing song as next song for guild {}", guild.id); let mut player = get_music_player_for_guild(ctx, guild.id).await; diff --git a/src/commands/music/playlists.rs b/src/commands/music/playlists.rs index 87fa238..4aeadeb 100644 --- a/src/commands/music/playlists.rs +++ b/src/commands/music/playlists.rs @@ -12,7 +12,7 @@ use crate::utils::context_data::get_database_from_context; #[usage("")] #[bucket("general")] async fn playlists(ctx: &Context, msg: &Message) -> CommandResult { - let guild = msg.guild(&ctx.cache).await.unwrap(); + let guild = msg.guild(&ctx.cache).unwrap(); tracing::debug!("Displaying playlists for guild {}", guild.id); let database = get_database_from_context(ctx).await; diff --git a/src/commands/music/queue.rs b/src/commands/music/queue.rs index f61a376..641e023 100644 --- a/src/commands/music/queue.rs +++ b/src/commands/music/queue.rs @@ -16,7 +16,7 @@ use crate::providers::music::queue::Song; #[aliases("q")] #[bucket("general")] async fn queue(ctx: &Context, msg: &Message, mut args: Args) -> CommandResult { - let guild = msg.guild(&ctx.cache).await.unwrap(); + let guild = msg.guild(&ctx.cache).unwrap(); tracing::trace!("Displaying queue for guild {}", guild.id); let query = args diff --git a/src/commands/music/remove_song.rs b/src/commands/music/remove_song.rs index f5420fd..8dfe4d7 100644 --- a/src/commands/music/remove_song.rs +++ b/src/commands/music/remove_song.rs @@ -5,8 +5,8 @@ use serenity::client::Context; use serenity::framework::standard::macros::command; use serenity::framework::standard::{Args, CommandError, CommandResult}; use serenity::model::channel::Message; -use serenity_rich_interaction::core::SHORT_TIMEOUT; -use serenity_rich_interaction::ephemeral_message::EphemeralMessage; +use serenity_additions::core::SHORT_TIMEOUT; +use serenity_additions::ephemeral_message::EphemeralMessage; #[command] #[description("Removes a song from the queue")] @@ -18,7 +18,7 @@ use serenity_rich_interaction::ephemeral_message::EphemeralMessage; #[aliases("rms", "removesong", "remove-song")] #[checks(DJ)] async fn remove_song(ctx: &Context, msg: &Message, mut args: Args) -> CommandResult { - let guild = msg.guild(&ctx.cache).await.unwrap(); + let guild = msg.guild(&ctx.cache).unwrap(); tracing::debug!("Moving song for guild {}", guild.id); let pos = args.single::()?; diff --git a/src/commands/music/save_playlist.rs b/src/commands/music/save_playlist.rs index 01bd983..e2102db 100644 --- a/src/commands/music/save_playlist.rs +++ b/src/commands/music/save_playlist.rs @@ -16,7 +16,7 @@ use crate::utils::context_data::get_database_from_context; #[bucket("general")] #[checks(DJ)] async fn save_playlist(ctx: &Context, msg: &Message, mut args: Args) -> CommandResult { - let guild = msg.guild(&ctx.cache).await.unwrap(); + let guild = msg.guild(&ctx.cache).unwrap(); let name: String = args.single().unwrap(); let url: &str = args.remains().unwrap(); diff --git a/src/commands/music/shuffle.rs b/src/commands/music/shuffle.rs index 3564f13..096e78d 100644 --- a/src/commands/music/shuffle.rs +++ b/src/commands/music/shuffle.rs @@ -6,8 +6,8 @@ use serenity::model::channel::Message; use crate::commands::common::handle_autodelete; use crate::commands::music::{get_music_player_for_guild, DJ_CHECK}; use crate::messages::music::no_voicechannel::create_no_voicechannel_message; -use serenity_rich_interaction::core::SHORT_TIMEOUT; -use serenity_rich_interaction::ephemeral_message::EphemeralMessage; +use serenity_additions::core::SHORT_TIMEOUT; +use serenity_additions::ephemeral_message::EphemeralMessage; #[command] #[only_in(guilds)] @@ -17,7 +17,7 @@ use serenity_rich_interaction::ephemeral_message::EphemeralMessage; #[bucket("general")] #[checks(DJ)] async fn shuffle(ctx: &Context, msg: &Message) -> CommandResult { - let guild = msg.guild(&ctx.cache).await.unwrap(); + let guild = msg.guild(&ctx.cache).unwrap(); tracing::debug!("Shuffling queue for guild {}", guild.id); let player = if let Some(player) = get_music_player_for_guild(ctx, guild.id).await { diff --git a/src/commands/music/skip.rs b/src/commands/music/skip.rs index be5f8db..851a277 100644 --- a/src/commands/music/skip.rs +++ b/src/commands/music/skip.rs @@ -6,8 +6,8 @@ use serenity::model::channel::Message; use crate::commands::common::handle_autodelete; use crate::commands::music::{get_music_player_for_guild, DJ_CHECK}; use crate::messages::music::no_voicechannel::create_no_voicechannel_message; -use serenity_rich_interaction::core::SHORT_TIMEOUT; -use serenity_rich_interaction::ephemeral_message::EphemeralMessage; +use serenity_additions::core::SHORT_TIMEOUT; +use serenity_additions::ephemeral_message::EphemeralMessage; #[command] #[only_in(guilds)] @@ -17,7 +17,7 @@ use serenity_rich_interaction::ephemeral_message::EphemeralMessage; #[bucket("general")] #[checks(DJ)] async fn skip(ctx: &Context, msg: &Message) -> CommandResult { - let guild = msg.guild(&ctx.cache).await.unwrap(); + let guild = msg.guild(&ctx.cache).unwrap(); tracing::debug!("Skipping song for guild {}", guild.id); let player = if let Some(player) = get_music_player_for_guild(ctx, guild.id).await { diff --git a/src/commands/settings/get.rs b/src/commands/settings/get.rs index 7389fd6..9b24415 100644 --- a/src/commands/settings/get.rs +++ b/src/commands/settings/get.rs @@ -17,7 +17,7 @@ use crate::utils::context_data::get_database_from_context; #[bucket("general")] async fn get(ctx: &Context, msg: &Message, mut args: Args) -> CommandResult { let database = get_database_from_context(ctx).await; - let guild = msg.guild(&ctx.cache).await.unwrap(); + let guild = msg.guild(&ctx.cache).unwrap(); tracing::debug!("Displaying guild setting for guild {}", guild.id); if let Some(key) = args.single::().ok() { diff --git a/src/commands/settings/set.rs b/src/commands/settings/set.rs index b14e5d6..c3ee145 100644 --- a/src/commands/settings/set.rs +++ b/src/commands/settings/set.rs @@ -28,7 +28,7 @@ async fn set(ctx: &Context, msg: &Message, mut args: Args) -> CommandResult { return Ok(()); } let database = get_database_from_context(ctx).await; - let guild = msg.guild(&ctx.cache).await.unwrap(); + let guild = msg.guild(&ctx.cache).unwrap(); if let Ok(value) = args.single::() { database diff --git a/src/commands/weeb/theme.rs b/src/commands/weeb/theme.rs index 01dc000..8feadd1 100644 --- a/src/commands/weeb/theme.rs +++ b/src/commands/weeb/theme.rs @@ -5,8 +5,8 @@ use serenity::client::Context; use serenity::framework::standard::macros::command; use serenity::framework::standard::{Args, CommandResult}; use serenity::model::channel::Message; -use serenity_rich_interaction::core::MEDIUM_TIMEOUT; -use serenity_rich_interaction::ephemeral_message::EphemeralMessage; +use serenity_additions::core::MEDIUM_TIMEOUT; +use serenity_additions::ephemeral_message::EphemeralMessage; #[command] #[description("Query for the opening/ending/insert song of an anime")] diff --git a/src/handler.rs b/src/handler.rs index 9453d49..2b6038e 100644 --- a/src/handler.rs +++ b/src/handler.rs @@ -4,7 +4,7 @@ use serenity::model::channel::GuildChannel; use serenity::model::event::ResumedEvent; use serenity::model::gateway::{Activity, Ready}; use serenity::model::guild::Member; -use serenity::model::id::{ChannelId, GuildId}; +use serenity::model::id::ChannelId; use serenity::model::voice::VoiceState; use serenity::prelude::*; @@ -12,8 +12,8 @@ use crate::commands::music::get_music_player_for_guild; use crate::utils::context_data::MusicPlayers; use crate::utils::delete_messages_from_database; use serenity::model::event; -use serenity_rich_interaction::events::RichEventHandler; -use serenity_rich_interaction::Result; +use serenity_additions::events::RichEventHandler; +use serenity_additions::Result; /// Returns the raw event handler built from a rich event handler pub fn get_raw_event_handler() -> RichEventHandler { @@ -34,8 +34,9 @@ async fn ready(ctx: &Context, _: &Ready) -> Result<()> { tracing::info!("Ready"); delete_messages_from_database(&ctx).await?; let prefix = std::env::var("BOT_PREFIX").unwrap_or("~!".to_string()); - ctx.set_activity(Activity::listening(format!("{}help", prefix).as_str())) + ctx.set_activity(Activity::listening(format!("{prefix}help").as_str())) .await; + tracing::info!("Fully initialized. Listening to {prefix}help"); Ok(()) } @@ -50,13 +51,12 @@ impl EventHandler for Handler { async fn voice_state_update( &self, ctx: Context, - guild_id: Option, old_state: Option, new_state: VoiceState, ) { let mut member_count = None; - let guild_id = if let Some(gid) = guild_id { + let guild_id = if let Some(gid) = new_state.guild_id { gid } else { return; @@ -81,7 +81,7 @@ impl EventHandler for Handler { } // handle disconnects if let (Some(state), None) = (old_state, new_state.channel_id) { - let current_user = ctx.cache.current_user().await; + let current_user = ctx.cache.current_user(); if state.user_id == current_user.id { let mut data = ctx.data.write().await; @@ -101,7 +101,7 @@ impl EventHandler for Handler { async fn get_own_channel_member_count(ctx: &Context, channel_id: ChannelId) -> Option { let guild_channel = get_guild_channel(ctx, channel_id).await?; - let current_user = ctx.cache.current_user().await; + let current_user = ctx.cache.current_user(); let members = guild_channel.members(&ctx).await.ok()?; let own_channel = members @@ -119,7 +119,7 @@ async fn get_own_channel_member_count(ctx: &Context, channel_id: ChannelId) -> O /// Returns the guild channel for a guild ID async fn get_guild_channel(ctx: &Context, channel_id: ChannelId) -> Option { - if let Some(channel) = ctx.cache.channel(channel_id).await { + if let Some(channel) = ctx.cache.channel(channel_id) { return channel.guild(); } let channel = ctx.http.get_channel(channel_id.0).await.ok()?; diff --git a/src/messages/gifs.rs b/src/messages/gifs.rs index 97c9717..4b6d8f3 100644 --- a/src/messages/gifs.rs +++ b/src/messages/gifs.rs @@ -3,7 +3,7 @@ use bot_database::models::Media; use serenity::builder::CreateMessage; use serenity::client::Context; use serenity::model::id::{ChannelId, UserId}; -use serenity_rich_interaction::menu::{MenuBuilder, Page}; +use serenity_additions::menu::{MenuBuilder, Page}; use std::time::Duration; /// Creates a new gifs embed diff --git a/src/messages/inspirobot.rs b/src/messages/inspirobot.rs index 87090ec..7f3541f 100644 --- a/src/messages/inspirobot.rs +++ b/src/messages/inspirobot.rs @@ -3,10 +3,8 @@ use crate::utils::error::BotResult; use serenity::builder::CreateMessage; use serenity::client::Context; use serenity::model::id::{ChannelId, UserId}; -use serenity_rich_interaction::core::EXTRA_LONG_TIMEOUT; -use serenity_rich_interaction::menu::{ - close_menu, display_page, MenuBuilder, Page, CLOSE_MENU_EMOJI, -}; +use serenity_additions::core::EXTRA_LONG_TIMEOUT; +use serenity_additions::menu::{close_menu, display_page, MenuBuilder, Page, CLOSE_MENU_EMOJI}; static REFRESH_EMOJI: &str = "๐Ÿ”„"; @@ -30,7 +28,7 @@ pub async fn create_inspirobot_menu( Box::pin(async { let message = create_inspirobot_page() .await - .map_err(|e| serenity_rich_interaction::Error::Msg(format!("{}", e)))?; + .map_err(|e| serenity_additions::Error::Msg(format!("{}", e)))?; Ok(message) }) })) diff --git a/src/messages/mod.rs b/src/messages/mod.rs index b0da98d..cf446f1 100644 --- a/src/messages/mod.rs +++ b/src/messages/mod.rs @@ -1,7 +1,7 @@ use crate::utils::context_data::get_database_from_context; use crate::utils::error::BotResult; use serenity::client::Context; -use serenity_rich_interaction::core::MessageHandle; +use serenity_additions::core::MessageHandle; use std::time::{Duration, SystemTime}; pub mod gifs; diff --git a/src/messages/music/equalizer.rs b/src/messages/music/equalizer.rs deleted file mode 100644 index 25b5810..0000000 --- a/src/messages/music/equalizer.rs +++ /dev/null @@ -1,262 +0,0 @@ -use crate::commands::music::is_dj; -use crate::providers::music::player::MusicPlayer; -use crate::utils::error::BotResult; -use serenity::builder::{CreateEmbed, CreateMessage}; -use serenity::client::Context; -use serenity::model::channel::Reaction; -use serenity::model::id::ChannelId; -use serenity_rich_interaction::core::EXTRA_LONG_TIMEOUT; -use serenity_rich_interaction::menu::{display_page, Menu, MenuBuilder, Page}; -use serenity_rich_interaction::Result as SerenityUtilsResult; -use std::sync::atomic::{AtomicU8, Ordering}; -use std::sync::Arc; -use tokio::sync::Mutex; -use typemap_rev::TypeMapKey; - -static DELETE_BUTTON: &str = "๐Ÿ—‘๏ธ"; -static NEXT_BAND_BUTTON: &str = "โžก๏ธ"; -static PREVIOUS_BAND_BUTTON: &str = "โฌ…๏ธ"; -static ADD_BUTTON: &str = "โž•"; -static SUB_BUTTON: &str = "โž–"; - -struct SelectedBand; - -impl TypeMapKey for SelectedBand { - type Value = Arc; -} - -struct Player; - -impl TypeMapKey for Player { - type Value = Arc>; -} - -/// Creates a new equalizer message -pub async fn create_equalizer_message( - ctx: &Context, - channel_id: ChannelId, - player: Arc>, -) -> BotResult<()> { - let selected_band = Arc::new(AtomicU8::new(0)); - let selected_band_clone = Arc::clone(&selected_band); - let player_clone = Arc::clone(&player); - - MenuBuilder::default() - .add_page(Page::new_builder(move || { - let player = Arc::clone(&player_clone); - let selected_band = Arc::clone(&selected_band_clone); - Box::pin(async move { - let mut page = CreateMessage::default(); - let mut embed = CreateEmbed::default(); - create_equalizer_embed(selected_band.load(Ordering::Relaxed), &mut embed, &player) - .await; - - page.embed(|e| { - e.0.clone_from(&embed.0); - e - }); - - Ok(page) - }) - })) - .add_control(-1, DELETE_BUTTON, |c, m, r| Box::pin(delete_menu(c, m, r))) - .add_help(DELETE_BUTTON, "Deletes this message.") - .add_control(0, PREVIOUS_BAND_BUTTON, |c, m, r| { - Box::pin(previous_band(c, m, r)) - }) - .add_help(PREVIOUS_BAND_BUTTON, "Selects the previous band.") - .add_control(1, NEXT_BAND_BUTTON, |c, m, r| Box::pin(next_band(c, m, r))) - .add_help(NEXT_BAND_BUTTON, "Selects the next band.") - .add_control(3, ADD_BUTTON, |c, m, r| Box::pin(add_to_band(c, m, r))) - .add_help(ADD_BUTTON, "Adds to the selected band.") - .add_control(2, SUB_BUTTON, |c, m, r| { - Box::pin(subtract_from_band(c, m, r)) - }) - .add_help(SUB_BUTTON, "Subtracts from the selected band") - .show_help() - .add_data::(selected_band) - .add_data::(player) - .timeout(EXTRA_LONG_TIMEOUT) - .build(ctx, channel_id) - .await?; - Ok(()) -} - -/// Creates a new equalizer embed -async fn create_equalizer_embed<'a>( - selected_band: u8, - embed: &'a mut CreateEmbed, - player: &Arc>, -) -> &'a mut CreateEmbed { - let mut description = String::new(); - let bands = { - let player = player.lock().await; - player.get_equalizer().clone() - }; - for i in 0..bands.len() { - if i as u8 == selected_band { - description += "โค‹" - } else { - description += " "; - } - } - description += "\n"; - for i in (0..11).rev() { - let eq_value = (i as f64) / 20.0 - 0.25; - - for band in &bands { - if (eq_value > 0. && band >= &eq_value) || (eq_value < 0. && band <= &eq_value) { - description += "โ–ˆ"; - } else if eq_value == 0. { - description += format!("-").as_str(); - } else { - description += " "; - } - } - description += "\n"; - } - for i in 0..bands.len() { - if i as u8 == selected_band { - description += "โคŠ" - } else { - description += " "; - } - } - embed - .title("Equalizer") - .description(format!("```\n{}\n```", description)); - - embed -} - -/// Selects the previous band -async fn next_band( - ctx: &Context, - menu: &mut Menu<'_>, - reaction: Reaction, -) -> SerenityUtilsResult<()> { - let guild_id = reaction.guild_id.unwrap(); - let user = reaction.user(&ctx).await?; - - if !is_dj(ctx, guild_id, &user).await? { - return Ok(()); - } - let selected_band = menu.data.get::().unwrap(); - if selected_band.load(Ordering::SeqCst) >= 14 { - selected_band.store(0, Ordering::SeqCst); - } else { - selected_band.fetch_add(1, Ordering::SeqCst); - } - display_page(ctx, menu).await?; - - Ok(()) -} - -/// Selects the previous band -async fn previous_band( - ctx: &Context, - menu: &mut Menu<'_>, - reaction: Reaction, -) -> SerenityUtilsResult<()> { - let guild_id = reaction.guild_id.unwrap(); - let user = reaction.user(&ctx).await?; - - if !is_dj(ctx, guild_id, &user).await? { - return Ok(()); - } - let selected_band = menu.data.get::().unwrap(); - if selected_band.load(Ordering::SeqCst) <= 0 { - selected_band.store(14, Ordering::SeqCst); - } else { - selected_band.fetch_sub(1, Ordering::SeqCst); - } - display_page(ctx, menu).await?; - - Ok(()) -} - -/// Adds to the selected band -async fn add_to_band( - ctx: &Context, - menu: &mut Menu<'_>, - reaction: Reaction, -) -> SerenityUtilsResult<()> { - let guild_id = reaction.guild_id.unwrap(); - let user = reaction.user(&ctx).await?; - - if !is_dj(ctx, guild_id, &user).await? { - return Ok(()); - } - { - let selected_band = menu - .data - .get::() - .unwrap() - .load(Ordering::Relaxed); - let player = menu.data.get::().unwrap(); - let mut player = player.lock().await; - let equalizer = player.get_equalizer(); - let current_value = equalizer[selected_band as usize]; - - if current_value < 0.25 { - player.equalize(selected_band, current_value + 0.05).await?; - } - } - - display_page(ctx, menu).await?; - - Ok(()) -} - -/// Substracts from the selected band -async fn subtract_from_band( - ctx: &Context, - menu: &mut Menu<'_>, - reaction: Reaction, -) -> SerenityUtilsResult<()> { - let guild_id = reaction.guild_id.unwrap(); - let user = reaction.user(&ctx).await?; - - if !is_dj(ctx, guild_id, &user).await? { - return Ok(()); - } - { - let selected_band = menu - .data - .get::() - .unwrap() - .load(Ordering::Relaxed); - let player = menu.data.get::().unwrap(); - let mut player = player.lock().await; - let equalizer = player.get_equalizer(); - let current_value = equalizer[selected_band as usize]; - - if current_value > -0.25 { - player.equalize(selected_band, current_value - 0.05).await?; - } - } - - display_page(ctx, menu).await?; - - Ok(()) -} - -/// Deletes the menu -async fn delete_menu( - ctx: &Context, - menu: &mut Menu<'_>, - reaction: Reaction, -) -> SerenityUtilsResult<()> { - let guild_id = reaction.guild_id.unwrap(); - let user = reaction.user(&ctx).await?; - - if !is_dj(ctx, guild_id, &user).await? { - return Ok(()); - } - let handle = menu.message.read().await; - ctx.http - .delete_message(handle.channel_id, handle.message_id) - .await?; - - Ok(()) -} diff --git a/src/messages/music/mod.rs b/src/messages/music/mod.rs index 9d0953a..0a2d747 100644 --- a/src/messages/music/mod.rs +++ b/src/messages/music/mod.rs @@ -1,4 +1,3 @@ -pub mod equalizer; pub mod no_voicechannel; pub mod now_playing; pub mod queue; diff --git a/src/messages/music/no_voicechannel.rs b/src/messages/music/no_voicechannel.rs index bc5cdc1..061d579 100644 --- a/src/messages/music/no_voicechannel.rs +++ b/src/messages/music/no_voicechannel.rs @@ -1,8 +1,8 @@ use crate::utils::error::BotResult; use serenity::http::Http; use serenity::model::prelude::ChannelId; -use serenity_rich_interaction::core::SHORT_TIMEOUT; -use serenity_rich_interaction::ephemeral_message::EphemeralMessage; +use serenity_additions::core::SHORT_TIMEOUT; +use serenity_additions::ephemeral_message::EphemeralMessage; use std::sync::Arc; /// Creates a not in a voicechannel message diff --git a/src/messages/music/now_playing.rs b/src/messages/music/now_playing.rs index 5fa69c6..0672b79 100644 --- a/src/messages/music/now_playing.rs +++ b/src/messages/music/now_playing.rs @@ -14,9 +14,9 @@ use crate::utils::error::*; use serenity::builder::CreateMessage; use serenity::client::Context; use serenity::model::channel::Reaction; -use serenity_rich_interaction::core::MessageHandle; -use serenity_rich_interaction::menu::{Menu, MenuBuilder, Page}; -use serenity_rich_interaction::Result as SerenityUtilsResult; +use serenity_additions::core::MessageHandle; +use serenity_additions::menu::{Menu, MenuBuilder, Page}; +use serenity_additions::Result as SerenityUtilsResult; use std::env; use std::time::Duration; use tokio::sync::{Mutex, RwLock}; diff --git a/src/messages/music/queue.rs b/src/messages/music/queue.rs index 9a870e7..50c9541 100644 --- a/src/messages/music/queue.rs +++ b/src/messages/music/queue.rs @@ -3,7 +3,7 @@ use crate::utils::error::BotResult; use serenity::builder::CreateMessage; use serenity::client::Context; use serenity::model::id::ChannelId; -use serenity_rich_interaction::menu::{MenuBuilder, Page}; +use serenity_additions::menu::{MenuBuilder, Page}; use std::time::Duration; /// Creates a new queue menu diff --git a/src/messages/sauce.rs b/src/messages/sauce.rs index 6235993..8cb1217 100644 --- a/src/messages/sauce.rs +++ b/src/messages/sauce.rs @@ -8,7 +8,7 @@ use bot_coreutils::url::get_domain_for_url; use crate::utils::error::BotResult; use rand::prelude::SliceRandom; -use serenity_rich_interaction::menu::{MenuBuilder, Page}; +use serenity_additions::menu::{MenuBuilder, Page}; use std::time::Duration; static MAX_RESULTS: usize = 6; diff --git a/src/messages/theme.rs b/src/messages/theme.rs index 165d5bf..571f162 100644 --- a/src/messages/theme.rs +++ b/src/messages/theme.rs @@ -3,8 +3,8 @@ use animethemes_rs::models::{Anime, ThemeEntry, ThemeType}; use serenity::builder::CreateMessage; use serenity::client::Context; use serenity::model::id::{ChannelId, UserId}; -use serenity_rich_interaction::core::EXTRA_LONG_TIMEOUT; -use serenity_rich_interaction::menu::{MenuBuilder, Page}; +use serenity_additions::core::EXTRA_LONG_TIMEOUT; +use serenity_additions::menu::{MenuBuilder, Page}; /// Creates a new Anime Theme Menu pub async fn create_theme_menu( diff --git a/src/messages/xkcd.rs b/src/messages/xkcd.rs index 4a3bf91..1cb201d 100644 --- a/src/messages/xkcd.rs +++ b/src/messages/xkcd.rs @@ -2,8 +2,8 @@ use crate::utils::error::BotResult; use serenity::builder::CreateMessage; use serenity::client::Context; use serenity::model::id::{ChannelId, UserId}; -use serenity_rich_interaction::core::LONG_TIMEOUT; -use serenity_rich_interaction::menu::{MenuBuilder, Page}; +use serenity_additions::core::LONG_TIMEOUT; +use serenity_additions::menu::{MenuBuilder, Page}; use xkcd_search::Comic; /// Creates a new xkcd menu diff --git a/src/providers/music/lavalink.rs b/src/providers/music/lavalink.rs deleted file mode 100644 index 060621d..0000000 --- a/src/providers/music/lavalink.rs +++ /dev/null @@ -1,53 +0,0 @@ -use crate::utils::context_data::MusicPlayers; -use lavalink_rs::gateway::LavalinkEventHandler; -use lavalink_rs::model::{PlayerUpdate, Stats, TrackFinish, TrackStart}; -use lavalink_rs::LavalinkClient; -use serenity::async_trait; -use serenity::prelude::TypeMapKey; -use std::sync::Arc; -use tokio::sync::RwLock; -use typemap_rev::TypeMap; - -pub struct LavalinkHandler { - pub data: Arc>, -} - -#[async_trait] -impl LavalinkEventHandler for LavalinkHandler { - async fn track_start(&self, _client: LavalinkClient, event: TrackStart) { - tracing::info!("Track started!\nGuild: {}", event.guild_id); - } - - async fn track_finish(&self, _: LavalinkClient, event: TrackFinish) { - tracing::info!("Track finished!\nGuild: {}", event.guild_id); - let player = { - let data = self.data.read().await; - let players = data.get::().unwrap(); - - players.get(&event.guild_id.0).cloned() - }; - if let Some(player) = player { - let mut player = player.lock().await; - if let Err(e) = player.play_next().await { - tracing::error!("Failed to play next song: {:?}", e); - } - if let Err(e) = player.update_now_playing().await { - tracing::error!("Failed to update now playing embed: {:?}", e); - } - } - } - - async fn player_update(&self, _: LavalinkClient, event: PlayerUpdate) { - tracing::debug!("Received player update event: {:?}", event); - } - - async fn stats(&self, _: LavalinkClient, event: Stats) { - tracing::debug!("Received stats event: {:?}", event); - } -} - -pub struct Lavalink; - -impl TypeMapKey for Lavalink { - type Value = Arc; -} diff --git a/src/providers/music/mod.rs b/src/providers/music/mod.rs index 4556584..b6f708b 100644 --- a/src/providers/music/mod.rs +++ b/src/providers/music/mod.rs @@ -8,9 +8,9 @@ use responses::VideoInformation; use youtube_dl::search_video_information; pub mod inspirobot; -pub mod lavalink; pub mod lyrics; pub mod player; +pub mod player_events; pub mod queue; pub mod responses; pub mod spotify; diff --git a/src/providers/music/player.rs b/src/providers/music/player.rs index 43fac0b..dc3b8eb 100644 --- a/src/providers/music/player.rs +++ b/src/providers/music/player.rs @@ -1,26 +1,27 @@ use crate::messages::music::now_playing::update_now_playing_msg; -use crate::providers::music::lavalink::Lavalink; use crate::providers::music::lyrics::get_lyrics; use crate::providers::music::queue::MusicQueue; use crate::utils::context_data::MusicPlayers; use crate::utils::error::{BotError, BotResult}; -use lavalink_rs::LavalinkClient; use serenity::prelude::TypeMap; use serenity::{ client::Context, http::Http, model::id::{ChannelId, GuildId}, }; -use serenity_rich_interaction::core::{MessageHandle, SHORT_TIMEOUT}; -use serenity_rich_interaction::ephemeral_message::EphemeralMessage; +use serenity_additions::core::{MessageHandle, SHORT_TIMEOUT}; +use serenity_additions::ephemeral_message::EphemeralMessage; +use songbird::tracks::TrackHandle; use songbird::Songbird; use std::mem; use std::sync::Arc; use std::time::Duration; use tokio::sync::{Mutex, RwLock}; +use super::player_events::register_player_events; + pub struct MusicPlayer { - client: Arc, + manager: Arc, http: Arc, queue: MusicQueue, guild_id: GuildId, @@ -28,19 +29,19 @@ pub struct MusicPlayer { msg_channel: ChannelId, leave_flag: bool, paused: bool, - equalizer: [f64; 15], + current_track: Option, } impl MusicPlayer { /// Creates a new music player pub fn new( - client: Arc, + manager: Arc, http: Arc, guild_id: GuildId, msg_channel: ChannelId, ) -> Self { Self { - client, + manager, http, guild_id, queue: MusicQueue::new(), @@ -48,7 +49,7 @@ impl MusicPlayer { now_playing_msg: None, leave_flag: false, paused: false, - equalizer: [0f64; 15], + current_track: None, } } @@ -60,20 +61,12 @@ impl MusicPlayer { msg_channel_id: ChannelId, ) -> BotResult>> { let manager = songbird::get(ctx).await.unwrap(); - let (handler, connection) = manager.join_gateway(guild_id, voice_channel_id).await; - let connection = connection?; - - { - let mut handler = handler.lock().await; - handler.deafen(true).await?; - } + let (handler, _) = manager.join(guild_id, voice_channel_id).await; let player = { let mut data = ctx.data.write().await; - let client = data.get::().unwrap(); - client.create_session_with_songbird(&connection).await?; let player = MusicPlayer::new( - Arc::clone(client), + Arc::clone(&manager), Arc::clone(&ctx.http), guild_id, msg_channel_id, @@ -84,6 +77,12 @@ impl MusicPlayer { player }; + { + let mut handler = handler.lock().await; + handler.deafen(true).await?; + register_player_events(player.clone(), &mut handler); + } + wait_for_disconnect( Arc::clone(&ctx.data), Arc::clone(&player), @@ -101,7 +100,9 @@ impl MusicPlayer { /// Skips to the next song pub async fn skip(&mut self) -> BotResult<()> { - self.client.stop(self.guild_id.0).await?; + if let Some(track) = self.current_track.take() { + track.stop()?; + } Ok(()) } @@ -109,7 +110,9 @@ impl MusicPlayer { /// Stops playback and leaves the channel pub async fn stop(&mut self) -> BotResult<()> { self.queue.clear(); - self.client.stop(self.guild_id.0).await?; + if let Some(track) = self.current_track.take() { + track.stop()?; + } Ok(()) } @@ -128,7 +131,9 @@ impl MusicPlayer { pub async fn play_next(&mut self) -> BotResult<()> { while !self.try_play_next().await? {} if self.paused { - self.client.pause(self.guild_id).await?; + if let Some(track) = self.current_track.as_ref() { + track.pause()?; + } } Ok(()) @@ -154,8 +159,8 @@ impl MusicPlayer { tracing::debug!("Could not find playable candidate for song."); return Ok(false); }; - let query_information = match self.client.auto_search_tracks(url).await { - Ok(i) => i, + let source = match songbird::ytdl(url).await { + Ok(s) => s, Err(e) => { tracing::error!("Failed to search for song: {}", e); self.send_error_message(format!( @@ -168,12 +173,16 @@ impl MusicPlayer { return Ok(false); } }; - - if query_information.tracks.len() == 0 { - return Ok(false); + let handler_lock = self + .manager + .get(self.guild_id.0) + .ok_or(BotError::MissingSongbirdClient)?; + { + let mut handler = handler_lock.lock().await; + let track_handle = handler.play_source(source); + self.current_track = Some(track_handle); } - let track = query_information.tracks[0].clone(); - self.client.play(self.guild_id.0, track).start().await?; + self.queue.set_current(next); Ok(true) @@ -208,7 +217,13 @@ impl MusicPlayer { /// Pauses playback pub async fn toggle_paused(&mut self) -> BotResult<()> { self.paused = !self.paused; - self.client.set_pause(self.guild_id.0, self.paused).await?; + if let Some(track) = self.current_track.as_ref() { + if self.paused { + track.play()?; + } else { + track.pause()?; + } + } Ok(()) } @@ -242,37 +257,6 @@ impl MusicPlayer { Ok(()) } - - /// Returns the equalizer - pub fn get_equalizer(&self) -> &[f64; 15] { - &self.equalizer - } - - /// Equalizes a specified band - pub async fn equalize(&mut self, band: u8, value: f64) -> BotResult<()> { - if band > 15 { - return Err(BotError::from("Invalid Equalizer band")); - } - if value < -0.25 || value > 0.25 { - return Err(BotError::from("Invalid Equalizer value")); - } - self.equalizer[band as usize] = value; - self.client - .equalize_all(self.guild_id, self.equalizer) - .await?; - - Ok(()) - } - - /// Equalizes all bands at the same time - pub async fn equalize_all(&mut self, bands: [f64; 15]) -> BotResult<()> { - self.equalizer = bands; - self.client - .equalize_all(self.guild_id, self.equalizer) - .await?; - - Ok(()) - } } /// Stats a tokio coroutine to check for player disconnect conditions @@ -295,8 +279,11 @@ fn wait_for_disconnect( tracing::debug!("Waiting to leave"); if leave_in <= 0 { - tracing::debug!("Leaving voice channel"); + tracing::info!("Leaving voice channel"); + if let Some(track) = player_lock.current_track.take() { + let _ = track.stop(); + } if let Some(handler) = manager.get(guild_id) { let mut handler_lock = handler.lock().await; let _ = handler_lock.leave().await; diff --git a/src/providers/music/player_events.rs b/src/providers/music/player_events.rs new file mode 100644 index 0000000..113c8f4 --- /dev/null +++ b/src/providers/music/player_events.rs @@ -0,0 +1,30 @@ +use serenity::async_trait; +use std::sync::Arc; + +use serenity::prelude::Mutex; +use songbird::{Call, Event, EventContext, EventHandler, TrackEvent}; + +use super::player::MusicPlayer; + +pub fn register_player_events(player: Arc>, handler: &mut Call) { + handler.add_global_event(Event::Track(TrackEvent::End), TrackEndHandler { player }); +} + +struct TrackEndHandler { + player: Arc>, +} + +#[async_trait] +impl EventHandler for TrackEndHandler { + #[tracing::instrument(level = "debug", skip_all)] + async fn act(&self, _ctx: &EventContext<'_>) -> Option { + let mut player = self.player.lock().await; + if let Err(e) = player.play_next().await { + tracing::error!("Failed to play next song: {:?}", e); + } + if let Err(e) = player.update_now_playing().await { + tracing::error!("Failed to update now playing embed: {:?}", e); + } + None + } +} diff --git a/src/providers/music/queue.rs b/src/providers/music/queue.rs index 1d86c16..e076353 100644 --- a/src/providers/music/queue.rs +++ b/src/providers/music/queue.rs @@ -12,7 +12,6 @@ use bot_database::models::YoutubeSong; pub struct MusicQueue { inner: VecDeque, current: Option, - pub leave_flag: bool, } impl MusicQueue { @@ -20,7 +19,6 @@ impl MusicQueue { Self { inner: VecDeque::new(), current: None, - leave_flag: false, } } diff --git a/src/utils/error.rs b/src/utils/error.rs index 3bbc578..aba26b6 100644 --- a/src/utils/error.rs +++ b/src/utils/error.rs @@ -1,5 +1,4 @@ -use lavalink_rs::error::LavalinkError; -use serenity_rich_interaction::Error as SerenityUtilsError; +use serenity_additions::Error as SerenityUtilsError; use thiserror::Error; pub type BotResult = Result; @@ -34,7 +33,7 @@ pub enum BotError { CliInject, #[error("Serenity Utils Error: {0}")] - SerenityUtils(#[from] serenity_rich_interaction::Error), + SerenityUtils(#[from] serenity_additions::Error), #[error("Track Error: {0}")] TrackError(#[from] songbird::error::TrackError), @@ -45,8 +44,8 @@ pub enum BotError { #[error("YouTube Error: {0}")] YoutubeError(#[from] youtube_metadata::error::Error), - #[error("Lavalink Error: {0}")] - LavalinkError(#[from] LavalinkError), + #[error("No songbird client for current guild")] + MissingSongbirdClient, #[error("{0}")] Msg(String), diff --git a/src/utils/mod.rs b/src/utils/mod.rs index 627bbc1..f223f1d 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -1,17 +1,15 @@ use chrono::{DateTime, FixedOffset, Local}; -use std::env; + use std::ops::Add; use std::sync::Arc; use std::time::SystemTime; -use lavalink_rs::LavalinkClient; use serenity::client::Context; -use serenity::model::application::CurrentApplicationInfo; + use serenity::model::channel::Message; -use serenity::prelude::{RwLock, TypeMap}; + use tokio::time::Instant; -use crate::providers::music::lavalink::{Lavalink, LavalinkHandler}; use crate::utils::context_data::get_database_from_context; use crate::utils::error::BotResult; @@ -92,28 +90,3 @@ pub async fn delete_messages_from_database(ctx: &Context) -> BotResult<()> { Ok(()) } - -pub async fn initialize_lavalink( - data: Arc>, - current_application: CurrentApplicationInfo, -) -> BotResult<()> { - let lava_client = LavalinkClient::builder(current_application.id.0) - .set_host(env::var("LAVALINK_HOST").unwrap_or("172.0.0.1".to_string())) - .set_password(env::var("LAVALINK_PASSWORD").expect("Missing lavalink password")) - .set_port( - env::var("LAVALINK_PORT") - .ok() - .and_then(|s| s.parse().ok()) - .expect("Missing lavalink port"), - ) - .build(LavalinkHandler { - data: Arc::clone(&data), - }) - .await?; - { - let mut data = data.write().await; - data.insert::(Arc::new(lava_client)); - } - - Ok(()) -}