diff options
| -rw-r--r-- | Cargo.lock | 953 | ||||
| -rw-r--r-- | Cargo.toml | 10 | ||||
| -rw-r--r-- | src/api/guzzle.rs | 28 | ||||
| -rw-r--r-- | src/api/shiggy.rs | 27 | ||||
| -rw-r--r-- | src/commands/ask.rs | 40 | ||||
| -rw-r--r-- | src/commands/bing.rs | 8 | ||||
| -rw-r--r-- | src/commands/bottom.rs | 98 | ||||
| -rw-r--r-- | src/commands/convert.rs | 88 | ||||
| -rw-r--r-- | src/commands/copypasta.rs | 115 | ||||
| -rw-r--r-- | src/commands/mod.rs | 2 | ||||
| -rw-r--r-- | src/commands/random_lore.rs | 25 | ||||
| -rw-r--r-- | src/commands/random_shiggy.rs | 24 | ||||
| -rw-r--r-- | src/commands/random_teawie.rs | 24 | ||||
| -rw-r--r-- | src/commands/teawiespam.rs | 17 | ||||
| -rw-r--r-- | src/consts.rs | 5 | ||||
| -rw-r--r-- | src/handler/events.rs | 24 | ||||
| -rw-r--r-- | src/handler/mod.rs | 34 | ||||
| -rw-r--r-- | src/main.rs | 285 | ||||
| -rw-r--r-- | src/pinboard.rs | 10 | ||||
| -rw-r--r-- | src/utils.rs | 113 |
20 files changed, 927 insertions, 1003 deletions
@@ -4,9 +4,9 @@ version = 3 [[package]] name = "addr2line" -version = "0.20.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4fa78e18c64fce05e902adecd7a5eed15a5e0a3439f7b0e169f0252214865e3" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" dependencies = [ "gimli", ] @@ -18,6 +18,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] +name = "aho-corasick" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +dependencies = [ + "memchr", +] + +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + +[[package]] name = "android_system_properties" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -37,19 +52,19 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.70" +version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7de8ce5e0f9f8d88245311066a578d72b7af3e7088f32783804676302df237e4" +checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" [[package]] name = "async-trait" -version = "0.1.68" +version = "0.1.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842" +checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.39", ] [[package]] @@ -87,15 +102,15 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "backtrace" -version = "0.3.68" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4319208da049c43661739c5fade2ba182f09d1dc2299b32298d3a31692b17e12" +checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" dependencies = [ "addr2line", "cc", "cfg-if", "libc", - "miniz_oxide 0.7.1", + "miniz_oxide", "object", "rustc-demangle", ] @@ -108,9 +123,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.21.0" +version = "0.21.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" +checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" [[package]] name = "bitflags" @@ -119,6 +134,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] +name = "bitflags" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" + +[[package]] name = "block-buffer" version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -141,27 +162,30 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.12.0" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" +checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" [[package]] name = "byteorder" -version = "1.4.3" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" +checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" [[package]] name = "cc" -version = "1.0.79" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +dependencies = [ + "libc", +] [[package]] name = "cfg-if" @@ -171,15 +195,15 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.24" +version = "0.4.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e3c5919066adf22df73762e50cffcde3a758f2a848b113b586d1f86728b673b" +checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" dependencies = [ + "android-tzdata", "iana-time-zone", - "num-integer", "num-traits", "serde", - "winapi", + "windows-targets", ] [[package]] @@ -190,35 +214,14 @@ checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" dependencies = [ "ansi_term", "atty", - "bitflags", - "strsim", + "bitflags 1.3.2", + "strsim 0.8.0", "textwrap", "unicode-width", "vec_map", ] [[package]] -name = "codespan-reporting" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" -dependencies = [ - "termcolor", - "unicode-width", -] - -[[package]] -name = "command_attr" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07b787d19b9806dd4c9c34b2b4147d1a61d6120d93ee289521ab9b0294d198e4" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] name = "core-foundation" version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -236,9 +239,9 @@ checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" [[package]] name = "cpufeatures" -version = "0.2.6" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "280a9f2d8b3a38871a3c8a46fb80db65e5e5ed97da80c4d08bf27fb63e35e181" +checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" dependencies = [ "libc", ] @@ -263,57 +266,48 @@ dependencies = [ ] [[package]] -name = "cxx" -version = "1.0.94" +name = "darling" +version = "0.14.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f61f1b6389c3fe1c316bf8a4dccc90a38208354b330925bce1f74a6c4756eb93" +checksum = "7b750cb3417fd1b327431a470f388520309479ab0bf5e323505daf0290cd3850" dependencies = [ - "cc", - "cxxbridge-flags", - "cxxbridge-macro", - "link-cplusplus", + "darling_core", + "darling_macro", ] [[package]] -name = "cxx-build" -version = "1.0.94" +name = "darling_core" +version = "0.14.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12cee708e8962df2aeb38f594aae5d827c022b6460ac71a7a3e2c3c2aae5a07b" +checksum = "109c1ca6e6b7f82cc233a97004ea8ed7ca123a9af07a8230878fcfda9b158bf0" dependencies = [ - "cc", - "codespan-reporting", - "once_cell", + "fnv", + "ident_case", "proc-macro2", "quote", - "scratch", - "syn 2.0.28", + "strsim 0.10.0", + "syn 1.0.109", ] [[package]] -name = "cxxbridge-flags" -version = "1.0.94" +name = "darling_macro" +version = "0.14.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7944172ae7e4068c533afbb984114a56c46e9ccddda550499caa222902c7f7bb" - -[[package]] -name = "cxxbridge-macro" -version = "1.0.94" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2345488264226bf682893e25de0769f3360aac9957980ec49361b083ddaa5bc5" +checksum = "a4aab4dbc9f7611d8b55048a3a16d2d010c2c8334e46304b40ac1cc14bf3b48e" dependencies = [ - "proc-macro2", + "darling_core", "quote", - "syn 2.0.28", + "syn 1.0.109", ] [[package]] name = "dashmap" -version = "5.4.0" +version = "5.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "907076dfda823b0b36d2a1bb5f90c96660a5bbcd7729e10727f07858f22c4edc" +checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" dependencies = [ "cfg-if", - "hashbrown", + "hashbrown 0.14.2", "lock_api", "once_cell", "parking_lot_core", @@ -321,32 +315,82 @@ dependencies = [ ] [[package]] +name = "deranged" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f32d04922c60427da6f9fef14d042d9edddef64cb9d4ce0d64d0685fbeb1fd3" +dependencies = [ + "powerfmt", + "serde", +] + +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] name = "digest" -version = "0.10.6" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", "crypto-common", ] [[package]] +name = "dotenvy" +version = "0.15.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" + +[[package]] name = "encoding_rs" -version = "0.8.32" +version = "0.8.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" +checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" dependencies = [ "cfg-if", ] [[package]] +name = "env_logger" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95b3f3e67048839cb0d0781f445682a35113da7121f7c949db0e2be96a4fbece" +dependencies = [ + "humantime", + "is-terminal", + "log", + "regex", + "termcolor", +] + +[[package]] +name = "errno" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c18ee0ed65a5f1f81cac6b1d213b69c35fa47d4252ad41f1486dbd8226fe36e" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] name = "flate2" -version = "1.0.25" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8a2db397cb1c8772f31494cb8917e48cd1e64f0fa7efac59fbd741a0a8ce841" +checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" dependencies = [ "crc32fast", - "miniz_oxide 0.6.2", + "miniz_oxide", ] [[package]] @@ -357,18 +401,18 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "form_urlencoded" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" +checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" dependencies = [ "percent-encoding", ] [[package]] name = "futures" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" +checksum = "da0290714b38af9b4a7b094b8a37086d1b4e61f2df9122c3cad2577669145335" dependencies = [ "futures-channel", "futures-core", @@ -380,9 +424,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" +checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" dependencies = [ "futures-core", "futures-sink", @@ -390,44 +434,44 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" +checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" [[package]] name = "futures-io" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" +checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" [[package]] name = "futures-macro" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" +checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.39", ] [[package]] name = "futures-sink" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" +checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" [[package]] name = "futures-task" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" +checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" [[package]] name = "futures-util" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" dependencies = [ "futures-channel", "futures-core", @@ -464,9 +508,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.8" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" +checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" dependencies = [ "cfg-if", "libc", @@ -475,15 +519,15 @@ dependencies = [ [[package]] name = "gimli" -version = "0.27.3" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" +checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" [[package]] name = "h2" -version = "0.3.18" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17f8a914c2987b688368b5138aa05321db91f4090cf26118185672ad588bce21" +checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833" dependencies = [ "bytes", "fnv", @@ -505,6 +549,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] +name = "hashbrown" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" + +[[package]] name = "hermit-abi" version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -515,18 +565,15 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.2.6" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" -dependencies = [ - "libc", -] +checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" [[package]] name = "http" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" +checksum = "f95b9abcae896730d42b78e09c155ed4ddf82c07b4de772c64aee5b2d8b7c150" dependencies = [ "bytes", "fnv", @@ -552,15 +599,21 @@ checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" [[package]] name = "httpdate" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.25" +version = "0.14.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc5e554ff619822309ffd57d8734d77cd5ce6238bc956f037ea06c58238c9899" +checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" dependencies = [ "bytes", "futures-channel", @@ -573,7 +626,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2 0.4.9", + "socket2 0.4.10", "tokio", "tower-service", "tracing", @@ -582,46 +635,52 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.24.0" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0646026eb1b3eea4cd9ba47912ea5ce9cc07713d105b1a14698f4e6433d348b7" +checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" dependencies = [ + "futures-util", "http", "hyper", - "rustls 0.21.7", + "rustls 0.21.8", "tokio", - "tokio-rustls 0.24.0", + "tokio-rustls 0.24.1", ] [[package]] name = "iana-time-zone" -version = "0.1.56" +version = "0.1.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0722cd7114b7de04316e7ea5456a0bbb20e4adb46fd27a3697adb812cff0f37c" +checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "windows", + "windows-core", ] [[package]] name = "iana-time-zone-haiku" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" dependencies = [ - "cxx", - "cxx-build", + "cc", ] [[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] name = "idna" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" dependencies = [ "unicode-bidi", "unicode-normalization", @@ -653,56 +712,58 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ "autocfg", - "hashbrown", + "hashbrown 0.12.3", ] [[package]] name = "ipnet" -version = "2.7.2" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" + +[[package]] +name = "is-terminal" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12b6ee2129af8d4fb011108c73d99a1b83a85977f23b82460c0ae2e25bb4b57f" +checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" +dependencies = [ + "hermit-abi 0.3.3", + "rustix", + "windows-sys", +] [[package]] name = "itoa" -version = "1.0.6" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "js-sys" -version = "0.3.61" +version = "0.3.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730" +checksum = "54c0c35952f67de54bb584e9fd912b3023117cbafc0a77d8f3dee1fb5f572fe8" dependencies = [ "wasm-bindgen", ] [[package]] -name = "levenshtein" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db13adb97ab515a3691f56e4dbab09283d0b86cb45abd991d8634a9d6f501760" - -[[package]] name = "libc" -version = "0.2.147" +version = "0.2.150" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" +checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" [[package]] -name = "link-cplusplus" -version = "1.0.8" +name = "linux-raw-sys" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5" -dependencies = [ - "cc", -] +checksum = "969488b55f8ac402214f3f5fd243ebb7206cf82de60d3172994707a4bcc2b829" [[package]] name = "lock_api" -version = "0.4.9" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" dependencies = [ "autocfg", "scopeguard", @@ -710,18 +771,15 @@ dependencies = [ [[package]] name = "log" -version = "0.4.17" +version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if", -] +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "memchr" -version = "2.5.0" +version = "2.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" [[package]] name = "mime" @@ -741,15 +799,6 @@ dependencies = [ [[package]] name = "miniz_oxide" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" -dependencies = [ - "adler", -] - -[[package]] -name = "miniz_oxide" version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" @@ -759,50 +808,39 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.6" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" +checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0" dependencies = [ "libc", - "log", "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.45.0", -] - -[[package]] -name = "num-integer" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" -dependencies = [ - "autocfg", - "num-traits", + "windows-sys", ] [[package]] name = "num-traits" -version = "0.2.15" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" dependencies = [ "autocfg", ] [[package]] name = "num_cpus" -version = "1.15.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi 0.2.6", + "hermit-abi 0.3.3", "libc", ] [[package]] name = "object" -version = "0.31.1" +version = "0.32.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bda667d9f2b5051b8833f59f3bf748b28ef54f850f4fcb389a252aa383866d1" +checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" dependencies = [ "memchr", ] @@ -815,9 +853,9 @@ checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "ordered-float" -version = "2.10.0" +version = "2.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7940cf2ca942593318d07fcf2596cdca60a85c9e7fab408a5e21a4f9dcd40d87" +checksum = "68f19d67e5a2795c94e73e0bb1cc1a7edeb2e28efd39e2e1c9b7a40c1108b11c" dependencies = [ "num-traits", ] @@ -834,22 +872,22 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.7" +version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" +checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" dependencies = [ "cfg-if", "libc", "redox_syscall", "smallvec", - "windows-sys 0.45.0", + "windows-targets", ] [[package]] name = "percent-encoding" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" +checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "phf" @@ -891,9 +929,9 @@ dependencies = [ [[package]] name = "pin-project-lite" -version = "0.2.12" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12cc1b0bf1727a77a54b6654e7b5f1af8604923edc8b81885f8ec92f9e3f0a05" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" [[package]] name = "pin-utils" @@ -902,6 +940,43 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] +name = "poise" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d104e4b5847283b2fbd6a7ec19fb6a8af328e2145623d056b66d750a30073fdf" +dependencies = [ + "async-trait", + "derivative", + "futures-core", + "futures-util", + "log", + "once_cell", + "parking_lot", + "poise_macros", + "regex", + "serenity", + "tokio", +] + +[[package]] +name = "poise_macros" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fb516a8cf4e4ae4bd7ef5819d08c6ca408976461a9bea3ee3eec5138ac070c1" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] name = "ppv-lite86" version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -909,18 +984,18 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" -version = "1.0.63" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb" +checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.29" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "573015e8ab27661678357f27dc26460738fd2b6c86e46f386fde94cb5d913105" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] @@ -985,7 +1060,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.8", + "getrandom 0.2.11", ] [[package]] @@ -1008,20 +1083,49 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.2.16" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] +name = "regex" +version = "1.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" + +[[package]] name = "reqwest" version = "0.11.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b" dependencies = [ - "base64 0.21.0", + "base64 0.21.5", "bytes", "encoding_rs", "futures-core", @@ -1039,14 +1143,14 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", - "rustls 0.21.7", + "rustls 0.21.8", "rustls-pemfile", "serde", "serde_json", "serde_urlencoded", "system-configuration", "tokio", - "tokio-rustls 0.24.0", + "tokio-rustls 0.24.1", "tokio-util", "tower-service", "url", @@ -1067,87 +1171,114 @@ dependencies = [ "cc", "libc", "once_cell", - "spin", - "untrusted", + "spin 0.5.2", + "untrusted 0.7.1", "web-sys", "winapi", ] [[package]] +name = "ring" +version = "0.17.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb0205304757e5d899b9c2e448b867ffd03ae7f988002e47cd24954391394d0b" +dependencies = [ + "cc", + "getrandom 0.2.11", + "libc", + "spin 0.9.8", + "untrusted 0.9.0", + "windows-sys", +] + +[[package]] name = "rustc-demangle" version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] +name = "rustix" +version = "0.38.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b426b0506e5d50a7d8dafcf2e81471400deb602392c7dd110815afb4eaf02a3" +dependencies = [ + "bitflags 2.4.1", + "errno", + "libc", + "linux-raw-sys", + "windows-sys", +] + +[[package]] name = "rustls" -version = "0.20.8" +version = "0.20.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fff78fc74d175294f4e83b28343315ffcfb114b156f0185e9741cb5570f50e2f" +checksum = "1b80e3dec595989ea8510028f30c408a4630db12c9cbb8de34203b89d6577e99" dependencies = [ "log", - "ring", + "ring 0.16.20", "sct", "webpki", ] [[package]] name = "rustls" -version = "0.21.7" +version = "0.21.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd8d6c9f025a446bc4d18ad9632e69aec8f287aa84499ee335599fabd20c3fd8" +checksum = "446e14c5cda4f3f30fe71863c34ec70f5ac79d6087097ad0bb433e1be5edf04c" dependencies = [ "log", - "ring", + "ring 0.17.5", "rustls-webpki", "sct", ] [[package]] name = "rustls-pemfile" -version = "1.0.2" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d194b56d58803a43635bdc398cd17e383d6f71f9182b9a192c127ca42494a59b" +checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" dependencies = [ - "base64 0.21.0", + "base64 0.21.5", ] [[package]] name = "rustls-webpki" -version = "0.101.4" +version = "0.101.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d93931baf2d282fff8d3a532bbfd7653f734643161b87e3e01e59a04439bf0d" +checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" dependencies = [ - "ring", - "untrusted", + "ring 0.17.5", + "untrusted 0.9.0", ] [[package]] -name = "ryu" -version = "1.0.13" +name = "rustversion" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" [[package]] -name = "scopeguard" -version = "1.1.0" +name = "ryu" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" [[package]] -name = "scratch" -version = "1.0.5" +name = "scopeguard" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1792db035ce95be60c3f8853017b3999209281c24e2ba5bc8e59bf97a0c590c1" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "sct" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" +checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" dependencies = [ - "ring", - "untrusted", + "ring 0.17.5", + "untrusted 0.9.0", ] [[package]] @@ -1177,14 +1308,14 @@ checksum = "d6c7207fbec9faa48073f3e3074cbe553af6ea512d7c21ba46e434e70ea9fbc1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.39", ] [[package]] name = "serde_json" -version = "1.0.95" +version = "1.0.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d721eca97ac802aa7777b701877c8004d950fc142651367300d21c1cc0194744" +checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" dependencies = [ "itoa", "ryu", @@ -1211,31 +1342,28 @@ checksum = "7a7a89cef23483fc9d4caf2df41e6d3928e18aada84c56abd237439d929622c6" dependencies = [ "async-trait", "async-tungstenite", - "base64 0.21.0", - "bitflags", + "base64 0.21.5", + "bitflags 1.3.2", "bytes", "cfg-if", "chrono", - "command_attr", "dashmap", "flate2", "futures", - "levenshtein", "mime", "mime_guess", "parking_lot", "percent-encoding", "reqwest", + "rustversion", "serde", "serde-value", "serde_json", - "static_assertions", "time", "tokio", "tracing", "typemap_rev", "url", - "uwl", ] [[package]] @@ -1251,30 +1379,30 @@ dependencies = [ [[package]] name = "siphasher" -version = "0.3.10" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de" +checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" [[package]] name = "slab" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" dependencies = [ "autocfg", ] [[package]] name = "smallvec" -version = "1.10.0" +version = "1.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" +checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" [[package]] name = "socket2" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" +checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" dependencies = [ "libc", "winapi", @@ -1282,12 +1410,12 @@ dependencies = [ [[package]] name = "socket2" -version = "0.5.3" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2538b18701741680e0322a2302176d3253a35388e2e62f172f64f4f16605f877" +checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" dependencies = [ "libc", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -1297,10 +1425,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" [[package]] -name = "static_assertions" -version = "1.1.0" +name = "spin" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" [[package]] name = "strsim" @@ -1309,6 +1437,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + +[[package]] name = "syn" version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1321,9 +1455,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.28" +version = "2.0.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04361975b3f5e348b2189d8dc55bc942f278b2d482a6a0365de5bdd62d351567" +checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" dependencies = [ "proc-macro2", "quote", @@ -1336,7 +1470,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" dependencies = [ - "bitflags", + "bitflags 1.3.2", "core-foundation", "system-configuration-sys", ] @@ -1356,20 +1490,23 @@ name = "teawiebot" version = "0.1.0" dependencies = [ "bottomify", + "dotenvy", + "env_logger", "include_dir", + "log", "once_cell", + "poise", "rand 0.8.5", "reqwest", "serde", - "serenity", "tokio", ] [[package]] name = "termcolor" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" +checksum = "6093bad37da69aab9d123a8091e4be0aa4a03e4d601ec641c327398315f62b64" dependencies = [ "winapi-util", ] @@ -1385,31 +1522,33 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.40" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" +checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.40" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" +checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.39", ] [[package]] name = "time" -version = "0.3.20" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd0cbfecb4d19b5ea75bb31ad904eb5b9fa13f21079c3b92017ebdf4999a5890" +checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" dependencies = [ + "deranged", "itoa", + "powerfmt", "serde", "time-core", "time-macros", @@ -1417,15 +1556,15 @@ dependencies = [ [[package]] name = "time-core" -version = "0.1.0" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.8" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd80a657e71da814b8e5d60d3374fc6d35045062245d80224748ae522dd76f36" +checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" dependencies = [ "time-core", ] @@ -1447,9 +1586,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.33.0" +version = "1.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f38200e3ef7995e5ef13baec2f432a6da0aa9ac495b2c0e8f3b7eec2c92d653" +checksum = "d0c014766411e834f7af5b8f4cf46257aab4036ca95e9d2c144a10f59ad6f5b9" dependencies = [ "backtrace", "bytes", @@ -1457,20 +1596,20 @@ dependencies = [ "mio", "num_cpus", "pin-project-lite", - "socket2 0.5.3", + "socket2 0.5.5", "tokio-macros", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] name = "tokio-macros" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" +checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.39", ] [[package]] @@ -1479,26 +1618,26 @@ version = "0.23.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" dependencies = [ - "rustls 0.20.8", + "rustls 0.20.9", "tokio", "webpki", ] [[package]] name = "tokio-rustls" -version = "0.24.0" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0d409377ff5b1e3ca6437aa86c1eb7d40c134bfec254e44c830defa92669db5" +checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" dependencies = [ - "rustls 0.21.7", + "rustls 0.21.8", "tokio", ] [[package]] name = "tokio-util" -version = "0.7.7" +version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5427d89453009325de0d8f342c9490009f76e999cb7672d77e46267448f7e6b2" +checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" dependencies = [ "bytes", "futures-core", @@ -1516,11 +1655,10 @@ checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" [[package]] name = "tracing" -version = "0.1.37" +version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ - "cfg-if", "log", "pin-project-lite", "tracing-attributes", @@ -1529,20 +1667,20 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.23" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.39", ] [[package]] name = "tracing-core" -version = "0.1.30" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ "once_cell", ] @@ -1566,7 +1704,7 @@ dependencies = [ "httparse", "log", "rand 0.8.5", - "rustls 0.20.8", + "rustls 0.20.9", "sha-1", "thiserror", "url", @@ -1582,15 +1720,15 @@ checksum = "ed5b74f0a24b5454580a79abb6994393b09adf0ab8070f15827cb666255de155" [[package]] name = "typenum" -version = "1.16.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "unicase" -version = "2.6.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" +checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" dependencies = [ "version_check", ] @@ -1603,9 +1741,9 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-normalization" @@ -1618,9 +1756,9 @@ dependencies = [ [[package]] name = "unicode-width" -version = "0.1.10" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" +checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" [[package]] name = "untrusted" @@ -1629,10 +1767,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" [[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] name = "url" -version = "2.3.1" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" +checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" dependencies = [ "form_urlencoded", "idna", @@ -1647,12 +1791,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" [[package]] -name = "uwl" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4bf03e0ca70d626ecc4ba6b0763b934b6f2976e8c744088bb3c1d646fbb1ad0" - -[[package]] name = "vec_map" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1666,11 +1804,10 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "want" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" dependencies = [ - "log", "try-lock", ] @@ -1688,9 +1825,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.84" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b" +checksum = "7daec296f25a1bae309c0cd5c29c4b260e510e6d813c286b19eaadf409d40fce" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -1698,24 +1835,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.84" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9" +checksum = "e397f4664c0e4e428e8313a469aaa58310d302159845980fd23b0f22a847f217" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.39", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.34" +version = "0.4.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f219e0d211ba40266969f6dbdd90636da12f75bee4fc9d6c23d1260dadb51454" +checksum = "9afec9963e3d0994cac82455b2b3502b81a7f40f9a0d32181f7528d9f4b43e02" dependencies = [ "cfg-if", "js-sys", @@ -1725,9 +1862,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.84" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5" +checksum = "5961017b3b08ad5f3fe39f1e79877f8ee7c23c5e5fd5eb80de95abc41f1f16b2" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1735,22 +1872,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.84" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" +checksum = "c5353b8dab669f5e10f5bd76df26a9360c748f054f862ff5f3f8aae0c7fb3907" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.39", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.84" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" +checksum = "0d046c5d029ba91a1ed14da14dca44b68bf2f124cfbaf741c54151fdb3e0750b" [[package]] name = "wasm-streams" @@ -1767,9 +1904,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.61" +version = "0.3.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e33b99f4b23ba3eec1a53ac264e35a755f00e966e0065077d6027c0f575b0b97" +checksum = "5db499c5f66323272151db0e666cd34f78617522fb0c1604d31a27c50c206a85" dependencies = [ "js-sys", "wasm-bindgen", @@ -1777,12 +1914,12 @@ dependencies = [ [[package]] name = "webpki" -version = "0.22.2" +version = "0.22.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07ecc0cd7cac091bf682ec5efa18b1cff79d617b84181f38b3951dbe135f607f" +checksum = "ed63aea5ce73d0ff405984102c42de94fc55a6b75765d621c65262469b3c9b53" dependencies = [ - "ring", - "untrusted", + "ring 0.17.5", + "untrusted 0.9.0", ] [[package]] @@ -1818,9 +1955,9 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" dependencies = [ "winapi", ] @@ -1832,21 +1969,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] -name = "windows" -version = "0.48.0" +name = "windows-core" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" +checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" dependencies = [ - "windows-targets 0.48.0", -] - -[[package]] -name = "windows-sys" -version = "0.45.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" -dependencies = [ - "windows-targets 0.42.2", + "windows-targets", ] [[package]] @@ -1855,122 +1983,65 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets 0.48.0", -] - -[[package]] -name = "windows-targets" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" -dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", + "windows-targets", ] [[package]] name = "windows-targets" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ - "windows_aarch64_gnullvm 0.48.0", - "windows_aarch64_msvc 0.48.0", - "windows_i686_gnu 0.48.0", - "windows_i686_msvc 0.48.0", - "windows_x86_64_gnu 0.48.0", - "windows_x86_64_gnullvm 0.48.0", - "windows_x86_64_msvc 0.48.0", + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", ] [[package]] name = "windows_aarch64_gnullvm" -version = "0.42.2" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_i686_gnu" -version = "0.42.2" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" - -[[package]] -name = "windows_i686_gnu" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_msvc" -version = "0.42.2" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" - -[[package]] -name = "windows_i686_msvc" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_x86_64_gnu" -version = "0.42.2" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnullvm" -version = "0.42.2" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "winreg" @@ -1979,5 +2050,5 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" dependencies = [ "cfg-if", - "windows-sys 0.48.0", + "windows-sys", ] @@ -7,10 +7,16 @@ edition = "2021" [dependencies] bottomify = "1.2.0" +dotenvy = "0.15.7" +env_logger = "0.10.0" include_dir = "0.7.3" +log = "0.4.20" +poise = "0.5.7" once_cell = "1.18.0" rand = "0.8.5" -reqwest = { version = "0.11.22", default-features = false, features = ["rustls-tls", "json"] } +reqwest = { version = "0.11.22", default-features = false, features = [ + "rustls-tls", + "json", +] } serde = "1.0.192" -serenity = "0.11.7" tokio = { version = "1.33.0", features = ["macros", "rt-multi-thread"] } diff --git a/src/api/guzzle.rs b/src/api/guzzle.rs index a13243d..6d1e41b 100644 --- a/src/api/guzzle.rs +++ b/src/api/guzzle.rs @@ -1,4 +1,6 @@ use crate::api::REQWEST_CLIENT; +use crate::Error; + use reqwest::StatusCode; use serde::{Deserialize, Serialize}; @@ -9,22 +11,22 @@ struct GuzzleResponse { const GUZZLE: &str = "https://api.mydadleft.me"; -pub async fn get_random_teawie() -> String { - let endpoint = "get_random_teawie"; +pub async fn get_random_teawie() -> Result<String, Error> { + let endpoint = "/get_random_teawie"; + let req = REQWEST_CLIENT - .get(format!("{GUZZLE}/{endpoint}")) + .get(format!("{GUZZLE}{endpoint}")) .build() .unwrap(); - let resp = REQWEST_CLIENT.execute(req).await.unwrap(); // why did i have to own - // this constant? i have - // no idea! - let err_msg = "couldn't get a teawie"; - match resp.status() { - StatusCode::OK => match resp.json::<GuzzleResponse>().await { - Ok(data) => data.url, - Err(why) => format!("{} ({:?})", err_msg, why), - }, - other => format!("{} ({:?})", err_msg, other), + let resp = REQWEST_CLIENT.execute(req).await.unwrap(); + + if let StatusCode::OK = resp.status() { + match resp.json::<GuzzleResponse>().await { + Ok(data) => Ok(data.url), + Err(why) => Err(Box::new(why)), + } + } else { + Err(resp.status().to_string().into()) } } diff --git a/src/api/shiggy.rs b/src/api/shiggy.rs index 0e9fd19..97895d9 100644 --- a/src/api/shiggy.rs +++ b/src/api/shiggy.rs @@ -1,29 +1,26 @@ use crate::api::REQWEST_CLIENT; +use crate::Error; use reqwest::StatusCode; use serde::Deserialize; const URL: &str = "https://safebooru.donmai.us/posts/random.json?tags=kemomimi-chan_(naga_u)+naga_u&only=file_url"; -const ERROR_MSG: &str = "couldn't get a shiggy"; #[derive(Deserialize)] struct SafebooruResponse { file_url: String, } -pub async fn get_random_shiggy() -> String { - let resp = match REQWEST_CLIENT - .execute(REQWEST_CLIENT.get(URL).build().unwrap()) - .await - { - Ok(r) => r, - Err(e) => return format!("{} ({:?})", ERROR_MSG, e), - }; +pub async fn get_random_shiggy() -> Result<String, Error> { + let req = REQWEST_CLIENT.get(URL).build().unwrap(); - match resp.status() { - StatusCode::OK => match resp.json::<SafebooruResponse>().await { - Ok(sr) => sr.file_url, - Err(e) => format!("{} ({:?})", ERROR_MSG, e), - }, - other => format!("{} ({:?})", ERROR_MSG, other), + let resp = REQWEST_CLIENT.execute(req).await.unwrap(); + + if let StatusCode::OK = resp.status() { + match resp.json::<SafebooruResponse>().await { + Ok(data) => Ok(data.file_url), + Err(why) => Err(Box::new(why)), + } + } else { + Err(resp.status().to_string().into()) } } diff --git a/src/commands/ask.rs b/src/commands/ask.rs index b0b24f3..5075b9d 100644 --- a/src/commands/ask.rs +++ b/src/commands/ask.rs @@ -1,21 +1,23 @@ -use crate::utils; -use serenity::builder::CreateApplicationCommand; -use serenity::model::prelude::command::CommandOptionType; -use serenity::model::prelude::interaction::application_command::CommandDataOption; +use crate::consts; +use crate::utils::random_choice; +use crate::{Context, Error}; -pub fn run(_: &[CommandDataOption]) -> String { - utils::get_random_response() -} - -pub fn register(command: &mut CreateApplicationCommand) -> &mut CreateApplicationCommand { - command - .name("ask") - .description("ask lord teawie a question and they shall respond") - .create_option(|option| { - option - .name("question") - .description("the question you want to ask teawie") - .kind(CommandOptionType::String) - .required(true) - }) +/// ask teawie a question! +#[poise::command(prefix_command, slash_command)] +pub async fn ask( + ctx: Context<'_>, + #[description = "the question you want to ask teawie"] + #[rename = "question"] + _question: String, +) -> Result<(), Error> { + match random_choice(consts::RESPONSES) { + Ok(resp) => { + ctx.say(resp).await?; + Ok(()) + } + Err(why) => { + ctx.say("idk").await?; + Err(why) + } + } } diff --git a/src/commands/bing.rs b/src/commands/bing.rs new file mode 100644 index 0000000..ed91bb3 --- /dev/null +++ b/src/commands/bing.rs @@ -0,0 +1,8 @@ +use crate::{Context, Error}; + +/// make sure the wie is alive +#[poise::command(prefix_command)] +pub async fn bing(ctx: Context<'_>) -> Result<(), Error> { + ctx.say("bong!").await?; + Ok(()) +} diff --git a/src/commands/bottom.rs b/src/commands/bottom.rs index dbe74b9..d38c4b8 100644 --- a/src/commands/bottom.rs +++ b/src/commands/bottom.rs @@ -1,70 +1,42 @@ -use crate::utils::{bottom_decode, bottom_encode}; -use serenity::builder::CreateApplicationCommand; -use serenity::model::prelude::command::CommandOptionType; -use serenity::model::prelude::interaction::application_command::{ - CommandDataOption, CommandDataOptionValue, -}; +use crate::{Context, Error}; +use bottomify::bottom::{decode_string, encode_string}; -pub fn run(options: &[CommandDataOption]) -> String { - let err = "failed to get nested option in"; - - let data = options - .get(0) - .unwrap_or_else(|| panic!("{} {:?}", err, options)); +fn decode_sync(s: &str) -> Result<String, bottomify::bottom::TranslationError> { + decode_string(&s) +} - // get subcommand to decide whether to encode/decode - let subcommand = data.name.as_str(); +#[poise::command(slash_command, subcommands("encode", "decode"))] +pub async fn bottom(_ctx: Context<'_>) -> Result<(), Error> { + Ok(()) +} - // TODO: this is horrendous - // get message content - let option = data - .options - .get(0) - .unwrap_or_else(|| panic!("{} {:?}", err, data)) - .resolved - .as_ref() - .expect("failed to resolve string!"); // this is annoying +/// teawie will translate to bottom 🥺 +#[poise::command(slash_command)] +pub async fn encode( + ctx: Context<'_>, + #[description = "what teawie will translate into bottom"] message: String, +) -> Result<(), Error> { + let encoded = encode_string(&message); + ctx.say(encoded).await?; + Ok(()) +} - if let CommandDataOptionValue::String(msg) = option { - match subcommand { - "encode" => bottom_encode(msg), - "decode" => bottom_decode(msg), - _ => "something went wrong :(".to_owned(), +/// teawie will translate from bottom 🥸 +#[poise::command(slash_command)] +pub async fn decode( + ctx: Context<'_>, + #[description = "what teawie will translate from bottom"] message: String, +) -> Result<(), Error> { + let d = decode_sync(&message); + match d { + Ok(decoded) => { + ctx.say(decoded).await?; + Ok(()) + } + Err(why) => { + ctx.say("couldn't decode that for you, i'm sowwy!! :((".to_string()) + .await?; + Err(Box::new(why)) } - } else { - "did you forget to enter a message?".to_owned() } } - -pub fn register(command: &mut CreateApplicationCommand) -> &mut CreateApplicationCommand { - command - .name("bottom") - .description("teawie will translate something to/from bottom for you 🥺") - // nesting...so much nesting - .create_option(|option| { - option - .name("encode") - .description("teawie will encode a message in bottom for you 🥺") - .kind(CommandOptionType::SubCommand) - .create_sub_option(|suboption| { - suboption - .name("content") - .description("what teawie will translate into bottom") - .kind(CommandOptionType::String) - .required(true) - }) - }) - .create_option(|option| { - option - .name("decode") - .description("teawie will decode a message in bottom for you 🥸") - .kind(CommandOptionType::SubCommand) - .create_sub_option(|suboption| { - suboption - .name("content") - .description("what teawie will translate from bottom") - .kind(CommandOptionType::String) - .required(true) - }) - }) -} diff --git a/src/commands/convert.rs b/src/commands/convert.rs index 8f8c424..c7e09c9 100644 --- a/src/commands/convert.rs +++ b/src/commands/convert.rs @@ -1,70 +1,28 @@ -use crate::utils; -use serenity::builder::CreateApplicationCommand; -use serenity::model::prelude::command::CommandOptionType; -use serenity::model::prelude::interaction::application_command::{ - CommandDataOption, CommandDataOptionValue, -}; +use crate::{Context, Error}; -pub fn run(options: &[CommandDataOption]) -> String { - let err = "couldn't get convert subcommand!"; - let data = options - .get(0) - .unwrap_or_else(|| panic!("{} {:?}", err, options)); - let subcommand = data.name.as_str(); - // get message content - let option = data - .options - .get(0) - .unwrap_or_else(|| panic!("{} {:?}", err, data)) - .resolved - .as_ref() - .expect("failed to resolve string!"); - - let temp = if let &CommandDataOptionValue::Number(number) = option { - match subcommand { - "fahrenheit" => Some(utils::celsius_to_fahrenheit(number)), - "celsius" => Some(utils::fahrenheit_to_celsius(number)), - _ => None, - } - } else { - None - }; +#[poise::command(slash_command, subcommands("to_fahrenheit", "to_celsius"))] +pub async fn convert(_ctx: Context<'_>) -> Result<(), Error> { + Ok(()) +} - if let Some(temp) = temp { - format!("{temp:.2}") - } else { - "couldn't figure it out oops".to_owned() - } +/// ask teawie to convert °F to °C +#[poise::command(slash_command)] +pub async fn to_celsius( + ctx: Context<'_>, + #[description = "what teawie will convert"] degrees_fahrenheit: f32, +) -> Result<(), Error> { + let temp = (degrees_fahrenheit - 32.0) * (5.0 / 9.0); + ctx.say(temp.to_string()).await?; + Ok(()) } -pub fn register(command: &mut CreateApplicationCommand) -> &mut CreateApplicationCommand { - command - .name("convertto") - .description("ask teawie to convert something for you") - .create_option(|option| { - option - .name("fahrenheit") - .description("ask teawie to convert celsius to fahrenheit") - .kind(CommandOptionType::SubCommand) - .create_sub_option(|suboption| { - suboption - .name("degrees_celsius") - .description("what teawie will convert") - .kind(CommandOptionType::Number) - .required(true) - }) - }) - .create_option(|option| { - option - .name("celsius") - .description("ask teawie to convert fahrenheit to celsius") - .kind(CommandOptionType::SubCommand) - .create_sub_option(|suboption| { - suboption - .name("degrees_fahrenheit") - .description("what teawie will convert") - .kind(CommandOptionType::Number) - .required(true) - }) - }) +/// ask teawie to convert °C to °F +#[poise::command(slash_command)] +pub async fn to_fahrenheit( + ctx: Context<'_>, + #[description = "what teawie will convert"] degrees_celsius: f32, +) -> Result<(), Error> { + let temp = (degrees_celsius * (9.0 / 5.0)) + 32.0; + ctx.say(temp.to_string()).await?; + Ok(()) } diff --git a/src/commands/copypasta.rs b/src/commands/copypasta.rs index 670a5df..dcff558 100644 --- a/src/commands/copypasta.rs +++ b/src/commands/copypasta.rs @@ -1,64 +1,71 @@ use crate::utils; -use serenity::builder::CreateApplicationCommand; -use serenity::http::client::Http; -use serenity::model::id::ChannelId; -use serenity::model::prelude::command::CommandOptionType; -use serenity::model::prelude::interaction::application_command::{ - CommandDataOption, CommandDataOptionValue, -}; -use std::sync::Arc; +use crate::{Context, Error}; +use include_dir::{include_dir, Dir}; +use log::*; +use std::collections::HashMap; -pub async fn run(options: &[CommandDataOption], channel_id: ChannelId, http: &Arc<Http>) -> String { - let err_msg = "expected a copypasta"; - let option = options - .get(0) - .expect(err_msg) - .resolved - .as_ref() - .expect(err_msg); +const FILES: Dir = include_dir!("src/copypastas"); - if let CommandDataOptionValue::String(copypasta) = option { - let replies = utils::get_copypasta(copypasta); - - if replies.len() > 1 { - for reply in replies { - let resp = channel_id.send_message(&http, |m| m.content(reply)).await; +#[allow(clippy::upper_case_acronyms)] +#[derive(Debug, poise::ChoiceParameter)] +pub enum Copypastas { + Astral, + DVD, + Egrill, + HappyMeal, + //Ismah, + Sus, + TickTock, + Twitter, +} - match resp { - Ok(_) => continue, - Err(why) => { - println!("couldn't send message: {:?}", why); - return "something went wrong!".to_string(); - } - } - } - return "here's your copypasta:".to_string(); // yes this causes the - // application to not respond. - // no i don't care. +impl Copypastas { + fn as_str(&self) -> &str { + match self { + Copypastas::Astral => "astral", + Copypastas::DVD => "dvd", + Copypastas::Egrill => "egrill", + Copypastas::HappyMeal => "happymeal", + //Copypastas::Ismah => "ismah", + Copypastas::Sus => "sus", + Copypastas::TickTock => "ticktock", + Copypastas::Twitter => "twitter", } - return replies[0].to_string(); + } +} + +fn get_copypasta(name: Copypastas) -> String { + let mut files: HashMap<&str, &str> = HashMap::new(); + + for file in FILES.files() { + let name = file.path().file_stem().unwrap().to_str().unwrap(); + + let contents = file.contents_utf8().unwrap(); + + // refer to files by their name w/o extension + files.insert(name, contents); } - "couldn't find a copypasta".to_string() + if files.contains_key(name.as_str()) { + files[name.as_str()].to_string() + } else { + format!("i don't have a copypasta named {name} :(") + } } -pub fn register(command: &mut CreateApplicationCommand) -> &mut CreateApplicationCommand { - command - .name("copypasta") - .description("send funni copypasta") - .create_option(|option| { - option - .name("copypasta") - .description("the copypasta you want to send") - .kind(CommandOptionType::String) - .required(true) - .add_string_choice("astral", "astral") - .add_string_choice("dvd", "dvd") - .add_string_choice("egrill", "egrill") - .add_string_choice("happymeal", "happymeal") - .add_string_choice("ismah", "ismah") - .add_string_choice("sus", "sus") - .add_string_choice("ticktock", "ticktock") - .add_string_choice("twitter", "twitter") - }) +/// ask teawie to send funni copypasta +#[poise::command(slash_command)] +pub async fn copypasta( + ctx: Context<'_>, + #[description = "the copypasta you want to send"] copypasta: Copypastas, +) -> Result<(), Error> { + let gid = ctx.guild_id().unwrap_or_default(); + if !utils::is_guild_allowed(gid) { + info!("not running copypasta command in {gid}"); + return Ok(()); + } + + ctx.say(get_copypasta(copypasta)).await?; + + Ok(()) } diff --git a/src/commands/mod.rs b/src/commands/mod.rs index 1640707..fe536c1 100644 --- a/src/commands/mod.rs +++ b/src/commands/mod.rs @@ -1,7 +1,9 @@ pub mod ask; +pub mod bing; pub mod bottom; pub mod convert; pub mod copypasta; pub mod random_lore; pub mod random_shiggy; pub mod random_teawie; +pub mod teawiespam; diff --git a/src/commands/random_lore.rs b/src/commands/random_lore.rs index b07660e..875a35e 100644 --- a/src/commands/random_lore.rs +++ b/src/commands/random_lore.rs @@ -1,13 +1,16 @@ -use crate::utils::get_random_lore; -use serenity::builder::CreateApplicationCommand; -use serenity::model::prelude::interaction::application_command::CommandDataOption; +use crate::{consts, utils, Context, Error}; -pub fn run(_: &[CommandDataOption]) -> String { - get_random_lore() -} - -pub fn register(command: &mut CreateApplicationCommand) -> &mut CreateApplicationCommand { - command - .name("random_lore") - .description("get a random piece of teawie lore!") +/// get a random piece of teawie lore! +#[poise::command(prefix_command, slash_command)] +pub async fn random_lore(ctx: Context<'_>) -> Result<(), Error> { + match utils::random_choice(consts::LORE) { + Ok(resp) => { + ctx.say(resp).await?; + Ok(()) + } + Err(why) => { + ctx.say("i can't think of any right now :(").await?; + Err(why) + } + } } diff --git a/src/commands/random_shiggy.rs b/src/commands/random_shiggy.rs index c6aa6de..e509a71 100644 --- a/src/commands/random_shiggy.rs +++ b/src/commands/random_shiggy.rs @@ -1,13 +1,17 @@ use crate::api::shiggy::get_random_shiggy; -use serenity::builder::CreateApplicationCommand; -use serenity::model::prelude::application_command::CommandDataOption; +use crate::{Context, Error}; -pub async fn run(_: &[CommandDataOption]) -> String { - get_random_shiggy().await -} - -pub fn register(command: &mut CreateApplicationCommand) -> &mut CreateApplicationCommand { - command - .name("random_shiggy") - .description("get a random shiggy!") +/// get a random shiggy +#[poise::command(prefix_command, slash_command)] +pub async fn random_shiggy(ctx: Context<'_>) -> Result<(), Error> { + match get_random_shiggy().await { + Ok(resp) => { + ctx.say(resp).await?; + Ok(()) + } + Err(why) => { + ctx.say("i can't get a shiggy right now :(").await?; + Err(why) + } + } } diff --git a/src/commands/random_teawie.rs b/src/commands/random_teawie.rs index b3c433d..8dcc76b 100644 --- a/src/commands/random_teawie.rs +++ b/src/commands/random_teawie.rs @@ -1,13 +1,17 @@ use crate::api::guzzle::get_random_teawie; -use serenity::builder::CreateApplicationCommand; -use serenity::model::prelude::interaction::application_command::CommandDataOption; +use crate::{Context, Error}; -pub async fn run(_: &[CommandDataOption]) -> String { - get_random_teawie().await -} - -pub fn register(command: &mut CreateApplicationCommand) -> &mut CreateApplicationCommand { - command - .name("random_teawie") - .description("get a random teawie!") +/// get a random teawie +#[poise::command(prefix_command, slash_command)] +pub async fn random_teawie(ctx: Context<'_>) -> Result<(), Error> { + match get_random_teawie().await { + Ok(resp) => { + ctx.say(resp).await?; + Ok(()) + } + Err(why) => { + ctx.say("i'm too lazy to send a selfie").await?; + Err(why) + } + } } diff --git a/src/commands/teawiespam.rs b/src/commands/teawiespam.rs new file mode 100644 index 0000000..4964e90 --- /dev/null +++ b/src/commands/teawiespam.rs @@ -0,0 +1,17 @@ +use crate::utils; +use crate::{Context, Error}; +use log::*; + +/// teawie will spam you. +#[poise::command(slash_command, prefix_command)] +pub async fn teawiespam(ctx: Context<'_>) -> Result<(), Error> { + let gid = ctx.guild_id().unwrap_or_default(); + if !utils::is_guild_allowed(gid) { + info!("not running copypasta command in {gid}"); + return Ok(()); + } + + let wies = "<:teawiesmile:1056438046440042546>".repeat(50); + ctx.say(wies).await?; + Ok(()) +} diff --git a/src/consts.rs b/src/consts.rs index b108f34..27a70bc 100644 --- a/src/consts.rs +++ b/src/consts.rs @@ -1,3 +1,8 @@ +use poise::serenity_prelude::{GuildId, UserId}; + +pub const TEAWIE_GUILD: GuildId = GuildId(1055663552679137310); +pub const BOT: UserId = UserId(1056467120986271764); + pub const TEAMOJIS: [&str; 15] = [ "<:teawiecry:1056438041872433303>", "<:teawiederp:1056438043109757018>", diff --git a/src/handler/events.rs b/src/handler/events.rs new file mode 100644 index 0000000..d971b25 --- /dev/null +++ b/src/handler/events.rs @@ -0,0 +1,24 @@ +use crate::handler::Handler; +use log::*; +use poise::async_trait; +use poise::serenity_prelude::{ChannelPinsUpdateEvent, Context, EventHandler, Message}; + +#[async_trait] +impl EventHandler for Handler { + async fn message(&self, ctx: Context, msg: Message) { + if self.should_echo(&msg) { + let send = msg.reply(&ctx, &msg.content); + if let Err(why) = send.await { + error!("error when replying to {:?}: {:?}", msg.content, why); + } + } + } + + async fn channel_pins_update(&self, ctx: Context, pin: ChannelPinsUpdateEvent) { + let Some(pin_board) = &self.data.pin_board else { + return; + }; + + pin_board.handle_pin(&ctx, &pin).await; + } +} diff --git a/src/handler/mod.rs b/src/handler/mod.rs new file mode 100644 index 0000000..7f7c881 --- /dev/null +++ b/src/handler/mod.rs @@ -0,0 +1,34 @@ +use crate::utils; +use crate::{consts, Data}; +use log::*; + +use poise::serenity_prelude::Message; + +mod events; + +pub struct Handler { + data: Data, +} + +impl Handler { + pub fn new(data: Data) -> Self { + Self { data } + } + + fn should_echo(&self, msg: &Message) -> bool { + let gid = msg.guild_id.unwrap_or_default(); + if msg.author.id == self.data.bot || !utils::is_guild_allowed(gid) { + info!("not running copypasta command in {gid}"); + return false; + } + + let content = &msg.content; + + content == "🗿" + || consts::TEAMOJIS.contains(&content.as_str()) + || content.to_ascii_lowercase() == "moyai" + || content + .to_ascii_lowercase() + .contains("twitter's recommendation algorithm") + } +} diff --git a/src/main.rs b/src/main.rs index 51f0f3c..d4914e9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,232 +1,115 @@ -use once_cell::sync::Lazy; -use serenity::async_trait; -use serenity::framework::standard::macros::{command, group}; -use serenity::framework::standard::{CommandResult, StandardFramework}; -use serenity::model::application::command::Command; -use serenity::model::prelude::*; -use serenity::prelude::*; -use utils::parse_snowflake_from_env; +use std::time::Duration; +use std::{env, error}; +use crate::commands::*; +use crate::consts::*; use crate::pinboard::PinBoard; -use crate::utils::parse_snowflakes_from_env; +use log::*; +use poise::serenity_prelude as serentiy; +use poise::serenity_prelude::*; mod api; mod commands; mod consts; +mod handler; mod pinboard; mod utils; -const TEAWIE_GUILD: GuildId = GuildId(1055663552679137310); -const BOT: UserId = UserId(1056467120986271764); +type Error = Box<dyn error::Error + Send + Sync>; +type Context<'a> = poise::Context<'a, Data, Error>; -fn is_guild_allowed(gid: GuildId) -> bool { - // Had to be global state because Serenity doesn't allow you to store - // extra state in frameworks - static ALLOWED_GUILDS: Lazy<Vec<GuildId>> = Lazy::new(|| { - parse_snowflakes_from_env("ALLOWED_GUILDS", GuildId) - .unwrap_or_else(|| vec![TEAWIE_GUILD, GuildId(1091969030694375444)]) - }); - - ALLOWED_GUILDS.contains(&gid) +#[derive(Clone)] +pub struct Data { + bot: serentiy::UserId, + pin_board: Option<PinBoard>, } -#[group] -#[commands(bing, ask, random_lore, random_teawie, teawiespam)] -struct General; - -struct Handler { - bot: UserId, - pin_board: Option<PinBoard>, +impl Default for Data { + fn default() -> Self { + Self::new() + } } -impl Handler { +impl Data { pub fn new() -> Self { - let bot = parse_snowflake_from_env("BOT", UserId).unwrap_or(BOT); + let bot = utils::parse_snowflake_from_env("BOT", UserId).unwrap_or(consts::BOT); let pin_board = PinBoard::new(); Self { bot, pin_board } } - fn should_echo(&self, msg: &Message) -> bool { - // Don't echo to anything we posted ourselves, and don't echo at all unless on certain - // servers - if msg.author.id == self.bot || !is_guild_allowed(msg.guild_id.unwrap_or_default()) { - return false; - } - - let content = &msg.content; - - content == "🗿" - || consts::TEAMOJIS.contains(&content.as_str()) - || content.to_ascii_lowercase() == "moyai" - || content - .to_ascii_lowercase() - .contains("twitter's recommendation algorithm") - } } -#[async_trait] -impl EventHandler for Handler { - /* - * echo some messages when they're sent - */ - async fn message(&self, ctx: Context, msg: Message) { - if self.should_echo(&msg) { - let send = msg.reply(&ctx, &msg.content); - if let Err(why) = send.await { - println!("error when replying to {:?}: {:?}", msg.content, why); - } +async fn on_error(error: poise::FrameworkError<'_, Data, Error>) { + match error { + poise::FrameworkError::Setup { error, .. } => panic!("failed to start bot: {error:?}"), + poise::FrameworkError::Command { error, ctx } => { + error!("error in command {}: {:?}", ctx.command().name, error); } - } - - async fn channel_pins_update(&self, ctx: Context, pin: ChannelPinsUpdateEvent) { - let Some(pin_board) = &self.pin_board else { - return; - }; - - println!( - "audit log: {:#?}", - pin.guild_id - .unwrap() - .audit_logs( - &ctx.http, - Some(Action::Message(MessageAction::Pin).num()), - None, - None, - Some(1), - ) - .await - ); - pin_board.handle_pin(&ctx, &pin).await; - } - - async fn interaction_create(&self, ctx: Context, interaction: Interaction) { - if let Interaction::ApplicationCommand(command) = interaction { - println!("Received command interaction: {command:#?}"); - let content = match command.data.name.as_str() { - "ask" => commands::ask::run(&command.data.options), - "bottom" => commands::bottom::run(&command.data.options), - "convertto" => commands::convert::run(&command.data.options), - "copypasta" => { - commands::copypasta::run(&command.data.options, command.channel_id, &ctx.http) - .await - } - "random_lore" => commands::random_lore::run(&command.data.options), - "random_shiggy" => commands::random_shiggy::run(&command.data.options).await, - "random_teawie" => commands::random_teawie::run(&command.data.options).await, - _ => "not implemented :(".to_string(), - }; - - if let Err(why) = command - .create_interaction_response(&ctx.http, |response| { - response - .kind(InteractionResponseType::ChannelMessageWithSource) - .interaction_response_data(|message| message.content(content)) - }) - .await - { - println!("cannot respond to slash command: {why}"); + error => { + if let Err(e) = poise::builtins::on_error(error).await { + error!("error while handling an error: {}", e); } } } - - async fn ready(&self, ctx: Context, ready: Ready) { - println!("connected as {:?}", ready.user.name); - - let guild_commands = - GuildId::set_application_commands(&TEAWIE_GUILD, &ctx.http, |commands| { - commands.create_application_command(commands::copypasta::register) - }) - .await; - - println!("registered guild commands: {guild_commands:#?}"); - - let commands = Command::set_global_application_commands(&ctx.http, |commands| { - commands - .create_application_command(commands::ask::register) - .create_application_command(commands::bottom::register) - .create_application_command(commands::convert::register) - .create_application_command(commands::random_lore::register) - .create_application_command(commands::random_shiggy::register) - .create_application_command(commands::random_teawie::register) - }) - .await; - - println!("registered global commands: {commands:#?}"); - } } #[tokio::main] async fn main() { - let framework = StandardFramework::new() - .configure(|c| c.prefix("!")) - .group(&GENERAL_GROUP); - - let token = std::env::var("TOKEN").expect("couldn't find token in environment."); - - let intents = GatewayIntents::all(); - let handler = Handler::new(); - - let mut client = Client::builder(token, intents) - .event_handler(handler) - .framework(framework) - .await - .expect("error creating client"); - - if let Err(why) = client.start().await { - println!("an error occurred: {:?}", why); - } -} - -#[command] -async fn bing(ctx: &Context, msg: &Message) -> CommandResult { - msg.channel_id - .send_message(&ctx.http, |m| m.content("bong")) - .await?; - - Ok(()) -} - -#[command] -async fn ask(ctx: &Context, msg: &Message) -> CommandResult { - let resp = utils::get_random_response(); - msg.channel_id - .send_message(&ctx.http, |m| m.content(resp)) - .await?; - - Ok(()) -} - -#[command] -async fn random_lore(ctx: &Context, msg: &Message) -> CommandResult { - let resp = utils::get_random_lore(); - msg.channel_id - .send_message(&ctx.http, |m| m.content(resp)) - .await?; - - Ok(()) -} - -#[command] -async fn random_teawie(ctx: &Context, msg: &Message) -> CommandResult { - let resp = api::guzzle::get_random_teawie().await; - msg.channel_id - .send_message(&ctx.http, |m| m.content(resp)) - .await?; - - Ok(()) -} - -#[command] -async fn teawiespam(ctx: &Context, msg: &Message) -> CommandResult { - if !is_guild_allowed(msg.guild_id.unwrap_or_default()) { - return Ok(()); - } - - let resp = "<:teawiesmile:1056438046440042546>".repeat(50); - - msg.channel_id - .send_message(&ctx.http, |m| m.content(resp)) - .await?; + env_logger::init(); + dotenvy::dotenv().unwrap(); + + let guild_commands = vec![copypasta::copypasta(), teawiespam::teawiespam()]; + + let options = poise::FrameworkOptions { + commands: vec![ + ask::ask(), + bing::bing(), + bottom::bottom(), + convert::convert(), + random_lore::random_lore(), + random_shiggy::random_shiggy(), + random_teawie::random_teawie(), + copypasta::copypasta(), + teawiespam::teawiespam(), + ], + event_handler: |ctx, event, _, data| { + Box::pin(async move { + // yes this is dumb. no i don't care. + let handler = handler::Handler::new(data.clone()); + event.clone().dispatch(ctx.clone(), &handler).await; + Ok(()) + }) + }, + prefix_options: poise::PrefixFrameworkOptions { + prefix: Some("!".into()), + edit_tracker: Some(poise::EditTracker::for_timespan(Duration::from_secs(3600))), + ..Default::default() + }, + on_error: |error| Box::pin(on_error(error)), + command_check: Some(|ctx| { + Box::pin(async move { + Ok(ctx.author().id != ctx.framework().bot_id && ctx.author().id != consts::BOT) + }) + }), + ..Default::default() + }; + + let framework = poise::Framework::builder() + .options(options) + .token(env::var("TOKEN").expect("couldn't find token in environment.")) + .intents(serentiy::GatewayIntents::all()) + .setup(|ctx, _ready, framework| { + Box::pin(async move { + info!("logged in as {}", _ready.user.name); + + poise::builtins::register_globally(ctx, &framework.options().commands).await?; + info!("registered global commands!"); + poise::builtins::register_in_guild(ctx, &guild_commands, TEAWIE_GUILD).await?; + info!("registered guild commands!"); + + Ok(Data::new()) + }) + }); - Ok(()) + framework.run().await.unwrap() } diff --git a/src/pinboard.rs b/src/pinboard.rs index 8f01bff..56f53b4 100644 --- a/src/pinboard.rs +++ b/src/pinboard.rs @@ -1,7 +1,9 @@ use crate::utils::{floor_char_boundary, parse_snowflake_from_env, parse_snowflakes_from_env}; -use serenity::model::prelude::*; -use serenity::prelude::Context; +use log::*; +use poise::serenity_prelude::model::prelude::*; +use poise::serenity_prelude::Context; +#[derive(Clone)] pub struct PinBoard { sources: Option<Vec<ChannelId>>, target: ChannelId, @@ -19,7 +21,8 @@ impl PinBoard { pub async fn handle_pin(&self, ctx: &Context, pin: &ChannelPinsUpdateEvent) { if let Some(sources) = &self.sources { if !sources.contains(&pin.channel_id) { - return; // Not on the list of permitted sources + warn!("can't access source of pin!"); + return; } } @@ -104,6 +107,7 @@ async fn guess_pinner(ctx: &Context, pin: &ChannelPinsUpdateEvent) -> Option<Use .map(|first| first.user_id) } else { // TODO: mayyyyybe we can guess who pinned something in a DM...? + warn!("couldn't figure out who pinned in {}!", pin.channel_id); None } } diff --git a/src/utils.rs b/src/utils.rs index c2a2031..8773b14 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -1,11 +1,9 @@ -use crate::consts::{LORE, RESPONSES}; -use bottomify::bottom::{decode_string, encode_string}; -use include_dir::{include_dir, Dir}; -use rand::seq::SliceRandom; -use std::collections::HashMap; -use std::vec; +use crate::consts::*; +use crate::Error; -const FILES: Dir = include_dir!("src/copypastas"); +use once_cell::sync::Lazy; +use poise::serenity_prelude::GuildId; +use rand::seq::SliceRandom; pub fn parse_snowflake_from_env<T, F: Fn(u64) -> T>(key: &str, f: F) -> Option<T> { std::env::var(key).ok().and_then(|v| v.parse().map(&f).ok()) @@ -21,23 +19,13 @@ pub fn parse_snowflakes_from_env<T, F: Fn(u64) -> T>(key: &str, f: F) -> Option< /* * chooses a random element from an array */ -fn random_choice<const N: usize>(arr: [&str; N]) -> String { +pub fn random_choice<const N: usize>(arr: [&str; N]) -> Result<String, Error> { let mut rng = rand::thread_rng(); - let resp = arr.choose(&mut rng).expect("couldn't choose random value!"); - (*resp).to_string() -} - -/* - * pub functions to get random elements - * from our consts - */ - -pub fn get_random_response() -> String { - random_choice(RESPONSES) -} - -pub fn get_random_lore() -> String { - random_choice(LORE) + if let Some(resp) = arr.choose(&mut rng) { + Ok((*resp).to_string()) + } else { + Err(Into::into("couldn't choose from arr!")) + } } // waiting for `round_char_boundary` to stabilize @@ -54,79 +42,12 @@ pub fn floor_char_boundary(s: &str, index: usize) -> usize { lower_bound + new_index.unwrap() } } -// waiting for `int_roundings` to stabilize -fn div_ceil(a: usize, b: usize) -> usize { - (a + b - 1) / b -} - -/* - * splits a message into multiple parts so that - * it can fit discord's character limit - */ -fn split_msg(mut msg: String) -> Vec<String> { - const CHAR_LIMIT: usize = 2000; - let mut msgs = Vec::with_capacity(div_ceil(msg.len(), CHAR_LIMIT)); - - while msg.len() > CHAR_LIMIT { - msgs.push(msg.split_off(floor_char_boundary(&msg, CHAR_LIMIT))); - } - msgs -} - -/* - * gets a random copypasta from include/ - */ -pub fn get_copypasta(name: &str) -> Vec<String> { - let mut files: HashMap<&str, &str> = HashMap::new(); - - for file in FILES.files() { - let name = file.path().file_stem().unwrap().to_str().unwrap(); - let contents = file.contents_utf8().unwrap(); +pub fn is_guild_allowed(gid: GuildId) -> bool { + static ALLOWED_GUILDS: Lazy<Vec<GuildId>> = Lazy::new(|| { + parse_snowflakes_from_env("ALLOWED_GUILDS", GuildId) + .unwrap_or_else(|| vec![TEAWIE_GUILD, GuildId(1091969030694375444)]) + }); - // refer to files by their name w/o extension - files.insert(name, contents); - } - - if files.contains_key(&name) { - let reply = files[name].to_string(); - split_msg(reply) - } else { - vec![format!("couldn't find {name:?} in files")] - } -} - -/* - * encodes a message into bottom - */ -pub fn bottom_encode(msg: &str) -> String { - encode_string(&msg) -} - -/* - * decodes a bottom string into english - */ -pub fn bottom_decode(msg: &str) -> String { - let decoded = decode_string(&msg); - match decoded { - Ok(ret) => ret, - Err(why) => { - println!("couldn't decode {msg:?}! ({why:?})"); - "couldn't decode that! sowwy 🥺".to_string() - } - } -} - -/* - * converts celsius to fahrenheit - */ -pub fn celsius_to_fahrenheit(c: f64) -> f64 { - (c * (9.0 / 5.0)) + 32.0 -} - -/* - * converts fahrenheit to celsius - */ -pub fn fahrenheit_to_celsius(f: f64) -> f64 { - (f - 32.0) * (5.0 / 9.0) + ALLOWED_GUILDS.contains(&gid) } |
