Initial rework to poise
This commit is contained in:
parent
f21f145618
commit
6ac5129114
193
Cargo.lock
generated
193
Cargo.lock
generated
@ -125,7 +125,7 @@ checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.100",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -136,7 +136,7 @@ checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.100",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -329,7 +329,7 @@ dependencies = [
|
||||
"regex",
|
||||
"rustc-hash 1.1.0",
|
||||
"shlex",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.100",
|
||||
"which",
|
||||
]
|
||||
|
||||
@ -586,17 +586,6 @@ dependencies = [
|
||||
"cc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "command_attr"
|
||||
version = "0.5.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6fcc89439e1bb4e19050a9586a767781a3060000d2f3296fd2a40597ad9421c5"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "config"
|
||||
version = "0.15.11"
|
||||
@ -761,8 +750,18 @@ version = "0.10.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0d706e75d87e35569db781a9b5e2416cff1236a47ed380831f959382ccd5f858"
|
||||
dependencies = [
|
||||
"darling_core",
|
||||
"darling_macro",
|
||||
"darling_core 0.10.2",
|
||||
"darling_macro 0.10.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "darling"
|
||||
version = "0.20.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989"
|
||||
dependencies = [
|
||||
"darling_core 0.20.10",
|
||||
"darling_macro 0.20.10",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -779,17 +778,42 @@ dependencies = [
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "darling_core"
|
||||
version = "0.20.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5"
|
||||
dependencies = [
|
||||
"fnv",
|
||||
"ident_case",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"strsim 0.11.1",
|
||||
"syn 2.0.100",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "darling_macro"
|
||||
version = "0.10.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d9b5a2f4ac4969822c62224815d069952656cadc7084fdca9751e6d959189b72"
|
||||
dependencies = [
|
||||
"darling_core",
|
||||
"darling_core 0.10.2",
|
||||
"quote",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "darling_macro"
|
||||
version = "0.20.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806"
|
||||
dependencies = [
|
||||
"darling_core 0.20.10",
|
||||
"quote",
|
||||
"syn 2.0.100",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dashmap"
|
||||
version = "5.5.3"
|
||||
@ -851,7 +875,7 @@ version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a2658621297f2cf68762a6f7dc0bb7e1ff2cfd6583daef8ee0fed6f7ec468ec0"
|
||||
dependencies = [
|
||||
"darling",
|
||||
"darling 0.10.2",
|
||||
"derive_builder_core",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -864,7 +888,7 @@ version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2791ea3e372c8495c0bc2033991d76b512cd799d07491fbd6890124db9458bef"
|
||||
dependencies = [
|
||||
"darling",
|
||||
"darling 0.10.2",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 1.0.109",
|
||||
@ -880,7 +904,7 @@ dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"rustc_version",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.100",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -917,7 +941,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.100",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1060,8 +1084,10 @@ dependencies = [
|
||||
"emojis",
|
||||
"j_db",
|
||||
"json",
|
||||
"log",
|
||||
"magick_rust",
|
||||
"ndm",
|
||||
"poise",
|
||||
"prost",
|
||||
"raas_types",
|
||||
"rand 0.9.0",
|
||||
@ -1069,13 +1095,13 @@ dependencies = [
|
||||
"reqwest 0.12.9",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serenity",
|
||||
"sha3",
|
||||
"songbird",
|
||||
"structopt",
|
||||
"tera",
|
||||
"tokio",
|
||||
"tonic",
|
||||
"tracing-subscriber",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1153,7 +1179,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.100",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1768,7 +1794,7 @@ checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.100",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1936,12 +1962,6 @@ version = "1.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
|
||||
|
||||
[[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.169"
|
||||
@ -1988,9 +2008,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.22"
|
||||
version = "0.4.26"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"
|
||||
checksum = "30bde2b3dc3671ae49d8e2e9f044c7c005836e7a023ee57cffa25ab82764bb9e"
|
||||
|
||||
[[package]]
|
||||
name = "loom"
|
||||
@ -2272,7 +2292,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.100",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2427,7 +2447,7 @@ dependencies = [
|
||||
"pest_meta",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.100",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2506,7 +2526,7 @@ checksum = "3c0f5fad0874fc7abcd4d750e76917eaebbecaa2c20bde22e1dbeeba8beb758c"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.100",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2545,7 +2565,7 @@ dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"regex",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.100",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2557,6 +2577,35 @@ dependencies = [
|
||||
"pnet_base",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "poise"
|
||||
version = "0.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1819d5a45e3590ef33754abce46432570c54a120798bdbf893112b4211fa09a6"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"derivative",
|
||||
"futures-util",
|
||||
"parking_lot 0.12.3",
|
||||
"poise_macros",
|
||||
"regex",
|
||||
"serenity",
|
||||
"tokio",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "poise_macros"
|
||||
version = "0.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8fa2c123c961e78315cd3deac7663177f12be4460f5440dbf62a7ed37b1effea"
|
||||
dependencies = [
|
||||
"darling 0.20.10",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.100",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "poly1305"
|
||||
version = "0.8.0"
|
||||
@ -2608,7 +2657,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "64d1ec885c64d0457d564db4ec299b2dae3f9c02808b8ad9c3a089c591b18033"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.100",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2646,9 +2695,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.92"
|
||||
version = "1.0.94"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0"
|
||||
checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
@ -2679,7 +2728,7 @@ dependencies = [
|
||||
"prost",
|
||||
"prost-types",
|
||||
"regex",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.100",
|
||||
"tempfile",
|
||||
]
|
||||
|
||||
@ -2693,7 +2742,7 @@ dependencies = [
|
||||
"itertools",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.100",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2770,9 +2819,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.37"
|
||||
version = "1.0.40"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af"
|
||||
checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
@ -3397,7 +3446,7 @@ checksum = "46f859dbbf73865c6627ed570e78961cd3ac92407a2d117204c49232485da55e"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.100",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3430,7 +3479,7 @@ checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.100",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3466,12 +3515,10 @@ dependencies = [
|
||||
"bitflags 2.6.0",
|
||||
"bytes",
|
||||
"chrono",
|
||||
"command_attr",
|
||||
"dashmap 5.5.3",
|
||||
"flate2",
|
||||
"futures",
|
||||
"fxhash",
|
||||
"levenshtein",
|
||||
"mime_guess",
|
||||
"parking_lot 0.12.3",
|
||||
"percent-encoding",
|
||||
@ -3480,7 +3527,6 @@ dependencies = [
|
||||
"serde",
|
||||
"serde_cow",
|
||||
"serde_json",
|
||||
"static_assertions",
|
||||
"time",
|
||||
"tokio",
|
||||
"tokio-tungstenite 0.21.0",
|
||||
@ -3488,7 +3534,6 @@ dependencies = [
|
||||
"typemap_rev",
|
||||
"typesize",
|
||||
"url",
|
||||
"uwl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3730,12 +3775,6 @@ version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
|
||||
|
||||
[[package]]
|
||||
name = "static_assertions"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
|
||||
|
||||
[[package]]
|
||||
name = "stream_lib"
|
||||
version = "0.5.2"
|
||||
@ -3782,6 +3821,12 @@ version = "0.9.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c"
|
||||
|
||||
[[package]]
|
||||
name = "strsim"
|
||||
version = "0.11.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
|
||||
|
||||
[[package]]
|
||||
name = "structopt"
|
||||
version = "0.3.26"
|
||||
@ -3882,9 +3927,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.91"
|
||||
version = "2.0.100"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d53cbcb5a243bd33b7858b1d7f4aca2153490815872d86d955d6ea29f743c035"
|
||||
checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -3914,7 +3959,7 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.100",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -4035,7 +4080,7 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.100",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -4046,7 +4091,7 @@ checksum = "7b50fa271071aae2e6ee85f842e2e28ba8cd2c5fb67f11fcb1fd70b276f9e7d4"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.100",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -4149,7 +4194,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.100",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -4347,7 +4392,7 @@ dependencies = [
|
||||
"prost-build",
|
||||
"prost-types",
|
||||
"quote",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.100",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -4418,7 +4463,7 @@ checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.100",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -4619,7 +4664,7 @@ checksum = "fd9fc0ad9e03a2b0c2e2a0eafaecccef2121829e1ab6ce9c9d790e6c6766bd1c"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.100",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -4757,12 +4802,6 @@ dependencies = [
|
||||
"getrandom 0.2.15",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "uwl"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f4bf03e0ca70d626ecc4ba6b0763b934b6f2976e8c744088bb3c1d646fbb1ad0"
|
||||
|
||||
[[package]]
|
||||
name = "valuable"
|
||||
version = "0.1.0"
|
||||
@ -4842,7 +4881,7 @@ dependencies = [
|
||||
"log",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.100",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
@ -4877,7 +4916,7 @@ checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.100",
|
||||
"wasm-bindgen-backend",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
@ -5255,7 +5294,7 @@ checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.100",
|
||||
"synstructure",
|
||||
]
|
||||
|
||||
@ -5286,7 +5325,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.100",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -5297,7 +5336,7 @@ checksum = "6352c01d0edd5db859a63e2605f4ea3183ddbd15e2c4a9e7d32184df75e4f154"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.100",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -5317,7 +5356,7 @@ checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.100",
|
||||
"synstructure",
|
||||
]
|
||||
|
||||
@ -5346,5 +5385,5 @@ checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.100",
|
||||
]
|
||||
|
||||
@ -28,10 +28,9 @@ raas_types = { version = "0.1.0", registry = "ahines"}
|
||||
tonic = "0.12.3"
|
||||
prost = "0.13.5"
|
||||
emojis = "0.6.2"
|
||||
|
||||
[dependencies.serenity]
|
||||
version = "0.12.0"
|
||||
features = ["framework", "standard_framework", "rustls_backend"]
|
||||
poise = "0.6.1"
|
||||
tracing-subscriber = "0.3.19"
|
||||
log = "0.4.26"
|
||||
|
||||
[dependencies.tokio]
|
||||
version = "1.35.1"
|
||||
|
||||
@ -4,17 +4,17 @@ use crate::migrations::{do_migration, CURRENT_DB_VERSION};
|
||||
use config::{Config, File};
|
||||
use j_db::database::Database;
|
||||
use j_db::metadata::DBMetadata;
|
||||
use poise::serenity_prelude::model::id::ChannelId;
|
||||
use poise::serenity_prelude::model::prelude::{GuildId, UserId};
|
||||
use poise::serenity_prelude::prelude::TypeMapKey;
|
||||
use reqwest::Url;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serenity::model::id::ChannelId;
|
||||
use serenity::model::prelude::{GuildId, UserId};
|
||||
use serenity::prelude::TypeMapKey;
|
||||
use std::net::SocketAddr;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::sync::Arc;
|
||||
use structopt::StructOpt;
|
||||
use tokio::sync::mpsc::{channel, Receiver, Sender};
|
||||
use tokio::sync::Mutex;
|
||||
use tokio::sync::{Mutex, MutexGuard};
|
||||
|
||||
#[derive(Debug, StructOpt)]
|
||||
#[structopt(name = "fren", about = "Friend Bot")]
|
||||
@ -75,7 +75,7 @@ impl BotState {
|
||||
pub struct GlobalData {
|
||||
pub args: Args,
|
||||
pub cfg: BotConfig,
|
||||
pub bot_state: BotState,
|
||||
pub bot_state: Mutex<BotState>,
|
||||
pub db: Database,
|
||||
pub picox: AlbumManager,
|
||||
}
|
||||
@ -98,7 +98,7 @@ impl GlobalData {
|
||||
|
||||
Ok(Self {
|
||||
args,
|
||||
bot_state: BotState::new().await?,
|
||||
bot_state: Mutex::new(BotState::new().await?),
|
||||
db,
|
||||
cfg: cfg.clone(),
|
||||
picox: AlbumManager::new(cfg.picox.api_base_url, &cfg.picox.token),
|
||||
@ -109,7 +109,6 @@ impl GlobalData {
|
||||
let cfg = BotConfig::new(&self.args.cfg_path)?;
|
||||
|
||||
self.cfg = cfg;
|
||||
self.bot_state = BotState::new().await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@ -1,49 +1,35 @@
|
||||
use crate::{command, group, GlobalData};
|
||||
use serenity::client::Context;
|
||||
use serenity::framework::standard::{Args, CommandResult};
|
||||
use serenity::model::channel::Message;
|
||||
use crate::config::GlobalData;
|
||||
use crate::discord::Context;
|
||||
use crate::error::Error;
|
||||
use std::net::ToSocketAddrs;
|
||||
|
||||
#[group]
|
||||
#[commands(nudetayne, tayne, celeryman)]
|
||||
pub struct CeleryMan;
|
||||
|
||||
#[command]
|
||||
#[aliases("NUDETAYNE")]
|
||||
#[only_in(guilds)]
|
||||
async fn nudetayne(ctx: &Context, msg: &Message, _args: Args) -> CommandResult {
|
||||
if msg.content.starts_with("!nudetayne") {
|
||||
msg.reply(&ctx.http, "Not computing, please repeat.")
|
||||
.await?;
|
||||
} else if msg.content.starts_with("!NUDETAYNE") {
|
||||
let mut data = ctx.data.write().await;
|
||||
let global_data = data.get_mut::<GlobalData>().unwrap();
|
||||
msg.reply(&ctx.http, "This is not suitable for work are you sure?")
|
||||
#[poise::command(prefix_command)]
|
||||
pub async fn nudetayne(ctx: Context<'_>) -> Result<(), Error> {
|
||||
if ctx.invoked_command_name() == "nudetayne".to_string() {
|
||||
ctx.reply("Not computing, please repeat.").await?;
|
||||
} else if ctx.invoked_command_name() == "NUDETAYNE".to_string() {
|
||||
ctx.reply("This is not suitable for work are you sure?")
|
||||
.await?;
|
||||
|
||||
global_data.bot_state.accepted_nsfw = Some(msg.author.id);
|
||||
let mut global_data = ctx.data().bot_state.lock().await;
|
||||
|
||||
global_data.accepted_nsfw = Some(ctx.author().id)
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[command]
|
||||
#[only_in(guilds)]
|
||||
async fn tayne(ctx: &Context, msg: &Message, _args: Args) -> CommandResult {
|
||||
msg.reply(
|
||||
&ctx.http,
|
||||
"https://media.tenor.com/115eUl2XUaAAAAAM/flarhgunnstow-paul-rudd.gif",
|
||||
)
|
||||
#[poise::command(prefix_command)]
|
||||
pub async fn tayne(ctx: Context<'_>) -> Result<(), Error> {
|
||||
ctx.reply("https://media.tenor.com/115eUl2XUaAAAAAM/flarhgunnstow-paul-rudd.gif")
|
||||
.await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[command]
|
||||
#[only_in(guilds)]
|
||||
async fn celeryman(ctx: &Context, msg: &Message, _args: Args) -> CommandResult {
|
||||
msg.reply(
|
||||
&ctx.http,
|
||||
"https://media.tenor.com/1iOUXZFLpBgAAAAM/dance-dancing.gif",
|
||||
)
|
||||
#[poise::command(prefix_command)]
|
||||
pub async fn celeryman(ctx: Context<'_>) -> Result<(), Error> {
|
||||
ctx.reply("https://media.tenor.com/1iOUXZFLpBgAAAAM/dance-dancing.gif")
|
||||
.await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@ -1,227 +1,50 @@
|
||||
pub mod admin;
|
||||
pub mod album;
|
||||
pub mod birthday;
|
||||
pub mod celeryman;
|
||||
pub mod color;
|
||||
pub mod emoji_race;
|
||||
pub mod fren_coin;
|
||||
pub mod joke;
|
||||
pub mod little_fren;
|
||||
pub mod motivate;
|
||||
pub mod shop;
|
||||
pub mod story;
|
||||
pub mod voices;
|
||||
mod celeryman;
|
||||
|
||||
use crate::api::web_server;
|
||||
use crate::discord::fren_coin::give_coin;
|
||||
use crate::discord::joke::random;
|
||||
use crate::models::lil_fren::lil_fren_task;
|
||||
use crate::models::task::Task;
|
||||
use crate::{help, hook, GlobalData};
|
||||
use rand::prelude::IteratorRandom;
|
||||
use rand::thread_rng;
|
||||
use serenity::all::{ActivityData, Http, RoleId};
|
||||
use serenity::async_trait;
|
||||
use serenity::client::Context;
|
||||
use serenity::framework::standard::{
|
||||
help_commands, Args, CommandGroup, CommandResult, HelpOptions,
|
||||
};
|
||||
use serenity::model::channel::{Message, ReactionType};
|
||||
use serenity::model::id::UserId;
|
||||
use serenity::model::prelude::{GuildId, OnlineStatus, Ready};
|
||||
use serenity::prelude::EventHandler;
|
||||
use std::collections::HashSet;
|
||||
use std::time::Duration;
|
||||
use tokio::time::sleep;
|
||||
use crate::config::GlobalData;
|
||||
use crate::error::Error;
|
||||
|
||||
pub struct Handler;
|
||||
use poise::{serenity_prelude as serenity, FrameworkOptions};
|
||||
|
||||
static ERROR_MSG: &str =
|
||||
"OOPSIE WOOPSIE!! Uwu We made a fucky wucky!! A wittle fucko boingo! The admins at our headquarters are working VEWY HAWD to fix this!";
|
||||
type Context<'a> = poise::Context<'a, GlobalData, Error>;
|
||||
|
||||
#[async_trait]
|
||||
impl EventHandler for Handler {
|
||||
async fn cache_ready(&self, ctx: Context, _guilds: Vec<GuildId>) {
|
||||
let ctx1 = ctx.clone();
|
||||
tokio::spawn(async move {
|
||||
loop {
|
||||
lil_fren_task(&ctx1).await;
|
||||
}
|
||||
});
|
||||
|
||||
tokio::spawn(async move {
|
||||
Task::create_reoccurring_tasks(&ctx).await.unwrap();
|
||||
loop {
|
||||
Task::run_tasks(&ctx).await.unwrap();
|
||||
sleep(Duration::from_secs(5)).await;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async fn message(&self, ctx: Context, new_message: Message) {
|
||||
if new_message.author.bot {
|
||||
return;
|
||||
}
|
||||
|
||||
if new_message.guild_id.is_none() {
|
||||
return;
|
||||
}
|
||||
|
||||
if new_message.content.eq_ignore_ascii_case("yes")
|
||||
|| new_message.content.eq_ignore_ascii_case("mhmm")
|
||||
{
|
||||
let mut data = ctx.data.write().await;
|
||||
let global_data = data.get_mut::<GlobalData>().unwrap();
|
||||
|
||||
if let Some(u) = global_data.bot_state.accepted_nsfw {
|
||||
if new_message.author.id == u {
|
||||
new_message.reply(&ctx.http, "||https://cdn.discordapp.com/attachments/614891432079130625/1041545254362423368/unknown.png||").await.unwrap();
|
||||
global_data.bot_state.accepted_nsfw = None;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if new_message.content.to_lowercase().contains("good bot") {
|
||||
let recv_coin = give_coin(&ctx, new_message.author.id, 0.50, 25)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
if recv_coin {
|
||||
let emojis = &new_message
|
||||
.guild_id
|
||||
.unwrap()
|
||||
.emojis(&ctx.http)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
let emoji = {
|
||||
let mut rng = thread_rng();
|
||||
emojis.iter().choose(&mut rng)
|
||||
};
|
||||
|
||||
if let Some(emoji) = emoji {
|
||||
new_message
|
||||
.react(
|
||||
&ctx.http,
|
||||
ReactionType::Custom {
|
||||
animated: emoji.animated,
|
||||
id: emoji.id,
|
||||
name: Some(emoji.name.clone()),
|
||||
pub async fn run_bot(global_data: GlobalData) {
|
||||
let framework_options: FrameworkOptions<GlobalData, Error> = poise::FrameworkOptions {
|
||||
prefix_options: poise::PrefixFrameworkOptions {
|
||||
prefix: Some("!".into()),
|
||||
ignore_bots: true,
|
||||
ignore_thread_creation: false,
|
||||
case_insensitive_commands: true,
|
||||
..Default::default()
|
||||
},
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if new_message.content.to_lowercase().contains("bad bot") {
|
||||
new_message.react(&ctx.http, '😭').await.unwrap();
|
||||
}
|
||||
|
||||
give_coin(&ctx, new_message.author.id, 0.05, 10)
|
||||
.await
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
async fn ready(&self, ctx: Context, ready: Ready) {
|
||||
println!("Connected as {}", ready.user.name);
|
||||
|
||||
ctx.set_presence(
|
||||
Some(
|
||||
ActivityData::streaming(
|
||||
"Security Cameras inside your Home",
|
||||
"https://www.youtube.com/watch?v=6n3pFFPSlW4",
|
||||
)
|
||||
.unwrap(),
|
||||
),
|
||||
OnlineStatus::Online,
|
||||
);
|
||||
|
||||
tokio::spawn(async move { web_server(ctx).await });
|
||||
}
|
||||
}
|
||||
|
||||
#[hook]
|
||||
pub async fn after(
|
||||
ctx: &Context,
|
||||
msg: &Message,
|
||||
command_name: &str,
|
||||
command_result: CommandResult,
|
||||
) {
|
||||
match command_result {
|
||||
Ok(()) => {
|
||||
println!("Processed command '{}'", command_name);
|
||||
|
||||
let data = ctx.data.read().await;
|
||||
let global_data = data.get::<GlobalData>().unwrap();
|
||||
|
||||
global_data.db.db.flush_async().await.unwrap();
|
||||
}
|
||||
Err(why) => {
|
||||
println!("Command '{}' returned error {:?}", command_name, why);
|
||||
msg.reply(
|
||||
&ctx.http,
|
||||
format!("{} (Error in command {})", ERROR_MSG, command_name),
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[hook]
|
||||
pub async fn unrecognised_command_hook(
|
||||
ctx: &Context,
|
||||
msg: &Message,
|
||||
unrecognised_command_name: &str,
|
||||
) {
|
||||
let contents_split: Vec<&str> = msg.content.split(' ').collect();
|
||||
|
||||
let tags = if contents_split.len() > 1 {
|
||||
contents_split[1..].to_vec()
|
||||
} else {
|
||||
Vec::new()
|
||||
commands: vec![
|
||||
celeryman::nudetayne(),
|
||||
celeryman::celeryman(),
|
||||
celeryman::tayne(),
|
||||
],
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
let parsed_album = match album::parse_album(ctx, msg, unrecognised_command_name, tags).await {
|
||||
Ok(parsed) => parsed,
|
||||
Err(e) => {
|
||||
println!("Error processing album command: {}", e);
|
||||
true
|
||||
}
|
||||
};
|
||||
let token = global_data.cfg.bot_token.clone();
|
||||
|
||||
if !parsed_album {
|
||||
match random(ctx, msg, unrecognised_command_name).await {
|
||||
Ok(_) => {}
|
||||
Err(e) => println!("Error processing random command: {}", e),
|
||||
}
|
||||
}
|
||||
let framework = poise::framework::Framework::builder()
|
||||
.options(framework_options)
|
||||
.setup(move |ctx, _ready, framework| {
|
||||
Box::pin(async move {
|
||||
poise::builtins::register_globally(ctx, &framework.options().commands).await?;
|
||||
Ok(global_data)
|
||||
})
|
||||
})
|
||||
.build();
|
||||
|
||||
give_coin(ctx, msg.author.id, 0.5, 10).await.unwrap();
|
||||
}
|
||||
let intents = serenity::GatewayIntents::non_privileged()
|
||||
| serenity::GatewayIntents::DIRECT_MESSAGES
|
||||
| serenity::GatewayIntents::GUILDS
|
||||
| serenity::GatewayIntents::MESSAGE_CONTENT;
|
||||
|
||||
#[help]
|
||||
pub async fn my_help(
|
||||
context: &Context,
|
||||
msg: &Message,
|
||||
args: Args,
|
||||
help_options: &'static HelpOptions,
|
||||
groups: &[&'static CommandGroup],
|
||||
owners: HashSet<UserId>,
|
||||
) -> CommandResult {
|
||||
let _ = help_commands::with_embeds(context, msg, args, help_options, groups, owners).await;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn get_role(http: &Http, guild_id: GuildId, role_name: &str) -> Option<RoleId> {
|
||||
guild_id
|
||||
.roles(http)
|
||||
let mut client = serenity::ClientBuilder::new(token, intents)
|
||||
.framework(framework)
|
||||
.await
|
||||
.unwrap()
|
||||
.iter()
|
||||
.find(|(_, role)| role.name == role_name)
|
||||
.map(|(role_id, _)| role_id)
|
||||
.copied()
|
||||
.unwrap();
|
||||
|
||||
client.start().await.unwrap();
|
||||
}
|
||||
|
||||
@ -7,7 +7,7 @@ use std::fmt::{Display, Formatter};
|
||||
#[allow(dead_code)]
|
||||
pub enum Error {
|
||||
ConfigError(config::ConfigError),
|
||||
SerenityError(serenity::Error),
|
||||
SerenityError(poise::serenity_prelude::Error),
|
||||
TeraError(tera::Error),
|
||||
NoAlbumFound,
|
||||
UserError(user::UserError),
|
||||
@ -23,8 +23,8 @@ impl From<config::ConfigError> for Error {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<serenity::Error> for Error {
|
||||
fn from(err: serenity::Error) -> Self {
|
||||
impl From<poise::serenity_prelude::Error> for Error {
|
||||
fn from(err: poise::serenity_prelude::Error) -> Self {
|
||||
Self::SerenityError(err)
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
use poise::serenity_prelude::utils::MessageBuilder;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serenity::utils::MessageBuilder;
|
||||
use std::collections::hash_map::DefaultHasher;
|
||||
use std::fmt::{Display, Formatter};
|
||||
use std::hash::{Hash, Hasher};
|
||||
|
||||
63
src/main.rs
63
src/main.rs
@ -1,5 +1,4 @@
|
||||
mod album_manager;
|
||||
mod api;
|
||||
mod config;
|
||||
mod discord;
|
||||
mod error;
|
||||
@ -9,13 +8,11 @@ mod models;
|
||||
mod user;
|
||||
|
||||
use crate::config::{Args, BotConfig, Channel, GlobalData};
|
||||
use crate::discord::emoji_race::RaceMessage;
|
||||
use crate::discord::unrecognised_command_hook;
|
||||
//use crate::discord::emoji_race::RaceMessage;
|
||||
//use crate::discord::{unrecognised_command_hook, Handler};
|
||||
use crate::discord::run_bot;
|
||||
use log::{error, info, LevelFilter};
|
||||
use magick_rust::magick_wand_genesis;
|
||||
use serenity::all::standard::BucketBuilder;
|
||||
use serenity::framework::standard::macros::{command, group, help, hook};
|
||||
use serenity::framework::standard::{Configuration, StandardFramework};
|
||||
use serenity::prelude::*;
|
||||
use songbird::SerenityInit;
|
||||
use std::sync::Once;
|
||||
use structopt::StructOpt;
|
||||
@ -31,11 +28,13 @@ async fn main() {
|
||||
let cfg = match BotConfig::new(&args.cfg_path) {
|
||||
Ok(cfg) => cfg,
|
||||
Err(err) => {
|
||||
println!("Unable to open config: {}", err);
|
||||
error!("Unable to open config: {}", err);
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
tracing_subscriber::fmt::init();
|
||||
|
||||
START.call_once(|| {
|
||||
magick_wand_genesis();
|
||||
});
|
||||
@ -43,53 +42,11 @@ async fn main() {
|
||||
let global_data = match GlobalData::new(args, cfg).await {
|
||||
Ok(global_data) => global_data,
|
||||
Err(err) => {
|
||||
println!("Error parsing config: {}", err);
|
||||
error!("Error parsing config: {}", err);
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
let framework = StandardFramework::new()
|
||||
.group(&discord::color::COLOR_GROUP)
|
||||
.group(&discord::album::ALBUMCMD_GROUP)
|
||||
.group(&discord::celeryman::CELERYMAN_GROUP)
|
||||
.group(&discord::joke::JOKE_GROUP)
|
||||
.group(&discord::admin::ADMIN_GROUP)
|
||||
.group(&discord::story::STORY_GROUP)
|
||||
.group(&discord::fren_coin::FRENCOIN_GROUP)
|
||||
.group(&discord::emoji_race::EMOJIRACE_GROUP)
|
||||
.group(&discord::motivate::MOTIVATE_GROUP)
|
||||
.group(&discord::voices::VOICES_GROUP)
|
||||
.group(&discord::shop::SHOP_GROUP)
|
||||
.group(&discord::birthday::BIRTHDAY_GROUP)
|
||||
.group(&discord::little_fren::BUDDY_GROUP)
|
||||
.unrecognised_command(unrecognised_command_hook)
|
||||
.bucket("bad_apple", BucketBuilder::default().delay(60 * 10))
|
||||
.await
|
||||
.help(&discord::MY_HELP)
|
||||
.after(discord::after);
|
||||
|
||||
framework.configure(
|
||||
Configuration::new()
|
||||
.with_whitespace(true)
|
||||
.prefix("!")
|
||||
.ignore_bots(true),
|
||||
);
|
||||
|
||||
let story_channel = Channel::<String>::new();
|
||||
let race_channel = Channel::<RaceMessage>::new();
|
||||
|
||||
let intents = GatewayIntents::all();
|
||||
let mut client = Client::builder(&global_data.cfg.bot_token, intents)
|
||||
.framework(framework)
|
||||
.register_songbird()
|
||||
.type_map_insert::<GlobalData>(global_data)
|
||||
.type_map_insert::<Channel<String>>(story_channel)
|
||||
.type_map_insert::<Channel<RaceMessage>>(race_channel)
|
||||
.event_handler(discord::Handler)
|
||||
.await
|
||||
.expect("Unable to create client.");
|
||||
|
||||
if let Err(err) = client.start().await {
|
||||
println!("Client error: {:?}", err);
|
||||
}
|
||||
info!("Fren bot starting...");
|
||||
run_bot(global_data).await;
|
||||
}
|
||||
|
||||
@ -2,10 +2,10 @@ use crate::error::Error;
|
||||
use base64::{engine::general_purpose, Engine as _};
|
||||
use j_db::database::Database;
|
||||
use j_db::model::JdbModel;
|
||||
use poise::serenity_prelude::model::id::UserId;
|
||||
use rand::distr::Alphanumeric;
|
||||
use rand::{rng, Rng};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serenity::model::id::UserId;
|
||||
use sha3::digest::FixedOutput;
|
||||
use sha3::{Digest, Sha3_256};
|
||||
|
||||
|
||||
@ -2,13 +2,13 @@ use crate::config::GlobalData;
|
||||
use crate::error::Error;
|
||||
use j_db::database::Database;
|
||||
use j_db::model::JdbModel;
|
||||
use poise::serenity_prelude::model::guild::Emoji;
|
||||
use poise::serenity_prelude::model::id::{EmojiId, GuildId};
|
||||
use poise::serenity_prelude::prelude::Context;
|
||||
use poise::serenity_prelude::utils::MessageBuilder;
|
||||
use rand::distr::{Distribution, StandardUniform};
|
||||
use rand::{rng, Rng};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serenity::model::guild::Emoji;
|
||||
use serenity::model::id::{EmojiId, GuildId};
|
||||
use serenity::prelude::Context;
|
||||
use serenity::utils::MessageBuilder;
|
||||
use std::time::Duration;
|
||||
|
||||
pub fn draw_standing(emoji: &Emoji) -> String {
|
||||
|
||||
@ -4,4 +4,4 @@ pub mod insult_compliment;
|
||||
pub mod lil_fren;
|
||||
pub mod motivation;
|
||||
pub mod random;
|
||||
pub mod task;
|
||||
//pub mod task;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
use crate::config::GlobalData;
|
||||
use crate::discord::shop::restock_shop;
|
||||
//use crate::discord::shop::restock_shop;
|
||||
use crate::error::Error;
|
||||
use crate::models::birthday::BirthdayEntry;
|
||||
use crate::models::insult_compliment::{RandomResponseTemplate, ResponseType};
|
||||
@ -7,8 +7,8 @@ use chrono::{Days, Duration, TimeZone, Timelike, Utc};
|
||||
use j_db::database::Database;
|
||||
use j_db::model::JdbModel;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serenity::all::Mentionable;
|
||||
use serenity::prelude::Context;
|
||||
use poise::serenity_prelude::all::Mentionable;
|
||||
use poise::
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize, Clone, Copy, PartialEq)]
|
||||
pub enum TaskType {
|
||||
|
||||
@ -2,8 +2,8 @@ use crate::error::Error;
|
||||
use crate::inventory::{InventoryError, InventoryManager, ItemData, ItemType, Operation};
|
||||
use j_db::database::Database;
|
||||
use j_db::model::JdbModel;
|
||||
use poise::serenity_prelude::model::id::UserId;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serenity::model::id::UserId;
|
||||
use std::fmt::{Display, Formatter};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user