Update poise version (with refactor)
set some command to ephemeral Add roles command Do some refactoring and minor changes to commands
This commit is contained in:
parent
12b934fcb4
commit
5caf820dc0
232
Cargo.lock
generated
232
Cargo.lock
generated
|
@ -165,16 +165,16 @@ checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db"
|
|||
|
||||
[[package]]
|
||||
name = "cached"
|
||||
version = "0.38.0"
|
||||
version = "0.42.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "27e6092f8c7ba6e65a46f6f26d7d7997201d3a6f0e69ff5d2440b930d7c0513a"
|
||||
checksum = "5e5877db5d1af7fae60d06b5db9430b68056a69b3582a0be8e3691e87654aeb6"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"async_once",
|
||||
"cached_proc_macro",
|
||||
"cached_proc_macro_types",
|
||||
"futures",
|
||||
"hashbrown",
|
||||
"hashbrown 0.13.2",
|
||||
"instant",
|
||||
"lazy_static",
|
||||
"once_cell",
|
||||
|
@ -184,12 +184,13 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cached_proc_macro"
|
||||
version = "0.15.0"
|
||||
version = "0.16.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "751f7f4e7a091545e7f6c65bacc404eaee7e87bfb1f9ece234a1caa173dc16f2"
|
||||
checksum = "e10ca87c81aaa3a949dbbe2b5e6c2c45dbc94ba4897e45ea31ff9ec5087be3dc"
|
||||
dependencies = [
|
||||
"cached_proc_macro_types",
|
||||
"darling 0.13.4",
|
||||
"darling",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
@ -391,43 +392,19 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "darling"
|
||||
version = "0.13.4"
|
||||
version = "0.14.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c"
|
||||
checksum = "c0808e1bd8671fb44a113a14e13497557533369847788fa2ae912b6ebfce9fa8"
|
||||
dependencies = [
|
||||
"darling_core 0.13.4",
|
||||
"darling_macro 0.13.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "darling"
|
||||
version = "0.14.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4529658bdda7fd6769b8614be250cdcfc3aeb0ee72fe66f9e41e5e5eb73eac02"
|
||||
dependencies = [
|
||||
"darling_core 0.14.1",
|
||||
"darling_macro 0.14.1",
|
||||
"darling_core",
|
||||
"darling_macro",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "darling_core"
|
||||
version = "0.13.4"
|
||||
version = "0.14.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610"
|
||||
dependencies = [
|
||||
"fnv",
|
||||
"ident_case",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"strsim",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "darling_core"
|
||||
version = "0.14.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "649c91bc01e8b1eac09fb91e8dbc7d517684ca6be8ebc75bb9cafc894f9fdb6f"
|
||||
checksum = "001d80444f28e193f30c2f293455da62dcf9a6b29918a4253152ae2b1de592cb"
|
||||
dependencies = [
|
||||
"fnv",
|
||||
"ident_case",
|
||||
|
@ -439,22 +416,11 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "darling_macro"
|
||||
version = "0.13.4"
|
||||
version = "0.14.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835"
|
||||
checksum = "b36230598a2d5de7ec1c6f51f72d8a99a9208daff41de2084d06e3fd3ea56685"
|
||||
dependencies = [
|
||||
"darling_core 0.13.4",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "darling_macro"
|
||||
version = "0.14.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ddfc69c5bfcbd2fc09a0f38451d2daf0e372e367986a83906d1b0dbc88134fb5"
|
||||
dependencies = [
|
||||
"darling_core 0.14.1",
|
||||
"darling_core",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
@ -466,7 +432,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "3495912c9c1ccf2e18976439f4443f3fee0fd61f424ff99fde6a66b15ecb448f"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"hashbrown",
|
||||
"hashbrown 0.12.3",
|
||||
"lock_api",
|
||||
"parking_lot_core",
|
||||
"serde",
|
||||
|
@ -761,6 +727,12 @@ dependencies = [
|
|||
"ahash",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.13.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e"
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
version = "0.1.19"
|
||||
|
@ -891,7 +863,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"hashbrown",
|
||||
"hashbrown 0.12.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1074,11 +1046,11 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "lru"
|
||||
version = "0.7.8"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e999beba7b6e8345721bd280141ed958096a2e4abdf74f67ff4ce49b4b54e47a"
|
||||
checksum = "b6e8aaa3f231bb4bd57b84b2d5dc3ae7f350265df8aa96492e0bc394a1571909"
|
||||
dependencies = [
|
||||
"hashbrown",
|
||||
"hashbrown 0.12.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1142,14 +1114,14 @@ dependencies = [
|
|||
"libc",
|
||||
"log",
|
||||
"wasi 0.11.0+wasi-snapshot-preview1",
|
||||
"windows-sys",
|
||||
"windows-sys 0.36.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mysql_async"
|
||||
version = "0.30.0"
|
||||
version = "0.31.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "456207bb9636a0fdade67a64cea7bdebe6730c3c16ee5e34f2c481838ee5a39e"
|
||||
checksum = "2975442c70450b8f3a0400216321f6ab7b8bda177579f533d312ac511f913655"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"crossbeam",
|
||||
|
@ -1166,6 +1138,7 @@ dependencies = [
|
|||
"pem",
|
||||
"percent-encoding",
|
||||
"pin-project",
|
||||
"priority-queue",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"socket2",
|
||||
|
@ -1179,9 +1152,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "mysql_common"
|
||||
version = "0.29.1"
|
||||
version = "0.29.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "522f2f30f72de409fc04f88df25a031f98cfc5c398a94e0b892cabb33a1464cb"
|
||||
checksum = "9006c95034ccf7b903d955f210469119f6c3477fc9c9e7a7845ce38a3e665c2a"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"bigdecimal",
|
||||
|
@ -1205,7 +1178,7 @@ dependencies = [
|
|||
"saturating",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sha-1",
|
||||
"sha1",
|
||||
"sha2",
|
||||
"smallvec",
|
||||
"subprocess",
|
||||
|
@ -1380,7 +1353,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "ccd746e37177e1711c20dd619a1620f34f5c8b569c53590a72dedd5344d8924a"
|
||||
dependencies = [
|
||||
"dlv-list",
|
||||
"hashbrown",
|
||||
"hashbrown 0.12.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1403,7 +1376,7 @@ dependencies = [
|
|||
"libc",
|
||||
"redox_syscall",
|
||||
"smallvec",
|
||||
"windows-sys",
|
||||
"windows-sys 0.36.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1517,9 +1490,9 @@ checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae"
|
|||
|
||||
[[package]]
|
||||
name = "poise"
|
||||
version = "0.3.0"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f6c01d22dcda434b0dfe956c60f6ac9b0352c4c2f4af852afb3155a971cd306d"
|
||||
checksum = "2ca787e4e516076de1995a83ee05fbdfed71d072ea0da3df018318db42a87803"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"derivative",
|
||||
|
@ -1536,11 +1509,11 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "poise_macros"
|
||||
version = "0.3.0"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "52ff861b6a52ec47bc54eb17424c025feeb040e82836036276c25dda045a8a0c"
|
||||
checksum = "b80c1f4e04114527f9d41ed6bb31707a095276f51bb0aef3ca11f062b25a67c4"
|
||||
dependencies = [
|
||||
"darling 0.14.1",
|
||||
"darling",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
|
@ -1552,6 +1525,16 @@ version = "0.2.16"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872"
|
||||
|
||||
[[package]]
|
||||
name = "priority-queue"
|
||||
version = "1.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5ca9c6be70d989d21a136eb86c2d83e4b328447fac4a88dace2143c179c86267"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"indexmap",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-hack"
|
||||
version = "0.5.19"
|
||||
|
@ -1560,9 +1543,9 @@ checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5"
|
|||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.43"
|
||||
version = "1.0.51"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0a2ca2c61bc9f3d74d2886294ab7b9853abd9c1ad903a3ac7815c58989bb7bab"
|
||||
checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
@ -1790,7 +1773,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "88d6731146462ea25d9244b2ed5fd1d716d25c52e4d54aa4fb0f3c4e9854dbe2"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"windows-sys",
|
||||
"windows-sys 0.36.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1928,6 +1911,17 @@ dependencies = [
|
|||
"digest",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sha1"
|
||||
version = "0.10.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "006769ba83e921b3085caa8334186b00cf92b4cb1a6cf4632fbccc8eff5c7549"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cpufeatures",
|
||||
"digest",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sha2"
|
||||
version = "0.10.2"
|
||||
|
@ -1956,13 +1950,13 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "simplelog"
|
||||
version = "0.11.2"
|
||||
version = "0.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c1348164456f72ca0116e4538bdaabb0ddb622c7d9f16387c725af3e96d6001c"
|
||||
checksum = "48dfff04aade74dd495b007c831cd6f4e0cee19c344dd9dc0884c0289b70a786"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"log",
|
||||
"termcolor",
|
||||
"time 0.3.13",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2099,8 +2093,15 @@ dependencies = [
|
|||
"libc",
|
||||
"num_threads",
|
||||
"serde",
|
||||
"time-macros",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "time-macros"
|
||||
version = "0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "42657b1a6f4d817cda8e7a0ace261fe0cc946cf3a80314390b22cc61ae080792"
|
||||
|
||||
[[package]]
|
||||
name = "tinyvec"
|
||||
version = "1.6.0"
|
||||
|
@ -2118,9 +2119,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
|
|||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.20.1"
|
||||
version = "1.26.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7a8325f63a7d4774dd041e363b2409ed1c5cbbd0f867795e661df066b2b0a581"
|
||||
checksum = "03201d01c3c27a29c8a5cee5b55a93ddae1ccf6f08f65365c2c918f8c1b76f64"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"bytes",
|
||||
|
@ -2128,12 +2129,11 @@ dependencies = [
|
|||
"memchr",
|
||||
"mio",
|
||||
"num_cpus",
|
||||
"once_cell",
|
||||
"pin-project-lite",
|
||||
"signal-hook-registry",
|
||||
"socket2",
|
||||
"tokio-macros",
|
||||
"winapi",
|
||||
"windows-sys 0.45.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2513,43 +2513,109 @@ version = "0.36.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2"
|
||||
dependencies = [
|
||||
"windows_aarch64_msvc",
|
||||
"windows_i686_gnu",
|
||||
"windows_i686_msvc",
|
||||
"windows_x86_64_gnu",
|
||||
"windows_x86_64_msvc",
|
||||
"windows_aarch64_msvc 0.36.1",
|
||||
"windows_i686_gnu 0.36.1",
|
||||
"windows_i686_msvc 0.36.1",
|
||||
"windows_x86_64_gnu 0.36.1",
|
||||
"windows_x86_64_msvc 0.36.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.45.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0"
|
||||
dependencies = [
|
||||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.42.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm",
|
||||
"windows_aarch64_msvc 0.42.1",
|
||||
"windows_i686_gnu 0.42.1",
|
||||
"windows_i686_msvc 0.42.1",
|
||||
"windows_x86_64_gnu 0.42.1",
|
||||
"windows_x86_64_gnullvm",
|
||||
"windows_x86_64_msvc 0.42.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.42.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.36.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.42.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.36.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.42.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.36.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.42.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.36.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.42.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.42.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.36.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.42.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd"
|
||||
|
||||
[[package]]
|
||||
name = "winreg"
|
||||
version = "0.10.1"
|
||||
|
|
|
@ -6,16 +6,16 @@ edition = "2021"
|
|||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
cached = "0.38"
|
||||
cached = "0.42"
|
||||
chrono = "0.4"
|
||||
config = "0.13"
|
||||
futures = { version = "0.3", default-features = false }
|
||||
glob = "0.3"
|
||||
lazy_static = "1"
|
||||
log = "0.4"
|
||||
mysql_async = "0.30"
|
||||
simplelog = "0.11.1"
|
||||
poise = { version = "0.3", features = ["collector"] }
|
||||
mysql_async = "0.31"
|
||||
simplelog = "0.12"
|
||||
poise = { version = "0.5", features = ["collector"] }
|
||||
rand = "0.8"
|
||||
regex = {version="1"}
|
||||
reqwest = "0.11"
|
||||
|
|
|
@ -29,7 +29,7 @@ pub async fn get_command(sign: &str, con: &mut Conn) -> Result<Option<String>, m
|
|||
Ok(a)
|
||||
}
|
||||
|
||||
// F1TV links throughout the seasons
|
||||
// Run any of a collection of arbitrary commands
|
||||
#[poise::command(slash_command)]
|
||||
pub async fn coms(
|
||||
ctx: Context<'_>,
|
||||
|
|
|
@ -117,7 +117,7 @@ async fn get_events() -> Vec<Events> {
|
|||
}
|
||||
|
||||
// All events filtered (Eurosport, NFL, Viaplay)
|
||||
#[poise::command(slash_command)]
|
||||
#[poise::command(slash_command, ephemeral)]
|
||||
pub async fn all(
|
||||
ctx: Context<'_>,
|
||||
#[description = "Filter sessions for when they are/were happening"] timeframe: Timeframe,
|
||||
|
|
|
@ -151,8 +151,8 @@ pub async fn get_schedule() -> Option<Vec<CmoreEvent>> {
|
|||
result
|
||||
}
|
||||
|
||||
//Cmore events listing
|
||||
#[poise::command(slash_command)]
|
||||
// Cmore events listing
|
||||
#[poise::command(slash_command, ephemeral)]
|
||||
pub async fn cmore(
|
||||
ctx: Context<'_>,
|
||||
#[description = "Filter sessions for when they are/were happening, defaults to future"]
|
||||
|
|
|
@ -298,7 +298,7 @@ pub async fn get_eurosport_events(url: String) -> Option<Vec<ESEvents>> {
|
|||
}
|
||||
|
||||
// Eurosport player events
|
||||
#[poise::command(slash_command)]
|
||||
#[poise::command(slash_command, ephemeral)]
|
||||
pub async fn eurosport(
|
||||
ctx: Context<'_>,
|
||||
#[description = "Filter sessions for when they are/were happening, defaults to future"]
|
||||
|
|
|
@ -12,6 +12,7 @@ async fn autocomplete_season<'a>(
|
|||
) -> impl Iterator<Item = String> + 'a {
|
||||
(1981..2023)
|
||||
.map(|n: u32| n.to_string())
|
||||
.rev()
|
||||
.filter(move |e| e.starts_with(&partial))
|
||||
.map(|e| e.to_string())
|
||||
}
|
||||
|
@ -195,7 +196,7 @@ async fn get_sessions(season: String) -> Option<Season> {
|
|||
}
|
||||
|
||||
// F1TV links throughout the seasons
|
||||
#[poise::command(slash_command)]
|
||||
#[poise::command(slash_command, ephemeral)]
|
||||
pub async fn f1(
|
||||
ctx: Context<'_>,
|
||||
#[description = "Which season to pull from?"]
|
||||
|
@ -237,7 +238,7 @@ pub async fn f1(
|
|||
})
|
||||
.await?;
|
||||
|
||||
while let Some(mci) = serenity::CollectComponentInteraction::new(ctx.discord())
|
||||
while let Some(mci) = serenity::CollectComponentInteraction::new(ctx)
|
||||
.channel_id(ctx.channel_id())
|
||||
.filter(move |mci| mci.data.custom_id == content_id.to_string())
|
||||
.await
|
||||
|
@ -247,7 +248,7 @@ pub async fn f1(
|
|||
let ses = get_event(session).await;
|
||||
println!("Now responding to interaction");
|
||||
match mci
|
||||
.create_interaction_response(ctx.discord(), |ir| {
|
||||
.create_interaction_response(ctx, |ir| {
|
||||
ir.kind(serenity::InteractionResponseType::UpdateMessage)
|
||||
.interaction_response_data(|m| match ses {
|
||||
None => m.content("Unable to get these events :("),
|
||||
|
|
|
@ -70,7 +70,8 @@ pub enum Timeframe {
|
|||
"nfl::nfl",
|
||||
"cmore::cmore",
|
||||
"all::all"
|
||||
)
|
||||
),
|
||||
ephemeral
|
||||
)]
|
||||
pub async fn links(ctx: Context<'_>) -> Result<(), Error> {
|
||||
ctx.say("Hello there!").await?;
|
||||
|
|
|
@ -196,7 +196,7 @@ async fn get_schedule(week: u8) -> Option<Vec<NFLEvent>> {
|
|||
}
|
||||
|
||||
//NFL events listing
|
||||
#[poise::command(slash_command)]
|
||||
#[poise::command(slash_command, ephemeral)]
|
||||
pub async fn nfl(
|
||||
ctx: Context<'_>,
|
||||
#[description = "Filter sessions for when they are/were happening, defaults to future"]
|
||||
|
|
|
@ -241,7 +241,7 @@ async fn autocomplete_sport<'a>(
|
|||
}
|
||||
|
||||
//Viaplay events listing
|
||||
#[poise::command(slash_command)]
|
||||
#[poise::command(slash_command, ephemeral)]
|
||||
pub async fn viaplay(
|
||||
ctx: Context<'_>,
|
||||
#[description = "Filter sessions for when they are/were happening, defaults to future"]
|
||||
|
|
|
@ -85,7 +85,7 @@ async fn get_schedule() -> Result<Option<WRC>, Error> {
|
|||
}
|
||||
|
||||
// WRC sessions
|
||||
#[poise::command(slash_command)]
|
||||
#[poise::command(slash_command, ephemeral)]
|
||||
pub async fn wrc(
|
||||
ctx: Context<'_>,
|
||||
// #[description = "Filter sessions for when they are/were happening, defaults to future"]
|
||||
|
|
|
@ -5,6 +5,7 @@ pub mod invites;
|
|||
mod links;
|
||||
// pub mod planning;
|
||||
pub mod coms;
|
||||
pub mod roles;
|
||||
pub mod schedule;
|
||||
pub mod utils;
|
||||
|
||||
|
@ -27,7 +28,7 @@ pub async fn boop(ctx: Context<'_>) -> Result<(), Error> {
|
|||
.await?;
|
||||
|
||||
let mut boop_count: i32 = 0;
|
||||
while let Some(mci) = serenity::CollectComponentInteraction::new(ctx.discord())
|
||||
while let Some(mci) = serenity::CollectComponentInteraction::new(ctx)
|
||||
.channel_id(ctx.channel_id())
|
||||
// .timeout(std::time::Duration::from_secs(1200))
|
||||
.filter(move |mci| mci.data.custom_id == uuid_boop.to_string())
|
||||
|
@ -36,7 +37,7 @@ pub async fn boop(ctx: Context<'_>) -> Result<(), Error> {
|
|||
boop_count += 1;
|
||||
|
||||
let mut msg = mci.message.clone();
|
||||
msg.edit(ctx.discord(), |m| {
|
||||
msg.edit(ctx, |m| {
|
||||
m.content(match boop_count {
|
||||
2 => "Boop count: <:HamSmile:738765923401596991>".to_string(),
|
||||
3 => "Boop 3".to_string(),
|
||||
|
@ -60,7 +61,7 @@ pub async fn boop(ctx: Context<'_>) -> Result<(), Error> {
|
|||
})
|
||||
.await?;
|
||||
|
||||
mci.create_interaction_response(ctx.discord(), |ir| {
|
||||
mci.create_interaction_response(ctx, |ir| {
|
||||
ir.kind(serenity::InteractionResponseType::DeferredUpdateMessage)
|
||||
})
|
||||
.await?;
|
||||
|
@ -69,6 +70,7 @@ pub async fn boop(ctx: Context<'_>) -> Result<(), Error> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
// Imaginary fix button
|
||||
#[poise::command(track_edits, slash_command)]
|
||||
pub async fn fix(ctx: Context<'_>) -> Result<(), Error> {
|
||||
let uuid_fix = ctx.id();
|
||||
|
@ -88,7 +90,7 @@ pub async fn fix(ctx: Context<'_>) -> Result<(), Error> {
|
|||
.await?;
|
||||
|
||||
let mut fix_count: i32 = 0;
|
||||
while let Some(mci) = serenity::CollectComponentInteraction::new(ctx.discord())
|
||||
while let Some(mci) = serenity::CollectComponentInteraction::new(ctx)
|
||||
.channel_id(ctx.channel_id())
|
||||
// .timeout(std::time::Duration::from_secs(1200))
|
||||
.filter(move |mci| mci.data.custom_id == uuid_fix.to_string())
|
||||
|
@ -97,12 +99,12 @@ pub async fn fix(ctx: Context<'_>) -> Result<(), Error> {
|
|||
fix_count += 1;
|
||||
|
||||
let mut msg = mci.message.clone();
|
||||
msg.edit(ctx.discord(), |m| {
|
||||
msg.edit(ctx, |m| {
|
||||
m.content(format!("Fixing failed try again. Attempt {}", fix_count))
|
||||
})
|
||||
.await?;
|
||||
|
||||
mci.create_interaction_response(ctx.discord(), |ir| {
|
||||
mci.create_interaction_response(ctx, |ir| {
|
||||
ir.kind(serenity::InteractionResponseType::DeferredUpdateMessage)
|
||||
})
|
||||
.await?;
|
||||
|
|
|
@ -63,7 +63,7 @@ pub async fn series(
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[derive(Debug, poise::SlashChoiceParameter)]
|
||||
#[derive(Debug, poise::ChoiceParameter)]
|
||||
pub enum Timeframe {
|
||||
#[name = "Currently happening"]
|
||||
Current,
|
||||
|
|
93
src/commands/roles.rs
Normal file
93
src/commands/roles.rs
Normal file
|
@ -0,0 +1,93 @@
|
|||
use crate::{Context, Error};
|
||||
use poise::serenity_prelude::RoleId;
|
||||
|
||||
#[derive(Debug, poise::ChoiceParameter)]
|
||||
pub enum Action {
|
||||
#[name = "Add specified role."]
|
||||
Add,
|
||||
#[name = "Remove specified role."]
|
||||
Remove,
|
||||
#[name = "Toggle specified role (default)."]
|
||||
Toggle,
|
||||
}
|
||||
|
||||
async fn autocomplete_role<'a>(
|
||||
ctx: Context<'_>,
|
||||
partial: &'a str,
|
||||
) -> impl Iterator<Item = String> + 'a {
|
||||
let mut roles: Vec<String> = match super::super::SETTINGS
|
||||
.read()
|
||||
.unwrap()
|
||||
.get_table("roles")
|
||||
.unwrap()
|
||||
.get(&ctx.guild_id().expect("Not in a guild").to_string())
|
||||
{
|
||||
None => {vec![]}
|
||||
Some(val) => {
|
||||
match val.clone()
|
||||
.into_table()
|
||||
{
|
||||
Err(_) => {vec![]}
|
||||
Ok(val) => {
|
||||
val.into_keys()
|
||||
.filter(|str| {str.contains(partial)})
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
roles.sort_unstable();
|
||||
|
||||
roles.into_iter() //.map(|a| a.to_owned())
|
||||
}
|
||||
|
||||
#[poise::command(slash_command, ephemeral, guild_only)]
|
||||
pub async fn roles(
|
||||
ctx: Context<'_>,
|
||||
#[description = "Which role to add or remove?"]
|
||||
#[autocomplete = "autocomplete_role"]
|
||||
role: String,
|
||||
#[description = "Remove or add role (default to add)"] action: Option<Action>,
|
||||
) -> Result<(), Error> {
|
||||
let role = super::super::SETTINGS
|
||||
.read()
|
||||
.unwrap()
|
||||
.get_table("roles")
|
||||
.unwrap()
|
||||
.get(&ctx.guild_id().unwrap().to_string())
|
||||
.expect("Command is only supported in a server")
|
||||
.clone()
|
||||
.into_table()
|
||||
.expect("Config error, something in the configuration is wrong. Please contact someone to fix the bot.")
|
||||
.get(&role)
|
||||
.expect("Configured role does not exist")
|
||||
.clone()
|
||||
.into_uint()
|
||||
.expect("Config error, specified role does not have the role_id configured.");
|
||||
let role_ding = RoleId(role);
|
||||
let mut member = ctx.author_member().await.expect("Where's my member....");
|
||||
let mem = member.to_mut();
|
||||
// if let Some(mut author) = ctx.author_member().await.as_mut().expect("Somehow there's no member object attached...") {
|
||||
match action {
|
||||
Some(Action::Remove) => {
|
||||
mem.remove_role(ctx, role_ding).await?;
|
||||
ctx.say(format!("Role {} Added", role)).await?
|
||||
}
|
||||
Some(Action::Add) => {
|
||||
mem.add_role(ctx, role_ding).await?;
|
||||
ctx.say(format!("Role {} Added", role)).await?
|
||||
}
|
||||
_ => {
|
||||
if mem.roles.contains(&role_ding) {
|
||||
mem.remove_role(ctx, role_ding).await?;
|
||||
ctx.say(format!("Role {} Added", role)).await?
|
||||
} else {
|
||||
mem.add_role(ctx, role_ding).await?;
|
||||
ctx.say(format!("Role {} Added", role)).await?
|
||||
}
|
||||
}
|
||||
};
|
||||
Ok(())
|
||||
}
|
|
@ -31,14 +31,14 @@ impl MSEvent {
|
|||
fn get_value(&self, high_tier: bool) -> String {
|
||||
let link = if high_tier {
|
||||
format!(
|
||||
"[{id}](https://morningstreams.com/hightier/f1/session/{id})\n",
|
||||
"[{id}](https://morningstreams.com/hightier/f1/session/{id})",
|
||||
id = self.id
|
||||
)
|
||||
} else {
|
||||
"".to_string()
|
||||
};
|
||||
format!(
|
||||
"{link}Start: <t:{start}:R>\nEnd: <t:{end}:R>",
|
||||
"{link}\nStart: <t:{start}:R>\nEnd: <t:{end}:R>",
|
||||
link = link,
|
||||
start = self.metadata.attributes.start.timestamp(),
|
||||
end = self.metadata.attributes.end.timestamp()
|
||||
|
@ -136,7 +136,8 @@ async fn get_schedule() -> Option<MSReq> {
|
|||
result
|
||||
}
|
||||
|
||||
#[poise::command(slash_command)]
|
||||
// Get the most recent F1 schedule
|
||||
#[poise::command(slash_command, ephemeral)]
|
||||
pub async fn schedule(ctx: Context<'_>) -> Result<(), Error> {
|
||||
let events: Option<MSReq> = get_schedule().await;
|
||||
let ht: bool = utils::high_tier(ctx).await;
|
||||
|
|
|
@ -11,13 +11,13 @@ pub async fn high_tier(ctx: Context<'_>) -> bool {
|
|||
_ => (),
|
||||
}
|
||||
|
||||
match ctx.discord().cache.guild_channel(ctx.channel_id()) {
|
||||
match ctx.serenity_context().cache.guild_channel(ctx.channel_id()) {
|
||||
None => return false,
|
||||
Some(chan) => match chan.parent_id {
|
||||
None => return false,
|
||||
Some(cat_id) => match cat_id {
|
||||
ChannelId(547551264498515978) => return true,
|
||||
ChannelId(884698356360818708) => return true,
|
||||
ChannelId(547551264498515978) => return true, // MS high tier
|
||||
ChannelId(884698356360818708) => return true, // Private server
|
||||
_ => return false,
|
||||
},
|
||||
},
|
||||
|
@ -92,7 +92,7 @@ pub async fn paginate_string(ctx: Context<'_>, pages: Vec<String>) -> Result<(),
|
|||
// let interaction = interaction1.unwrap();
|
||||
|
||||
let mut page = 0;
|
||||
while let Some(mci) = serenity::CollectComponentInteraction::new(ctx.discord())
|
||||
while let Some(mci) = serenity::CollectComponentInteraction::new(ctx)
|
||||
// .author_id(ctx.author().id)
|
||||
.channel_id(ctx.channel_id())
|
||||
.timeout(std::time::Duration::from_secs(1200))
|
||||
|
@ -116,7 +116,7 @@ pub async fn paginate_string(ctx: Context<'_>, pages: Vec<String>) -> Result<(),
|
|||
}
|
||||
|
||||
let mut msg = mci.message.clone();
|
||||
msg.edit(ctx.discord(), |m| {
|
||||
msg.edit(ctx, |m| {
|
||||
m.content(format!(
|
||||
"{}\n\nPage: {}/{}",
|
||||
pages.get(page).unwrap(),
|
||||
|
@ -126,7 +126,7 @@ pub async fn paginate_string(ctx: Context<'_>, pages: Vec<String>) -> Result<(),
|
|||
})
|
||||
.await?;
|
||||
|
||||
mci.create_interaction_response(ctx.discord(), |ir| {
|
||||
mci.create_interaction_response(ctx, |ir| {
|
||||
ir.kind(serenity::InteractionResponseType::DeferredUpdateMessage)
|
||||
})
|
||||
.await?;
|
||||
|
@ -193,7 +193,7 @@ pub async fn paginate_string_embed(
|
|||
// let interaction = interaction1.unwrap();
|
||||
|
||||
let mut page = 0;
|
||||
while let Some(mci) = serenity::CollectComponentInteraction::new(ctx.discord())
|
||||
while let Some(mci) = serenity::CollectComponentInteraction::new(ctx)
|
||||
// .author_id(ctx.author().id)
|
||||
.channel_id(ctx.channel_id())
|
||||
.timeout(std::time::Duration::from_secs(1200))
|
||||
|
@ -217,7 +217,7 @@ pub async fn paginate_string_embed(
|
|||
}
|
||||
|
||||
let mut msg = mci.message.clone();
|
||||
msg.edit(ctx.discord(), |m| {
|
||||
msg.edit(ctx, |m| {
|
||||
m.embed(|e| {
|
||||
e.title(format!("{} Page {}/{}", title, page + 1, page_count))
|
||||
.description(pages.get(page).unwrap())
|
||||
|
@ -225,7 +225,7 @@ pub async fn paginate_string_embed(
|
|||
})
|
||||
.await?;
|
||||
|
||||
mci.create_interaction_response(ctx.discord(), |ir| {
|
||||
mci.create_interaction_response(ctx, |ir| {
|
||||
ir.kind(serenity::InteractionResponseType::DeferredUpdateMessage)
|
||||
})
|
||||
.await?;
|
||||
|
|
11
src/main.rs
11
src/main.rs
|
@ -74,7 +74,7 @@ async fn register(
|
|||
"Purging global commands, must have been a mistake eh?"
|
||||
))
|
||||
.await?;
|
||||
ctx.discord()
|
||||
ctx.serenity_context()
|
||||
.http
|
||||
.create_global_application_commands(&serenity::json::Value::Null)
|
||||
.await?;
|
||||
|
@ -85,7 +85,7 @@ async fn register(
|
|||
commands.len()
|
||||
))
|
||||
.await?;
|
||||
ctx.discord()
|
||||
ctx.serenity_context()
|
||||
.http
|
||||
.create_global_application_commands(&commands_builder)
|
||||
.await?;
|
||||
|
@ -111,7 +111,7 @@ async fn register(
|
|||
commands.len()
|
||||
))
|
||||
.await?;
|
||||
ctx.discord()
|
||||
ctx.serenity_context()
|
||||
.http
|
||||
.create_guild_application_commands(guild.id.0, &commands_builder)
|
||||
.await?;
|
||||
|
@ -127,7 +127,7 @@ async fn on_error(error: poise::FrameworkError<'_, Data, Error>) {
|
|||
// They are many errors that can occur, so we only handle the ones we want to customize
|
||||
// and forward the rest to the default handler
|
||||
match error {
|
||||
poise::FrameworkError::Setup { error } => panic!("Failed to start bot: {:?}", error),
|
||||
poise::FrameworkError::Setup { error, .. } => panic!("Failed to start bot: {:?}", error),
|
||||
poise::FrameworkError::Command { error, ctx } => {
|
||||
println!("Error in command `{}`: {:?}", ctx.command().name, error,);
|
||||
}
|
||||
|
@ -182,6 +182,7 @@ async fn app() -> Result<(), Error> {
|
|||
register(),
|
||||
commands::invites::invites(),
|
||||
commands::schedule::schedule(),
|
||||
commands::roles::roles(),
|
||||
commands::boop(),
|
||||
commands::fix(),
|
||||
// commands::planning::get_command(),
|
||||
|
@ -245,7 +246,7 @@ async fn app() -> Result<(), Error> {
|
|||
|
||||
let framework = poise::Framework::builder()
|
||||
.token(token)
|
||||
.user_data_setup(move |_ctx, _ready, _framework| {
|
||||
.setup(move |_ctx, _ready, _framework| {
|
||||
// Box::pin(async move { Ok(Data { database: database }) })
|
||||
Box::pin(async move { Ok(Data { database: db }) })
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue