diff --git a/.gitignore b/.gitignore index 2c549b2..f50483c 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,6 @@ # IDE config .vscode -mooverdb.db* \ No newline at end of file +mooverdb.db* + +*.txt \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index d88a0c7..b28a66d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -52,18 +52,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "ahash" -version = "0.8.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" -dependencies = [ - "cfg-if", - "once_cell", - "version_check", - "zerocopy 0.7.35", -] - [[package]] name = "aho-corasick" version = "1.1.3" @@ -96,9 +84,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.94" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1fd03a028ef38ba2276dce7e33fcd6369c158a1bca17946c4b1b701891c1ff7" +checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04" [[package]] name = "arrayvec" @@ -109,6 +97,184 @@ dependencies = [ "serde", ] +[[package]] +name = "async-attributes" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3203e79f4dd9bdda415ed03cf14dae5a2bf775c683a00f94e9cd1faf0f596e5" +dependencies = [ + "quote", + "syn 1.0.109", +] + +[[package]] +name = "async-channel" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35" +dependencies = [ + "concurrent-queue", + "event-listener 2.5.3", + "futures-core", +] + +[[package]] +name = "async-channel" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89b47800b0be77592da0afd425cc03468052844aff33b84e33cc696f64e77b6a" +dependencies = [ + "concurrent-queue", + "event-listener-strategy", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-executor" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30ca9a001c1e8ba5149f91a74362376cc6bc5b919d92d988668657bd570bdcec" +dependencies = [ + "async-task", + "concurrent-queue", + "fastrand", + "futures-lite", + "slab", +] + +[[package]] +name = "async-global-executor" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05b1b633a2115cd122d73b955eadd9916c18c8f510ec9cd1686404c60ad1c29c" +dependencies = [ + "async-channel 2.3.1", + "async-executor", + "async-io", + "async-lock", + "blocking", + "futures-lite", + "once_cell", + "tokio", +] + +[[package]] +name = "async-io" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a2b323ccce0a1d90b449fd71f2a06ca7faa7c54c2751f06c9bd851fc061059" +dependencies = [ + "async-lock", + "cfg-if", + "concurrent-queue", + "futures-io", + "futures-lite", + "parking", + "polling", + "rustix", + "slab", + "tracing", + "windows-sys 0.59.0", +] + +[[package]] +name = "async-lock" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff6e472cdea888a4bd64f342f09b3f50e1886d32afe8df3d663c01140b811b18" +dependencies = [ + "event-listener 5.3.1", + "event-listener-strategy", + "pin-project-lite", +] + +[[package]] +name = "async-process" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63255f1dc2381611000436537bbedfe83183faa303a5a0edaf191edef06526bb" +dependencies = [ + "async-channel 2.3.1", + "async-io", + "async-lock", + "async-signal", + "async-task", + "blocking", + "cfg-if", + "event-listener 5.3.1", + "futures-lite", + "rustix", + "tracing", +] + +[[package]] +name = "async-signal" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "637e00349800c0bdf8bfc21ebbc0b6524abea702b0da4168ac00d070d0c0b9f3" +dependencies = [ + "async-io", + "async-lock", + "atomic-waker", + "cfg-if", + "futures-core", + "futures-io", + "rustix", + "signal-hook-registry", + "slab", + "windows-sys 0.59.0", +] + +[[package]] +name = "async-std" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c634475f29802fde2b8f0b505b1bd00dfe4df7d4a000f0b36f7671197d5c3615" +dependencies = [ + "async-attributes", + "async-channel 1.9.0", + "async-global-executor", + "async-io", + "async-lock", + "async-process", + "crossbeam-utils", + "futures-channel", + "futures-core", + "futures-io", + "futures-lite", + "gloo-timers", + "kv-log-macro", + "log", + "memchr", + "once_cell", + "pin-project-lite", + "pin-utils", + "slab", + "wasm-bindgen-futures", +] + +[[package]] +name = "async-std-resolver" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa5ee46ec0c518414838d2fdc7dd18f6ba7d934b6e728005c958621da450682d" +dependencies = [ + "async-std", + "async-trait", + "futures-io", + "futures-util", + "hickory-resolver", + "pin-utils", + "socket2", +] + +[[package]] +name = "async-task" +version = "4.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" + [[package]] name = "async-trait" version = "0.1.81" @@ -224,6 +390,19 @@ dependencies = [ "generic-array", ] +[[package]] +name = "blocking" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "703f41c54fc768e63e091340b424302bb1c29ef4aa0c7f10fe849dfb114d29ea" +dependencies = [ + "async-channel 2.3.1", + "async-task", + "futures-io", + "futures-lite", + "piper", +] + [[package]] name = "bumpalo" version = "3.16.0" @@ -323,9 +502,9 @@ dependencies = [ [[package]] name = "chrono" -version = "0.4.38" +version = "0.4.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" +checksum = "7e36cc9d416881d2e24f9a963be5fb1cd90966419ac844274161d10488b3e825" dependencies = [ "android-tzdata", "iana-time-zone", @@ -571,7 +750,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" dependencies = [ "cfg-if", - "hashbrown", + "hashbrown 0.14.5", "lock_api", "once_cell", "parking_lot_core", @@ -676,6 +855,17 @@ dependencies = [ "pnet_macros_support", ] +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", +] + [[package]] name = "dotenv" version = "0.15.0" @@ -706,6 +896,18 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "enum-as-inner" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1e6a265c649f3f5979b601d26f1d05ada116434c87741c9493cb56218f76cbc" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote", + "syn 2.0.87", +] + [[package]] name = "equivalent" version = "1.0.1" @@ -742,6 +944,12 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "event-listener" +version = "2.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" + [[package]] name = "event-listener" version = "5.3.1" @@ -753,6 +961,16 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "event-listener-strategy" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c3e4e0dd3673c1139bf041f3008816d9cf2946bbfac2945c09e523b8d7b05b2" +dependencies = [ + "event-listener 5.3.1", + "pin-project-lite", +] + [[package]] name = "extended" version = "0.1.0" @@ -793,6 +1011,12 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foldhash" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0d2fde1f7b3d48b8395d5f2de76c18a528bd6a9cdde438df747bfcba3e05d6f" + [[package]] name = "foreign-types" version = "0.3.2" @@ -885,6 +1109,19 @@ version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" +[[package]] +name = "futures-lite" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5edaec856126859abb19ed65f39e90fea3a9574b9707f13539acf4abf7eb532" +dependencies = [ + "fastrand", + "futures-core", + "futures-io", + "parking", + "pin-project-lite", +] + [[package]] name = "futures-macro" version = "0.3.30" @@ -994,6 +1231,18 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" +[[package]] +name = "gloo-timers" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbb143cf96099802033e0d4f4963b19fd2e0b728bcf076cd9cf7f6634f092994" +dependencies = [ + "futures-channel", + "futures-core", + "js-sys", + "wasm-bindgen", +] + [[package]] name = "h2" version = "0.3.26" @@ -1037,18 +1286,25 @@ name = "hashbrown" version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" + +[[package]] +name = "hashbrown" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" dependencies = [ - "ahash", "allocator-api2", + "equivalent", + "foldhash", ] [[package]] name = "hashlink" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ba4ff7128dee98c7dc9794b6a411377e1404dba1c97deb8d1a55297bd25d8af" +checksum = "7382cf6263419f2d8df38c55d7da83da5c18aef87fc7a7fc1fb1e344edfe14c1" dependencies = [ - "hashbrown", + "hashbrown 0.15.2", ] [[package]] @@ -1083,12 +1339,61 @@ version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" +[[package]] +name = "hermit-abi" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc" + [[package]] name = "hex" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +[[package]] +name = "hickory-proto" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "447afdcdb8afb9d0a852af6dc65d9b285ce720ed7a59e42a8bf2e931c67bc1b5" +dependencies = [ + "async-trait", + "cfg-if", + "data-encoding", + "enum-as-inner", + "futures-channel", + "futures-io", + "futures-util", + "idna 1.0.3", + "ipnet", + "once_cell", + "rand", + "thiserror 1.0.64", + "tinyvec", + "tracing", + "url", +] + +[[package]] +name = "hickory-resolver" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a2e2aba9c389ce5267d31cf1e4dace82390ae276b0b364ea55630b1fa1b44b4" +dependencies = [ + "cfg-if", + "futures-util", + "hickory-proto", + "ipconfig", + "lru-cache", + "once_cell", + "parking_lot", + "rand", + "resolv-conf", + "smallvec", + "thiserror 1.0.64", + "tracing", +] + [[package]] name = "hkdf" version = "0.12.4" @@ -1110,7 +1415,7 @@ dependencies = [ "shorthand", "stable-vec", "strum", - "thiserror", + "thiserror 1.0.64", ] [[package]] @@ -1131,6 +1436,17 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "hostname" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" +dependencies = [ + "libc", + "match_cfg", + "winapi", +] + [[package]] name = "http" version = "0.2.12" @@ -1345,6 +1661,124 @@ dependencies = [ "cc", ] +[[package]] +name = "icu_collections" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locid" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_locid_transform" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_locid_transform_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_locid_transform_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e" + +[[package]] +name = "icu_normalizer" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "write16", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516" + +[[package]] +name = "icu_properties" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locid_transform", + "icu_properties_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" + +[[package]] +name = "icu_provider" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_provider_macros", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_provider_macros" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", +] + [[package]] name = "ident_case" version = "1.0.1" @@ -1361,6 +1795,27 @@ dependencies = [ "unicode-normalization", ] +[[package]] +name = "idna" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + [[package]] name = "indexmap" version = "2.3.0" @@ -1368,7 +1823,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de3fc2e30ba82dd1b3911c8de1ffc143c74a914a14e99514d7637e3099df5ea0" dependencies = [ "equivalent", - "hashbrown", + "hashbrown 0.14.5", ] [[package]] @@ -1380,6 +1835,18 @@ dependencies = [ "generic-array", ] +[[package]] +name = "ipconfig" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b58db92f96b720de98181bbbe63c831e87005ab460c1bf306eb2622b4707997f" +dependencies = [ + "socket2", + "widestring", + "windows-sys 0.48.0", + "winreg", +] + [[package]] name = "ipnet" version = "2.9.0" @@ -1407,6 +1874,15 @@ version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "078e285eafdfb6c4b434e0d31e8cfcb5115b651496faca5749b88fafd4f23bfd" +[[package]] +name = "kv-log-macro" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0de8b303297635ad57c9f5059fd9cee7a47f8e8daa09df0fcd07dd39fb22977f" +dependencies = [ + "log", +] + [[package]] name = "lazy_static" version = "1.5.0" @@ -1418,9 +1894,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.155" +version = "0.2.169" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" +checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" [[package]] name = "libm" @@ -1439,12 +1915,24 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "linked-hash-map" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" + [[package]] name = "linux-raw-sys" version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +[[package]] +name = "litemap" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104" + [[package]] name = "lock_api" version = "0.4.12" @@ -1460,6 +1948,9 @@ name = "log" version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" +dependencies = [ + "value-bag", +] [[package]] name = "loom" @@ -1476,6 +1967,21 @@ dependencies = [ "tracing-subscriber", ] +[[package]] +name = "lru-cache" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c" +dependencies = [ + "linked-hash-map", +] + +[[package]] +name = "match_cfg" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" + [[package]] name = "matchers" version = "0.1.0" @@ -1532,12 +2038,6 @@ dependencies = [ "triomphe", ] -[[package]] -name = "minimal-lexical" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" - [[package]] name = "miniz_oxide" version = "0.7.4" @@ -1553,7 +2053,7 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4569e456d394deccd22ce1c1913e6ea0e54519f577285001215d33557431afe4" dependencies = [ - "hermit-abi", + "hermit-abi 0.3.9", "libc", "wasi", "windows-sys 0.52.0", @@ -1568,6 +2068,7 @@ dependencies = [ "dotenv", "form_urlencoded", "poise", + "radiobrowser", "rand", "regex", "reqwest 0.11.27", @@ -1624,16 +2125,6 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" -[[package]] -name = "nom" -version = "7.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" -dependencies = [ - "memchr", - "minimal-lexical", -] - [[package]] name = "nu-ansi-term" version = "0.46.0" @@ -1723,7 +2214,7 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi", + "hermit-abi 0.3.9", "libc", ] @@ -1836,12 +2327,6 @@ dependencies = [ "windows-targets 0.52.6", ] -[[package]] -name = "paste" -version = "1.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" - [[package]] name = "patricia_tree" version = "0.8.0" @@ -1898,6 +2383,17 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "piper" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96c8c490f422ef9a4efd2cb5b42b76c8613d7e7dfc1caf667b8a3350a5acc066" +dependencies = [ + "atomic-waker", + "fastrand", + "futures-io", +] + [[package]] name = "pkcs1" version = "0.7.5" @@ -1984,6 +2480,21 @@ dependencies = [ "syn 2.0.87", ] +[[package]] +name = "polling" +version = "3.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a604568c3202727d1507653cb121dbd627a58684eb09a820fd746bee38b4442f" +dependencies = [ + "cfg-if", + "concurrent-queue", + "hermit-abi 0.4.0", + "pin-project-lite", + "rustix", + "tracing", + "windows-sys 0.59.0", +] + [[package]] name = "poly1305" version = "0.8.0" @@ -2025,7 +2536,7 @@ version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dee4364d9f3b902ef14fab8a1ddffb783a1cb6b4bba3bfc1fa3922732c7de97f" dependencies = [ - "zerocopy 0.6.6", + "zerocopy", ] [[package]] @@ -2057,6 +2568,12 @@ dependencies = [ "unicase", ] +[[package]] +name = "quick-error" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" + [[package]] name = "quote" version = "1.0.36" @@ -2066,6 +2583,21 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "radiobrowser" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "763ad5f847e3d2e3221dac4e87370297a970e3f9eb8f2760b915001b9c79023b" +dependencies = [ + "async-std", + "async-std-resolver", + "chrono", + "log", + "rand", + "reqwest 0.11.27", + "serde", +] + [[package]] name = "rand" version = "0.8.5" @@ -2258,6 +2790,16 @@ dependencies = [ "windows-registry", ] +[[package]] +name = "resolv-conf" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52e44394d2086d010551b14b53b1f24e31647570cd1deb0379e2c21b329aba00" +dependencies = [ + "hostname", + "quick-error", +] + [[package]] name = "ring" version = "0.16.20" @@ -2909,21 +3451,11 @@ dependencies = [ "der", ] -[[package]] -name = "sqlformat" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f895e3734318cc55f1fe66258926c9b910c124d47520339efecbb6c59cec7c1f" -dependencies = [ - "nom", - "unicode_categories", -] - [[package]] name = "sqlx" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93334716a037193fac19df402f8571269c84a00852f6a7066b5d2616dcd64d3e" +checksum = "4410e73b3c0d8442c5f99b425d7a435b5ee0ae4167b3196771dd3f7a01be745f" dependencies = [ "sqlx-core", "sqlx-macros", @@ -2934,37 +3466,31 @@ dependencies = [ [[package]] name = "sqlx-core" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4d8060b456358185f7d50c55d9b5066ad956956fddec42ee2e8567134a8936e" +checksum = "6a007b6936676aa9ab40207cde35daab0a04b823be8ae004368c0793b96a61e0" dependencies = [ - "atoi", - "byteorder", "bytes", "crc", "crossbeam-queue", "either", - "event-listener", - "futures-channel", + "event-listener 5.3.1", "futures-core", "futures-intrusive", "futures-io", "futures-util", - "hashbrown", + "hashbrown 0.15.2", "hashlink", - "hex", "indexmap", "log", "memchr", "once_cell", - "paste", "percent-encoding", "serde", "serde_json", "sha2", "smallvec", - "sqlformat", - "thiserror", + "thiserror 2.0.11", "tokio", "tokio-stream", "tracing", @@ -2973,9 +3499,9 @@ dependencies = [ [[package]] name = "sqlx-macros" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cac0692bcc9de3b073e8d747391827297e075c7710ff6276d9f7a1f3d58c6657" +checksum = "3112e2ad78643fef903618d78cf0aec1cb3134b019730edb039b69eaf531f310" dependencies = [ "proc-macro2", "quote", @@ -2986,9 +3512,9 @@ dependencies = [ [[package]] name = "sqlx-macros-core" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1804e8a7c7865599c9c79be146dc8a9fd8cc86935fa641d3ea58e5f0688abaa5" +checksum = "4e9f90acc5ab146a99bf5061a7eb4976b573f560bc898ef3bf8435448dd5e7ad" dependencies = [ "dotenvy", "either", @@ -3012,9 +3538,9 @@ dependencies = [ [[package]] name = "sqlx-mysql" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64bb4714269afa44aef2755150a0fc19d756fb580a67db8885608cf02f47d06a" +checksum = "4560278f0e00ce64938540546f59f590d60beee33fffbd3b9cd47851e5fff233" dependencies = [ "atoi", "base64 0.22.1", @@ -3047,16 +3573,16 @@ dependencies = [ "smallvec", "sqlx-core", "stringprep", - "thiserror", + "thiserror 2.0.11", "tracing", "whoami", ] [[package]] name = "sqlx-postgres" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fa91a732d854c5d7726349bb4bb879bb9478993ceb764247660aee25f67c2f8" +checksum = "c5b98a57f363ed6764d5b3a12bfedf62f07aa16e1856a7ddc2a0bb190a959613" dependencies = [ "atoi", "base64 0.22.1", @@ -3067,7 +3593,6 @@ dependencies = [ "etcetera", "futures-channel", "futures-core", - "futures-io", "futures-util", "hex", "hkdf", @@ -3085,16 +3610,16 @@ dependencies = [ "smallvec", "sqlx-core", "stringprep", - "thiserror", + "thiserror 2.0.11", "tracing", "whoami", ] [[package]] name = "sqlx-sqlite" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5b2cf34a45953bfd3daaf3db0f7a7878ab9b7a6b91b422d24a7a9e4c857b680" +checksum = "f85ca71d3a5b24e64e1d08dd8fe36c6c95c339a896cc33068148906784620540" dependencies = [ "atoi", "flume", @@ -3122,6 +3647,12 @@ dependencies = [ "no-std-compat", ] +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + [[package]] name = "stream_lib" version = "0.4.2" @@ -3426,6 +3957,17 @@ dependencies = [ "futures-core", ] +[[package]] +name = "synstructure" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", +] + [[package]] name = "system-configuration" version = "0.5.1" @@ -3495,7 +4037,7 @@ dependencies = [ "json", "regex", "reqwest 0.12.12", - "thiserror", + "thiserror 1.0.64", ] [[package]] @@ -3504,7 +4046,16 @@ version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84" dependencies = [ - "thiserror-impl", + "thiserror-impl 1.0.64", +] + +[[package]] +name = "thiserror" +version = "2.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d452f284b73e6d76dd36758a0c8684b1d5be31f92b89d07fd5822175732206fc" +dependencies = [ + "thiserror-impl 2.0.11", ] [[package]] @@ -3518,6 +4069,17 @@ dependencies = [ "syn 2.0.87", ] +[[package]] +name = "thiserror-impl" +version = "2.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26afc1baea8a989337eeb52b6e72a039780ce45c3edfcc9c5b9d112feeb173c2" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", +] + [[package]] name = "thread_local" version = "1.1.8" @@ -3559,6 +4121,16 @@ dependencies = [ "time-core", ] +[[package]] +name = "tinystr" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" +dependencies = [ + "displaydoc", + "zerovec", +] + [[package]] name = "tinyvec" version = "1.8.0" @@ -3576,9 +4148,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.42.0" +version = "1.43.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cec9b21b0450273377fc97bd4c33a8acffc8c996c987a7c5b319a0083707551" +checksum = "3d61fa4ffa3de412bfea335c6ecff681de2b609ba3c77ef3e00e521813a9ed9e" dependencies = [ "backtrace", "bytes", @@ -3608,9 +4180,9 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" +checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" dependencies = [ "proc-macro2", "quote", @@ -3862,7 +4434,7 @@ dependencies = [ "rand", "rustls 0.20.9", "sha1", - "thiserror", + "thiserror 1.0.64", "url", "utf-8", "webpki", @@ -3884,7 +4456,7 @@ dependencies = [ "rustls 0.22.4", "rustls-pki-types", "sha1", - "thiserror", + "thiserror 1.0.64", "url", "utf-8", ] @@ -3952,7 +4524,7 @@ checksum = "5dece5c06268af6a9ff4541788601e560a4284ffebfb357f713d676f13b964db" dependencies = [ "chrono", "dashmap", - "hashbrown", + "hashbrown 0.14.5", "mini-moka", "parking_lot", "secrecy", @@ -4015,12 +4587,6 @@ version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" -[[package]] -name = "unicode_categories" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" - [[package]] name = "universal-hash" version = "0.5.1" @@ -4050,7 +4616,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" dependencies = [ "form_urlencoded", - "idna", + "idna 0.5.0", "percent-encoding", "serde", ] @@ -4061,6 +4627,18 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" +[[package]] +name = "utf16_iter" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + [[package]] name = "uuid" version = "1.10.0" @@ -4076,6 +4654,12 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" +[[package]] +name = "value-bag" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ef4c4aa54d5d05a279399bfa921ec387b7aba77caf7a682ae8d86785b8fdad2" + [[package]] name = "vcpkg" version = "0.2.15" @@ -4243,6 +4827,12 @@ dependencies = [ "wasite", ] +[[package]] +name = "widestring" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7219d36b6eac893fa81e84ebe06485e7dcbb616177469b142df14f1f4deb1311" + [[package]] name = "winapi" version = "0.3.9" @@ -4480,6 +5070,42 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "write16" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" + +[[package]] +name = "writeable" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" + +[[package]] +name = "yoke" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", + "synstructure", +] + [[package]] name = "zerocopy" version = "0.6.6" @@ -4487,16 +5113,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "854e949ac82d619ee9a14c66a1b674ac730422372ccb759ce0c39cabcf2bf8e6" dependencies = [ "byteorder", - "zerocopy-derive 0.6.6", -] - -[[package]] -name = "zerocopy" -version = "0.7.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" -dependencies = [ - "zerocopy-derive 0.7.35", + "zerocopy-derive", ] [[package]] @@ -4511,14 +5128,24 @@ dependencies = [ ] [[package]] -name = "zerocopy-derive" -version = "0.7.35" +name = "zerofrom" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +checksum = "cff3ee08c995dee1859d998dea82f7374f2826091dd9cd47def953cae446cd2e" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808" dependencies = [ "proc-macro2", "quote", "syn 2.0.87", + "synstructure", ] [[package]] @@ -4526,3 +5153,25 @@ name = "zeroize" version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" + +[[package]] +name = "zerovec" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", +] diff --git a/Cargo.toml b/Cargo.toml index c9e3f30..79850ab 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,21 +7,22 @@ edition = "2021" [dependencies] rand = "0.8.5" -anyhow = "1.0.89" +anyhow = "1.0.95" tokio-cron-scheduler = "0.13.0" dotenv = "0.15.0" poise = "0.6.1" serenity = { version = "0.12.4", default-features = false, features = ["client", "gateway", "rustls_backend", "model", "http", "cache"] } # serenity_utils = "0.7.0" -tokio = { version = "1.42.0", features = ["macros", "rt-multi-thread"] } +tokio = { version = "1.43.0", features = ["macros", "rt-multi-thread"] } regex = "1.11.1" -chrono = "0.4.38" -sqlx = {version="0.8.2", features=["runtime-tokio", "sqlite"]} +chrono = "0.4.39" +sqlx = {version="0.8.3", features=["runtime-tokio", "sqlite"]} form_urlencoded = "1.2.1" tenorv2 = { path = "./tenor-v2/tenorv2" } # librespot = { version = "0.6.0", default-features = false, features = ["rodio-backend"] } songbird = { version = "0.4.6", features = ["driver", "builtin-queue"] } reqwest = "0.11.27" # songbird depends on ^0.11 +radiobrowser = "0.6.1" [dependencies.symphonia] version = "0.5.2" diff --git a/src/commands/mod.rs b/src/commands.rs similarity index 64% rename from src/commands/mod.rs rename to src/commands.rs index df0d152..6a1c0f7 100644 --- a/src/commands/mod.rs +++ b/src/commands.rs @@ -1,11 +1,13 @@ pub use moover::*; pub use notice::*; pub use user_interactions::*; -pub use other::*; +// pub use other::*; pub use voice::*; +// pub use command_utils::*; pub mod moover; pub mod notice; pub mod user_interactions; -pub mod other; +// pub mod other; pub mod voice; +// mod command_utils; diff --git a/src/commands/moover/mod.rs b/src/commands/moover.rs similarity index 64% rename from src/commands/moover/mod.rs rename to src/commands/moover.rs index 51a3f5b..f2c99f7 100644 --- a/src/commands/moover/mod.rs +++ b/src/commands/moover.rs @@ -1,7 +1,7 @@ pub use moove::*; +pub use gif::*; pub use say::*; -// pub use gif::*; pub mod moove; +pub mod gif; pub mod say; -// pub mod gif; diff --git a/src/commands/moover/gif.rs b/src/commands/moover/gif.rs new file mode 100644 index 0000000..4861a37 --- /dev/null +++ b/src/commands/moover/gif.rs @@ -0,0 +1,20 @@ +use poise; +use serenity::all::{Embed, User}; + +use crate::types::{Error, Context}; + +#[poise::command( + slash_command, + description_localized("en-US", "Send a gif from Tenor") +)] +pub async fn gif(ctx: Context<'_>, + #[description = "What should I search?"] + what: String, + #[description = "Should the gif be R-rated?"] + contentfilter: String +) -> Result<(), Error> { + // let embed; + // send_with_embed(ctx, "hug", &title, &desc).await?; + ctx.reply("Done!").await?; + Ok(()) +} \ No newline at end of file diff --git a/src/commands/notice/mod.rs b/src/commands/notice.rs similarity index 78% rename from src/commands/notice/mod.rs rename to src/commands/notice.rs index d63767d..33bed17 100644 --- a/src/commands/notice/mod.rs +++ b/src/commands/notice.rs @@ -2,4 +2,4 @@ pub use birthday::*; pub use events::*; pub mod birthday; -pub mod events; \ No newline at end of file +pub mod events; diff --git a/src/commands/other/mod.rs b/src/commands/other/mod.rs deleted file mode 100644 index e69de29..0000000 diff --git a/src/commands/user_interactions/mod.rs b/src/commands/user_interactions.rs similarity index 85% rename from src/commands/user_interactions/mod.rs rename to src/commands/user_interactions.rs index 0e8654b..f9a7882 100644 --- a/src/commands/user_interactions/mod.rs +++ b/src/commands/user_interactions.rs @@ -3,4 +3,4 @@ pub use hug::*; pub mod interaction; pub mod headpat; -pub mod hug; \ No newline at end of file +pub mod hug; diff --git a/src/commands/user_interactions/interaction.rs b/src/commands/user_interactions/interaction.rs index 6db121a..f495f3e 100644 --- a/src/commands/user_interactions/interaction.rs +++ b/src/commands/user_interactions/interaction.rs @@ -2,7 +2,7 @@ use anyhow::anyhow; use serenity::all::{Colour, CreateEmbed, CreateMessage}; use tenorv2::tenor_builder::Tenor; -use crate::{types::Context, util::{gifs::get_random_tenor_gif, utilities}}; +use crate::{types::Context, utils::{gifs::get_random_tenor_gif, utilities}}; /// Sends embed with random tenor gif from searched query /// title and desc are used in the embed diff --git a/src/commands/voice.rs b/src/commands/voice.rs new file mode 100644 index 0000000..98fd8f5 --- /dev/null +++ b/src/commands/voice.rs @@ -0,0 +1,11 @@ +use voice_utils::*; + +mod voice_utils; +pub mod player_common; +pub mod radio; +pub mod general_player; + +// ! not working +// pub mod yt; +// TODO implement +// pub mod spotify; diff --git a/src/commands/voice/general/mod.rs b/src/commands/voice/general/mod.rs deleted file mode 100644 index 8b6dfd4..0000000 --- a/src/commands/voice/general/mod.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub use general_player::*; - -pub mod general_player; \ No newline at end of file diff --git a/src/commands/voice/general/general_player.rs b/src/commands/voice/general_player.rs similarity index 79% rename from src/commands/voice/general/general_player.rs rename to src/commands/voice/general_player.rs index c3cd0d6..860d22f 100644 --- a/src/commands/voice/general/general_player.rs +++ b/src/commands/voice/general_player.rs @@ -2,10 +2,11 @@ use std::vec; use songbird::input::YoutubeDl; -use crate::commands::util::connect; -use crate::util::poise_context_extension::ContextExt; +use crate::utils::poise_context_extension::ContextExt; use crate::types::{Context, Error}; -use crate::commands::voice::util::autocomplete_channel; +use crate::commands::voice::voice_utils::autocomplete_channel; + +use super::connect; // TODO: search, queue #[poise::command( @@ -38,12 +39,9 @@ pub async fn play(ctx: Context<'_>, let http_client = &ctx.data().http_client; if manager.get(guild_id).is_none() { - match connect(&ctx, guild_id, channel).await { - Ok(_) => (), - Err(e) => { - ctx.reply_ephemeral(&e.to_string()).await?; - return Ok(()) - } + if let Err(e) = connect(&ctx, guild_id, channel).await { + ctx.reply_ephemeral(&e.to_string()).await?; + return Ok(()) } } diff --git a/src/commands/voice/mod.rs b/src/commands/voice/mod.rs deleted file mode 100644 index f3d7e73..0000000 --- a/src/commands/voice/mod.rs +++ /dev/null @@ -1,6 +0,0 @@ -pub mod util; -pub mod player_common; -pub mod radio; -// pub mod spotify; -pub mod general; -pub mod yt; \ No newline at end of file diff --git a/src/commands/voice/player_common.rs b/src/commands/voice/player_common.rs index 38ac50a..f87031c 100644 --- a/src/commands/voice/player_common.rs +++ b/src/commands/voice/player_common.rs @@ -2,12 +2,12 @@ use std::vec; use songbird::input::{File, Input}; -use crate::util::debug::send_error; -use crate::util::poise_context_extension::ContextExt; -use crate::util::utilities::get_local_songs; +use crate::utils::debug::send_error; +use crate::utils::poise_context_extension::ContextExt; +use crate::utils::utilities::get_local_songs; use crate::types::{Context, Error}; -use super::util::{connect, autocomplete_channel}; +use super::voice_utils::{connect, autocomplete_channel}; /** * Common commands that are the same for every implementation diff --git a/src/commands/voice/radio/mod.rs b/src/commands/voice/radio.rs similarity index 55% rename from src/commands/voice/radio/mod.rs rename to src/commands/voice/radio.rs index 27ead6c..0ea2063 100644 --- a/src/commands/voice/radio/mod.rs +++ b/src/commands/voice/radio.rs @@ -1,3 +1,6 @@ pub use radio_player::*; +use radio_utils::*; pub mod radio_player; + +mod radio_utils; diff --git a/src/commands/voice/radio/radio_player.rs b/src/commands/voice/radio/radio_player.rs index b9ed39d..599c610 100644 --- a/src/commands/voice/radio/radio_player.rs +++ b/src/commands/voice/radio/radio_player.rs @@ -1,26 +1,41 @@ use std::vec; +use radiobrowser::RadioBrowserAPI; use reqwest::Client; use songbird::input::Input; use songbird::input::HttpRequest; -use crate::commands::util::connect; -use crate::util::poise_context_extension::ContextExt; +use super::super::connect; +use crate::utils::poise_context_extension::ContextExt; use crate::types::{Context, Error}; -use crate::commands::voice::util::autocomplete_channel; +use crate::commands::voice::voice_utils::autocomplete_channel; + +use super::radio_utils::paginate_search; + +use super::super::voice_utils::MAX_ENTRIES; + +#[poise::command( + slash_command, + description_localized("en-US", "Plays music from URL source"), + subcommands("search", "play") +)] +pub async fn radio(_ctx: Context<'_>) -> Result<(), Error> { + Ok(()) +} // TODO: autocomplete radio stream URLs #[poise::command( slash_command, description_localized("en-US", "Plays music from URL source") )] -pub async fn radio(ctx: Context<'_>, +pub async fn play(ctx: Context<'_>, #[autocomplete = "autocomplete_channel"] #[description = "Voice channel name: "] channel: Option, - #[description = "Source URL: "] - url: String, + #[autocomplete = "autocomplete_radio"] + #[description = "Radio station: "] + name: String, ) -> Result<(), Error> { if ctx.guild().is_none() { @@ -39,12 +54,9 @@ pub async fn radio(ctx: Context<'_>, }; if manager.get(guild_id).is_none() { - match connect(&ctx, guild_id, channel).await { - Ok(_) => (), - Err(e) => { - ctx.reply_ephemeral(&e.to_string()).await?; - return Ok(()) - } + if let Err(e) = connect(&ctx, guild_id, channel).await { + ctx.reply_ephemeral(&e.to_string()).await?; + return Ok(()) } } @@ -52,7 +64,7 @@ pub async fn radio(ctx: Context<'_>, let mut handler = handler_lock.lock().await; let client = Client::new(); - let request = HttpRequest::new(client, url); + let request = HttpRequest::new(client, name); let input = Input::from(request); handler.play_only_input(input); } @@ -64,3 +76,80 @@ pub async fn radio(ctx: Context<'_>, ctx.reply_ephemeral("Done!").await?; Ok(()) } + +async fn autocomplete_radio( + ctx: Context<'_>, + partial: &str +) -> Vec { + + let api = { + match &ctx.data().radio_browser { + Some(v) => v.clone(), + None => { + let Ok(radio_browser) = RadioBrowserAPI::new().await else { + return vec!["There was an error with radio API!".to_owned()] + }; + radio_browser + } + } + }; + + let stations: Vec = match api.get_stations() + .limit(MAX_ENTRIES) + .name(partial) + .hidebroken(true) + .send().await { + Ok(stations) => { + stations.iter().map(|station| + format!("Name: {} Language: {} Bitrate: {}", station.name, station.countrycode, station.bitrate) + ).collect() + }, + Err(_) => return vec!["".to_owned()] + }; + + dbg!(&stations); + + return stations + // return vec![]; +} + +// TODO +// autocomplete +// search with buttons and list in embed with direct links to stream +// embed showing currently playing song + +// TODO: autocomplete radio stream URLs +#[poise::command( + slash_command, + description_localized("en-US", "Search for a radio") +)] +pub async fn search(ctx: Context<'_>, + #[description = "Radio station: "] + name: String, + #[description = "Country: "] + country: Option, + #[description = "Tag: "] + tag: Option +) -> Result<(), Error> { + + let api = match &ctx.data().radio_browser { + Some(v) => v.clone(), + None => { + let Ok(radio_browser) = RadioBrowserAPI::new().await else { + let _ = ctx.reply_ephemeral("There was an error with radio API!").await; + return Ok(()) + }; + radio_browser + } + }; + + let station_search_builder = api.get_stations() + .name(name) + .tag(tag.unwrap_or("".to_owned())) + .country(country.unwrap_or("".to_owned())) + .hidebroken(true); + + paginate_search(ctx, station_search_builder); + + Ok(()) +} diff --git a/src/commands/voice/radio/radio_utils.rs b/src/commands/voice/radio/radio_utils.rs new file mode 100644 index 0000000..de1832c --- /dev/null +++ b/src/commands/voice/radio/radio_utils.rs @@ -0,0 +1,83 @@ +use poise::{ChoiceParameter, CreateReply}; +use radiobrowser::StationSearchBuilder; +use serenity::{all::{CreateActionRow, CreateButton, CreateEmbed, CreateInteractionResponse, CreateInteractionResponseMessage}, futures::SinkExt}; + +use crate::types::Context; + +#[derive(ChoiceParameter)] +pub enum WelcomeChoice { + #[name = "5"] + A, + #[name = "10"] + B, + #[name = "15"] + C +} + +pub async fn paginate_search( + ctx: Context<'_>, + search_builder: StationSearchBuilder, +) -> Result<(), serenity::Error> { + // Define some unique identifiers for the navigation buttons + let ctx_id = ctx.id(); + let prev_button_id = format!("{}prev", ctx_id); + let next_button_id = format!("{}next", ctx_id); + + let Ok(stations) = search_builder.send().await else { + let _ = ctx.reply("Something went wrong, try searching again").await; + return Ok(()) + }; + + // Send the embed with the first page as content + let reply = { + let components = CreateActionRow::Buttons(vec![ + CreateButton::new(&prev_button_id).emoji('◀'), + CreateButton::new(&next_button_id).emoji('▶'), + ]); + + CreateReply::default() + .embed(CreateEmbed::new()) + .components(vec![components]) + }; + + ctx.send(reply).await?; + + // Loop through incoming interactions with the navigation buttons + let mut current_page = 0; + while let Some(press) = serenity::collector::ComponentInteractionCollector::new(ctx) + // We defined our button IDs to start with `ctx_id`. If they don't, some other command's + // button was pressed + .filter(move |press| press.data.custom_id.starts_with(&ctx_id.to_string())) + // Timeout when no navigation button has been pressed for 24 hours + .timeout(std::time::Duration::from_secs(3600 * 24)) + .await + { + // Depending on which button was pressed, go to next or previous page + if press.data.custom_id == next_button_id { + current_page += 1; + // TODO find a way to check end + // if current_page >= pages.len() { + // current_page = 0; + // } + } else if press.data.custom_id == prev_button_id { + // TODO find a way to get pages len + // current_page = current_page.checked_sub(1).unwrap_or(pages.len() - 1); + } else { + // This is an unrelated button interaction + continue; + } + + // Update the message with the new page contents + press + .create_response( + ctx.serenity_context(), + CreateInteractionResponse::UpdateMessage( + CreateInteractionResponseMessage::new() + .embed(CreateEmbed::new()), + ), + ) + .await?; + } + + Ok(()) +} diff --git a/src/commands/voice/spotify/mod.rs b/src/commands/voice/spotify.rs similarity index 100% rename from src/commands/voice/spotify/mod.rs rename to src/commands/voice/spotify.rs diff --git a/src/commands/voice/util.rs b/src/commands/voice/voice_utils.rs similarity index 86% rename from src/commands/voice/util.rs rename to src/commands/voice/voice_utils.rs index 4208b51..d9e4a8c 100644 --- a/src/commands/voice/util.rs +++ b/src/commands/voice/voice_utils.rs @@ -1,10 +1,13 @@ -use serenity::all::{ChannelId, GuildId}; +use poise::{CreateReply}; +use serenity::all::{ChannelId, CreateActionRow, CreateButton, CreateEmbed, CreateInteractionResponse, CreateInteractionResponseMessage, Embed, GuildId}; use serenity::async_trait; use songbird::events::{Event, EventContext, EventHandler as VoiceEventHandler}; use songbird::TrackEvent; -use crate::{types::{Context, Error}, util::utilities::get_channel_by_name}; +use crate::{types::{Context, Error}, utils::utilities::get_channel_by_name}; + +pub const MAX_ENTRIES: &str = "15"; /// Returns either voice channel to which the user is currently connected to or the one passed via name async fn get_voice_channel(ctx: &Context<'_>, name: Option) -> Result { @@ -68,7 +71,7 @@ pub async fn autocomplete_channel( _partial: &str, ) -> Vec { - use crate::util::utilities::get_vc_names; + use crate::utils::utilities::get_vc_names; match ctx.guild() { Some(guild) => get_vc_names(guild), None => [].to_vec() diff --git a/src/commands/voice/yt/mod.rs b/src/commands/voice/yt.rs similarity index 54% rename from src/commands/voice/yt/mod.rs rename to src/commands/voice/yt.rs index 989288e..af9e888 100644 --- a/src/commands/voice/yt/mod.rs +++ b/src/commands/voice/yt.rs @@ -1,3 +1,3 @@ pub use yt_player::*; -pub mod yt_player; \ No newline at end of file +pub mod yt_player; diff --git a/src/main.rs b/src/main.rs index 66380e6..a36e45a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -23,7 +23,7 @@ mod message_handler; use message_handler::handle; mod commands; -mod util; +mod utils; mod other; use other::notice; @@ -57,7 +57,7 @@ impl EventHandler for Handler { println!("{} v3.3.1 is connected!", ready.user.name); #[cfg(feature="RELEASE")] { - use util::debug::hello; + use utils::debug::hello; let _ = hello(ctx.http.clone()).await; } @@ -87,10 +87,9 @@ async fn main() -> anyhow::Result<()> { commands::say(), commands::hug(), // commands::player::play_local(), - commands::player_common::disconnect(), commands::radio::radio(), - commands::general::play(), - commands::yt::play_yt() + commands::general_player::play(), + commands::player_common::disconnect(), ], prefix_options: poise::PrefixFrameworkOptions { prefix: Some("/".into()), @@ -129,8 +128,10 @@ async fn main() -> anyhow::Result<()> { register_globally(ctx, &framework.options().commands).await?; } + Ok(Data { - http_client: HttpClient::new() + http_client: HttpClient::new(), + radio_browser: RadioBrowserAPI::new().await.ok() }) }) }) diff --git a/src/message_handler.rs b/src/message_handler.rs index 4aa263e..8033036 100644 --- a/src/message_handler.rs +++ b/src/message_handler.rs @@ -5,8 +5,8 @@ use serenity::model::channel::Message; use std::collections::HashMap; use std::sync::Arc; -use crate::util::debug::send_error; -use crate::util::utilities; +use crate::utils::debug::send_error; +use crate::utils::utilities; use crate::commands::moover::moove::{moove, moove_check}; diff --git a/src/other/notice.rs b/src/other/notice.rs index 69b39ed..9d75231 100644 --- a/src/other/notice.rs +++ b/src/other/notice.rs @@ -6,8 +6,8 @@ use serenity::{all::{GuildId, UserId}, builder::{CreateEmbed, CreateMessage}, cl use sqlx::{Connection, FromRow, SqliteConnection}; -use crate::util::debug::send_error; -use crate::util::utilities; +use crate::utils::debug::send_error; +use crate::utils::utilities; use std::{env, sync::Arc}; diff --git a/src/types.rs b/src/types.rs index 1103f1c..068d8e4 100644 --- a/src/types.rs +++ b/src/types.rs @@ -2,20 +2,15 @@ use std::{ffi::OsString, path::PathBuf}; -use serenity::prelude::TypeMapKey; - +use radiobrowser::RadioBrowserAPI; use reqwest::Client as HttpClient; // TODO: this should be probably expanded also to be used by multiple servers and commands // radio and spotify commands always create new HttpClient -pub struct HttpKey; - -impl TypeMapKey for HttpKey { - type Value = HttpClient; -} pub struct Data { pub http_client: HttpClient, + pub radio_browser: Option, } pub type Error = Box; diff --git a/src/util/mod.rs b/src/utils.rs similarity index 100% rename from src/util/mod.rs rename to src/utils.rs diff --git a/src/util/debug.rs b/src/utils/debug.rs similarity index 100% rename from src/util/debug.rs rename to src/utils/debug.rs diff --git a/src/util/embeds.rs b/src/utils/embeds.rs similarity index 100% rename from src/util/embeds.rs rename to src/utils/embeds.rs diff --git a/src/util/gifs.rs b/src/utils/gifs.rs similarity index 100% rename from src/util/gifs.rs rename to src/utils/gifs.rs diff --git a/src/util/poise_context_extension.rs b/src/utils/poise_context_extension.rs similarity index 100% rename from src/util/poise_context_extension.rs rename to src/utils/poise_context_extension.rs diff --git a/src/util/utilities.rs b/src/utils/utilities.rs similarity index 100% rename from src/util/utilities.rs rename to src/utils/utilities.rs