diff --git a/Cargo.lock b/Cargo.lock index a713e1b..c05f2fb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -64,7 +64,7 @@ checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.87", ] [[package]] @@ -108,9 +108,9 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "bb8" -version = "0.8.5" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b10cf871f3ff2ce56432fddc2615ac7acc3aa22ca321f8fea800846fbb32f188" +checksum = "d89aabfae550a5c44b43ab941844ffcd2e993cb6900b342debf59e9ea74acdb8" dependencies = [ "async-trait", "futures-util", @@ -170,9 +170,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.7.2" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3" +checksum = "9ac0150caa2ae65ca5bd83f25c7de183dea78d4d366469f148435e2acfbad0da" [[package]] name = "camino" @@ -217,9 +217,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.28" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e80e3b6a3ab07840e1cae9b0666a63970dc28e8ed5ffbcdacbfc760c281bfc1" +checksum = "fd9de9f2205d5ef3fd67e685b0df337994ddd4495e2a28d185500d0e1edfea47" dependencies = [ "shlex", ] @@ -238,8 +238,10 @@ checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" dependencies = [ "android-tzdata", "iana-time-zone", + "js-sys", "num-traits", "serde", + "wasm-bindgen", "windows-targets 0.52.6", ] @@ -275,9 +277,9 @@ checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "cpufeatures" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" +checksum = "0ca741a962e1b0bff6d724a1a0958b686406e853bb14061f218562e1896f95e6" dependencies = [ "libc", ] @@ -356,7 +358,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.79", + "syn 2.0.87", ] [[package]] @@ -367,7 +369,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core", "quote", - "syn 2.0.79", + "syn 2.0.87", ] [[package]] @@ -421,6 +423,17 @@ dependencies = [ "crypto-common", ] +[[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 = "either" version = "1.13.0" @@ -429,9 +442,9 @@ checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" [[package]] name = "encoding_rs" -version = "0.8.34" +version = "0.8.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" +checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" dependencies = [ "cfg-if", ] @@ -445,7 +458,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.87", ] [[package]] @@ -475,15 +488,15 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.1.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" +checksum = "486f806e73c5707928240ddc295403b1b93c96a02038563881c4a2fd84b81ac4" [[package]] name = "feed-rs" -version = "2.1.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6511d29ecf291f32688d546c33d8e62bbebd4fe60ef40b52b20e3f3a0ec6eb56" +checksum = "d57df0b823b3055c667ddde499736e0d8d7d486b269454eebd96a0fdd59ce051" dependencies = [ "chrono", "mediatype", @@ -498,9 +511,9 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.34" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1b589b4dc103969ad3cf85c950899926ec64300a1a46d76c03a6072957036f0" +checksum = "c936bfdafb507ebbf50b8074c54fa31c5be9a1e7e5f467dd659697041407d07c" dependencies = [ "crc32fast", "miniz_oxide", @@ -580,7 +593,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.87", ] [[package]] @@ -701,9 +714,9 @@ checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" [[package]] name = "hashbrown" -version = "0.15.0" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" +checksum = "3a9bfc1af68b1726ea47d3d5109de126281def866b33970e10fbab11b5dafab3" [[package]] name = "heck" @@ -798,9 +811,9 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "hyper" -version = "0.14.30" +version = "0.14.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a152ddd61dfaec7273fe8419ab357f33aee0d914c5f4efbf0d96fa749eea5ec9" +checksum = "8c08302e8fa335b151b788c775ff56e7a03ae64ff85c548ee820fecb70356e85" dependencies = [ "bytes", "futures-channel", @@ -822,9 +835,9 @@ dependencies = [ [[package]] name = "hyper" -version = "1.4.1" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05" +checksum = "bbbff0a806a4728c99295b254c8838933b5b082d75e3cb70c8dab21fdfbcfa9a" dependencies = [ "bytes", "futures-channel", @@ -848,7 +861,7 @@ checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" dependencies = [ "futures-util", "http 0.2.12", - "hyper 0.14.30", + "hyper 0.14.31", "rustls 0.21.12", "tokio", "tokio-rustls 0.24.1", @@ -862,9 +875,9 @@ checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333" dependencies = [ "futures-util", "http 1.1.0", - "hyper 1.4.1", + "hyper 1.5.0", "hyper-util", - "rustls 0.23.14", + "rustls 0.23.17", "rustls-pki-types", "tokio", "tokio-rustls 0.26.0", @@ -879,7 +892,7 @@ checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" dependencies = [ "bytes", "http-body-util", - "hyper 1.4.1", + "hyper 1.5.0", "hyper-util", "native-tls", "tokio", @@ -889,16 +902,16 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.9" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41296eb09f183ac68eec06e03cdbea2e759633d4067b2f6552fc2e009bcad08b" +checksum = "df2dcfbe0677734ab2f3ffa7fa7bfd4706bfdc1ef393f2ee30184aed67e631b4" dependencies = [ "bytes", "futures-channel", "futures-util", "http 1.1.0", "http-body 1.0.1", - "hyper 1.4.1", + "hyper 1.5.0", "pin-project-lite", "socket2", "tokio", @@ -929,6 +942,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" @@ -947,12 +1078,23 @@ dependencies = [ [[package]] name = "idna" -version = "0.5.0" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" dependencies = [ - "unicode-bidi", - "unicode-normalization", + "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]] @@ -962,7 +1104,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" dependencies = [ "equivalent", - "hashbrown 0.15.0", + "hashbrown 0.15.1", ] [[package]] @@ -991,16 +1133,16 @@ checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "js-sys" -version = "0.3.71" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cb94a0ffd3f3ee755c20f7d8752f45cac88605a4dcf808abcff72873296ec7b" +checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" dependencies = [ "wasm-bindgen", ] [[package]] name = "kon" -version = "0.4.1" +version = "0.5.0" dependencies = [ "bb8", "bb8-redis", @@ -1009,7 +1151,7 @@ dependencies = [ "once_cell", "poise", "regex", - "reqwest 0.12.8", + "reqwest 0.12.9", "serde", "serde_json", "sysinfo", @@ -1020,9 +1162,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.159" +version = "0.2.164" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" +checksum = "433bfe06b8c75da9b2e3fbea6e5329ff87748f0b144ef75306e674c3f6f7c13f" [[package]] name = "linked-hash-map" @@ -1036,6 +1178,12 @@ version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +[[package]] +name = "litemap" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "643cb0b8d4fcc284004d5fd0d67ccf61dfffadb7f75e1e71bc420f4688a3a704" + [[package]] name = "lock_api" version = "0.4.12" @@ -1072,6 +1220,9 @@ name = "mediatype" version = "0.19.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8878cd8d1b3c8c8ae4b2ba0a36652b7cf192f618a599a7fbdfa25cffd4ea72dd" +dependencies = [ + "serde", +] [[package]] name = "memchr" @@ -1208,9 +1359,9 @@ checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" [[package]] name = "openssl" -version = "0.10.66" +version = "0.10.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9529f4786b70a3e8c61e11179af17ab6188ad8d0ded78c5529441ed39d4bd9c1" +checksum = "6174bc48f102d208783c2c84bf931bb75927a617866870de8a4ea85597f871f5" dependencies = [ "bitflags 2.6.0", "cfg-if", @@ -1229,7 +1380,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.87", ] [[package]] @@ -1240,18 +1391,18 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-src" -version = "300.3.2+3.3.2" +version = "300.4.1+3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a211a18d945ef7e648cc6e0058f4c548ee46aab922ea203e0d30e966ea23647b" +checksum = "faa4eac4138c62414b5622d1b31c5c304f34b406b013c079c2bbc652fdd6678c" dependencies = [ "cc", ] [[package]] name = "openssl-sys" -version = "0.9.103" +version = "0.9.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f9e8deee91df40a943c71b917e5874b951d32a802526c85721ce3b776c929d6" +checksum = "45abf306cbf99debc8195b66b7346498d7b10c210de50418b5ccd7ceba08c741" dependencies = [ "cc", "libc", @@ -1291,9 +1442,9 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pin-project-lite" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" +checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" [[package]] name = "pin-utils" @@ -1310,30 +1461,30 @@ checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" [[package]] name = "poise" version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1819d5a45e3590ef33754abce46432570c54a120798bdbf893112b4211fa09a6" +source = "git+https://github.com/serenity-rs/poise?branch=next#3feba0cb3b305aecae3ca47abe048b986813c8e4" dependencies = [ "async-trait", "derivative", "futures-util", + "indexmap", "parking_lot", "poise_macros", "regex", "serenity", "tokio", "tracing", + "trim-in-place", ] [[package]] name = "poise_macros" version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fa2c123c961e78315cd3deac7663177f12be4460f5440dbf62a7ed37b1effea" +source = "git+https://github.com/serenity-rs/poise?branch=next#3feba0cb3b305aecae3ca47abe048b986813c8e4" dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.87", ] [[package]] @@ -1353,9 +1504,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.87" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3e4daa0dcf6feba26f985457cdf104d4b4256fc5a09547140f3631bb076b19a" +checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" dependencies = [ "unicode-ident", ] @@ -1379,9 +1530,9 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quick-xml" -version = "0.36.2" +version = "0.37.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7649a7b4df05aed9ea7ec6f628c67c9953a43869b8bc50929569b2999d443fe" +checksum = "f22f29bdff3987b4d8632ef95fd6424ec7e4e0a57e2f4fc63e489e75357f6a03" dependencies = [ "encoding_rs", "memchr", @@ -1448,9 +1599,9 @@ dependencies = [ [[package]] name = "redis" -version = "0.27.4" +version = "0.27.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc6baebe319ef5e4b470f248335620098d1c2e9261e995be05f56f719ca4bdb2" +checksum = "81cccf17a692ce51b86564334614d72dcae1def0fd5ecebc9f02956da74352b5" dependencies = [ "arc-swap", "async-trait", @@ -1478,9 +1629,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.11.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38200e5ee88914975b69f657f0801b6f6dccafd44fd9326302a4aaeecfacb1d8" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ "aho-corasick", "memchr", @@ -1490,9 +1641,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" dependencies = [ "aho-corasick", "memchr", @@ -1519,7 +1670,7 @@ dependencies = [ "h2 0.3.26", "http 0.2.12", "http-body 0.4.6", - "hyper 0.14.30", + "hyper 0.14.31", "hyper-rustls 0.24.2", "ipnet", "js-sys", @@ -1551,9 +1702,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.12.8" +version = "0.12.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f713147fbe92361e52392c73b8c9e48c04c6625bce969ef54dc901e58e042a7b" +checksum = "a77c62af46e79de0a562e1a9849205ffcb7fc1238876e9bd743357570e04046f" dependencies = [ "base64 0.22.1", "bytes", @@ -1564,7 +1715,7 @@ dependencies = [ "http 1.1.0", "http-body 1.0.1", "http-body-util", - "hyper 1.4.1", + "hyper 1.5.0", "hyper-rustls 0.27.3", "hyper-tls", "hyper-util", @@ -1625,9 +1776,9 @@ checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" [[package]] name = "rustix" -version = "0.38.37" +version = "0.38.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811" +checksum = "d7f649912bc1495e167a6edee79151c84b1bad49748cb4f1f1167f459f6224f6" dependencies = [ "bitflags 2.6.0", "errno", @@ -1664,9 +1815,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.14" +version = "0.23.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "415d9944693cb90382053259f89fbb077ea730ad7273047ec63b19bc9b160ba8" +checksum = "7f1a745511c54ba6d4465e8d5dfbd81b45791756de28d4981af70d6dca128f1e" dependencies = [ "once_cell", "rustls-pki-types", @@ -1695,9 +1846,9 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e696e35370c65c9c541198af4543ccd580cf17fc25d8e05c5a242b202488c55" +checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b" [[package]] name = "rustls-webpki" @@ -1737,9 +1888,9 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.26" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01227be5826fa0690321a2ba6c5cd57a19cf3f6a09e76973b58e61de6ab9d1c1" +checksum = "1f29ebaa345f945cec9fbbc532eb307f0fdad8161f281b6369539c8d84876b3d" dependencies = [ "windows-sys 0.59.0", ] @@ -1785,9 +1936,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.12.0" +version = "2.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea4a292869320c0272d7bc55a5a6aafaff59b4f63404a003887b679a2e05b4b6" +checksum = "fa39c7303dc58b5543c94d22c1766b0d31f2ee58306363ea622b10bbc075eaa2" dependencies = [ "core-foundation-sys", "libc", @@ -1804,9 +1955,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.210" +version = "1.0.215" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" +checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f" dependencies = [ "serde_derive", ] @@ -1822,20 +1973,20 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.210" +version = "1.0.215" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" +checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.87", ] [[package]] name = "serde_json" -version = "1.0.128" +version = "1.0.133" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" +checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377" dependencies = [ "itoa", "memchr", @@ -1866,9 +2017,9 @@ dependencies = [ [[package]] name = "serenity" -version = "0.12.2" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "880a04106592d0a8f5bdacb1d935889bfbccb4a14f7074984d9cd857235d34ac" +checksum = "3d72ec4323681bf9a3cabe40fd080abc2435859b502a1b5aa9bf693f125bfa76" dependencies = [ "arrayvec", "async-trait", @@ -1975,6 +2126,12 @@ version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + [[package]] name = "strsim" version = "0.11.1" @@ -2000,9 +2157,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.79" +version = "2.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" +checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" dependencies = [ "proc-macro2", "quote", @@ -2024,6 +2181,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 = "sysinfo" version = "0.32.0" @@ -2088,9 +2256,9 @@ checksum = "7b2093cf4c8eb1e67749a6762251bc9cd836b6fc171623bd0a9d324d37af2417" [[package]] name = "tempfile" -version = "3.13.0" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b" +checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c" dependencies = [ "cfg-if", "fastrand", @@ -2101,22 +2269,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.64" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.64" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.87", ] [[package]] @@ -2150,6 +2318,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" @@ -2167,11 +2345,11 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokenservice-client" -version = "0.4.0" +version = "0.4.1" source = "sparse+https://git.toast-server.net/api/packages/toast/cargo/" -checksum = "69fb4574f5ff7b98c91c98d3a8be2eb4c55a895c44f0682aa269c67b5922bbf8" +checksum = "cf11991da505b67c1a8201aa2d4746eefe338d34ce8d985c93474672d900c5cd" dependencies = [ - "reqwest 0.12.8", + "reqwest 0.12.9", "serde", "serde_json", "tokio", @@ -2180,9 +2358,9 @@ dependencies = [ [[package]] name = "tokio" -version = "1.40.0" +version = "1.41.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998" +checksum = "22cfb5bee7a6a52939ca9224d6ac897bb669134078daa8735560897f69de4d33" dependencies = [ "backtrace", "bytes", @@ -2204,7 +2382,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.87", ] [[package]] @@ -2244,7 +2422,7 @@ version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" dependencies = [ - "rustls 0.23.14", + "rustls 0.23.17", "rustls-pki-types", "tokio", ] @@ -2338,7 +2516,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.87", ] [[package]] @@ -2350,6 +2528,12 @@ dependencies = [ "once_cell", ] +[[package]] +name = "trim-in-place" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "343e926fc669bc8cde4fa3129ab681c63671bae288b1f1081ceee6d9d37904fc" + [[package]] name = "triomphe" version = "0.1.14" @@ -2443,9 +2627,9 @@ checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "typesize" -version = "0.1.9" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dece5c06268af6a9ff4541788601e560a4284ffebfb357f713d676f13b964db" +checksum = "549e54551d85ba6718a95333d9bc4367f69793d7aba638de30f8d25a1f554a1d" dependencies = [ "chrono", "dashmap", @@ -2461,23 +2645,20 @@ dependencies = [ [[package]] name = "typesize-derive" -version = "0.1.7" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "905e88c2a4cc27686bd57e495121d451f027e441388a67f773be729ad4be1ea8" +checksum = "fd9fc0ad9e03a2b0c2e2a0eafaecccef2121829e1ab6ce9c9d790e6c6766bd1c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.87", ] [[package]] name = "unicase" -version = "2.7.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" -dependencies = [ - "version_check", -] +checksum = "7e51b68083f157f853b6379db119d1c1be0e6e4dec98101079dec41f6f5cf6df" [[package]] name = "unicode-bidi" @@ -2519,12 +2700,12 @@ dependencies = [ [[package]] name = "url" -version = "2.5.2" +version = "2.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" +checksum = "8d157f1b96d14500ffdc1f10ba712e780825526c03d9a49b4d0324b0d9113ada" dependencies = [ "form_urlencoded", - "idna 0.5.0", + "idna 1.0.3", "percent-encoding", "serde", ] @@ -2536,10 +2717,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" [[package]] -name = "uuid" -version = "1.10.0" +name = "utf16_iter" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314" +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.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a" dependencies = [ "getrandom", ] @@ -2583,9 +2776,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.94" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef073ced962d62984fb38a36e5fdc1a2b23c9e0e1fa0689bb97afa4202ef6887" +checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" dependencies = [ "cfg-if", "once_cell", @@ -2594,24 +2787,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.94" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4bfab14ef75323f4eb75fa52ee0a3fb59611977fd3240da19b2cf36ff85030e" +checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.87", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.44" +version = "0.4.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65471f79c1022ffa5291d33520cbbb53b7687b01c2f8e83b57d102eed7ed479d" +checksum = "cc7ec4f8827a71586374db3e87abdb5a2bb3a15afed140221307c3ec06b1f63b" dependencies = [ "cfg-if", "js-sys", @@ -2621,9 +2814,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.94" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7bec9830f60924d9ceb3ef99d55c155be8afa76954edffbb5936ff4509474e7" +checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2631,28 +2824,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.94" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c74f6e152a76a2ad448e223b0fc0b6b5747649c3d769cc6bf45737bf97d0ed6" +checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.87", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.94" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a42f6c679374623f295a8623adfe63d9284091245c3504bde47c17a3ce2777d9" +checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" [[package]] name = "wasm-streams" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e072d4e72f700fb3443d8fe94a39315df013eef1104903cdb0a2abd322bbecd" +checksum = "15053d8d85c7eccdbefef60f06769760a563c7f0a9d6902a13d35c7800b0ad65" dependencies = [ "futures-util", "js-sys", @@ -2663,9 +2856,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.71" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44188d185b5bdcae1052d08bcbcf9091a5524038d4572cc4f4f2bb9d5554ddd9" +checksum = "f6488b90108c040df0fe62fa815cbdee25124641df01814dd7282749234c6112" dependencies = [ "js-sys", "wasm-bindgen", @@ -2762,7 +2955,7 @@ checksum = "9107ddc059d5b6fbfbffdfa7a7fe3e22a226def0b2608f72e9d552763d3e1ad7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.87", ] [[package]] @@ -2773,7 +2966,7 @@ checksum = "29bee4b38ea3cde66011baa44dba677c432a78593e202392d1e9070cf2a7fca7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.87", ] [[package]] @@ -2982,6 +3175,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.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c5b1314b079b0930c31e3af543d8ee1757b1951ae1e1565ec704403a7240ca5" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28cc31741b18cb6f1d5ff12f5b7523e3d6eb0852bbbad19d73905511d9849b95" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", + "synstructure", +] + [[package]] name = "zerocopy" version = "0.7.35" @@ -3000,7 +3229,28 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.87", +] + +[[package]] +name = "zerofrom" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91ec111ce797d0e0784a1116d0ddcdbea84322cd79e5d5ad173daeba4f93ab55" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ea7b4a3637ea8669cedf0f1fd5c286a17f3de97b8dd5a70a6c167a1730e63a5" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", + "synstructure", ] [[package]] @@ -3008,3 +3258,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 75bdda3..60f77e3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,24 +1,27 @@ [package] name = "kon" -version = "0.4.1" +version = "0.5.0" edition = "2021" [dependencies] -bb8 = "0.8.5" +bb8 = "0.8.6" bb8-redis = "0.17.0" cargo_toml = "0.20.5" -feed-rs = "2.1.1" +feed-rs = "2.2.0" once_cell = "1.20.2" poise = "0.6.1" -regex = "1.11.0" -reqwest = { version = "0.12.8", features = ["json", "native-tls-vendored"] } -serde = "1.0.210" -serde_json = "1.0.128" +regex = "1.11.1" +reqwest = { version = "0.12.9", features = ["json", "native-tls-vendored"] } +serde = "1.0.215" +serde_json = "1.0.133" sysinfo = "0.32.0" tokenservice-client = { version = "0.4.0", registry = "gitea" } -tokio = { version = "1.40.0", features = ["macros", "signal", "rt-multi-thread"] } +tokio = { version = "1.41.1", features = ["macros", "signal", "rt-multi-thread"] } uptime_lib = "0.3.1" +[patch.crates-io] +poise = { git = "https://github.com/serenity-rs/poise", branch = "next" } + [features] production = [] diff --git a/docker-compose.yml b/docker-compose.yml index 123d4fd..01d667b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,7 +8,7 @@ services: - cache cache: container_name: kon-redis - image: redis/redis-stack-server:7.4.0-v0 + image: redis/redis-stack-server:7.4.0-v1 restart: unless-stopped ports: - 37935:6379/tcp diff --git a/src/commands.rs b/src/commands.rs index 534efbd..e6ce2a7 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -6,13 +6,15 @@ pub mod ping; pub mod status; pub mod uptime; +type PoiseCtx<'a> = poise::Context<'a, (), Error>; + /// Deploy the commands globally or in a guild #[poise::command( prefix_command, owners_only, guild_only )] -pub async fn deploy(ctx: poise::Context<'_, (), Error>) -> Result<(), Error> { +pub async fn deploy(ctx: PoiseCtx<'_>) -> Result<(), Error> { poise::builtins::register_application_commands_buttons(ctx).await?; Ok(()) } diff --git a/src/commands/ilo.rs b/src/commands/ilo.rs index 6e7a66e..9d6ca73 100644 --- a/src/commands/ilo.rs +++ b/src/commands/ilo.rs @@ -187,15 +187,17 @@ async fn ilo_data(endpoint: RedfishEndpoint) -> Result) -> Result<(), Error> { +pub async fn ilo(_: super::PoiseCtx<'_>) -> Result<(), Error> { Ok(()) } /// Retrieve the server's temperature data #[poise::command(slash_command)] -pub async fn temperature(ctx: poise::Context<'_, (), Error>) -> Result<(), Error> { +pub async fn temperature(ctx: super::PoiseCtx<'_>) -> Result<(), Error> { ctx.defer().await?; let ilo = ilo_data(RedfishEndpoint::Thermal).await.unwrap(); let data = ilo.downcast_ref::().unwrap(); @@ -246,7 +248,7 @@ pub async fn temperature(ctx: poise::Context<'_, (), Error>) -> Result<(), Error /// Retrieve the server's power data #[poise::command(slash_command)] -pub async fn power(ctx: poise::Context<'_, (), Error>) -> Result<(), Error> { +pub async fn power(ctx: super::PoiseCtx<'_>) -> Result<(), Error> { ctx.defer().await?; let ilo = ilo_data(RedfishEndpoint::Power).await.unwrap(); let data = ilo.downcast_ref::().unwrap(); @@ -272,7 +274,7 @@ pub async fn power(ctx: poise::Context<'_, (), Error>) -> Result<(), Error> { /// Retrieve the server's system data #[poise::command(slash_command)] -pub async fn system(ctx: poise::Context<'_, (), Error>) -> Result<(), Error> { +pub async fn system(ctx: super::PoiseCtx<'_>) -> Result<(), Error> { ctx.defer().await?; let (ilo_sys, ilo_event) = tokio::join!( diff --git a/src/commands/midi.rs b/src/commands/midi.rs index 69c2a2e..5d4b651 100644 --- a/src/commands/midi.rs +++ b/src/commands/midi.rs @@ -21,9 +21,13 @@ use poise::{ }; /// Convert MIDI file to WAV -#[poise::command(context_menu_command = "MIDI -> WAV")] +#[poise::command( + context_menu_command = "MIDI -> WAV", + install_context = "User", + interaction_context = "Guild|BotDm|PrivateChannel", +)] pub async fn midi_to_wav( - ctx: poise::Context<'_, (), Error>, + ctx: super::PoiseCtx<'_>, #[description = "MIDI file to be converted"] message: poise::serenity_prelude::Message ) -> Result<(), Error> { let re = Regex::new(r"(?i)\.mid$").unwrap(); @@ -46,7 +50,7 @@ pub async fn midi_to_wav( ) .await.unwrap(); - return Err(Error::from(format!("Failed to download the file: {}", y))) + return Err(Error::from(format!("Failed to download the file: {y}"))) } }; @@ -63,7 +67,7 @@ pub async fn midi_to_wav( .output(); // Just to add an info to console to tell what the bot is doing when MIDI file is downloaded. - println!("Discord[{}:{}]: Processing MIDI file: \"{}\"", ctx.guild().unwrap().name, ctx.command().qualified_name, midi_path); + println!("Discord[{}]: Processing MIDI file: \"{}\"", ctx.command().qualified_name, midi_path); match output { Ok(_) => { @@ -73,8 +77,8 @@ pub async fn midi_to_wav( if reply.is_err() { println!( - "Discord[{}:{}]: Processed file couldn't be uploaded back to Discord channel due to upload limit", - ctx.guild().unwrap().name, ctx.command().qualified_name + "Discord[{}]: Processed file couldn't be uploaded back to Discord channel due to upload limit", + ctx.command().qualified_name ); ctx.send(CreateReply::default() @@ -93,7 +97,7 @@ pub async fn midi_to_wav( .content("Command didn't execute successfully, check console for more information!") ).await.unwrap(); - return Err(Error::from(format!("Midi conversion failed: {}", y))) + return Err(Error::from(format!("Midi conversion failed: {y}"))) } } diff --git a/src/commands/ping.rs b/src/commands/ping.rs index aa0300e..763aa99 100644 --- a/src/commands/ping.rs +++ b/src/commands/ping.rs @@ -2,7 +2,7 @@ use crate::Error; /// Check if the bot is alive #[poise::command(slash_command)] -pub async fn ping(ctx: poise::Context<'_, (), Error>) -> Result<(), Error> { +pub async fn ping(ctx: super::PoiseCtx<'_>) -> Result<(), Error> { ctx.reply(format!("Powong! `{:?}`", ctx.ping().await)).await?; Ok(()) } diff --git a/src/commands/status.rs b/src/commands/status.rs index 58304b3..1b70a14 100644 --- a/src/commands/status.rs +++ b/src/commands/status.rs @@ -71,13 +71,13 @@ fn process_pms_statuses(servers: Vec<(String, Vec)>) -> Vec<(String, Stri slash_command, subcommands("wg") )] -pub async fn status(_: poise::Context<'_, (), Error>) -> Result<(), Error> { +pub async fn status(_: super::PoiseCtx<'_>) -> Result<(), Error> { Ok(()) } /// Retrieve the server statuses from Wargaming #[poise::command(slash_command)] -pub async fn wg(ctx: poise::Context<'_, (), Error>) -> Result<(), Error> { +pub async fn wg(ctx: super::PoiseCtx<'_>) -> Result<(), Error> { let pms_asia = token_path().await.wg_pms; let pms_eu = pms_asia.replace("asia", "eu"); let embed = CreateEmbed::new().color(BINARY_PROPERTIES.embed_color); diff --git a/src/commands/uptime.rs b/src/commands/uptime.rs index 593d8a7..8f23dc5 100644 --- a/src/commands/uptime.rs +++ b/src/commands/uptime.rs @@ -42,12 +42,12 @@ fn get_os_info() -> String { }); } - format!("{} {}", name, version) + format!("{name} {version}") } /// Retrieve host and bot uptimes #[poise::command(slash_command)] -pub async fn uptime(ctx: poise::Context<'_, (), Error>) -> Result<(), Error> { +pub async fn uptime(ctx: super::PoiseCtx<'_>) -> Result<(), Error> { let _bot = ctx.http().get_current_user().await.unwrap(); let mut sys = System::new_all(); sys.refresh_all(); @@ -68,7 +68,7 @@ pub async fn uptime(ctx: poise::Context<'_, (), Error>) -> Result<(), Error> { } let stat_msg = [ - format!("**{} {}** `{}:{}`", _bot.name, BOT_VERSION.as_str(), GIT_COMMIT_HASH, GIT_COMMIT_BRANCH), + format!("**{} {}** `{GIT_COMMIT_HASH}:{GIT_COMMIT_BRANCH}`", _bot.name, BOT_VERSION.as_str()), format!(">>> System: `{}`", format_duration(sys_uptime)), format!("Process: `{}`", format_duration(proc_uptime)), format!("CPU: `{}`", cpu[0].brand()), diff --git a/src/controllers/cache.rs b/src/controllers/cache.rs index 9bf0240..66e2253 100644 --- a/src/controllers/cache.rs +++ b/src/controllers/cache.rs @@ -27,6 +27,7 @@ impl RedisController { async fn create_pool(manager: RedisConnectionManager) -> Pool { let mut backoff = 1; + let redis_err = "Redis[Error]: {{ e }}, retrying in {{ backoff }} seconds"; loop { match Pool::builder().max_size(20).retry_connection(true).build(manager.clone()).await { @@ -40,19 +41,19 @@ impl RedisController { return pool.clone(); }, Err(e) => { - eprintln!("Redis[Error]: {}, retrying in {} seconds", e, backoff); + eprintln!("{}", redis_err.replace("{{ e }}", &e.to_string()).replace("{{ backoff }}", &backoff.to_string())); Self::apply_backoff(&mut backoff).await; } } }, Err(e) => { - eprintln!("Redis[ConnError]: {}, retrying in {} seconds", e, backoff); + eprintln!("{}", redis_err.replace("{{ e }}", &e.to_string()).replace("{{ backoff }}", &backoff.to_string())); Self::apply_backoff(&mut backoff).await; } } } Err(e) => { - eprintln!("Redis[PoolError]: {}, retrying in {} seconds", e, backoff); + eprintln!("Redis[PoolError]: {e}, retrying in {backoff} seconds"); Self::apply_backoff(&mut backoff).await; } } diff --git a/src/internals/config.rs b/src/internals/config.rs index e7638a4..34af516 100644 --- a/src/internals/config.rs +++ b/src/internals/config.rs @@ -1,6 +1,7 @@ use std::sync::LazyLock; pub struct ConfigMeta { + pub env: String, pub embed_color: i32, pub ready_notify: u64, pub rss_channel: u64, @@ -14,6 +15,7 @@ pub static BINARY_PROPERTIES: LazyLock = LazyLock::new(ConfigMeta::n #[cfg(not(feature = "production"))] pub static BINARY_PROPERTIES: LazyLock = LazyLock::new(|| ConfigMeta::new() + .env("dev") .embed_color(0xf1d63c) .ready_notify(865673694184996888) .rss_channel(865673694184996888) @@ -22,6 +24,7 @@ pub static BINARY_PROPERTIES: LazyLock = LazyLock::new(|| impl ConfigMeta { fn new() -> Self { Self { + env: "prod".to_string(), embed_color: 0x5a99c7, ready_notify: 865673694184996888, rss_channel: 865673694184996888, @@ -33,6 +36,12 @@ impl ConfigMeta { } // Scalable functions below; + #[cfg(not(feature = "production"))] + fn env(mut self, env: &str) -> Self { + self.env = env.to_string(); + self + } + #[cfg(not(feature = "production"))] fn embed_color(mut self, color: i32) -> Self { self.embed_color = color; diff --git a/src/internals/http.rs b/src/internals/http.rs index 6233eef..083a9c0 100644 --- a/src/internals/http.rs +++ b/src/internals/http.rs @@ -17,7 +17,7 @@ impl HttpClient { pub async fn get(&self, url: &str, ua: &str) -> Result { let response = self.0.get(url).header( reqwest::header::USER_AGENT, - format!("Kon ({}-{}) - {}/reqwest", super::utils::BOT_VERSION.as_str(), crate::GIT_COMMIT_HASH, ua) + format!("Kon ({}-{}) - {ua}/reqwest", super::utils::BOT_VERSION.as_str(), crate::GIT_COMMIT_HASH) ) .timeout(Duration::from_secs(30)) .send() @@ -26,11 +26,11 @@ impl HttpClient { match response { Ok(res) => Ok(res), Err(y) if y.is_timeout() => { - eprintln!("{ERROR_PREFIX} Request timed out for \"{}\"", url); + eprintln!("{ERROR_PREFIX} Request timed out for \"{url}\""); Err(y) }, Err(y) if y.is_connect() => { - eprintln!("{ERROR_PREFIX} Connection failed for \"{}\"", url); + eprintln!("{ERROR_PREFIX} Connection failed for \"{url}\""); Err(y) }, Err(y) => Err(y) diff --git a/src/internals/tasks.rs b/src/internals/tasks.rs index da9784f..212e837 100644 --- a/src/internals/tasks.rs +++ b/src/internals/tasks.rs @@ -16,11 +16,11 @@ use std::{ }; fn task_info(name: &str, message: &str) { - println!("TaskScheduler[{}]: {}", name, message) + println!("TaskScheduler[{name}]: {message}") } fn task_err(name: &str, message: &str) { - eprintln!("TaskScheduler[{}:Error]: {}", name, message) + eprintln!("TaskScheduler[{name}:Error]: {message}") } static TASK_RUNNING: AtomicBool = AtomicBool::new(false); @@ -36,9 +36,9 @@ where TASK_RUNNING.store(true, Ordering::SeqCst); spawn(async move { if let Err(y) = task(ctx_cl).await { - eprintln!("TaskScheduler[Main:Error]: Failed to execute the task, error reason: {}", y); + eprintln!("TaskScheduler[Main:Error]: Failed to execute the task, error reason: {y}"); if let Some(source) = y.source() { - eprintln!("TaskScheduler[Main:Error]: Failed to execute the task, this is caused by: {:#?}", source); + eprintln!("TaskScheduler[Main:Error]: Failed to execute the task, this is caused by: {source:#?}"); } } TASK_RUNNING.store(false, Ordering::SeqCst); diff --git a/src/internals/utils.rs b/src/internals/utils.rs index 08059e7..710cb84 100644 --- a/src/internals/utils.rs +++ b/src/internals/utils.rs @@ -11,7 +11,7 @@ pub static BOT_VERSION: LazyLock = LazyLock::new(|| { .unwrap() .version .unwrap(); - format!("v{}", cargo_version) + format!("v{cargo_version}") }); static TSCLIENT: LazyLock> = LazyLock::new(|| Mutex::new(TSClient::new())); @@ -28,7 +28,7 @@ pub fn mention_dev(ctx: poise::Context<'_, (), crate::Error>) -> Option for dev in devs { if app_owners.contains(&UserId::new(dev)) { - mentions.push(format!("<@{}>", dev)); + mentions.push(format!("<@{dev}>")); } } @@ -47,15 +47,15 @@ pub fn format_duration(secs: u64) -> String { let mut formatted_string = String::new(); if days > 0 { - formatted_string.push_str(&format!("{}d, ", days)); + formatted_string.push_str(&format!("{days}d, ")); } if hours > 0 || days > 0 { - formatted_string.push_str(&format!("{}h, ", hours)); + formatted_string.push_str(&format!("{hours}h, ")); } if minutes > 0 || hours > 0 { - formatted_string.push_str(&format!("{}m, ", minutes)); + formatted_string.push_str(&format!("{minutes}m, ")); } - formatted_string.push_str(&format!("{}s", seconds)); + formatted_string.push_str(&format!("{seconds}s")); formatted_string } @@ -75,8 +75,8 @@ pub fn format_bytes(bytes: u64) -> String { } if unit == "B" { - format!("{}{}", value, unit) + format!("{value}{unit}") } else { - format!("{:.2}{}", value, unit) + format!("{value:.2}{unit}") } } diff --git a/src/main.rs b/src/main.rs index 8acddcf..e325f2c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -19,6 +19,7 @@ use crate::internals::{ use std::{ sync::Arc, + borrow::Cow, thread::current }; use poise::serenity_prelude::{ @@ -57,7 +58,7 @@ async fn on_ready( println!("Event[Ready][Notice]: Session limit: {}/{}", session.remaining, session.total); } - println!("Event[Ready]: Build version: {} ({}:{})", *BOT_VERSION, GIT_COMMIT_HASH, GIT_COMMIT_BRANCH); + println!("Event[Ready]: Build version: {} ({GIT_COMMIT_HASH}:{GIT_COMMIT_BRANCH})", *BOT_VERSION); println!("Event[Ready]: Connected to API as {}", ready.user.name); let message = CreateMessage::new(); @@ -72,16 +73,15 @@ async fn on_ready( } async fn event_processor( - ctx: &Context, - event: &FullEvent, - _framework: poise::FrameworkContext<'_, (), Error> + framework: poise::FrameworkContext<'_, (), Error>, + event: &FullEvent ) -> Result<(), Error> { if let FullEvent::Ready { .. } = event { let thread_id = format!("{:?}", current().id()); let thread_num: String = thread_id.chars().filter(|c| c.is_ascii_digit()).collect(); - println!("Event[Ready]: Task Scheduler operating on thread {}", thread_num); + println!("Event[Ready]: Task Scheduler operating on thread {thread_num}"); - let ctx = Arc::new(ctx.clone()); + let ctx = Arc::new(framework.serenity_context.clone()); run_task(ctx.clone(), rss).await; } @@ -90,6 +90,12 @@ async fn event_processor( #[tokio::main] async fn main() { + let prefix = if BINARY_PROPERTIES.env.contains("dev") { + Some(Cow::Borrowed("kon!")) + } else { + Some(Cow::Borrowed("k!")) + }; + let framework = poise::Framework::builder() .options(poise::FrameworkOptions { commands: vec![ @@ -101,7 +107,7 @@ async fn main() { commands::uptime::uptime() ], prefix_options: poise::PrefixFrameworkOptions { - prefix: Some(String::from("konata")), + prefix, mention_as_prefix: false, case_insensitive_commands: true, ignore_bots: true, @@ -113,29 +119,32 @@ async fn main() { Some(guild) => guild.name.clone(), None => String::from("Direct Message") }; - println!("Discord[{}]: {} ran /{}", get_guild_name, ctx.author().name, ctx.command().qualified_name); + println!( + "Discord[{get_guild_name}]: {} ran /{}", + ctx.author().name, + ctx.command().qualified_name + ); }), on_error: |error| Box::pin(async move { match error { poise::FrameworkError::Command { error, ctx, .. } => { - println!("PoiseCommandError({}): {}", ctx.command().qualified_name, error); + println!("PoiseCommandError({}): {error}", ctx.command().qualified_name); ctx.reply(format!( "Encountered an error during command execution, ask {} to check console for more details!", mention_dev(ctx).unwrap_or_default() )).await.expect("Error sending message"); }, - poise::FrameworkError::EventHandler { error, event, .. } => println!("PoiseEventHandlerError({}): {}", event.snake_case_name(), error), - poise::FrameworkError::Setup { error, .. } => println!("PoiseSetupError: {}", error), + poise::FrameworkError::EventHandler { error, event, .. } => println!("PoiseEventHandlerError({}): {error}", event.snake_case_name()), poise::FrameworkError::UnknownInteraction { interaction, .. } => println!( "PoiseUnknownInteractionError: {} tried to execute an unknown interaction ({})", interaction.user.name, interaction.data.name ), - other => println!("PoiseOtherError: {}", other) + other => println!("PoiseOtherError: {other}") } }), initialize_owners: true, - event_handler: |ctx, event, framework, _| Box::pin(event_processor(ctx, event, framework)), + event_handler: |framework, event| Box::pin(event_processor(framework, event)), ..Default::default() }) .setup(|ctx, ready, framework| Box::pin(on_ready(ctx, ready, framework))) @@ -151,6 +160,6 @@ async fn main() { .await.expect("Error creating client"); if let Err(why) = client.start().await { - println!("Error starting client: {:#?}", why); + println!("Error starting client: {why:#?}"); } }