Update events available to event handler

Signed-off-by: trivernis <trivernis@protonmail.com>
main
trivernis 3 years ago
parent 24ad0f54e4
commit fe0180e54c
Signed by: Trivernis
GPG Key ID: DFFFCC2C7A02DB45

307
Cargo.lock generated

@ -21,20 +21,20 @@ dependencies = [
[[package]] [[package]]
name = "async-tungstenite" name = "async-tungstenite"
version = "0.11.0" version = "0.17.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7cc5408453d37e2b1c6f01d8078af1da58b6cfa6a80fa2ede3bd2b9a6ada9c4" checksum = "a1b71b31561643aa8e7df3effe284fa83ab1a840e52294c5f4bd7bfd8b2becbb"
dependencies = [ dependencies = [
"futures-io", "futures-io",
"futures-util", "futures-util",
"log", "log",
"native-tls", "native-tls",
"pin-project", "pin-project-lite",
"tokio", "tokio",
"tokio-native-tls", "tokio-native-tls",
"tokio-rustls 0.22.0", "tokio-rustls",
"tungstenite", "tungstenite",
"webpki-roots 0.20.0", "webpki-roots",
] ]
[[package]] [[package]]
@ -43,12 +43,6 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "base64"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff"
[[package]] [[package]]
name = "base64" name = "base64"
version = "0.13.0" version = "0.13.0"
@ -63,9 +57,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]] [[package]]
name = "block-buffer" name = "block-buffer"
version = "0.9.0" version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" checksum = "0bf7fe51849ea569fd452f37822f606a5cabb684dc918707a0193fd4664ff324"
dependencies = [ dependencies = [
"generic-array", "generic-array",
] ]
@ -82,12 +76,6 @@ version = "1.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
[[package]]
name = "bytes"
version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38"
[[package]] [[package]]
name = "bytes" name = "bytes"
version = "1.1.0" version = "1.1.0"
@ -106,19 +94,6 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "chrono"
version = "0.4.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73"
dependencies = [
"libc",
"num-integer",
"num-traits",
"serde",
"winapi",
]
[[package]] [[package]]
name = "core-foundation" name = "core-foundation"
version = "0.9.3" version = "0.9.3"
@ -153,6 +128,16 @@ dependencies = [
"cfg-if", "cfg-if",
] ]
[[package]]
name = "crypto-common"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57952ca27b5e3606ff4dd79b0020231aaf9d6aa76dc05fd30137538c50bd3ce8"
dependencies = [
"generic-array",
"typenum",
]
[[package]] [[package]]
name = "dashmap" name = "dashmap"
version = "5.2.0" version = "5.2.0"
@ -162,15 +147,17 @@ dependencies = [
"cfg-if", "cfg-if",
"num_cpus", "num_cpus",
"parking_lot", "parking_lot",
"serde",
] ]
[[package]] [[package]]
name = "digest" name = "digest"
version = "0.9.0" version = "0.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" checksum = "f2fb860ca6fafa5552fb6d0e816a69c8e49f0908bf524e30a90d97c85892d506"
dependencies = [ dependencies = [
"generic-array", "block-buffer",
"crypto-common",
] ]
[[package]] [[package]]
@ -335,13 +322,13 @@ dependencies = [
[[package]] [[package]]
name = "getrandom" name = "getrandom"
version = "0.1.16" version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" checksum = "9be70c98951c83b8d2f8f60d7065fa6d5146873094452a1008da8c2f1e4205ad"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"libc", "libc",
"wasi 0.9.0+wasi-snapshot-preview1", "wasi 0.10.2+wasi-snapshot-preview1",
] ]
[[package]] [[package]]
@ -350,7 +337,7 @@ version = "0.3.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37a82c6d637fc9515a4694bbf1cb2457b79d81ce52b3108bdeea58b07dd34a57" checksum = "37a82c6d637fc9515a4694bbf1cb2457b79d81ce52b3108bdeea58b07dd34a57"
dependencies = [ dependencies = [
"bytes 1.1.0", "bytes",
"fnv", "fnv",
"futures-core", "futures-core",
"futures-sink", "futures-sink",
@ -384,7 +371,7 @@ version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "31f4c6746584866f0feabcc69893c5b51beef3831656a968ed7ae254cdc4fd03" checksum = "31f4c6746584866f0feabcc69893c5b51beef3831656a968ed7ae254cdc4fd03"
dependencies = [ dependencies = [
"bytes 1.1.0", "bytes",
"fnv", "fnv",
"itoa", "itoa",
] ]
@ -395,7 +382,7 @@ version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ff4f84919677303da5f147645dbea6b1881f368d03ac84e1dc09031ebd7b2c6" checksum = "1ff4f84919677303da5f147645dbea6b1881f368d03ac84e1dc09031ebd7b2c6"
dependencies = [ dependencies = [
"bytes 1.1.0", "bytes",
"http", "http",
"pin-project-lite", "pin-project-lite",
] ]
@ -418,7 +405,7 @@ version = "0.14.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b26ae0a80afebe130861d90abf98e3814a4f28a4c6ffeb5ab8ebb2be311e0ef2" checksum = "b26ae0a80afebe130861d90abf98e3814a4f28a4c6ffeb5ab8ebb2be311e0ef2"
dependencies = [ dependencies = [
"bytes 1.1.0", "bytes",
"futures-channel", "futures-channel",
"futures-core", "futures-core",
"futures-util", "futures-util",
@ -444,9 +431,9 @@ checksum = "d87c48c02e0dc5e3b849a2041db3029fd066650f8f717c07bf8ed78ccb895cac"
dependencies = [ dependencies = [
"http", "http",
"hyper", "hyper",
"rustls 0.20.4", "rustls",
"tokio", "tokio",
"tokio-rustls 0.23.3", "tokio-rustls",
] ]
[[package]] [[package]]
@ -455,7 +442,7 @@ version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905"
dependencies = [ dependencies = [
"bytes 1.1.0", "bytes",
"hyper", "hyper",
"native-tls", "native-tls",
"tokio", "tokio",
@ -483,15 +470,6 @@ dependencies = [
"hashbrown", "hashbrown",
] ]
[[package]]
name = "input_buffer"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19a8a95243d5a0398cae618ec29477c6e3cb631152be5c19481f80bc71559754"
dependencies = [
"bytes 0.5.6",
]
[[package]] [[package]]
name = "instant" name = "instant"
version = "0.1.12" version = "0.1.12"
@ -641,16 +619,6 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "num-integer"
version = "0.1.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db"
dependencies = [
"autocfg",
"num-traits",
]
[[package]] [[package]]
name = "num-traits" name = "num-traits"
version = "0.2.14" version = "0.2.14"
@ -671,16 +639,19 @@ dependencies = [
] ]
[[package]] [[package]]
name = "once_cell" name = "num_threads"
version = "1.10.0" 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 = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9" checksum = "aba1801fb138d8e85e11d0fc70baf4fe1cdfffda7c6cd34a854905df588e5ed0"
dependencies = [
"libc",
]
[[package]] [[package]]
name = "opaque-debug" name = "once_cell"
version = "0.3.0" version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9"
[[package]] [[package]]
name = "openssl" name = "openssl"
@ -715,6 +686,15 @@ dependencies = [
"vcpkg", "vcpkg",
] ]
[[package]]
name = "ordered-float"
version = "2.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7940cf2ca942593318d07fcf2596cdca60a85c9e7fab408a5e21a4f9dcd40d87"
dependencies = [
"num-traits",
]
[[package]] [[package]]
name = "parking_lot" name = "parking_lot"
version = "0.12.0" version = "0.12.0"
@ -744,26 +724,6 @@ version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e"
[[package]]
name = "pin-project"
version = "1.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "58ad3879ad3baf4e44784bc6a718a8698867bb991f8ce24d1bcbe2cfb4c3a75e"
dependencies = [
"pin-project-internal",
]
[[package]]
name = "pin-project-internal"
version = "1.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "744b6f092ba29c3650faf274db506afd39944f48420f6c86b17cfe0ee1cb36bb"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]] [[package]]
name = "pin-project-lite" name = "pin-project-lite"
version = "0.2.8" version = "0.2.8"
@ -808,22 +768,20 @@ dependencies = [
[[package]] [[package]]
name = "rand" name = "rand"
version = "0.7.3" version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
dependencies = [ dependencies = [
"getrandom",
"libc", "libc",
"rand_chacha", "rand_chacha",
"rand_core", "rand_core",
"rand_hc",
] ]
[[package]] [[package]]
name = "rand_chacha" name = "rand_chacha"
version = "0.2.2" version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
dependencies = [ dependencies = [
"ppv-lite86", "ppv-lite86",
"rand_core", "rand_core",
@ -831,22 +789,13 @@ dependencies = [
[[package]] [[package]]
name = "rand_core" name = "rand_core"
version = "0.5.1" version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7"
dependencies = [ dependencies = [
"getrandom", "getrandom",
] ]
[[package]]
name = "rand_hc"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
dependencies = [
"rand_core",
]
[[package]] [[package]]
name = "redox_syscall" name = "redox_syscall"
version = "0.2.13" version = "0.2.13"
@ -871,8 +820,8 @@ version = "0.11.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46a1f7aa4f35e5e8b4160449f51afc758f0ce6454315a9fa7d0d113e958c41eb" checksum = "46a1f7aa4f35e5e8b4160449f51afc758f0ce6454315a9fa7d0d113e958c41eb"
dependencies = [ dependencies = [
"base64 0.13.0", "base64",
"bytes 1.1.0", "bytes",
"encoding_rs", "encoding_rs",
"futures-core", "futures-core",
"futures-util", "futures-util",
@ -891,20 +840,20 @@ dependencies = [
"native-tls", "native-tls",
"percent-encoding", "percent-encoding",
"pin-project-lite", "pin-project-lite",
"rustls 0.20.4", "rustls",
"rustls-pemfile", "rustls-pemfile",
"serde", "serde",
"serde_json", "serde_json",
"serde_urlencoded", "serde_urlencoded",
"tokio", "tokio",
"tokio-native-tls", "tokio-native-tls",
"tokio-rustls 0.23.3", "tokio-rustls",
"tokio-util 0.6.9", "tokio-util 0.6.9",
"url", "url",
"wasm-bindgen", "wasm-bindgen",
"wasm-bindgen-futures", "wasm-bindgen-futures",
"web-sys", "web-sys",
"webpki-roots 0.22.3", "webpki-roots",
"winreg", "winreg",
] ]
@ -923,19 +872,6 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "rustls"
version = "0.19.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "35edb675feee39aec9c99fa5ff985081995a06d594114ae14cbe797ad7b7a6d7"
dependencies = [
"base64 0.13.0",
"log",
"ring",
"sct 0.6.1",
"webpki 0.21.4",
]
[[package]] [[package]]
name = "rustls" name = "rustls"
version = "0.20.4" version = "0.20.4"
@ -944,8 +880,8 @@ checksum = "4fbfeb8d0ddb84706bc597a5574ab8912817c52a397f819e5b614e2265206921"
dependencies = [ dependencies = [
"log", "log",
"ring", "ring",
"sct 0.7.0", "sct",
"webpki 0.22.0", "webpki",
] ]
[[package]] [[package]]
@ -954,7 +890,7 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ee86d63972a7c661d1536fefe8c3c8407321c3df668891286de28abcd087360" checksum = "1ee86d63972a7c661d1536fefe8c3c8407321c3df668891286de28abcd087360"
dependencies = [ dependencies = [
"base64 0.13.0", "base64",
] ]
[[package]] [[package]]
@ -979,16 +915,6 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
[[package]]
name = "sct"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b362b83898e0e69f38515b82ee15aa80636befe47c3b6d3d89a911e78fc228ce"
dependencies = [
"ring",
"untrusted",
]
[[package]] [[package]]
name = "sct" name = "sct"
version = "0.7.0" version = "0.7.0"
@ -1031,6 +957,16 @@ dependencies = [
"serde_derive", "serde_derive",
] ]
[[package]]
name = "serde-value"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3a1a3341211875ef120e117ea7fd5228530ae7e7036a779fdc9117be6b3282c"
dependencies = [
"ordered-float",
"serde",
]
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.136" version = "1.0.136"
@ -1067,22 +1003,28 @@ dependencies = [
[[package]] [[package]]
name = "serenity" name = "serenity"
version = "0.10.10" version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dde86919535c6047e055d512641c5241320c01cb8fee54f1e5ba77c939a0ec23" checksum = "96455fdd03a3cb8c3270c47adf21d748b65067affc6c911ed4ed4ae05f097cab"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"async-tungstenite", "async-tungstenite",
"base64 0.13.0", "base64",
"bitflags", "bitflags",
"bytes 1.1.0", "bytes",
"chrono", "cfg-if",
"dashmap",
"flate2", "flate2",
"futures", "futures",
"mime",
"mime_guess",
"parking_lot",
"percent-encoding", "percent-encoding",
"reqwest", "reqwest",
"serde", "serde",
"serde-value",
"serde_json", "serde_json",
"time",
"tokio", "tokio",
"tracing", "tracing",
"typemap_rev", "typemap_rev",
@ -1091,7 +1033,7 @@ dependencies = [
[[package]] [[package]]
name = "serenity-additions" name = "serenity-additions"
version = "0.3.0" version = "0.3.1"
dependencies = [ dependencies = [
"dashmap", "dashmap",
"futures", "futures",
@ -1104,15 +1046,13 @@ dependencies = [
[[package]] [[package]]
name = "sha-1" name = "sha-1"
version = "0.9.8" version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "99cd6713db3cf16b6c84e06321e049a9b9f699826e16096d23bbcc44d15d51a6" checksum = "028f48d513f9678cda28f6e4064755b3fbb2af6acd672f2c209b62323f7aea0f"
dependencies = [ dependencies = [
"block-buffer",
"cfg-if", "cfg-if",
"cpufeatures", "cpufeatures",
"digest", "digest",
"opaque-debug",
] ]
[[package]] [[package]]
@ -1188,6 +1128,18 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "time"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2702e08a7a860f005826c6815dcac101b19b5eb330c27fe4a5928fec1d20ddd"
dependencies = [
"itoa",
"libc",
"num_threads",
"serde",
]
[[package]] [[package]]
name = "tinyvec" name = "tinyvec"
version = "1.5.1" version = "1.5.1"
@ -1209,7 +1161,7 @@ version = "1.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2af73ac49756f3f7c01172e34a23e5d0216f6c32333757c2c61feb2bbff5a5ee" checksum = "2af73ac49756f3f7c01172e34a23e5d0216f6c32333757c2c61feb2bbff5a5ee"
dependencies = [ dependencies = [
"bytes 1.1.0", "bytes",
"libc", "libc",
"memchr", "memchr",
"mio", "mio",
@ -1240,26 +1192,15 @@ dependencies = [
"tokio", "tokio",
] ]
[[package]]
name = "tokio-rustls"
version = "0.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6"
dependencies = [
"rustls 0.19.1",
"tokio",
"webpki 0.21.4",
]
[[package]] [[package]]
name = "tokio-rustls" name = "tokio-rustls"
version = "0.23.3" version = "0.23.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4151fda0cf2798550ad0b34bcfc9b9dcc2a9d2471c895c68f3a8818e54f2389e" checksum = "4151fda0cf2798550ad0b34bcfc9b9dcc2a9d2471c895c68f3a8818e54f2389e"
dependencies = [ dependencies = [
"rustls 0.20.4", "rustls",
"tokio", "tokio",
"webpki 0.22.0", "webpki",
] ]
[[package]] [[package]]
@ -1268,7 +1209,7 @@ version = "0.6.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e99e1983e5d376cd8eb4b66604d2e99e79f5bd988c3055891dcd8c9e2604cc0" checksum = "9e99e1983e5d376cd8eb4b66604d2e99e79f5bd988c3055891dcd8c9e2604cc0"
dependencies = [ dependencies = [
"bytes 1.1.0", "bytes",
"futures-core", "futures-core",
"futures-sink", "futures-sink",
"log", "log",
@ -1282,7 +1223,7 @@ version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0edfdeb067411dba2044da6d1cb2df793dd35add7888d73c16e3381ded401764" checksum = "0edfdeb067411dba2044da6d1cb2df793dd35add7888d73c16e3381ded401764"
dependencies = [ dependencies = [
"bytes 1.1.0", "bytes",
"futures-core", "futures-core",
"futures-sink", "futures-sink",
"pin-project-lite", "pin-project-lite",
@ -1337,22 +1278,24 @@ checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642"
[[package]] [[package]]
name = "tungstenite" name = "tungstenite"
version = "0.11.1" version = "0.17.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0308d80d86700c5878b9ef6321f020f29b1bb9d5ff3cab25e75e23f3a492a23" checksum = "d96a2dea40e7570482f28eb57afbe42d97551905da6a9400acc5c328d24004f5"
dependencies = [ dependencies = [
"base64 0.12.3", "base64",
"byteorder", "byteorder",
"bytes 0.5.6", "bytes",
"http", "http",
"httparse", "httparse",
"input_buffer",
"log", "log",
"native-tls", "native-tls",
"rand", "rand",
"rustls",
"sha-1", "sha-1",
"thiserror",
"url", "url",
"utf-8", "utf-8",
"webpki",
] ]
[[package]] [[package]]
@ -1413,6 +1356,7 @@ dependencies = [
"idna", "idna",
"matches", "matches",
"percent-encoding", "percent-encoding",
"serde",
] ]
[[package]] [[package]]
@ -1445,9 +1389,9 @@ dependencies = [
[[package]] [[package]]
name = "wasi" name = "wasi"
version = "0.9.0+wasi-snapshot-preview1" version = "0.10.2+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6"
[[package]] [[package]]
name = "wasi" name = "wasi"
@ -1531,16 +1475,6 @@ dependencies = [
"wasm-bindgen", "wasm-bindgen",
] ]
[[package]]
name = "webpki"
version = "0.21.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8e38c0608262c46d4a56202ebabdeb094cef7e560ca7a226c6bf055188aa4ea"
dependencies = [
"ring",
"untrusted",
]
[[package]] [[package]]
name = "webpki" name = "webpki"
version = "0.22.0" version = "0.22.0"
@ -1551,22 +1485,13 @@ dependencies = [
"untrusted", "untrusted",
] ]
[[package]]
name = "webpki-roots"
version = "0.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0f20dea7535251981a9670857150d571846545088359b28e4951d350bdaf179f"
dependencies = [
"webpki 0.21.4",
]
[[package]] [[package]]
name = "webpki-roots" name = "webpki-roots"
version = "0.22.3" version = "0.22.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44d8de8415c823c8abd270ad483c6feeac771fad964890779f9a8cb24fbbc1bf" checksum = "44d8de8415c823c8abd270ad483c6feeac771fad964890779f9a8cb24fbbc1bf"
dependencies = [ dependencies = [
"webpki 0.22.0", "webpki",
] ]
[[package]] [[package]]

@ -1,6 +1,6 @@
[package] [package]
name = "serenity-additions" name = "serenity-additions"
version = "0.3.0" version = "0.3.1"
authors = ["trivernis <trivernis@protonmail.com>"] authors = ["trivernis <trivernis@protonmail.com>"]
edition = "2018" edition = "2018"
description = "Menus and self deleting messages for the serenity discord framework" description = "Menus and self deleting messages for the serenity discord framework"
@ -24,6 +24,6 @@ serde_json = "1.0.79"
dashmap = "5.2.0" dashmap = "5.2.0"
[dependencies.serenity] [dependencies.serenity]
version = "0.10.10" version = "0.11.1"
default-features = false default-features = false
features = ["builder", "http", "cache", "model", "client", "gateway"] features = ["builder", "http", "cache", "model", "client", "gateway"]

@ -8,13 +8,9 @@ You have to register the module in the serenity client builder.
```rust ```rust
use serenity::client::Client; use serenity::client::Client;
use serenity_additions::RegisterRichInteractions; use serenity_additions::RegisterRichInteractions;
use serenity::prelude::GatewayIntents;
#[tokio::main] let client = Client::builder("TOKEN", GatewayIntends::default()).register_serenity_additions()
async fn get_client {
// stuff
let client = Client::builder("TOKEN").register_serenity_additions().await?;
// stuff
}
``` ```
## Menu ## Menu
@ -23,7 +19,7 @@ async fn get_client {
use serenity::builder::CreateMessage; use serenity::builder::CreateMessage;
use serenity::client::Context; use serenity::client::Context;
use serenity::model::id::ChannelId; use serenity::model::id::ChannelId;
use serenity_rich_interaction::menu::{MenuBuilder, Page}; use serenity_additions::menu::{MenuBuilder, Page};
use std::time::Duration; use std::time::Duration;
use serenity_additions::Result; use serenity_additions::Result;

@ -75,7 +75,7 @@ pub trait RegisterAdditions {
fn register_serenity_additions_with(self, rich_handler: RichEventHandler) -> Self; fn register_serenity_additions_with(self, rich_handler: RichEventHandler) -> Self;
} }
impl<'a> RegisterAdditions for ClientBuilder<'a> { impl RegisterAdditions for ClientBuilder {
/// Registers the rich interactions configuration on the client /// Registers the rich interactions configuration on the client
fn register_serenity_additions(self) -> Self { fn register_serenity_additions(self) -> Self {
self.register_serenity_additions_with(RichEventHandler::default()) self.register_serenity_additions_with(RichEventHandler::default())

@ -11,6 +11,19 @@ use std::future::Future;
use std::pin::Pin; use std::pin::Pin;
use std::sync::Arc; use std::sync::Arc;
macro_rules! handle_events {
(
match $evt:ident {
$($variant:pat) | + => $handle_call:expr,
}
) => {
match $evt {
$($variant => $handle_call),+,
_ => {},
}
}
}
pub struct EventCallback<T> { pub struct EventCallback<T> {
inner: Arc< inner: Arc<
dyn for<'a> Fn( dyn for<'a> Fn(
@ -34,6 +47,7 @@ impl<T> EventCallback<T> {
/// use serenity_additions::events::RichEventHandler; /// use serenity_additions::events::RichEventHandler;
/// use serenity::model::event; /// use serenity::model::event;
/// use serenity::client::Client; /// use serenity::client::Client;
/// use serenity::prelude::GatewayIntents;
/// use serenity_additions::RegisterAdditions; /// use serenity_additions::RegisterAdditions;
/// # async fn a() -> serenity_additions::Result<()> { /// # async fn a() -> serenity_additions::Result<()> {
/// ///
@ -42,7 +56,7 @@ impl<T> EventCallback<T> {
/// println!("Ready event received"); /// println!("Ready event received");
/// Ok(()) /// Ok(())
/// })); /// }));
/// let client = Client::builder("TOKEN").register_serenity_additions_with(handler).await?; /// let client = Client::builder("TOKEN", GatewayIntents::default()).register_serenity_additions_with(handler).await?;
/// // ... /// // ...
/// # unimplemented!() /// # unimplemented!()
/// # } /// # }
@ -130,46 +144,58 @@ impl Default for RichEventHandler {
#[async_trait] #[async_trait]
impl RawEventHandler for RichEventHandler { impl RawEventHandler for RichEventHandler {
async fn raw_event(&self, ctx: Context, event: Event) { async fn raw_event(&self, ctx: Context, event: Event) {
match event { handle_events!(match event {
Event::ChannelCreate(e) => self.handle_event(ctx, e).await, Event::ChannelCreate(e)
Event::ChannelDelete(e) => self.handle_event(ctx, e).await, | Event::ChannelDelete(e)
Event::ChannelPinsUpdate(e) => self.handle_event(ctx, e).await, | Event::ChannelPinsUpdate(e)
Event::ChannelUpdate(e) => self.handle_event(ctx, e).await, | Event::ChannelUpdate(e)
Event::GuildBanAdd(e) => self.handle_event(ctx, e).await, | Event::GuildBanAdd(e)
Event::GuildBanRemove(e) => self.handle_event(ctx, e).await, | Event::GuildBanRemove(e)
Event::GuildCreate(e) => self.handle_event(ctx, e).await, | Event::GuildCreate(e)
Event::GuildDelete(e) => self.handle_event(ctx, e).await, | Event::GuildDelete(e)
Event::GuildEmojisUpdate(e) => self.handle_event(ctx, e).await, | Event::GuildEmojisUpdate(e)
Event::GuildIntegrationsUpdate(e) => self.handle_event(ctx, e).await, | Event::GuildIntegrationsUpdate(e)
Event::GuildMemberAdd(e) => self.handle_event(ctx, e).await, | Event::GuildMemberAdd(e)
Event::GuildMemberRemove(e) => self.handle_event(ctx, e).await, | Event::GuildMemberRemove(e)
Event::GuildMemberUpdate(e) => self.handle_event(ctx, e).await, | Event::GuildMemberUpdate(e)
Event::GuildMembersChunk(e) => self.handle_event(ctx, e).await, | Event::GuildMembersChunk(e)
Event::GuildRoleCreate(e) => self.handle_event(ctx, e).await, | Event::GuildRoleCreate(e)
Event::GuildRoleDelete(e) => self.handle_event(ctx, e).await, | Event::GuildRoleDelete(e)
Event::GuildRoleUpdate(e) => self.handle_event(ctx, e).await, | Event::GuildRoleUpdate(e)
Event::GuildUnavailable(e) => self.handle_event(ctx, e).await, | Event::GuildUnavailable(e)
Event::GuildUpdate(e) => self.handle_event(ctx, e).await, | Event::GuildUpdate(e)
Event::InviteCreate(e) => self.handle_event(ctx, e).await, | Event::InviteCreate(e)
Event::InviteDelete(e) => self.handle_event(ctx, e).await, | Event::InviteDelete(e)
Event::MessageCreate(e) => self.handle_event(ctx, e).await, | Event::MessageCreate(e)
Event::MessageDelete(e) => self.handle_event(ctx, e).await, | Event::MessageDelete(e)
Event::MessageDeleteBulk(e) => self.handle_event(ctx, e).await, | Event::MessageDeleteBulk(e)
Event::MessageUpdate(e) => self.handle_event(ctx, e).await, | Event::MessageUpdate(e)
Event::PresenceUpdate(e) => self.handle_event(ctx, e).await, | Event::PresenceUpdate(e)
Event::PresencesReplace(e) => self.handle_event(ctx, e).await, | Event::PresencesReplace(e)
Event::ReactionAdd(e) => self.handle_event(ctx, e).await, | Event::ReactionAdd(e)
Event::ReactionRemove(e) => self.handle_event(ctx, e).await, | Event::ReactionRemove(e)
Event::ReactionRemoveAll(e) => self.handle_event(ctx, e).await, | Event::ReactionRemoveAll(e)
Event::Ready(e) => self.handle_event(ctx, e).await, | Event::Ready(e)
Event::Resumed(e) => self.handle_event(ctx, e).await, | Event::Resumed(e)
Event::TypingStart(e) => self.handle_event(ctx, e).await, | Event::TypingStart(e)
Event::UserUpdate(e) => self.handle_event(ctx, e).await, | Event::UserUpdate(e)
Event::VoiceStateUpdate(e) => self.handle_event(ctx, e).await, | Event::VoiceStateUpdate(e)
Event::VoiceServerUpdate(e) => self.handle_event(ctx, e).await, | Event::VoiceServerUpdate(e)
Event::WebhookUpdate(e) => self.handle_event(ctx, e).await, | Event::WebhookUpdate(e)
Event::Unknown(e) => self.handle_event(ctx, e).await, | Event::Unknown(e)
_ => {} | Event::InteractionCreate(e)
} | Event::IntegrationCreate(e)
| Event::IntegrationUpdate(e)
| Event::IntegrationDelete(e)
| Event::StageInstanceCreate(e)
| Event::StageInstanceUpdate(e)
| Event::StageInstanceDelete(e)
| Event::ThreadCreate(e)
| Event::ThreadUpdate(e)
| Event::ThreadDelete(e)
| Event::ThreadListSync(e)
| Event::ThreadMemberUpdate(e)
| Event::ThreadMembersUpdate(e) => self.handle_event(ctx, e).await,
});
} }
} }

Loading…
Cancel
Save