guild data caching

This commit is contained in:
jellywx 2021-04-12 22:33:02 +01:00
parent 72a976dea8
commit 0a9624d12d
9 changed files with 214 additions and 222 deletions

188
Cargo.lock generated
View File

@ -61,9 +61,9 @@ dependencies = [
[[package]] [[package]]
name = "async-tungstenite" name = "async-tungstenite"
version = "0.13.0" version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5cb4e1f5450b0f41b0dad072f176f2faca87dab540492ee17d73615d5e6f4ee1" checksum = "07b30ef0ea5c20caaa54baea49514a206308989c68be7ecd86c7f956e4da6378"
dependencies = [ dependencies = [
"futures-io", "futures-io",
"futures-util", "futures-util",
@ -213,8 +213,8 @@ dependencies = [
[[package]] [[package]]
name = "command_attr" name = "command_attr"
version = "0.3.4" version = "0.3.5"
source = "git+https://github.com/serenity-rs/serenity?branch=next#943cf037c114ddf3513a3c8c3a2301da41c34f9e" source = "git+https://github.com/serenity-rs/serenity?branch=next#ed8d7ab1df6427be825b66c590fd02dd3ab5dfc0"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -263,9 +263,9 @@ dependencies = [
[[package]] [[package]]
name = "crossbeam-channel" name = "crossbeam-channel"
version = "0.5.0" version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775" checksum = "06ed27e177f16d65f0f0c22a213e17c696ace5dd64b14258b52f9417ccb52db4"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"crossbeam-utils", "crossbeam-utils",
@ -396,9 +396,9 @@ checksum = "fed34cd105917e91daa4da6b3728c47b068749d6a62c59811f06ed2ac71d9da7"
[[package]] [[package]]
name = "futures" name = "futures"
version = "0.3.13" version = "0.3.14"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f55667319111d593ba876406af7c409c0ebb44dc4be6132a783ccf163ea14c1" checksum = "a9d5813545e459ad3ca1bff9915e9ad7f1a47dc6a91b627ce321d5863b7dd253"
dependencies = [ dependencies = [
"futures-channel", "futures-channel",
"futures-core", "futures-core",
@ -411,9 +411,9 @@ dependencies = [
[[package]] [[package]]
name = "futures-channel" name = "futures-channel"
version = "0.3.13" version = "0.3.14"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8c2dd2df839b57db9ab69c2c9d8f3e8c81984781937fe2807dc6dcf3b2ad2939" checksum = "ce79c6a52a299137a6013061e0cf0e688fce5d7f1bc60125f520912fdb29ec25"
dependencies = [ dependencies = [
"futures-core", "futures-core",
"futures-sink", "futures-sink",
@ -421,15 +421,15 @@ dependencies = [
[[package]] [[package]]
name = "futures-core" name = "futures-core"
version = "0.3.13" version = "0.3.14"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "15496a72fabf0e62bdc3df11a59a3787429221dd0710ba8ef163d6f7a9112c94" checksum = "098cd1c6dda6ca01650f1a37a794245eb73181d0d4d4e955e2f3c37db7af1815"
[[package]] [[package]]
name = "futures-executor" name = "futures-executor"
version = "0.3.13" version = "0.3.14"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "891a4b7b96d84d5940084b2a37632dd65deeae662c114ceaa2c879629c9c0ad1" checksum = "10f6cb7042eda00f0049b1d2080aa4b93442997ee507eb3828e8bd7577f94c9d"
dependencies = [ dependencies = [
"futures-core", "futures-core",
"futures-task", "futures-task",
@ -438,15 +438,15 @@ dependencies = [
[[package]] [[package]]
name = "futures-io" name = "futures-io"
version = "0.3.13" version = "0.3.14"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d71c2c65c57704c32f5241c1223167c2c3294fd34ac020c807ddbe6db287ba59" checksum = "365a1a1fb30ea1c03a830fdb2158f5236833ac81fa0ad12fe35b29cddc35cb04"
[[package]] [[package]]
name = "futures-macro" name = "futures-macro"
version = "0.3.13" version = "0.3.14"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea405816a5139fb39af82c2beb921d52143f556038378d6db21183a5c37fbfb7" checksum = "668c6733a182cd7deb4f1de7ba3bf2120823835b3bcfbeacf7d2c4a773c1bb8b"
dependencies = [ dependencies = [
"proc-macro-hack", "proc-macro-hack",
"proc-macro2", "proc-macro2",
@ -456,21 +456,21 @@ dependencies = [
[[package]] [[package]]
name = "futures-sink" name = "futures-sink"
version = "0.3.13" version = "0.3.14"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85754d98985841b7d4f5e8e6fbfa4a4ac847916893ec511a2917ccd8525b8bb3" checksum = "5c5629433c555de3d82861a7a4e3794a4c40040390907cfbfd7143a92a426c23"
[[package]] [[package]]
name = "futures-task" name = "futures-task"
version = "0.3.13" version = "0.3.14"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa189ef211c15ee602667a6fcfe1c1fd9e07d42250d2156382820fba33c9df80" checksum = "ba7aa51095076f3ba6d9a1f702f74bd05ec65f555d70d2033d55ba8d69f581bc"
[[package]] [[package]]
name = "futures-util" name = "futures-util"
version = "0.3.13" version = "0.3.14"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1812c7ab8aedf8d6f2701a43e1243acdbcc2b36ab26e2ad421eb99ac963d96d1" checksum = "3c144ad54d60f23927f0a6b6d816e4271278b64f005ad65e4e35291d2de9c025"
dependencies = [ dependencies = [
"futures-channel", "futures-channel",
"futures-core", "futures-core",
@ -520,9 +520,9 @@ dependencies = [
[[package]] [[package]]
name = "h2" name = "h2"
version = "0.3.1" version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d832b01df74254fe364568d6ddc294443f61cbec82816b60904303af87efae78" checksum = "fc018e188373e2777d0ef2467ebff62a08e66c3f5857b23c8fbec3018210dc00"
dependencies = [ dependencies = [
"bytes", "bytes",
"fnv", "fnv",
@ -581,9 +581,9 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
[[package]] [[package]]
name = "http" name = "http"
version = "0.2.3" version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7245cd7449cc792608c3c8a9eaf69bd4eabbabf802713748fd739c98b82f0747" checksum = "527e8c9ac747e28542699a951517aa9a6945af506cd1f2e1b53a576c17b6cc11"
dependencies = [ dependencies = [
"bytes", "bytes",
"fnv", "fnv",
@ -603,9 +603,9 @@ dependencies = [
[[package]] [[package]]
name = "httparse" name = "httparse"
version = "1.3.5" version = "1.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "615caabe2c3160b313d52ccc905335f4ed5f10881dd63dc5699d47e90be85691" checksum = "bc35c995b9d93ec174cf9a27d425c7892722101e14993cd227fdb51d70cf9589"
[[package]] [[package]]
name = "httpdate" name = "httpdate"
@ -621,9 +621,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
[[package]] [[package]]
name = "hyper" name = "hyper"
version = "0.14.4" version = "0.14.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8e946c2b1349055e0b72ae281b238baf1a3ea7307c7e9f9d64673bdd9c26ac7" checksum = "8bf09f61b52cfcf4c00de50df88ae423d6c02354e385a86341133b5338630ad1"
dependencies = [ dependencies = [
"bytes", "bytes",
"futures-channel", "futures-channel",
@ -724,9 +724,9 @@ checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736"
[[package]] [[package]]
name = "js-sys" name = "js-sys"
version = "0.3.49" version = "0.3.50"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc15e39392125075f60c95ba416f5381ff6c3a948ff02ab12464715adf56c821" checksum = "2d99f9e3e84b8f67f846ef5b4cbbc3b1c29f6c759fcbce6f01aa0e73d932a24c"
dependencies = [ dependencies = [
"wasm-bindgen", "wasm-bindgen",
] ]
@ -761,9 +761,9 @@ dependencies = [
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.90" version = "0.2.93"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba4aede83fc3617411dc6993bc8c70919750c1c257c6ca6a502aed6e0e2394ae" checksum = "9385f66bf6105b241aa65a61cb923ef20efc665cb9f9bb50ac2f0c4b7f378d41"
[[package]] [[package]]
name = "libm" name = "libm"
@ -773,9 +773,9 @@ checksum = "c7d73b3f436185384286bd8098d17ec07c9a7d2388a6599f824d8502b529702a"
[[package]] [[package]]
name = "lock_api" name = "lock_api"
version = "0.4.2" version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd96ffd135b2fd7b973ac026d28085defbe8983df057ced3eb4f2130b0831312" checksum = "5a3c91c24eae6777794bb1997ad98bbb87daf92890acab859f7eaa4320333176"
dependencies = [ dependencies = [
"scopeguard", "scopeguard",
] ]
@ -835,9 +835,9 @@ dependencies = [
[[package]] [[package]]
name = "mio" name = "mio"
version = "0.7.10" version = "0.7.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2182a122f3b7f3f5329cb1972cee089ba2459a0a80a56935e6e674f096f8d839" checksum = "cf80d3e903b34e0bd7282b218398aec54e082c840d9baf8339e0080a0c542956"
dependencies = [ dependencies = [
"libc", "libc",
"log", "log",
@ -848,11 +848,10 @@ dependencies = [
[[package]] [[package]]
name = "miow" name = "miow"
version = "0.3.6" version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a33c1b55807fbed163481b5ba66db4b2fa6cde694a5027be10fb724206c5897" checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21"
dependencies = [ dependencies = [
"socket2",
"winapi", "winapi",
] ]
@ -1075,18 +1074,18 @@ checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e"
[[package]] [[package]]
name = "pin-project" name = "pin-project"
version = "1.0.5" version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96fa8ebb90271c4477f144354485b8068bd8f6b78b428b01ba892ca26caf0b63" checksum = "bc174859768806e91ae575187ada95c91a29e96a98dc5d2cd9a1fed039501ba6"
dependencies = [ dependencies = [
"pin-project-internal", "pin-project-internal",
] ]
[[package]] [[package]]
name = "pin-project-internal" name = "pin-project-internal"
version = "1.0.5" version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "758669ae3558c6f74bd2a18b41f7ac0b5a195aea6639d6a9b5e5d1ad5ba24c0b" checksum = "a490329918e856ed1b083f244e3bfe2d8c4f336407e4ea9e1a9f479ff09049e5"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -1131,9 +1130,9 @@ checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086"
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.24" version = "1.0.26"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" checksum = "a152013215dca273577e18d2bf00fa862b89b24169fb78c4c95aeb07992c9cec"
dependencies = [ dependencies = [
"unicode-xid", "unicode-xid",
] ]
@ -1271,7 +1270,7 @@ dependencies = [
[[package]] [[package]]
name = "reminder_rs" name = "reminder_rs"
version = "1.4.12" version = "1.4.13"
dependencies = [ dependencies = [
"Inflector", "Inflector",
"chrono", "chrono",
@ -1418,9 +1417,9 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
[[package]] [[package]]
name = "sct" name = "sct"
version = "0.6.0" version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3042af939fca8c3453b7af0f1c66e533a15a86169e39de2657310ade8f98d3c" checksum = "b362b83898e0e69f38515b82ee15aa80636befe47c3b6d3d89a911e78fc228ce"
dependencies = [ dependencies = [
"ring", "ring",
"untrusted", "untrusted",
@ -1428,9 +1427,9 @@ dependencies = [
[[package]] [[package]]
name = "security-framework" name = "security-framework"
version = "2.1.2" version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d493c5f39e02dfb062cd8f33301f90f9b13b650e8c1b1d0fd75c19dd64bff69d" checksum = "3670b1d2fdf6084d192bc71ead7aabe6c06aa2ea3fbd9cc3ac111fa5c2b1bd84"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"core-foundation", "core-foundation",
@ -1441,9 +1440,9 @@ dependencies = [
[[package]] [[package]]
name = "security-framework-sys" name = "security-framework-sys"
version = "2.1.1" version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dee48cdde5ed250b0d3252818f646e174ab414036edb884dde62d80a3ac6082d" checksum = "3676258fd3cfe2c9a0ec99ce3038798d847ce3e4bb17746373eb9f0f1ac16339"
dependencies = [ dependencies = [
"core-foundation-sys", "core-foundation-sys",
"libc", "libc",
@ -1451,18 +1450,18 @@ dependencies = [
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.124" version = "1.0.125"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd761ff957cb2a45fbb9ab3da6512de9de55872866160b23c25f1a841e99d29f" checksum = "558dc50e1a5a5fa7112ca2ce4effcb321b0300c0d4ccf0776a9f60cd89031171"
dependencies = [ dependencies = [
"serde_derive", "serde_derive",
] ]
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.124" version = "1.0.125"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1800f7693e94e186f5e25a28291ae1570da908aff7d97a095dec1e56ff99069b" checksum = "b093b7a2bb58203b5da3056c05b4ec1fed827dcfdb37347a8841695263b3d06d"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -1494,8 +1493,8 @@ dependencies = [
[[package]] [[package]]
name = "serenity" name = "serenity"
version = "0.10.4" version = "0.10.5"
source = "git+https://github.com/serenity-rs/serenity?branch=next#943cf037c114ddf3513a3c8c3a2301da41c34f9e" source = "git+https://github.com/serenity-rs/serenity?branch=next#ed8d7ab1df6427be825b66c590fd02dd3ab5dfc0"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"async-tungstenite", "async-tungstenite",
@ -1578,11 +1577,10 @@ checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e"
[[package]] [[package]]
name = "socket2" name = "socket2"
version = "0.3.19" version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "122e570113d28d773067fab24266b66753f6ea915758651696b6e35e49f88d6e" checksum = "9e3dfc207c526015c632472a77be09cf1b6e46866581aecae5cc38fb4235dea2"
dependencies = [ dependencies = [
"cfg-if",
"libc", "libc",
"winapi", "winapi",
] ]
@ -1721,9 +1719,9 @@ checksum = "1e81da0851ada1f3e9d4312c704aa4f8806f0f9d69faaf8df2f3464b4a9437c2"
[[package]] [[package]]
name = "syn" name = "syn"
version = "1.0.64" version = "1.0.69"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fd9d1e9976102a03c542daa2eff1b43f9d72306342f3f8b3ed5fb8908195d6f" checksum = "48fe99c6bd8b1cc636890bcc071842de909d902c81ac7dab53ba33c421ab8ffb"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -1803,9 +1801,9 @@ dependencies = [
[[package]] [[package]]
name = "tinyvec" name = "tinyvec"
version = "1.1.1" version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "317cca572a0e89c3ce0ca1f1bdc9369547fe318a683418e42ac8f59d14701023" checksum = "5b5220f05bb7de7f3f53c7c065e1199b3172696fe2db9f9c4d8ad9b4ee74c342"
dependencies = [ dependencies = [
"tinyvec_macros", "tinyvec_macros",
] ]
@ -1818,9 +1816,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
[[package]] [[package]]
name = "tokio" name = "tokio"
version = "1.4.0" version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "134af885d758d645f0f0505c9a8b3f9bf8a348fd822e112ab5248138348f1722" checksum = "83f0c8e7c0addab50b663055baf787d0af7f413a46e6e7fb9559a4e4db7137a5"
dependencies = [ dependencies = [
"autocfg 1.0.1", "autocfg 1.0.1",
"bytes", "bytes",
@ -1881,9 +1879,9 @@ dependencies = [
[[package]] [[package]]
name = "tokio-util" name = "tokio-util"
version = "0.6.5" version = "0.6.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5143d049e85af7fbc36f5454d990e62c2df705b3589f123b71f441b6b59f443f" checksum = "940a12c99365c31ea8dd9ba04ec1be183ffe4920102bb7122c2f515437601e8e"
dependencies = [ dependencies = [
"bytes", "bytes",
"futures-core", "futures-core",
@ -1963,9 +1961,9 @@ dependencies = [
[[package]] [[package]]
name = "typemap_rev" name = "typemap_rev"
version = "0.1.4" version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "335fb14412163adc9ed4a3e53335afaa7a4b72bdd122e5f72f51b8f1db1a131e" checksum = "ed5b74f0a24b5454580a79abb6994393b09adf0ab8070f15827cb666255de155"
[[package]] [[package]]
name = "typenum" name = "typenum"
@ -1984,9 +1982,9 @@ dependencies = [
[[package]] [[package]]
name = "unicode-bidi" name = "unicode-bidi"
version = "0.3.4" version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" checksum = "eeb8be209bb1c96b7c177c7420d26e04eccacb0eeae6b980e35fcb74678107e0"
dependencies = [ dependencies = [
"matches", "matches",
] ]
@ -2084,9 +2082,9 @@ checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6"
[[package]] [[package]]
name = "wasm-bindgen" name = "wasm-bindgen"
version = "0.2.72" version = "0.2.73"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8fe8f61dba8e5d645a4d8132dc7a0a66861ed5e1045d2c0ed940fab33bac0fbe" checksum = "83240549659d187488f91f33c0f8547cbfef0b2088bc470c116d1d260ef623d9"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"serde", "serde",
@ -2096,9 +2094,9 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-backend" name = "wasm-bindgen-backend"
version = "0.2.72" version = "0.2.73"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "046ceba58ff062da072c7cb4ba5b22a37f00a302483f7e2a6cdc18fedbdc1fd3" checksum = "ae70622411ca953215ca6d06d3ebeb1e915f0f6613e3b495122878d7ebec7dae"
dependencies = [ dependencies = [
"bumpalo", "bumpalo",
"lazy_static", "lazy_static",
@ -2111,9 +2109,9 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-futures" name = "wasm-bindgen-futures"
version = "0.4.22" version = "0.4.23"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73157efb9af26fb564bb59a009afd1c7c334a44db171d280690d0c3faaec3468" checksum = "81b8b767af23de6ac18bf2168b690bed2902743ddf0fb39252e36f9e2bfc63ea"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"js-sys", "js-sys",
@ -2123,9 +2121,9 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-macro" name = "wasm-bindgen-macro"
version = "0.2.72" version = "0.2.73"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ef9aa01d36cda046f797c57959ff5f3c615c9cc63997a8d545831ec7976819b" checksum = "3e734d91443f177bfdb41969de821e15c516931c3c3db3d318fa1b68975d0f6f"
dependencies = [ dependencies = [
"quote", "quote",
"wasm-bindgen-macro-support", "wasm-bindgen-macro-support",
@ -2133,9 +2131,9 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-macro-support" name = "wasm-bindgen-macro-support"
version = "0.2.72" version = "0.2.73"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96eb45c1b2ee33545a813a92dbb53856418bf7eb54ab34f7f7ff1448a5b3735d" checksum = "d53739ff08c8a68b0fdbcd54c372b8ab800b1449ab3c9d706503bc7dd1621b2c"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -2146,15 +2144,15 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-shared" name = "wasm-bindgen-shared"
version = "0.2.72" version = "0.2.73"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b7148f4696fb4960a346eaa60bbfb42a1ac4ebba21f750f75fc1375b098d5ffa" checksum = "d9a543ae66aa233d14bb765ed9af4a33e81b8b58d1584cf1b47ff8cd0b9e4489"
[[package]] [[package]]
name = "web-sys" name = "web-sys"
version = "0.3.49" version = "0.3.50"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59fe19d70f5dacc03f6e46777213facae5ac3801575d56ca6cbd4c93dcd12310" checksum = "a905d57e488fec8861446d3393670fb50d27a262344013181c2cdf9fff5481be"
dependencies = [ dependencies = [
"js-sys", "js-sys",
"wasm-bindgen", "wasm-bindgen",
@ -2172,18 +2170,18 @@ dependencies = [
[[package]] [[package]]
name = "webpki-roots" name = "webpki-roots"
version = "0.21.0" version = "0.21.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "82015b7e0b8bad8185994674a13a93306bea76cf5a16c5a181382fd3a5ec2376" checksum = "aabe153544e473b775453675851ecc86863d2a81d786d741f6b76778f2a48940"
dependencies = [ dependencies = [
"webpki", "webpki",
] ]
[[package]] [[package]]
name = "whoami" name = "whoami"
version = "1.1.1" version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e296f550993cba2c5c3eba5da0fb335562b2fa3d97b7a8ac9dc91f40a3abc70" checksum = "4abacf325c958dfeaf1046931d37f2a901b6dfe0968ee965a29e94c6766b2af6"
dependencies = [ dependencies = [
"wasm-bindgen", "wasm-bindgen",
"web-sys", "web-sys",

View File

@ -1,11 +1,11 @@
[package] [package]
name = "reminder_rs" name = "reminder_rs"
version = "1.4.12" version = "1.4.13"
authors = ["jellywx <judesouthworth@pm.me>"] authors = ["jellywx <judesouthworth@pm.me>"]
edition = "2018" edition = "2018"
[dependencies] [dependencies]
dashmap = { version = "4.0", optional = true } dashmap = "4.0"
dotenv = "0.15" dotenv = "0.15"
humantime = "2.1" humantime = "2.1"
tokio = { version = "1", features = ["process", "full"] } tokio = { version = "1", features = ["process", "full"] }
@ -28,6 +28,3 @@ sqlx = { version = "0.5", features = ["runtime-tokio-rustls", "macros", "mysql",
[dependencies.regex_command_attr] [dependencies.regex_command_attr]
path = "./regex_command_attr" path = "./regex_command_attr"
[features]
prefix-cache = ["dashmap"]

View File

@ -5,14 +5,11 @@ use serenity::{client::Context, model::channel::Message};
use chrono::offset::Utc; use chrono::offset::Utc;
use crate::{ use crate::{
command_help, command_help, consts::DEFAULT_PREFIX, get_ctx_data, language_manager::LanguageManager,
consts::DEFAULT_PREFIX, models::UserData, FrameworkCtx, THEME_COLOR,
get_ctx_data,
language_manager::LanguageManager,
models::{GuildData, UserData},
FrameworkCtx, THEME_COLOR,
}; };
use crate::models::CtxGuildData;
use serenity::builder::CreateEmbedFooter; use serenity::builder::CreateEmbedFooter;
use std::sync::Arc; use std::sync::Arc;
use std::time::{SystemTime, UNIX_EPOCH}; use std::time::{SystemTime, UNIX_EPOCH};
@ -107,7 +104,7 @@ async fn help(ctx: &Context, msg: &Message, args: String) {
let (pool, lm) = get_ctx_data(&ctx).await; let (pool, lm) = get_ctx_data(&ctx).await;
let language = UserData::language_of(&msg.author, &pool); let language = UserData::language_of(&msg.author, &pool);
let prefix = GuildData::prefix_from_id(msg.guild_id, &ctx); let prefix = ctx.prefix(msg.guild_id);
if !args.is_empty() { if !args.is_empty() {
let framework = ctx let framework = ctx
@ -138,7 +135,7 @@ async fn info(ctx: &Context, msg: &Message, _args: String) {
let (pool, lm) = get_ctx_data(&ctx).await; let (pool, lm) = get_ctx_data(&ctx).await;
let language = UserData::language_of(&msg.author, &pool); let language = UserData::language_of(&msg.author, &pool);
let prefix = GuildData::prefix_from_id(msg.guild_id, &ctx); let prefix = ctx.prefix(msg.guild_id);
let current_user = ctx.cache.current_user(); let current_user = ctx.cache.current_user();
let footer = footer(ctx).await; let footer = footer(ctx).await;

View File

@ -31,6 +31,7 @@ use crate::{
#[cfg(feature = "prefix-cache")] #[cfg(feature = "prefix-cache")]
use crate::PrefixCache; use crate::PrefixCache;
use crate::models::CtxGuildData;
use std::{collections::HashMap, iter, time::Duration}; use std::{collections::HashMap, iter, time::Duration};
#[command] #[command]
@ -175,10 +176,9 @@ async fn timezone(ctx: &Context, msg: &Message, args: String) {
} }
} }
} else { } else {
let content = lm.get(&user_data.language, "timezone/no_argument").replace( let content = lm
"{prefix}", .get(&user_data.language, "timezone/no_argument")
&GuildData::prefix_from_id(msg.guild_id, &ctx).await, .replace("{prefix}", &ctx.prefix(msg.guild_id).await);
);
let popular_timezones = ctx let popular_timezones = ctx
.data .data
@ -255,7 +255,7 @@ async fn change_meridian(ctx: &Context, msg: &Message, args: String) {
}) })
.await; .await;
} else { } else {
let prefix = GuildData::prefix_from_id(msg.guild_id, &ctx).await; let prefix = ctx.prefix(msg.guild_id).await;
command_help(ctx, msg, lm, &prefix, &user_data.language, "meridian").await; command_help(ctx, msg, lm, &prefix, &user_data.language, "meridian").await;
} }
@ -557,7 +557,7 @@ WHERE
}) })
.await; .await;
} else { } else {
let prefix = GuildData::prefix_from_id(msg.guild_id, &ctx).await; let prefix = ctx.prefix(msg.guild_id).await;
command_help(ctx, msg, lm, &prefix, &language, "restrict").await; command_help(ctx, msg, lm, &prefix, &language, "restrict").await;
} }
@ -684,7 +684,7 @@ SELECT command FROM command_aliases WHERE guild_id = (SELECT id FROM guilds WHER
} }
} }
} else { } else {
let prefix = GuildData::prefix_from_id(msg.guild_id, &ctx).await; let prefix = ctx.prefix(msg.guild_id).await;
command_help(ctx, msg, lm, &prefix, &language, "alias").await; command_help(ctx, msg, lm, &prefix, &language, "alias").await;
} }

View File

@ -47,7 +47,7 @@ use std::{
time::{SystemTime, UNIX_EPOCH}, time::{SystemTime, UNIX_EPOCH},
}; };
use crate::models::MeridianType; use crate::models::{CtxGuildData, MeridianType};
use regex::Captures; use regex::Captures;
use serenity::model::channel::Channel; use serenity::model::channel::Channel;
@ -177,7 +177,7 @@ async fn offset(ctx: &Context, msg: &Message, args: String) {
let user_data = UserData::from_user(&msg.author, &ctx, &pool).await.unwrap(); let user_data = UserData::from_user(&msg.author, &ctx, &pool).await.unwrap();
if args.is_empty() { if args.is_empty() {
let prefix = GuildData::prefix_from_id(msg.guild_id, &ctx).await; let prefix = ctx.prefix(msg.guild_id).await;
command_help(ctx, msg, lm, &prefix, &user_data.language, "offset").await; command_help(ctx, msg, lm, &prefix, &user_data.language, "offset").await;
} else { } else {
@ -815,7 +815,7 @@ DELETE FROM timers WHERE owner = ? AND name = ?
} }
_ => { _ => {
let prefix = GuildData::prefix_from_id(msg.guild_id, &ctx).await; let prefix = ctx.prefix(msg.guild_id).await;
command_help(ctx, msg, lm, &prefix, &language, "timer").await; command_help(ctx, msg, lm, &prefix, &language, "timer").await;
} }
@ -851,7 +851,6 @@ enum ReminderError {
InvalidTag, InvalidTag,
InvalidTime, InvalidTime,
InvalidExpiration, InvalidExpiration,
NeedSubscription,
DiscordError(String), DiscordError(String),
} }
@ -879,7 +878,6 @@ impl ToResponse for ReminderError {
Self::InvalidTag => "remind/invalid_tag", Self::InvalidTag => "remind/invalid_tag",
Self::InvalidTime => "remind/invalid_time", Self::InvalidTime => "remind/invalid_time",
Self::InvalidExpiration => "interval/invalid_expiration", Self::InvalidExpiration => "interval/invalid_expiration",
Self::NeedSubscription => "interval/donor",
Self::DiscordError(_) => "remind/generic_error", Self::DiscordError(_) => "remind/generic_error",
} }
} }
@ -1146,7 +1144,7 @@ INSERT INTO reminders (
ctx, ctx,
msg, msg,
lm, lm,
&GuildData::prefix_from_id(msg.guild_id, &ctx).await, &ctx.prefix(msg.guild_id).await,
&language, &language,
"countdown", "countdown",
) )
@ -1157,10 +1155,8 @@ INSERT INTO reminders (
.channel_id .channel_id
.say( .say(
&ctx, &ctx,
lm.get(&language, "interval/donor").replace( lm.get(&language, "interval/donor")
"{prefix}", .replace("{prefix}", &ctx.prefix(msg.guild_id).await),
&GuildData::prefix_from_id(msg.guild_id, &ctx).await,
),
) )
.await; .await;
} }
@ -1229,10 +1225,8 @@ async fn remind_command(ctx: &Context, msg: &Message, args: String, command: Rem
.channel_id .channel_id
.say( .say(
&ctx, &ctx,
lm.get(&language, "interval/donor").replace( lm.get(&language, "interval/donor")
"{prefix}", .replace("{prefix}", &ctx.prefix(msg.guild_id).await),
&GuildData::prefix_from_id(msg.guild_id, &ctx).await,
),
) )
.await; .await;
} else { } else {
@ -1383,7 +1377,7 @@ async fn remind_command(ctx: &Context, msg: &Message, args: String, command: Rem
} }
None => { None => {
let prefix = GuildData::prefix_from_id(msg.guild_id, &ctx).await; let prefix = ctx.prefix(msg.guild_id).await;
match command { match command {
RemindCommand::Remind => { RemindCommand::Remind => {
@ -1608,7 +1602,7 @@ async fn natural(ctx: &Context, msg: &Message, args: String) {
ctx, ctx,
msg, msg,
lm, lm,
&GuildData::prefix_from_id(msg.guild_id, &ctx).await, &ctx.prefix(msg.guild_id).await,
&user_data.language, &user_data.language,
"natural", "natural",
) )

View File

@ -12,10 +12,8 @@ use serenity::{
use std::fmt; use std::fmt;
use crate::{ use crate::models::CtxGuildData;
command_help, get_ctx_data, use crate::{command_help, get_ctx_data, models::UserData};
models::{GuildData, UserData},
};
use sqlx::MySqlPool; use sqlx::MySqlPool;
use std::convert::TryFrom; use std::convert::TryFrom;
@ -233,7 +231,7 @@ DELETE FROM todos WHERE user_id = (SELECT id FROM users WHERE user = ?) AND guil
let (pool, lm) = get_ctx_data(&ctx).await; let (pool, lm) = get_ctx_data(&ctx).await;
let user_data = UserData::from_user(&msg.author, &ctx, &pool).await.unwrap(); let user_data = UserData::from_user(&msg.author, &ctx, &pool).await.unwrap();
let prefix = GuildData::prefix_from_id(msg.guild_id, &ctx).await; let prefix = ctx.prefix(msg.guild_id).await;
match subcommand { match subcommand {
SubCommand::View => { SubCommand::View => {
@ -426,7 +424,7 @@ async fn show_help(ctx: &Context, msg: &Message, target: Option<TodoTarget>) {
let (pool, lm) = get_ctx_data(&ctx).await; let (pool, lm) = get_ctx_data(&ctx).await;
let language = UserData::language_of(&msg.author, &pool); let language = UserData::language_of(&msg.author, &pool);
let prefix = GuildData::prefix_from_id(msg.guild_id, &ctx); let prefix = ctx.prefix(msg.guild_id);
let command = match target { let command = match target {
None => "todo", None => "todo",

View File

@ -20,7 +20,7 @@ use regex::{Match, Regex, RegexBuilder};
use std::{collections::HashMap, fmt}; use std::{collections::HashMap, fmt};
use crate::language_manager::LanguageManager; use crate::language_manager::LanguageManager;
use crate::models::{GuildData, UserData}; use crate::models::{CtxGuildData, GuildData, UserData};
use crate::{models::ChannelData, SQLPool}; use crate::{models::ChannelData, SQLPool};
type CommandFn = for<'fut> fn(&'fut Context, &'fut Message, String) -> BoxFuture<'fut, ()>; type CommandFn = for<'fut> fn(&'fut Context, &'fut Message, String) -> BoxFuture<'fut, ()>;
@ -335,7 +335,7 @@ impl Framework for RegexFramework {
async fn check_prefix(ctx: &Context, guild: &Guild, prefix_opt: Option<Match<'_>>) -> bool { async fn check_prefix(ctx: &Context, guild: &Guild, prefix_opt: Option<Match<'_>>) -> bool {
if let Some(prefix) = prefix_opt { if let Some(prefix) = prefix_opt {
let guild_prefix = GuildData::prefix_from_id(Some(guild.id), &ctx).await; let guild_prefix = ctx.prefix(Some(guild.id)).await;
guild_prefix.as_str() == prefix.as_str() guild_prefix.as_str() == prefix.as_str()
} else { } else {
@ -419,11 +419,7 @@ impl Framework for RegexFramework {
lm.get(&language.await, "no_perms_managed") lm.get(&language.await, "no_perms_managed")
.replace( .replace(
"{prefix}", "{prefix}",
&GuildData::prefix_from_id( &ctx.prefix(msg.guild_id).await,
msg.guild_id,
&ctx,
)
.await,
), ),
) )
.await; .await;

View File

@ -34,6 +34,7 @@ use crate::{
consts::{CNC_GUILD, DEFAULT_PREFIX, SUBSCRIPTION_ROLES, THEME_COLOR}, consts::{CNC_GUILD, DEFAULT_PREFIX, SUBSCRIPTION_ROLES, THEME_COLOR},
framework::RegexFramework, framework::RegexFramework,
language_manager::LanguageManager, language_manager::LanguageManager,
models::GuildData,
}; };
use serenity::futures::TryFutureExt; use serenity::futures::TryFutureExt;
@ -41,14 +42,16 @@ use serenity::futures::TryFutureExt;
use inflector::Inflector; use inflector::Inflector;
use log::info; use log::info;
use crate::models::GuildData; use dashmap::DashMap;
use tokio::sync::RwLock;
use chrono_tz::Tz; use chrono_tz::Tz;
#[cfg(feature = "prefix-cache")] struct GuildDataCache;
struct PrefixCache;
#[cfg(feature = "prefix-cache")] impl TypeMapKey for GuildDataCache {
impl TypeMapKey for PrefixCache { type Value = Arc<DashMap<GuildId, Arc<RwLock<GuildData>>>>;
type Value = Arc<dashmap::DashMap<GuildId, String>>;
} }
struct SQLPool; struct SQLPool;
@ -172,10 +175,14 @@ DELETE FROM channels WHERE channel = ?
.cloned() .cloned()
.expect("Could not get SQLPool from data"); .expect("Could not get SQLPool from data");
#[cfg(feature = "prefix-cache")] let guild_data_cache = ctx
let prefix_cache = ctx.data.read().await.get::<PrefixCache>().cloned().unwrap(); .data
#[cfg(feature = "prefix-cache")] .read()
prefix_cache.remove(&guild.id); .await
.get::<GuildDataCache>()
.cloned()
.unwrap();
guild_data_cache.remove(&guild.id);
sqlx::query!( sqlx::query!(
" "
@ -274,8 +281,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
.expect("Error occurred creating client"); .expect("Error occurred creating client");
{ {
#[cfg(feature = "prefix-cache")] let guild_data_cache = dashmap::DashMap::new();
let prefix_cache = dashmap::DashMap::new();
let pool = MySqlPool::connect( let pool = MySqlPool::connect(
&env::var("DATABASE_URL").expect("Missing DATABASE_URL from environment"), &env::var("DATABASE_URL").expect("Missing DATABASE_URL from environment"),
@ -302,8 +308,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
let mut data = client.data.write().await; let mut data = client.data.write().await;
#[cfg(feature = "prefix-cache")] data.insert::<GuildDataCache>(Arc::new(guild_data_cache));
data.insert::<PrefixCache>(Arc::new(prefix_cache));
data.insert::<SQLPool>(pool); data.insert::<SQLPool>(pool);
data.insert::<PopularTimezones>(Arc::new(popular_timezones)); data.insert::<PopularTimezones>(Arc::new(popular_timezones));

View File

@ -1,4 +1,5 @@
use serenity::{ use serenity::{
async_trait,
http::CacheHttp, http::CacheHttp,
model::{ model::{
channel::Channel, channel::Channel,
@ -6,6 +7,7 @@ use serenity::{
id::{GuildId, UserId}, id::{GuildId, UserId},
user::User, user::User,
}, },
prelude::Context,
}; };
use sqlx::MySqlPool; use sqlx::MySqlPool;
@ -15,13 +17,77 @@ use chrono_tz::Tz;
use log::error; use log::error;
use crate::consts::{DEFAULT_PREFIX, LOCAL_LANGUAGE, LOCAL_TIMEZONE}; use crate::{
consts::{DEFAULT_PREFIX, LOCAL_LANGUAGE, LOCAL_TIMEZONE},
GuildDataCache, SQLPool,
};
#[cfg(feature = "prefix-cache")] use std::sync::Arc;
use crate::PrefixCache; use tokio::sync::RwLock;
use crate::SQLPool;
use serenity::prelude::Context; #[async_trait]
pub trait CtxGuildData {
async fn guild_data<G: Into<GuildId> + Send + Sync>(
&self,
guild_id: G,
) -> Result<Arc<RwLock<GuildData>>, sqlx::Error>;
async fn prefix<G: Into<GuildId> + Send + Sync>(&self, guild_id: Option<G>) -> String;
}
#[async_trait]
impl CtxGuildData for Context {
async fn guild_data<G: Into<GuildId> + Send + Sync>(
&self,
guild_id: G,
) -> Result<Arc<RwLock<GuildData>>, sqlx::Error> {
let guild_id = guild_id.into();
let guild = guild_id.to_guild_cached(&self.cache).await.unwrap();
let guild_cache = self
.data
.read()
.await
.get::<GuildDataCache>()
.cloned()
.unwrap();
let x = if let Some(guild_data) = guild_cache.get(&guild_id) {
Ok(guild_data.clone())
} else {
let pool = self.data.read().await.get::<SQLPool>().cloned().unwrap();
match GuildData::from_guild(guild, &pool).await {
Ok(d) => {
let lock = Arc::new(RwLock::new(d));
guild_cache.insert(guild_id, lock.clone());
Ok(lock)
}
Err(e) => Err(e),
}
};
x
}
async fn prefix<G: Into<GuildId> + Send + Sync>(&self, guild_id: Option<G>) -> String {
if let Some(guild_id) = guild_id {
self.guild_data(guild_id)
.await
.unwrap()
.read()
.await
.prefix
.clone()
} else {
DEFAULT_PREFIX.clone()
}
}
}
pub struct GuildData { pub struct GuildData {
pub id: u32, pub id: u32,
@ -30,65 +96,6 @@ pub struct GuildData {
} }
impl GuildData { impl GuildData {
#[cfg(feature = "prefix-cache")]
pub async fn prefix_from_id<T: Into<GuildId>>(
guild_id_opt: Option<T>,
ctx: &Context,
) -> String {
let pool = ctx.data.read().await.get::<SQLPool>().cloned().unwrap();
let prefix_cache = ctx.data.read().await.get::<PrefixCache>().cloned().unwrap();
if let Some(guild_id) = guild_id_opt {
let guild_id = guild_id.into();
if let Some(prefix) = prefix_cache.get(&guild_id) {
prefix.to_string()
} else {
let row = sqlx::query!(
"
SELECT prefix FROM guilds WHERE guild = ?
",
guild_id.as_u64().to_owned()
)
.fetch_one(&pool)
.await;
let prefix = row.map_or_else(|_| DEFAULT_PREFIX.clone(), |r| r.prefix);
prefix_cache.insert(guild_id, prefix.clone());
prefix
}
} else {
DEFAULT_PREFIX.clone()
}
}
#[cfg(not(feature = "prefix-cache"))]
pub async fn prefix_from_id<T: Into<GuildId>>(
guild_id_opt: Option<T>,
ctx: &Context,
) -> String {
let pool = ctx.data.read().await.get::<SQLPool>().cloned().unwrap();
if let Some(guild_id) = guild_id_opt {
let guild_id = guild_id.into().as_u64().to_owned();
let row = sqlx::query!(
"
SELECT prefix FROM guilds WHERE guild = ?
",
guild_id
)
.fetch_one(&pool)
.await;
row.map_or_else(|_| DEFAULT_PREFIX.clone(), |r| r.prefix)
} else {
DEFAULT_PREFIX.clone()
}
}
pub async fn from_guild(guild: Guild, pool: &MySqlPool) -> Result<Self, sqlx::Error> { pub async fn from_guild(guild: Guild, pool: &MySqlPool) -> Result<Self, sqlx::Error> {
let guild_id = guild.id.as_u64().to_owned(); let guild_id = guild.id.as_u64().to_owned();