Several improvements #2

Merged
moonleay merged 1 commit from migueldamota/Rustendo:several-improvements into master 2024-03-03 22:38:59 +00:00
10 changed files with 384 additions and 269 deletions

3
.gitignore vendored
View file

@ -3,3 +3,6 @@
config.json
.idea/
.zed
.DS_Store

326
Cargo.lock generated
View file

@ -68,7 +68,7 @@ checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.50",
"syn 2.0.52",
]
[[package]]
@ -208,9 +208,9 @@ dependencies = [
[[package]]
name = "cc"
version = "1.0.86"
version = "1.0.88"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f9fa1897e4325be0d68d48df6aa1a71ac2ed4d27723887e7754192705350730"
checksum = "02f341c093d19155a6e41631ce5971aac4e9a868262212153124c15fa22d1cdc"
[[package]]
name = "cfg-if"
@ -230,7 +230,7 @@ dependencies = [
"num-traits",
"serde",
"wasm-bindgen",
"windows-targets 0.52.3",
"windows-targets 0.52.4",
]
[[package]]
@ -266,9 +266,9 @@ dependencies = [
[[package]]
name = "confy"
version = "0.6.0"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "15d296c475c6ed4093824c28e222420831d27577aaaf0a1163a3b7fc35b248a5"
checksum = "45b1f4c00870f07dc34adcac82bb6a72cc5aabca8536ba1797e01df51d2ce9a0"
dependencies = [
"directories",
"serde",
@ -312,9 +312,9 @@ dependencies = [
[[package]]
name = "crossbeam-channel"
version = "0.5.11"
version = "0.5.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "176dc175b78f56c0f321911d9c8eb2b77a78a4860b9c19db83835fea1a46649b"
checksum = "ab3db02a9c5b5121e1e42fbdb1aeb65f5e02624cc58c43f2884c6ccac0b82f95"
dependencies = [
"crossbeam-utils",
]
@ -467,6 +467,12 @@ dependencies = [
"version_check",
]
[[package]]
name = "extended"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af9673d8203fcb076b19dfd17e38b3d4ae9f44959416ea532ce72415a6020365"
[[package]]
name = "fastrand"
version = "2.0.1"
@ -581,7 +587,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.50",
"syn 2.0.52",
]
[[package]]
@ -625,11 +631,12 @@ dependencies = [
[[package]]
name = "generator"
version = "0.7.5"
version = "0.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5cc16584ff22b460a382b7feec54b23d2908d858152e5739a120b949293bd74e"
checksum = "b5b25e5b3e733153bcab35ee4671b46604b42516163cae442d1601cb716f2ac5"
dependencies = [
"cc",
"cfg-if",
"libc",
"log",
"rustversion",
@ -683,7 +690,7 @@ dependencies = [
"futures-core",
"futures-sink",
"futures-util",
"http",
"http 0.2.11",
"indexmap",
"slab",
"tokio",
@ -699,9 +706,9 @@ checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604"
[[package]]
name = "hermit-abi"
version = "0.3.6"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd5256b483761cd23699d0da46cc6fd2ee3be420bbe6d020ae4a091e70b7e9fd"
checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024"
[[package]]
name = "http"
@ -714,6 +721,17 @@ dependencies = [
"itoa",
]
[[package]]
name = "http"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b32afd38673a8016f7c9ae69e5af41a58f81b1d31689040f2f1959594ce194ea"
dependencies = [
"bytes",
"fnv",
"itoa",
]
[[package]]
name = "http-body"
version = "0.4.6"
@ -721,7 +739,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2"
dependencies = [
"bytes",
"http",
"http 0.2.11",
"pin-project-lite",
]
@ -748,7 +766,7 @@ dependencies = [
"futures-core",
"futures-util",
"h2",
"http",
"http 0.2.11",
"http-body",
"httparse",
"httpdate",
@ -768,7 +786,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590"
dependencies = [
"futures-util",
"http",
"http 0.2.11",
"hyper",
"rustls 0.21.10",
"tokio",
@ -799,7 +817,7 @@ dependencies = [
"iana-time-zone-haiku",
"js-sys",
"wasm-bindgen",
"windows-core",
"windows-core 0.52.0",
]
[[package]]
@ -823,9 +841,9 @@ dependencies = [
[[package]]
name = "indexmap"
version = "2.2.3"
version = "2.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "233cf39063f058ea2caae4091bf4a3ef70a653afbc026f5c4a4135d114e3c177"
checksum = "7b0b929d511467233429c45a44ac1dcaa21ba0f5ba11e4879e6ed28ddb4f9df4"
dependencies = [
"equivalent",
"hashbrown",
@ -908,9 +926,9 @@ dependencies = [
[[package]]
name = "log"
version = "0.4.20"
version = "0.4.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c"
[[package]]
name = "loom"
@ -984,9 +1002,9 @@ dependencies = [
[[package]]
name = "mio"
version = "0.8.10"
version = "0.8.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09"
checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c"
dependencies = [
"libc",
"wasi",
@ -1102,9 +1120,9 @@ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
[[package]]
name = "opaque-debug"
version = "0.3.0"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381"
[[package]]
name = "openssl"
@ -1129,7 +1147,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.50",
"syn 2.0.52",
]
[[package]]
@ -1217,7 +1235,7 @@ checksum = "266c042b60c9c76b8d53061e52b2e0d1116abc57cefc8c5cd671619a56ac3690"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.50",
"syn 2.0.52",
]
[[package]]
@ -1256,7 +1274,7 @@ dependencies = [
"proc-macro2",
"quote",
"regex",
"syn 2.0.50",
"syn 2.0.52",
]
[[package]]
@ -1444,7 +1462,7 @@ dependencies = [
"futures-core",
"futures-util",
"h2",
"http",
"http 0.2.11",
"http-body",
"hyper",
"hyper-rustls",
@ -1475,7 +1493,7 @@ dependencies = [
"wasm-bindgen-futures",
"wasm-streams",
"web-sys",
"webpki-roots",
"webpki-roots 0.25.4",
"winreg",
]
@ -1603,10 +1621,24 @@ checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba"
dependencies = [
"log",
"ring 0.17.8",
"rustls-webpki",
"rustls-webpki 0.101.7",
"sct",
]
[[package]]
name = "rustls"
version = "0.22.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e87c9956bd9807afa1f77e0f7594af32566e830e088a5576d27c5b6f30f49d41"
dependencies = [
"log",
"ring 0.17.8",
"rustls-pki-types",
"rustls-webpki 0.102.2",
"subtle",
"zeroize",
]
[[package]]
name = "rustls-native-certs"
version = "0.6.3"
@ -1628,6 +1660,12 @@ dependencies = [
"base64 0.21.7",
]
[[package]]
name = "rustls-pki-types"
version = "1.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5ede67b28608b4c60685c7d54122d4400d90f62b40caee7700e700380a390fa8"
[[package]]
name = "rustls-webpki"
version = "0.101.7"
@ -1638,6 +1676,17 @@ dependencies = [
"untrusted 0.9.0",
]
[[package]]
name = "rustls-webpki"
version = "0.102.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "faaa0a62740bedb9b2ef5afa303da42764c012f743917351dc9a237ea1663610"
dependencies = [
"ring 0.17.8",
"rustls-pki-types",
"untrusted 0.9.0",
]
[[package]]
name = "rustversion"
version = "1.0.14"
@ -1792,7 +1841,7 @@ checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.50",
"syn 2.0.52",
]
[[package]]
@ -1814,7 +1863,7 @@ checksum = "0b2e6b945e9d3df726b65d6ee24060aff8e3533d431f677a9695db04eff9dfdb"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.50",
"syn 2.0.52",
]
[[package]]
@ -1840,9 +1889,9 @@ dependencies = [
[[package]]
name = "serenity"
version = "0.12.0"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "385647faa24a889929028973650a4f158fb1b4272b2fcf94feb9fcc3c009e813"
checksum = "c64da29158bb55d70677cacd4f4f8eab1acef005fb830d9c3bea411b090e96a9"
dependencies = [
"arrayvec",
"async-trait",
@ -1866,7 +1915,7 @@ dependencies = [
"static_assertions",
"time",
"tokio",
"tokio-tungstenite 0.20.1",
"tokio-tungstenite 0.21.0",
"tracing",
"typemap_rev",
"typesize",
@ -1958,9 +2007,9 @@ dependencies = [
[[package]]
name = "songbird"
version = "0.4.0"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b905d2cdd4becf0e643a4aa5491cdfe8f193d5676b5bae7c0460e0e3c6358d63"
checksum = "54d70e66a385ea8f732afac37b6ff2a8334eccac9aeed3d162a3c550b059233a"
dependencies = [
"async-trait",
"audiopus",
@ -1990,7 +2039,7 @@ dependencies = [
"symphonia",
"symphonia-core",
"tokio",
"tokio-tungstenite 0.20.1",
"tokio-tungstenite 0.21.0",
"tokio-util",
"tracing",
"tracing-futures",
@ -2046,9 +2095,9 @@ checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc"
[[package]]
name = "symphonia"
version = "0.5.3"
version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62e48dba70095f265fdb269b99619b95d04c89e619538138383e63310b14d941"
checksum = "815c942ae7ee74737bb00f965fa5b5a2ac2ce7b6c01c0cc169bbeaf7abd5f5a9"
dependencies = [
"lazy_static",
"symphonia-bundle-flac",
@ -2058,15 +2107,15 @@ dependencies = [
"symphonia-core",
"symphonia-format-mkv",
"symphonia-format-ogg",
"symphonia-format-wav",
"symphonia-format-riff",
"symphonia-metadata",
]
[[package]]
name = "symphonia-bundle-flac"
version = "0.5.3"
version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f23b0482a7cb18fcdf9981ab0b78df800ef0080187d294650023c462439058d"
checksum = "72e34f34298a7308d4397a6c7fbf5b84c5d491231ce3dd379707ba673ab3bd97"
dependencies = [
"log",
"symphonia-core",
@ -2076,9 +2125,9 @@ dependencies = [
[[package]]
name = "symphonia-codec-adpcm"
version = "0.5.3"
version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "870e7dc1865d818c7b6318879d060553a73a3b2a3b8443dff90910f10ac41150"
checksum = "c94e1feac3327cd616e973d5be69ad36b3945f16b06f19c6773fc3ac0b426a0f"
dependencies = [
"log",
"symphonia-core",
@ -2086,9 +2135,9 @@ dependencies = [
[[package]]
name = "symphonia-codec-pcm"
version = "0.5.3"
version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "47f1fbd220a06a641c8ce2ddad10f5ef6ee5cc0c54d9044d25d43b0d3119deaa"
checksum = "f395a67057c2ebc5e84d7bb1be71cce1a7ba99f64e0f0f0e303a03f79116f89b"
dependencies = [
"log",
"symphonia-core",
@ -2096,9 +2145,9 @@ dependencies = [
[[package]]
name = "symphonia-codec-vorbis"
version = "0.5.3"
version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3953397e3506aa01350c4205817e4f95b58d476877a42f0458d07b665749e203"
checksum = "5a98765fb46a0a6732b007f7e2870c2129b6f78d87db7987e6533c8f164a9f30"
dependencies = [
"log",
"symphonia-core",
@ -2107,9 +2156,9 @@ dependencies = [
[[package]]
name = "symphonia-core"
version = "0.5.3"
version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7c73eb88fee79705268cc7b742c7bc93a7b76e092ab751d0833866970754142"
checksum = "798306779e3dc7d5231bd5691f5a813496dc79d3f56bf82e25789f2094e022c3"
dependencies = [
"arrayvec",
"bitflags 1.3.2",
@ -2120,9 +2169,9 @@ dependencies = [
[[package]]
name = "symphonia-format-mkv"
version = "0.5.3"
version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f5c61dfc851ad25d4043d8c231d8617e8f7cd02a6cc0edad21ade21848d58895"
checksum = "1bb43471a100f7882dc9937395bd5ebee8329298e766250b15b3875652fe3d6f"
dependencies = [
"lazy_static",
"log",
@ -2133,9 +2182,9 @@ dependencies = [
[[package]]
name = "symphonia-format-ogg"
version = "0.5.3"
version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9bf1a00ccd11452d44048a0368828040f778ae650418dbd9d8765b7ee2574c8d"
checksum = "ada3505789516bcf00fc1157c67729eded428b455c27ca370e41f4d785bfa931"
dependencies = [
"log",
"symphonia-core",
@ -2144,11 +2193,12 @@ dependencies = [
]
[[package]]
name = "symphonia-format-wav"
version = "0.5.3"
name = "symphonia-format-riff"
version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da76614728fa27c003bdcdfbac51396bd8fcbf94c95fe8e62f1d2bac58ef03a4"
checksum = "05f7be232f962f937f4b7115cbe62c330929345434c834359425e043bfd15f50"
dependencies = [
"extended",
"log",
"symphonia-core",
"symphonia-metadata",
@ -2156,9 +2206,9 @@ dependencies = [
[[package]]
name = "symphonia-metadata"
version = "0.5.3"
version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89c3e1937e31d0e068bbe829f66b2f2bfaa28d056365279e0ef897172c3320c0"
checksum = "bc622b9841a10089c5b18e99eb904f4341615d5aa55bbf4eedde1be721a4023c"
dependencies = [
"encoding_rs",
"lazy_static",
@ -2168,9 +2218,9 @@ dependencies = [
[[package]]
name = "symphonia-utils-xiph"
version = "0.5.3"
version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a450ca645b80d69aff8b35576cbfdc7f20940b29998202aab910045714c951f8"
checksum = "484472580fa49991afda5f6550ece662237b00c6f562c7d9638d1b086ed010fe"
dependencies = [
"symphonia-core",
"symphonia-metadata",
@ -2189,9 +2239,9 @@ dependencies = [
[[package]]
name = "syn"
version = "2.0.50"
version = "2.0.52"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "74f1bdc9872430ce9b75da68329d1c1746faf50ffac5f19e02b71e37ff881ffb"
checksum = "b699d15b36d1f02c3e7c69f8ffef53de37aefae075d8488d4ba1a7788d574a07"
dependencies = [
"proc-macro2",
"quote",
@ -2233,9 +2283,9 @@ checksum = "7b2093cf4c8eb1e67749a6762251bc9cd836b6fc171623bd0a9d324d37af2417"
[[package]]
name = "tempfile"
version = "3.10.0"
version = "3.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a365e8cd18e44762ef95d87f284f4b5cd04107fec2ff3052bd6a3e6069669e67"
checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1"
dependencies = [
"cfg-if",
"fastrand",
@ -2260,7 +2310,7 @@ checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.50",
"syn 2.0.52",
]
[[package]]
@ -2345,7 +2395,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.50",
"syn 2.0.52",
]
[[package]]
@ -2379,6 +2429,17 @@ dependencies = [
"tokio",
]
[[package]]
name = "tokio-rustls"
version = "0.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f"
dependencies = [
"rustls 0.22.2",
"rustls-pki-types",
"tokio",
]
[[package]]
name = "tokio-tungstenite"
version = "0.18.0"
@ -2397,17 +2458,18 @@ dependencies = [
[[package]]
name = "tokio-tungstenite"
version = "0.20.1"
version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "212d5dcb2a1ce06d81107c3d0ffa3121fe974b73f068c8282cb1c32328113b6c"
checksum = "c83b561d025642014097b66e6c1bb422783339e0909e4429cde4749d1990bc38"
dependencies = [
"futures-util",
"log",
"rustls 0.21.10",
"rustls 0.22.2",
"rustls-pki-types",
"tokio",
"tokio-rustls 0.24.1",
"tungstenite 0.20.1",
"webpki-roots",
"tokio-rustls 0.25.0",
"tungstenite 0.21.0",
"webpki-roots 0.26.1",
]
[[package]]
@ -2484,7 +2546,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.50",
"syn 2.0.52",
]
[[package]]
@ -2567,7 +2629,7 @@ dependencies = [
"base64 0.13.1",
"byteorder",
"bytes",
"http",
"http 0.2.11",
"httparse",
"log",
"rand",
@ -2581,18 +2643,19 @@ dependencies = [
[[package]]
name = "tungstenite"
version = "0.20.1"
version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e3dac10fd62eaf6617d3a904ae222845979aec67c615d1c842b4002c7666fb9"
checksum = "9ef1a641ea34f399a848dea702823bbecfb4c486f911735368f1f137cb8257e1"
dependencies = [
"byteorder",
"bytes",
"data-encoding",
"http",
"http 1.0.0",
"httparse",
"log",
"rand",
"rustls 0.21.10",
"rustls 0.22.2",
"rustls-pki-types",
"sha1",
"thiserror",
"url",
@ -2680,7 +2743,7 @@ checksum = "0b122284365ba8497be951b9a21491f70c9688eb6fddc582931a0703f6a00ece"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.50",
"syn 2.0.52",
]
[[package]]
@ -2788,9 +2851,9 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
[[package]]
name = "walkdir"
version = "2.4.0"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee"
checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b"
dependencies = [
"same-file",
"winapi-util",
@ -2832,7 +2895,7 @@ dependencies = [
"once_cell",
"proc-macro2",
"quote",
"syn 2.0.50",
"syn 2.0.52",
"wasm-bindgen-shared",
]
@ -2866,7 +2929,7 @@ checksum = "642f325be6301eb8107a83d12a8ac6c1e1c54345a7ef1a9261962dfefda09e66"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.50",
"syn 2.0.52",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
@ -2916,6 +2979,15 @@ version = "0.25.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1"
[[package]]
name = "webpki-roots"
version = "0.26.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b3de34ae270483955a94f4b21bdaaeb83d508bb84a01435f393818edb0012009"
dependencies = [
"rustls-pki-types",
]
[[package]]
name = "winapi"
version = "0.3.9"
@ -2949,11 +3021,12 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows"
version = "0.48.0"
version = "0.53.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f"
checksum = "efc5cf48f83140dcaab716eeaea345f9e93d0018fb81162753a3f76c3397b538"
dependencies = [
"windows-targets 0.48.5",
"windows-core 0.53.0",
"windows-targets 0.52.4",
]
[[package]]
@ -2962,7 +3035,26 @@ version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9"
dependencies = [
"windows-targets 0.52.3",
"windows-targets 0.52.4",
]
[[package]]
name = "windows-core"
version = "0.53.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9dcc5b895a6377f1ab9fa55acedab1fd5ac0db66ad1e6c7f47e28a22e446a5dd"
dependencies = [
"windows-result",
"windows-targets 0.52.4",
]
[[package]]
name = "windows-result"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd19df78e5168dfb0aedc343d1d1b8d422ab2db6756d2dc3fef75035402a3f64"
dependencies = [
"windows-targets 0.52.4",
]
[[package]]
@ -2980,7 +3072,7 @@ version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
dependencies = [
"windows-targets 0.52.3",
"windows-targets 0.52.4",
]
[[package]]
@ -3000,17 +3092,17 @@ dependencies = [
[[package]]
name = "windows-targets"
version = "0.52.3"
version = "0.52.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d380ba1dc7187569a8a9e91ed34b8ccfc33123bbacb8c0aed2d1ad7f3ef2dc5f"
checksum = "7dd37b7e5ab9018759f893a1952c9420d060016fc19a472b4bb20d1bdd694d1b"
dependencies = [
"windows_aarch64_gnullvm 0.52.3",
"windows_aarch64_msvc 0.52.3",
"windows_i686_gnu 0.52.3",
"windows_i686_msvc 0.52.3",
"windows_x86_64_gnu 0.52.3",
"windows_x86_64_gnullvm 0.52.3",
"windows_x86_64_msvc 0.52.3",
"windows_aarch64_gnullvm 0.52.4",
"windows_aarch64_msvc 0.52.4",
"windows_i686_gnu 0.52.4",
"windows_i686_msvc 0.52.4",
"windows_x86_64_gnu 0.52.4",
"windows_x86_64_gnullvm 0.52.4",
"windows_x86_64_msvc 0.52.4",
]
[[package]]
@ -3021,9 +3113,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.52.3"
version = "0.52.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68e5dcfb9413f53afd9c8f86e56a7b4d86d9a2fa26090ea2dc9e40fba56c6ec6"
checksum = "bcf46cf4c365c6f2d1cc93ce535f2c8b244591df96ceee75d8e83deb70a9cac9"
[[package]]
name = "windows_aarch64_msvc"
@ -3033,9 +3125,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
[[package]]
name = "windows_aarch64_msvc"
version = "0.52.3"
version = "0.52.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8dab469ebbc45798319e69eebf92308e541ce46760b49b18c6b3fe5e8965b30f"
checksum = "da9f259dd3bcf6990b55bffd094c4f7235817ba4ceebde8e6d11cd0c5633b675"
[[package]]
name = "windows_i686_gnu"
@ -3045,9 +3137,9 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
[[package]]
name = "windows_i686_gnu"
version = "0.52.3"
version = "0.52.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2a4e9b6a7cac734a8b4138a4e1044eac3404d8326b6c0f939276560687a033fb"
checksum = "b474d8268f99e0995f25b9f095bc7434632601028cf86590aea5c8a5cb7801d3"
[[package]]
name = "windows_i686_msvc"
@ -3057,9 +3149,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
[[package]]
name = "windows_i686_msvc"
version = "0.52.3"
version = "0.52.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28b0ec9c422ca95ff34a78755cfa6ad4a51371da2a5ace67500cf7ca5f232c58"
checksum = "1515e9a29e5bed743cb4415a9ecf5dfca648ce85ee42e15873c3cd8610ff8e02"
[[package]]
name = "windows_x86_64_gnu"
@ -3069,9 +3161,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
[[package]]
name = "windows_x86_64_gnu"
version = "0.52.3"
version = "0.52.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "704131571ba93e89d7cd43482277d6632589b18ecf4468f591fbae0a8b101614"
checksum = "5eee091590e89cc02ad514ffe3ead9eb6b660aedca2183455434b93546371a03"
[[package]]
name = "windows_x86_64_gnullvm"
@ -3081,9 +3173,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.52.3"
version = "0.52.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42079295511643151e98d61c38c0acc444e52dd42ab456f7ccfd5152e8ecf21c"
checksum = "77ca79f2451b49fa9e2af39f0747fe999fcda4f5e241b2898624dca97a1f2177"
[[package]]
name = "windows_x86_64_msvc"
@ -3093,15 +3185,15 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
[[package]]
name = "windows_x86_64_msvc"
version = "0.52.3"
version = "0.52.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0770833d60a970638e989b3fa9fd2bb1aaadcf88963d1659fd7d9990196ed2d6"
checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8"
[[package]]
name = "winnow"
version = "0.6.2"
version = "0.6.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a4191c47f15cc3ec71fcb4913cb83d58def65dd3787610213c649283b5ce178"
checksum = "dffa400e67ed5a4dd237983829e66475f0a4a26938c4b04c21baede6262215b8"
dependencies = [
"memchr",
]

View file

@ -1,20 +1,21 @@
use chrono::Local;
use serenity::all::{CommandInteraction, Context};
use serenity::builder::{CreateCommand, CreateEmbed, CreateEmbedAuthor, CreateEmbedFooter};
use serenity::builder::{CreateCommand, CreateEmbed};
use crate::util::embed::Embed;
pub async fn run(_ctx: &Context, command: &CommandInteraction) -> CreateEmbed {
let username = command.user.name.as_str();
let current_time = Local::now().format("%Y-%m-%d @ %H:%M:%S");
CreateEmbed::new()
.author(CreateEmbedAuthor::new("Rustendo"))
.description("Botendo v7\ndeveloped by [moonleay](https://moonleay.net)\n\nCheck out the repository: https://git.moonleay.net/DiscordBots/Rustendo")
.footer(CreateEmbedFooter::new(format!(">{} | {}", current_time, username)))
}
Embed::create(
username,
"",
"Botendo v7\ndeveloped by [moonleay](https://moonleay.net)\n\nCheck out the repository: https://git.moonleay.net/DiscordBots/Rustendo",
)
}
pub fn register() -> CreateCommand {
CreateCommand::new("info").description("Infos about the bot")
}
// >18/02/2024 @ 19:01:59 - bartlo
// >2024-02-19 17:58:39 | moonleay
// >2024-02-19 17:58:39 | moonleay

View file

@ -1,93 +1,104 @@
use chrono::Local;
use serenity::all::{CommandDataOption, CommandDataOptionValue, CommandInteraction, Context, ResolvedOption, ResolvedValue};
use serenity::builder::{CreateCommand, CreateCommandOption, CreateEmbed, CreateEmbedAuthor, CreateEmbedFooter};
use serenity::all::{CommandDataOption, CommandDataOptionValue, CommandInteraction, Context};
use serenity::builder::{CreateCommand, CreateCommandOption, CreateEmbed};
use serenity::model::application::CommandOptionType;
use crate::util::user_util;
use crate::util::embed::Embed;
use crate::util::user_util::{self, get_guild};
pub async fn run(ctx: &Context, command: &CommandInteraction) -> CreateEmbed {
let username = command.user.name.as_str();
let current_time = Local::now().format("%Y-%m-%d @ %H:%M:%S");
let options = &command.data.options;
let query = if let Some(CommandDataOption {
value: CommandDataOptionValue::String(query), ..
}) = &options.first()
{
query
} else {
return CreateEmbed::new()
.author(CreateEmbedAuthor::new("Rustendo"))
.title("Error 400")
.description("There is no query provied.")
.footer(CreateEmbedFooter::new(format!(">{} | {}", current_time, username)))
};
let query = command.data.options.first().and_then(|option| {
if let CommandDataOptionValue::String(query) = &option.value {
Some(query)
} else {
None
}
});
if query.is_none() {
return Embed::create(username, "Error 400", "There is no query provided");
}
let guild_id = match &command.guild_id {
Some(guild_id) => guild_id,
None => {
return CreateEmbed::new()
.author(CreateEmbedAuthor::new("Rustendo"))
.title("GuildId not found")
.description("Could not find guild id.")
.footer(CreateEmbedFooter::new(format!("> {} | {}", current_time, username)));
return Embed::create(username, "GuildId not found", "Could not find guild id.");
}
};
let (guild_id, channel_id) = {
let guild = &ctx.cache.guild(guild_id).unwrap(); // TODO: This unwrap throws errors.
// This may be unsafe, idk not sure yet
let channel_id = guild
.voice_states
.get(&command.user.id)
.and_then(|voice_state| voice_state.channel_id);
(guild.id, channel_id)
let guild = get_guild(ctx, guild_id);
match guild {
Some(guild) => {
let channel_id = guild
.voice_states
.get(&command.user.id)
.and_then(|voice_state| voice_state.channel_id);
(guild.id, channel_id)
}
None => {
return Embed::create(username, "Guild not found", "Could not find guild.");
}
}
};
let connect_to = match channel_id {
Some(channel) => channel,
None => {
return CreateEmbed::new()
.author(CreateEmbedAuthor::new("Rustendo"))
.title("You are not in a VC.")
.description("Join one to start playing music.")
.footer(CreateEmbedFooter::new(format!("> {} | {}", current_time, username)));
},
return Embed::create(
username,
"You are not in a VC.",
"Join one to start playing music.",
);
}
};
let manager = &songbird::get(ctx)
.await
.expect("Cannot get Songbird.")
.clone();
if !user_util::is_self_connected_to_vc(&ctx, &guild_id) {
if !user_util::is_self_connected_to_vc(ctx, &guild_id) {
// self is connected to vc, check if user is in same vc
let self_channel = user_util::get_self_vc_id(&ctx, &guild_id);
let self_channel = user_util::get_self_vc_id(ctx, &guild_id);
if self_channel.is_none() {
return Embed::create(
username,
"I am not in a VC.",
"Connect me to a VC to start playing music.",
);
}
let self_channel = self_channel.unwrap();
// Check if user is in the same VC as the bot
if self_channel != connect_to {
return CreateEmbed::new()
.author(CreateEmbedAuthor::new("Rustendo"))
.title("You are not in my VC.")
.description("Connect to my VC to control the music.")
.footer(CreateEmbedFooter::new(format!("> {} | {}", current_time, username)));
return Embed::create(
username,
"You are not in my VC.",
"Connect to my VC to control the music.",
);
}
// Connect to VC
manager.join(guild_id, connect_to).await.expect("Cannot connect>...");
manager
.join(guild_id, connect_to)
.await
.expect("Cannot connect>...");
}
CreateEmbed::new()
.author(CreateEmbedAuthor::new("Rustendo"))
.title("Searching...")
.description(format!("Looking for {}", query))
.footer(CreateEmbedFooter::new(format!(">{} | {}", current_time, username)))
}
Embed::create(username, "Searching...", format!("Looking for {}", query))
}
pub fn register() -> CreateCommand {
CreateCommand::new("play")
.description("Play music")
.add_option(
CreateCommandOption::new(CommandOptionType::String, "query", "Link or search term")
.required(true)
.required(true),
)
}

View file

@ -1,60 +1,52 @@
use chrono::Local;
use serenity::all::{CommandInteraction, Context};
use serenity::builder::{CreateCommand, CreateEmbed, CreateEmbedAuthor, CreateEmbedFooter};
use serenity::builder::{CreateCommand, CreateEmbed};
use crate::util::embed::Embed;
use crate::util::user_util;
pub async fn run(ctx: &Context, command: &CommandInteraction) -> CreateEmbed {
let username = command.user.name.as_str();
let current_time = Local::now().format("%Y-%m-%d @ %H:%M:%S");
let guild_id = match &command.guild_id {
Some(guild_id) => guild_id,
None => {
return CreateEmbed::new()
.author(CreateEmbedAuthor::new("Rustendo"))
.title("GuildId not found")
.description("Could not find guild id.")
.footer(CreateEmbedFooter::new(format!("> {} | {}", current_time, username)));
return Embed::create(username, "GuildId not found", "Could not find guild id.");
}
};
if !user_util::is_self_connected_to_vc(&ctx, guild_id) {
if !user_util::is_self_connected_to_vc(ctx, guild_id) {
// Bot is not connectd to vc; no need to dc
return CreateEmbed::new()
.author(CreateEmbedAuthor::new("Rustendo"))
.title("Bot is not connected")
.description("And therefore I cannot stop playing.")
.footer(CreateEmbedFooter::new(format!("> {} | {}", current_time, username)));
return Embed::create(
username,
"Bot is not connected",
"And therefore I cannot stop playing.",
);
}
let manager = songbird::get(&ctx)
let manager = songbird::get(ctx)
.await
.expect("Cannot get Songbird")
.clone();
let has_handler = manager.get(guild_id.clone()).is_some();
let has_handler = manager.get(*guild_id).is_some();
if has_handler {
if let Err(e) = manager.remove(guild_id.clone()).await {
return CreateEmbed::new()
.author(CreateEmbedAuthor::new("Rustendo"))
.title("There was an error")
.description(format!("Failed: {:?}", e))
.footer(CreateEmbedFooter::new(format!("> {} | {}", current_time, username)));
if let Err(e) = manager.remove(*guild_id).await {
return Embed::create(username, "There was an error", format!("Failed: {:?}", e));
}
return CreateEmbed::new()
.author(CreateEmbedAuthor::new("Rustendo"))
.title("I stopped and left\nJust like your girlfriend.")
.footer(CreateEmbedFooter::new(format!(">{} | {}", current_time, username)))
return Embed::create(
username,
"I stopped and left\nJust like your girlfriend.",
"",
);
}
CreateEmbed::new()
.author(CreateEmbedAuthor::new("Rustendo"))
.title("Bot is not connected")
.description("And therefore I cannot stop playing.\nSomething happend, which shouldn't have.")
.footer(CreateEmbedFooter::new(format!("> {} | {}", current_time, username)))
}
Embed::create(
username,
"Bot is not connected",
"And therefore I cannot stop playing.\nSomething happend, which shouldn't have.",
)
}
pub fn register() -> CreateCommand {
CreateCommand::new("stop").description("Stop playing and start leavin'")

View file

@ -2,18 +2,14 @@ mod commands;
mod handler;
mod util;
use chrono::Local;
use serenity::all::{CommandInteraction, OnlineStatus};
use serenity::async_trait;
use serenity::builder::{
CreateEmbed, CreateEmbedAuthor, CreateEmbedFooter, CreateInteractionResponse,
CreateInteractionResponseMessage,
};
use serenity::builder::{CreateEmbed, CreateInteractionResponse, CreateInteractionResponseMessage};
use serenity::gateway::ActivityData;
use serenity::model::application::{Command, Interaction};
use serenity::model::gateway::Ready;
use serenity::prelude::*;
use util::config;
use util::{config, error::Embed};
// This trait adds the `register_songbird` and `register_songbird_with` methods
// to the client builder below, making it easy to install this voice client.
@ -63,17 +59,11 @@ impl EventHandler for Handler {
}
pub async fn respond_with_error(_ctx: &Context, command: &CommandInteraction) -> CreateEmbed {
let username = &command.user.name.as_str();
let current_time = Local::now().format("%Y-%m-%d @ %H:%M:%S");
CreateEmbed::new()
.author(CreateEmbedAuthor::new("Rustendo"))
.title("Command not found")
.description("Cannot find the executed command")
.footer(CreateEmbedFooter::new(format!(
"> {} | {}",
current_time, username
)))
Embed::create(
command.user.name.to_owned(),
"Command not found",
"Cannot find the executed command",
)
}
#[tokio::main]

View file

@ -8,7 +8,7 @@ pub struct Config {
pub discord_token: String,
pub lavalink_address: String,
pub lavalink_password: String,
pub user_id: u64
pub user_id: u64,
}
const CONFIG_FILE: &str = "./data/config.json";
@ -17,23 +17,23 @@ pub fn load() -> Result<Config, Box<dyn Error>> {
// TODO: load config, create empty config if there is no config, stop if there is no complete config
let config_file = match fs::File::open(CONFIG_FILE) {
Ok(file) => file,
Err(_) => create_empty()
Err(_) => create_empty(),
};
let config_file = serde_json::from_reader(config_file).unwrap();
Ok(config_file)
}
fn create_empty() -> fs::File{
fn create_empty() -> fs::File {
let example_config = Config {
discord_token: "paste_your_token".to_string(),
lavalink_address: "paste_your_lavalink_address".to_string(),
lavalink_password: "paste_your_lavalink_password".to_string(),
user_id: 1
user_id: 1,
};
let mut config_file = fs::File::create(CONFIG_FILE).unwrap();
let file_content = serde_json::to_string(&example_config).unwrap();
config_file.write_all(&file_content.as_bytes()).unwrap();
config_file.write_all(file_content.as_bytes()).unwrap();
panic!("There is no config. But now there is a template.")
}
}

29
src/util/embed.rs Normal file
View file

@ -0,0 +1,29 @@
use std::fmt::Display;
use chrono::Local;
use serenity::all::{CreateEmbed, CreateEmbedAuthor, CreateEmbedFooter};
pub struct Embed;
impl Embed {
pub fn create<
S: Into<String> + Display,
T: Into<String> + Display,
U: Into<String> + Display,
>(
username: S,
title: T,
message: U,
) -> CreateEmbed {
let current_time = Local::now().format("%Y-%m-%d @ %H:%M:%S");
CreateEmbed::new()
.author(CreateEmbedAuthor::new(username.to_string()))
.title(title)
.description(message)
.footer(CreateEmbedFooter::new(format!(
"> {} | {}",
current_time, username
)))
}
}

View file

@ -1,2 +1,3 @@
pub mod config;
pub mod user_util;
pub mod embed;
pub mod user_util;

View file

@ -1,42 +1,38 @@
use serenity::all::{ChannelId, Context, CreateEmbed, CreateEmbedAuthor, CreateEmbedFooter, GuildId};
use serenity::all::{ChannelId, Context, Guild, GuildId};
/// Get a guild by id
pub fn get_guild(ctx: &Context, guild_id: &GuildId) -> Option<Guild> {
let guild = ctx.cache.guild(guild_id)?;
Some(guild.clone())
}
/// Get the current channel id of the bot
pub fn get_channel_id(ctx: &Context, guild_id: &GuildId) -> Option<ChannelId> {
let guild = get_guild(ctx, guild_id)?;
let channel_id = guild
.voice_states
.get(&ctx.cache.current_user().id)
.and_then(|voice_state| voice_state.channel_id);
Some(channel_id.unwrap())
}
pub fn is_self_connected_to_vc(ctx: &Context, guild_id: &GuildId) -> bool {
let self_id = &ctx.cache.current_user().id;
let (_guild_id, channel_id) = {
let guild = &ctx.cache.guild(guild_id).unwrap();
// This may be unsafe, idk not sure yet
let channel_id = guild
.voice_states
.get(self_id)
.and_then(|voice_state| voice_state.channel_id);
(guild.id, channel_id)
};
let channel_id = get_channel_id(ctx, guild_id);
// TODO: There has to be a way to improve this. This is bad code and it should be optimized.
let connect_to = match channel_id {
Some(channel) => channel,
None => {
return false
},
};
true
if channel_id.is_none() {
return false;
}
true
}
// This whole file is jank. I have to rewrite this once I know Rust better
pub fn get_self_vc_id(ctx: &Context, guild_id: &GuildId) -> ChannelId {
let self_id = &ctx.cache.current_user().id;
let (guild_id, channel_id) = {
let guild = &ctx.cache.guild(guild_id).unwrap();
// This may be unsafe, idk not sure yet
let channel_id = guild
.voice_states
.get(&self_id)
.and_then(|voice_state| voice_state.channel_id);
(guild.id, channel_id)
};
channel_id.unwrap()
pub fn get_self_vc_id(ctx: &Context, guild_id: &GuildId) -> Option<ChannelId> {
let channel_id = get_channel_id(ctx, guild_id)?;
Some(channel_id)
}