From f0590328b05535cae8804f025f212f7343cc3a57 Mon Sep 17 00:00:00 2001 From: jellywx Date: Thu, 24 Jun 2021 15:52:45 +0100 Subject: [PATCH] start of soundboard and help rework --- Cargo.lock | 596 ++++++++++++++++++++++++++++++++--------------- Cargo.toml | 4 +- src/framework.rs | 10 +- src/main.rs | 232 +++++++++--------- 4 files changed, 530 insertions(+), 312 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 807fd05..83c048a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8,9 +8,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "aead" -version = "0.4.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "922b33332f54fc0ad13fa3e514601e8d30fb54e1f3eadc36643f6526db645621" +checksum = "7fc95d1bdb8e6666b2b217308eeeb09f2d6728d104be3e31916cc74d15420331" dependencies = [ "generic-array", ] @@ -21,7 +21,7 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43bb833f0bf979d8475d38fbf09ed3b8a55e1885fe93ad3f93239fc6a4f17b98" dependencies = [ - "getrandom", + "getrandom 0.2.3", "once_cell", "version_check", ] @@ -35,15 +35,6 @@ dependencies = [ "memchr", ] -[[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.5.2" @@ -61,6 +52,22 @@ dependencies = [ "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 0.4.14", + "pin-project", + "tokio", + "tokio-rustls", + "tungstenite 0.11.1", + "webpki-roots 0.20.0", +] + [[package]] name = "async-tungstenite" version = "0.13.1" @@ -69,12 +76,12 @@ checksum = "07b30ef0ea5c20caaa54baea49514a206308989c68be7ecd86c7f956e4da6378" dependencies = [ "futures-io", "futures-util", - "log", + "log 0.4.14", "pin-project-lite", "tokio", "tokio-rustls", - "tungstenite", - "webpki-roots", + "tungstenite 0.13.0", + "webpki-roots 0.21.1", ] [[package]] @@ -94,7 +101,7 @@ checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ "hermit-abi", "libc", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -112,7 +119,7 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "927791de46f70facea982dbfaf19719a41ce6064443403be631a85de6a58fff9" dependencies = [ - "log", + "log 0.4.14", "pkg-config", ] @@ -128,6 +135,12 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" +[[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" @@ -145,6 +158,12 @@ dependencies = [ "num-traits 0.2.14", ] +[[package]] +name = "bitflags" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f67931368edf3a9a51d29886d245f1c3db2f1ef0dcc9e35ff70341b78c10d23" + [[package]] name = "bitflags" version = "1.2.1" @@ -184,6 +203,12 @@ version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" 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.0.1" @@ -219,22 +244,21 @@ dependencies = [ "num-traits 0.2.14", "serde", "time", - "winapi", + "winapi 0.3.9", ] [[package]] name = "cipher" -version = "0.3.0" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7" +checksum = "12f8e7987cbd042a63249497f41aed09f8e65add917ea6566effbc56578d6801" dependencies = [ "generic-array", ] [[package]] name = "command_attr" -version = "0.3.6" -source = "git+https://github.com/serenity-rs/serenity?branch=next#a24132fc66bea5fe7772d9f694ab3517d24d286b" +version = "0.3.7" dependencies = [ "proc-macro2", "quote", @@ -259,13 +283,19 @@ checksum = "ea221b5284a47e40033bf9b66f35f984ec0ea2931eb03505246cd27a963f981b" [[package]] name = "cpufeatures" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed00c67cb5d0a7d64a44f6ad2668db7e7530311dd53ea79bcd4fb022c64911c8" +checksum = "66c99696f6c9dd7f35d486b9d04d7e6e202aa3e8c40d553f2fdf5e7e0c6a71ef" dependencies = [ "libc", ] +[[package]] +name = "cpuid-bool" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcb25d077389e53838a8158c8e99174c5a9d902dee4904320db714f3c653ffba" + [[package]] name = "crc32fast" version = "1.2.1" @@ -336,12 +366,14 @@ dependencies = [ [[package]] name = "discortp" -version = "0.4.0" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb66017646a48220b5ea30d63ac18bb5952f647f1a41ed755880895125d26972" +checksum = "9c0d482488c336a2164529765da3f645f26215df9c2033137ddedac333c8e2e8" dependencies = [ + "glob", "pnet_macros", "pnet_macros_support", + "syntex", ] [[package]] @@ -376,13 +408,13 @@ dependencies = [ [[package]] name = "env_logger" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17392a012ea30ef05a610aa97dfb49496e71c9f676b27879922ea5bdf60d9d3f" +checksum = "a19187fea3ac7e84da7dacf48de0c45d63c6a76f9490dae389aead16c243fce3" dependencies = [ "atty", "humantime", - "log", + "log 0.4.14", "regex", "termcolor", ] @@ -401,9 +433,9 @@ dependencies = [ [[package]] name = "flume" -version = "0.10.5" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa9d66b91e902db43baefd8e40c8678ce29db2cf1d88ebd715174368d5fe70a9" +checksum = "ddad16e8529759736a9ce4cdf078ed702e45d3c5b0474a1c65f5149e9fa7f1eb" dependencies = [ "futures-core", "futures-sink", @@ -551,9 +583,9 @@ checksum = "061d3be1afec479d56fa3bd182bf966c7999ec175fcfdb87ac14d417241366c6" dependencies = [ "cc", "libc", - "log", + "log 0.4.14", "rustversion", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -566,6 +598,17 @@ dependencies = [ "version_check", ] +[[package]] +name = "getrandom" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "wasi 0.9.0+wasi-snapshot-preview1", +] + [[package]] name = "getrandom" version = "0.2.3" @@ -575,17 +618,23 @@ dependencies = [ "cfg-if 1.0.0", "js-sys", "libc", - "wasi", + "wasi 0.10.2+wasi-snapshot-preview1", "wasm-bindgen", ] +[[package]] +name = "glob" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" + [[package]] name = "h2" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "825343c4eef0b63f541f8903f395dc5beb362a979b5799a84062527ef1e37726" dependencies = [ - "bytes", + "bytes 1.0.1", "fnv", "futures-core", "futures-sink", @@ -652,7 +701,7 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "527e8c9ac747e28542699a951517aa9a6945af506cd1f2e1b53a576c17b6cc11" dependencies = [ - "bytes", + "bytes 1.0.1", "fnv", "itoa", ] @@ -663,7 +712,7 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60daa14be0e0786db0f03a9e57cb404c9d756eed2b6c62b9ea98ec5743ec75a9" dependencies = [ - "bytes", + "bytes 1.0.1", "http", "pin-project-lite", ] @@ -688,11 +737,11 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.8" +version = "0.14.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3f71a7eea53a3f8257a7b4795373ff886397178cd634430ea94e12d7fe4fe34" +checksum = "07d6baa1b441335f3ce5098ac421fb6547c46dda735ca1bc6d0153c838f9dd83" dependencies = [ - "bytes", + "bytes 1.0.1", "futures-channel", "futures-core", "futures-util", @@ -702,7 +751,7 @@ dependencies = [ "httparse", "httpdate", "itoa", - "pin-project", + "pin-project-lite", "socket2", "tokio", "tower-service", @@ -718,7 +767,7 @@ checksum = "5f9f7a97316d44c0af9b0301e65010573a853a9fc97046d7331d7f6bc0fd5a64" dependencies = [ "futures-util", "hyper", - "log", + "log 0.4.14", "rustls", "tokio", "tokio-rustls", @@ -731,7 +780,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ - "bytes", + "bytes 1.0.1", "hyper", "native-tls", "tokio", @@ -759,13 +808,22 @@ dependencies = [ "hashbrown 0.9.1", ] +[[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", +] + [[package]] name = "input_buffer" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f97967975f448f1a7ddb12b0bc41069d09ed6a1c161a92687e057325db35d413" dependencies = [ - "bytes", + "bytes 1.0.1", ] [[package]] @@ -779,9 +837,9 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.3.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47be2f14c678be2fdcab04ab1171db51b2762ce6f0a8ee87c8dd4a04ed216135" +checksum = "68f2d64f2edebec4ce84ad108148e67e1064789bee435edc5b60ad398714a3a9" [[package]] name = "itoa" @@ -798,6 +856,16 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "kernel32-sys" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +dependencies = [ + "winapi 0.2.8", + "winapi-build", +] + [[package]] name = "lazy_static" version = "1.4.0" @@ -813,8 +881,8 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6607c62aa161d23d17a9072cc5da0be67cdfc89d3afb1e8d9c842bebc2525ffe" dependencies = [ - "arrayvec 0.5.2", - "bitflags", + "arrayvec", + "bitflags 1.2.1", "cfg-if 1.0.0", "ryu", "static_assertions", @@ -822,9 +890,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.95" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "789da6d93f1b866ffe175afc5322a4d76c038605a1c3319bb57b06967ca98a36" +checksum = "12b8adadd720df158f4d70dfe7ccc6adb0472d7c55ca83445f6a5ab3e36f8fb6" [[package]] name = "libm" @@ -841,6 +909,15 @@ dependencies = [ "scopeguard", ] +[[package]] +name = "log" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" +dependencies = [ + "log 0.4.14", +] + [[package]] name = "log" version = "0.4.14" @@ -909,15 +986,15 @@ dependencies = [ [[package]] name = "mio" -version = "0.7.11" +version = "0.7.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf80d3e903b34e0bd7282b218398aec54e082c840d9baf8339e0080a0c542956" +checksum = "8c2bdb6314ec10835cd3293dd268473a835c02b7b352e788be788b3c6ca6bb16" dependencies = [ "libc", - "log", + "log 0.4.14", "miow", "ntapi", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -926,7 +1003,7 @@ version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" dependencies = [ - "winapi", + "winapi 0.3.9", ] [[package]] @@ -935,7 +1012,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac1378b66f7c93a1c0f8464a19bf47df8795083842e5090f4b7305973d5a22d0" dependencies = [ - "getrandom", + "getrandom 0.2.3", ] [[package]] @@ -946,7 +1023,7 @@ checksum = "b8d96b2e1c8da3957d58100b09f102c6d9cfdfced01b7ec5a8974044bb09dbd4" dependencies = [ "lazy_static", "libc", - "log", + "log 0.4.14", "openssl", "openssl-probe", "openssl-sys", @@ -956,12 +1033,6 @@ dependencies = [ "tempfile", ] -[[package]] -name = "nodrop" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" - [[package]] name = "nom" version = "6.1.2" @@ -981,7 +1052,7 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44" dependencies = [ - "winapi", + "winapi 0.3.9", ] [[package]] @@ -1019,7 +1090,7 @@ dependencies = [ "num-integer", "num-iter", "num-traits 0.2.14", - "rand", + "rand 0.8.4", "smallvec", "zeroize", ] @@ -1076,9 +1147,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.7.2" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af8b08b04175473088b46763e51ee54da5f9a164bc162f615b91bc179dbf15a3" +checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56" [[package]] name = "opaque-debug" @@ -1088,11 +1159,11 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openssl" -version = "0.10.34" +version = "0.10.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d7830286ad6a3973c0f1d9b73738f69c76b739301d0229c4b96501695cbe4c8" +checksum = "549430950c79ae24e6d02e0b7404534ecf311d94cc9f861e9e4020187d13d885" dependencies = [ - "bitflags", + "bitflags 1.2.1", "cfg-if 1.0.0", "foreign-types", "libc", @@ -1108,9 +1179,9 @@ checksum = "28988d872ab76095a6e6ac88d99b54fd267702734fd7ffe610ca27f533ddb95a" [[package]] name = "openssl-sys" -version = "0.9.63" +version = "0.9.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6b0d6fb7d80f877617dfcb014e605e2b5ab2fb0afdf27935219bb6bd984cb98" +checksum = "7a7907e3bfa08bb85105209cdfcb6c63d109f8f6c1ed6ca318fff5c1853fbc1d" dependencies = [ "autocfg 1.0.1", "cc", @@ -1141,7 +1212,7 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -1150,7 +1221,7 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd56cbd21fea48d0c440b41cd69c589faacade08c992d9a54e471b79d0fd13eb" dependencies = [ - "base64", + "base64 0.13.0", "once_cell", "regex", ] @@ -1201,39 +1272,37 @@ checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" [[package]] name = "pnet_base" -version = "0.28.0" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25488cd551a753dcaaa6fffc9f69a7610a412dd8954425bf7ffad5f7d1156fb8" +checksum = "b7cd5f7e15220afa66b0a9a62841ea10089f39dcaa1c29752c0b22dfc03111b5" [[package]] name = "pnet_macros" -version = "0.28.0" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30490e0852e58402b8fae0d39897b08a24f493023a4d6cf56b2e30f31ed57548" +checksum = "bbbd5c52c6e04aa720400f9c71cd0e8bcb38cd13421d5caabd9035e9efa47de9" dependencies = [ - "proc-macro2", - "quote", "regex", - "syn", + "syntex", + "syntex_syntax", ] [[package]] name = "pnet_macros_support" -version = "0.28.0" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4714e10f30cab023005adce048f2d30dd4ac4f093662abf2220855655ef8f90" +checksum = "daf9c5c0c36766d0a4da9ab268c0700771b8ec367b9463fd678109fa28463c5b" dependencies = [ "pnet_base", ] [[package]] name = "poly1305" -version = "0.7.0" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fe800695325da85083cd23b56826fccb2e2dc29b218e7811a6f33bc93f414be" +checksum = "4b7456bc1ad2d4cf82b3a016be4c2ac48daf11bf990c1603ebd447fe6f30fca8" dependencies = [ - "cpufeatures", - "opaque-debug", + "cpuid-bool", "universal-hash", ] @@ -1261,7 +1330,7 @@ version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0d8caf72986c1a598726adc988bb5984792ef84f5ee5aa50209145ee8077038" dependencies = [ - "unicode-xid", + "unicode-xid 0.2.2", ] [[package]] @@ -1281,51 +1350,92 @@ checksum = "941ba9d78d8e2f7ce474c015eea4d9c6d25b6a3327f9832ee29a4de27f91bbb8" [[package]] name = "rand" -version = "0.8.3" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +dependencies = [ + "getrandom 0.1.16", + "libc", + "rand_chacha 0.2.2", + "rand_core 0.5.1", + "rand_hc 0.2.0", +] + +[[package]] +name = "rand" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8" dependencies = [ "libc", - "rand_chacha", - "rand_core", - "rand_hc", + "rand_chacha 0.3.1", + "rand_core 0.6.3", + "rand_hc 0.3.1", ] [[package]] name = "rand_chacha" -version = "0.3.0" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" dependencies = [ "ppv-lite86", - "rand_core", + "rand_core 0.5.1", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.3", ] [[package]] name = "rand_core" -version = "0.6.2" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34cf66eb183df1c5876e2dcf6b13d57340741e8dc255b48e40a26de954d06ae7" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" dependencies = [ - "getrandom", + "getrandom 0.1.16", +] + +[[package]] +name = "rand_core" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" +dependencies = [ + "getrandom 0.2.3", ] [[package]] name = "rand_hc" -version = "0.3.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" dependencies = [ - "rand_core", + "rand_core 0.5.1", +] + +[[package]] +name = "rand_hc" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7" +dependencies = [ + "rand_core 0.6.3", ] [[package]] name = "redox_syscall" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "742739e41cd49414de871ea5e549afb7e2a3ac77b589bcbebe8c82fab37147fc" +checksum = "5ab49abadf3f9e1c4bc499e8845e152ad87d2ad2d30371841171169e9d75feee" dependencies = [ - "bitflags", + "bitflags 1.2.1", ] [[package]] @@ -1360,17 +1470,17 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" dependencies = [ - "winapi", + "winapi 0.3.9", ] [[package]] name = "reqwest" -version = "0.11.3" +version = "0.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2296f2fac53979e8ccbc4a1136b25dcefd37be9ed7e4a1f6b05a6029c84ff124" +checksum = "246e9f61b9bb77df069a947682be06e31ac43ea37862e244a69f177694ea6d22" dependencies = [ - "base64", - "bytes", + "base64 0.13.0", + "bytes 1.0.1", "encoding_rs", "futures-core", "futures-util", @@ -1382,7 +1492,7 @@ dependencies = [ "ipnet", "js-sys", "lazy_static", - "log", + "log 0.4.14", "mime", "mime_guess", "native-tls", @@ -1399,7 +1509,7 @@ dependencies = [ "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "webpki-roots", + "webpki-roots 0.21.1", "winreg", ] @@ -1415,7 +1525,7 @@ dependencies = [ "spin", "untrusted", "web-sys", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -1432,20 +1542,26 @@ dependencies = [ "num-iter", "num-traits 0.2.14", "pem", - "rand", + "rand 0.8.4", "simple_asn1", "subtle", "zeroize", ] +[[package]] +name = "rustc-serialize" +version = "0.3.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" + [[package]] name = "rustls" version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "35edb675feee39aec9c99fa5ff985081995a06d594114ae14cbe797ad7b7a6d7" dependencies = [ - "base64", - "log", + "base64 0.13.0", + "log 0.4.14", "ring", "sct", "webpki", @@ -1465,9 +1581,9 @@ checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" [[package]] name = "salsa20" -version = "0.8.0" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c7c5f10864beba947e1a1b43f3ef46c8cc58d1c2ae549fa471713e8ff60787a" +checksum = "399f290ffc409596022fce5ea5d4138184be4784f2b28c62c59f0d8389059a15" dependencies = [ "cipher", "zeroize", @@ -1480,7 +1596,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75" dependencies = [ "lazy_static", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -1507,11 +1623,11 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.2.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3670b1d2fdf6084d192bc71ead7aabe6c06aa2ea3fbd9cc3ac111fa5c2b1bd84" +checksum = "23a2ac85147a3a11d77ecf1bc7166ec0b92febfa4461c37944e180f319ece467" dependencies = [ - "bitflags", + "bitflags 1.2.1", "core-foundation", "core-foundation-sys", "libc", @@ -1520,9 +1636,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3676258fd3cfe2c9a0ec99ce3038798d847ce3e4bb17746373eb9f0f1ac16339" +checksum = "7e4effb91b4b8b6fb7732e670b6cee160278ff8e6bf485c7805d9e319d76e284" dependencies = [ "core-foundation-sys", "libc", @@ -1584,14 +1700,13 @@ dependencies = [ [[package]] name = "serenity" -version = "0.10.7" -source = "git+https://github.com/serenity-rs/serenity?branch=next#a24132fc66bea5fe7772d9f694ab3517d24d286b" +version = "0.10.8" dependencies = [ "async-trait", - "async-tungstenite", - "base64", - "bitflags", - "bytes", + "async-tungstenite 0.11.0", + "base64 0.13.0", + "bitflags 1.2.1", + "bytes 1.0.1", "chrono", "command_attr", "flate2", @@ -1611,9 +1726,10 @@ dependencies = [ [[package]] name = "serenity-voice-model" version = "0.1.0" -source = "git+https://github.com/serenity-rs/serenity?branch=next#a24132fc66bea5fe7772d9f694ab3517d24d286b" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "158aeb823791f79bbb92110212970797757fee7102784453dcb9b172a8af272b" dependencies = [ - "bitflags", + "bitflags 1.2.1", "enum_primitive", "serde", "serde_json", @@ -1686,16 +1802,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e3dfc207c526015c632472a77be09cf1b6e46866581aecae5cc38fb4235dea2" dependencies = [ "libc", - "winapi", + "winapi 0.3.9", ] [[package]] name = "songbird" -version = "0.2.0-beta.3" -source = "git+https://github.com/serenity-rs/songbird?branch=next#e0ea2f5fe2fe14cb2de0774227f27cb1175d8295" +version = "0.1.7" dependencies = [ "async-trait", - "async-tungstenite", + "async-tungstenite 0.13.1", "audiopus", "byteorder", "dashmap", @@ -1703,15 +1818,14 @@ dependencies = [ "flume", "futures", "parking_lot", - "pin-project", - "rand", + "rand 0.8.4", "serde", "serde_json", "serenity", "serenity-voice-model", "spin_sleep", + "spinning_top", "streamcatcher", - "symphonia-core", "tokio", "tracing", "tracing-futures", @@ -1729,7 +1843,7 @@ dependencies = [ "dotenv", "env_logger", "lazy_static", - "log", + "log 0.4.14", "regex", "regex_command_attr", "reqwest", @@ -1753,14 +1867,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a98101bdc3833e192713c2af0b0dd2614f50d1cf1f7a97c5221b7aac052acc7" dependencies = [ "once_cell", - "winapi", + "winapi 0.3.9", ] [[package]] name = "spinning_top" -version = "0.2.4" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75adad84ee84b521fb2cca2d4fd0f1dab1d8d026bda3c5bea4ca63b5f9f9293c" +checksum = "7e529d73e80d64b5f2631f9035113347c578a1c9c7774b83a2b880788459ab36" dependencies = [ "lock_api", ] @@ -1796,11 +1910,11 @@ checksum = "7f23af36748ec8ea8d49ef8499839907be41b0b1178a4e82b8cb45d29f531dc9" dependencies = [ "ahash", "atoi", - "base64", + "base64 0.13.0", "bigdecimal", - "bitflags", + "bitflags 1.2.1", "byteorder", - "bytes", + "bytes 1.0.1", "crossbeam-channel", "crossbeam-queue", "crossbeam-utils 0.8.5", @@ -1814,13 +1928,13 @@ dependencies = [ "hex", "itoa", "libc", - "log", + "log 0.4.14", "memchr", "num-bigint 0.3.2", "once_cell", "parking_lot", "percent-encoding", - "rand", + "rand 0.8.4", "rsa", "rustls", "sha-1", @@ -1833,7 +1947,7 @@ dependencies = [ "tokio-stream", "url", "webpki", - "webpki-roots", + "webpki-roots 0.21.1", "whoami", ] @@ -1900,28 +2014,15 @@ version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e81da0851ada1f3e9d4312c704aa4f8806f0f9d69faaf8df2f3464b4a9437c2" -[[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 = "syn" -version = "1.0.72" +version = "1.0.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1e8cdbefb79a9a5a65e0db8b47b723ee907b7c7f8496c76a1770b5c310bab82" +checksum = "f71489ff30030d2ae598524f61326b902466f72a0fb1a8564c001cc63425bcc7" dependencies = [ "proc-macro2", "quote", - "unicode-xid", + "unicode-xid 0.2.2", ] [[package]] @@ -1933,7 +2034,56 @@ dependencies = [ "proc-macro2", "quote", "syn", - "unicode-xid", + "unicode-xid 0.2.2", +] + +[[package]] +name = "syntex" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a30b08a6b383a22e5f6edc127d169670d48f905bb00ca79a00ea3e442ebe317" +dependencies = [ + "syntex_errors", + "syntex_syntax", +] + +[[package]] +name = "syntex_errors" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04c48f32867b6114449155b2a82114b86d4b09e1bddb21c47ff104ab9172b646" +dependencies = [ + "libc", + "log 0.3.9", + "rustc-serialize", + "syntex_pos", + "term", + "unicode-xid 0.0.3", +] + +[[package]] +name = "syntex_pos" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fd49988e52451813c61fecbe9abb5cfd4e1b7bb6cdbb980a6fbcbab859171a6" +dependencies = [ + "rustc-serialize", +] + +[[package]] +name = "syntex_syntax" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7628a0506e8f9666fdabb5f265d0059b059edac9a3f810bda077abb5d826bd8d" +dependencies = [ + "bitflags 0.5.0", + "libc", + "log 0.3.9", + "rustc-serialize", + "syntex_errors", + "syntex_pos", + "term", + "unicode-xid 0.0.3", ] [[package]] @@ -1950,10 +2100,20 @@ checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" dependencies = [ "cfg-if 1.0.0", "libc", - "rand", + "rand 0.8.4", "redox_syscall", "remove_dir_all", - "winapi", + "winapi 0.3.9", +] + +[[package]] +name = "term" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa63644f74ce96fbeb9b794f66aff2a52d601cbd5e80f4b97123e3899f4570f1" +dependencies = [ + "kernel32-sys", + "winapi 0.2.8", ] [[package]] @@ -1992,7 +2152,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" dependencies = [ "libc", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -2012,12 +2172,12 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.6.1" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a38d31d7831c6ed7aad00aa4c12d9375fd225a6dd77da1d25b707346319a975" +checksum = "5fb2ed024293bb19f7a5dc54fe83bf86532a44c12a2bb8ba40d64a4509395ca2" dependencies = [ "autocfg 1.0.1", - "bytes", + "bytes 1.0.1", "libc", "memchr", "mio", @@ -2026,7 +2186,7 @@ dependencies = [ "pin-project-lite", "signal-hook-registry", "tokio-macros", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -2078,10 +2238,10 @@ version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1caa0b0c8d94a049db56b5acf8cba99dc0623aab1b26d5b5f5e2d945846b3592" dependencies = [ - "bytes", + "bytes 1.0.1", "futures-core", "futures-sink", - "log", + "log 0.4.14", "pin-project-lite", "tokio", ] @@ -2099,7 +2259,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09adeb8c97449311ccd28a427f96fb563e7fd31aabf994189879d9da2394b89d" dependencies = [ "cfg-if 1.0.0", - "log", + "log 0.4.14", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -2141,27 +2301,46 @@ 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 0.3.1", + "log 0.4.14", + "rand 0.7.3", + "sha-1", + "url", + "utf-8", +] + [[package]] name = "tungstenite" version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5fe8dada8c1a3aeca77d6b51a4f1314e0f4b8e438b7b1b71e3ddaca8080e4093" dependencies = [ - "base64", + "base64 0.13.0", "byteorder", - "bytes", + "bytes 1.0.1", "http", "httparse", - "input_buffer", - "log", - "rand", + "input_buffer 0.4.0", + "log 0.4.14", + "rand 0.8.4", "rustls", "sha-1", "thiserror", "url", "utf-8", "webpki", - "webpki-roots", + "webpki-roots 0.21.1", ] [[package]] @@ -2209,6 +2388,12 @@ version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bb0d2e7be6ae3a5fa87eed5fb451aff96f2573d2694942e40543ae0bbe19c796" +[[package]] +name = "unicode-xid" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36dff09cafb4ec7c8cf0023eb0b686cb6ce65499116a12201c9e11840ca01beb" + [[package]] name = "unicode-xid" version = "0.2.2" @@ -2261,7 +2446,7 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" dependencies = [ - "getrandom", + "getrandom 0.2.3", ] [[package]] @@ -2272,9 +2457,9 @@ checksum = "f4bf03e0ca70d626ecc4ba6b0763b934b6f2976e8c744088bb3c1d646fbb1ad0" [[package]] name = "vcpkg" -version = "0.2.13" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "025ce40a007e1907e58d5bc1a594def78e5573bb0b1160bc389634e8f12e4faa" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" [[package]] name = "version_check" @@ -2288,10 +2473,16 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" dependencies = [ - "log", + "log 0.4.14", "try-lock", ] +[[package]] +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" + [[package]] name = "wasi" version = "0.10.2+wasi-snapshot-preview1" @@ -2318,7 +2509,7 @@ checksum = "3b33f6a0694ccfea53d94db8b2ed1c3a8a4c86dd936b13b9f0a15ec4a451b900" dependencies = [ "bumpalo", "lazy_static", - "log", + "log 0.4.14", "proc-macro2", "quote", "syn", @@ -2386,6 +2577,15 @@ dependencies = [ "untrusted", ] +[[package]] +name = "webpki-roots" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f20dea7535251981a9670857150d571846545088359b28e4951d350bdaf179f" +dependencies = [ + "webpki", +] + [[package]] name = "webpki-roots" version = "0.21.1" @@ -2405,6 +2605,12 @@ dependencies = [ "web-sys", ] +[[package]] +name = "winapi" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" + [[package]] name = "winapi" version = "0.3.9" @@ -2415,6 +2621,12 @@ dependencies = [ "winapi-x86_64-pc-windows-gnu", ] +[[package]] +name = "winapi-build" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" + [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" @@ -2427,7 +2639,7 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" dependencies = [ - "winapi", + "winapi 0.3.9", ] [[package]] @@ -2442,7 +2654,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0120db82e8a1e0b9fb3345a539c478767c0048d842860994d96113d5b667bd69" dependencies = [ - "winapi", + "winapi 0.3.9", ] [[package]] @@ -2453,13 +2665,13 @@ checksum = "85e60b0d1b5f99db2556934e21937020776a5d31520bf169e851ac44e6420214" [[package]] name = "xsalsa20poly1305" -version = "0.7.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a214b4d445e6534a858c970b44eb526c398dbfaa2961e3efb637307af634284d" +checksum = "0304c336e98d753428f7b3d8899d60b8a87a961ef50bdfc44af0c1bea2651ce5" dependencies = [ "aead", "poly1305", - "rand_core", + "rand_core 0.5.1", "salsa20", "subtle", "zeroize", diff --git a/Cargo.toml b/Cargo.toml index 4310403..6660e5b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,8 +5,8 @@ authors = ["jellywx "] edition = "2018" [dependencies] -songbird = { git = "https://github.com/serenity-rs/songbird", branch = "next" } -serenity = { git = "https://github.com/serenity-rs/serenity", branch = "next", features = ["voice", "collector", "unstable_discord_api"] } +songbird = { path = "/home/jude/songbird" } +serenity = { path = "/home/jude/serenity", features = ["voice", "collector", "unstable_discord_api"] } sqlx = { version = "0.5", default-features = false, features = ["runtime-tokio-rustls", "macros", "mysql", "bigdecimal"] } dotenv = "0.15" tokio = { version = "1", features = ["fs", "process", "io-util"] } diff --git a/src/framework.rs b/src/framework.rs index 45d402d..11388a2 100644 --- a/src/framework.rs +++ b/src/framework.rs @@ -10,7 +10,7 @@ use serenity::{ channel::{Channel, GuildChannel, Message}, guild::{Guild, Member}, id::{ChannelId, GuildId, UserId}, - interactions::{ApplicationCommand, Interaction, InteractionType}, + interactions::{ApplicationCommand, Interaction, InteractionData, InteractionType}, prelude::{ApplicationCommandOptionType, InteractionResponseType}, }, prelude::TypeMapKey, @@ -249,7 +249,7 @@ impl CommandInvoke for Interaction { d.content(generic_response.content); if let Some(embed) = generic_response.embed { - d.set_embed(embed.clone()); + d.add_embed(embed.clone()); } d @@ -268,7 +268,7 @@ impl CommandInvoke for Interaction { d.content(generic_response.content); if let Some(embed) = generic_response.embed { - d.set_embed(embed.clone()); + d.add_embed(embed.clone()); } d @@ -408,7 +408,7 @@ impl fmt::Debug for Command { } pub struct RegexFramework { - commands: HashMap, + pub commands: HashMap, commands_: HashSet<&'static Command>, command_matcher: Regex, default_prefix: String, @@ -615,7 +615,7 @@ impl RegexFramework { pub async fn execute(&self, ctx: Context, interaction: Interaction) { if interaction.kind == InteractionType::ApplicationCommand && interaction.guild_id.is_some() { - if let Some(data) = interaction.data.clone() { + if let Some(InteractionData::ApplicationCommand(data)) = interaction.data.clone() { let command = { let name = data.name; diff --git a/src/main.rs b/src/main.rs index 3833949..d56e2d8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -19,12 +19,14 @@ use log::info; use regex_command_attr::command; use serenity::{ + builder::CreateActionRow, client::{bridge::gateway::GatewayIntents, Client, Context}, framework::standard::CommandResult, http::Http, model::{ guild::Guild, id::{ChannelId, GuildId, RoleId, UserId}, + interactions::ButtonStyle, }, prelude::*, }; @@ -46,6 +48,7 @@ use dashmap::DashMap; use std::{collections::HashMap, convert::TryFrom, env, sync::Arc, time::Duration}; +use serenity::model::prelude::InteractionResponseType; use tokio::sync::{MutexGuard, RwLock}; struct MySQL; @@ -193,6 +196,7 @@ async fn main() -> Result<(), Box> { .add_command(&PLAY_COMMAND) .add_command(&STOP_PLAYING_COMMAND) .add_command(&DISCONNECT_COMMAND) + .add_command(&SOUNDBOARD_COMMAND) // sound management commands .add_command(&UPLOAD_NEW_SOUND_COMMAND) .add_command(&DELETE_SOUND_COMMAND) @@ -298,8 +302,8 @@ async fn main() -> Result<(), Box> { #[command] #[description("Get information on the commands of the bot")] #[arg( - name = "category", - description = "Get help for a specific category", + name = "command", + description = "Get help for a specific command", kind = "String", required = false )] @@ -308,123 +312,80 @@ async fn help( invoke: &(dyn CommandInvoke + Sync + Send), args: Args, ) -> CommandResult { - if let Some(category) = args.named("category") { - let body = match category.to_lowercase().as_str() { - "info" => { - "__Info Commands__ -`help` - view all commands -`help [category]` - view help for the commands in a category + if let Some(command_name) = args.named("command") { + let framework = ctx + .data + .read() + .await + .get::() + .cloned() + .unwrap(); -`info` - view information about the bot + if let Some(command) = framework.commands.get(command_name) { + invoke + .respond( + ctx.http.clone(), + CreateGenericResponse::new().embed(|e| { + e.title(format!("{} Help", command_name)) + .color(THEME_COLOR) + .description(format!( + "**Aliases** +{} -`invite` - get an invite link for the bot +**Overview** + • {} -`donate` - view information about the Patreon - " - } - "play" => { - "__Play Commands__ -`play [sound]` - play a sound matching the name \"sound\" -`play [id]` - play the sound with numerical ID `id` - -`p` - an alias for `play` - -`stop` - stop the bot from playing -`dc` - disconnect the bot from the current channel - -`loop [sound]` - play a sound matching the name \"sound\" on loop -`loop [id]` - play a sound matching the numerical ID `id` on loop - " - } - "manage" => { - "__Manage Commands__ -`upload [name]` - upload a new sound effect to the name \"name\" - -`delete [name]` - delete a sound you have uploaded under the name \"name\" - -`list` - list sounds uploaded on the server you are on -`list me` - list sounds you have uploaded to any server - -`public [name]` - make a sound you have uploaded public or private - " - } - "settings" => { - "__Settings Commands__ -`prefix [new prefix]` - change the prefix of the bot - -`roles [role list]` - set which roles can use the bot -`roles off` - allow all users to use the bot - -`volume [new volume]` - change the volume of the bot - -`allow_greet` - toggle whether users in your server can use greet sounds - " - } - "search" => { - "__Search Commands__ -`search [term]` - search for sounds matching \"term\" - -`random` - find some random sounds on the bot - -`popular` - find the most played sounds on the bot - " - } - "other" => { - "__Other Commands__ -`greet [name]` - set your greet sound (join sound) to the sound called \"name\" -`greet [id]` - set your greet sound (join sound) to the sound with numerical ID `id` - -`ambience` - view a list of ambience sounds -`ambience [name]` - set an ambience sound playing - " - } - _ => { - "__Unrecognised Category__ -Please select a category from the following: - -`info` -`play` -`manage` -`settings` -`search` -`other` - " - } - }; +**Arguments** +{} +**Examples** +{}", + command + .names + .iter() + .map(|n| format!("`{}`", n)) + .collect::>() + .join(" "), + command.desc, + command + .args + .iter() + .map(|a| format!( + " • `{}` {} - {}", + a.name, + if a.required { "" } else { "[optional]" }, + a.description + )) + .collect::>() + .join("\n"), + command + .examples + .iter() + .map(|e| format!(" • {}", e)) + .collect::>() + .join("\n") + )) + }), + ) + .await?; + } else { + invoke + .respond( + ctx.http.clone(), + CreateGenericResponse::new().embed(|e| { + e.title("Invalid Command") + .color(THEME_COLOR) + .description("") + }), + ) + .await?; + } + } else { invoke .respond( ctx.http.clone(), CreateGenericResponse::new() - .embed(|e| e.title("Help").color(THEME_COLOR).description(body)), - ) - .await?; - } else { - let description = { - let guild_data = ctx.guild_data(invoke.guild_id().unwrap()).await.unwrap(); - - let read_lock = guild_data.read().await; - - format!( - "Type `{}help category` to view help for a command category below:", - read_lock.prefix - ) - }; - - invoke - .respond( - ctx.http.clone(), - CreateGenericResponse::new().embed(|e| { - e.title("Help") - .color(THEME_COLOR) - .description(description) - .field("Info", "`help` `info` `invite` `donate`", false) - .field("Play", "`play` `p` `stop` `dc` `loop`", false) - .field("Manage", "`upload` `delete` `list` `public`", false) - .field("Settings", "`prefix` `roles` `volume` `allow_greet`", false) - .field("Search", "`search` `random` `popular`", false) - .field("Other", "`greet` `ambience`", false) - }), + .embed(|e| e.title("Help").color(THEME_COLOR).description("")), ) .await?; } @@ -499,8 +460,6 @@ async fn play_cmd(ctx: &Context, guild: Guild, user_id: UserId, args: Args, loop Some(user_channel) => { let search_term = args.named("query").unwrap(); - println!("{}", search_term); - let pool = ctx .data .read() @@ -1177,6 +1136,53 @@ async fn list_sounds( Ok(()) } +#[command("soundboard")] +#[aliases("board")] +#[description("Get a menu of sounds in this server with buttons to play them")] +async fn soundboard( + ctx: &Context, + invoke: &(dyn CommandInvoke + Sync + Send), + _args: Args, +) -> CommandResult { + let pool = ctx + .data + .read() + .await + .get::() + .cloned() + .expect("Could not get SQLPool from data"); + + let sounds = Sound::get_guild_sounds(invoke.guild_id().unwrap(), pool).await?; + + if let Some(interaction) = invoke.interaction() { + interaction + .create_interaction_response(&ctx, |r| r.kind(InteractionResponseType::Pong)) + .await?; + } + + invoke + .channel_id() + .send_message(&ctx, |m| { + m.components(|c| { + for row in sounds.as_slice().chunks(5) { + let mut action_row: CreateActionRow = Default::default(); + for sound in row { + action_row.create_button(|b| { + b.style(ButtonStyle::Primary) + .label(&sound.name) + .custom_id(sound.id) + }); + } + } + + c + }) + }) + .await?; + + Ok(()) +} + #[command("public")] #[description("Change a sound between public and private")] #[arg(