html terminal
map viewage
bendn 2023-07-19
parent f912641 · commit 734f838
-rw-r--r--Cargo.lock231
-rw-r--r--Cargo.toml2
-rw-r--r--src/bot/maps.rs40
-rw-r--r--src/bot/mod.rs1
-rw-r--r--src/bot/schematic.rs6
-rw-r--r--src/bot/schematics.rs0
-rw-r--r--src/bot/status.rs2
-rw-r--r--src/bot/voting.rs4
-rw-r--r--src/webhook.rs2
9 files changed, 188 insertions, 100 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 874aaa0..40a5a6e 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -63,9 +63,9 @@ dependencies = [
[[package]]
name = "anyhow"
-version = "1.0.71"
+version = "1.0.72"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8"
+checksum = "3b13c32d80ecc7ab747b80c3784bce54ee8a7a0cc4fbda9bf4cda2cf6fe90854"
[[package]]
name = "arrayvec"
@@ -75,13 +75,13 @@ checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b"
[[package]]
name = "async-trait"
-version = "0.1.68"
+version = "0.1.71"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842"
+checksum = "a564d521dd56509c4c47480d00b80ee55f7e385ae48db5744c67ad50c92d2ebf"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.22",
+ "syn 2.0.26",
]
[[package]]
@@ -108,9 +108,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "axum"
-version = "0.6.18"
+version = "0.6.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f8175979259124331c1d7bf6586ee7e0da434155e4b2d48ec2c8386281d8df39"
+checksum = "a6a1de45611fdb535bfde7b7de4fd54f4fd2b17b1737c0a59b69bf9b92074b8c"
dependencies = [
"async-trait",
"axum-core",
@@ -195,6 +195,18 @@ dependencies = [
]
[[package]]
+name = "blurslice"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ad73c1456d8431da101a70616474273cf418382a3df426600a331a807b430f13"
+
+[[package]]
+name = "bobbin-bits"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "84a856508d80144eabeae3392de76f269e5fd2983226e4757219f8ce87c5e572"
+
+[[package]]
name = "btparse"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -266,9 +278,9 @@ checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b"
[[package]]
name = "const-str"
-version = "0.5.5"
+version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ce5cd0d05ad8032f6252503d4a61401b640ce9365082accf046c68c7a419339d"
+checksum = "aca749d3d3f5b87a0d6100509879f9cf486ab510803a4a4e1001da1ff61c2bd6"
[[package]]
name = "convert_case"
@@ -293,9 +305,9 @@ checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa"
[[package]]
name = "cpufeatures"
-version = "0.2.8"
+version = "0.2.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "03e69e28e9f7f77debdedbaafa2866e1de9ba56df55a8bd7cfc724c25a09987c"
+checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1"
dependencies = [
"libc",
]
@@ -376,12 +388,12 @@ dependencies = [
[[package]]
name = "dashmap"
-version = "5.4.0"
+version = "5.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "907076dfda823b0b36d2a1bb5f90c96660a5bbcd7729e10727f07858f22c4edc"
+checksum = "6943ae99c34386c84a470c499d3414f66502a41340aa895406e0d2e4a207b91d"
dependencies = [
"cfg-if",
- "hashbrown 0.12.3",
+ "hashbrown 0.14.0",
"lock_api",
"once_cell",
"parking_lot_core",
@@ -438,6 +450,16 @@ dependencies = [
]
[[package]]
+name = "fast_image_resize"
+version = "2.7.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cc789a40040e11bbe4ba31ca319406805a12fe3f8d71314bbc4bd076602ad55a"
+dependencies = [
+ "num-traits",
+ "thiserror",
+]
+
+[[package]]
name = "fdeflate"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -528,7 +550,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.22",
+ "syn 2.0.26",
]
[[package]]
@@ -624,10 +646,16 @@ dependencies = [
]
[[package]]
+name = "hashbrown"
+version = "0.14.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a"
+
+[[package]]
name = "hermit-abi"
-version = "0.3.1"
+version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286"
+checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b"
[[package]]
name = "http"
@@ -689,13 +717,14 @@ dependencies = [
[[package]]
name = "hyper-rustls"
-version = "0.24.0"
+version = "0.24.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0646026eb1b3eea4cd9ba47912ea5ce9cc07713d105b1a14698f4e6433d348b7"
+checksum = "8d78e1e73ec14cf7375674f74d7dde185c8206fd9dea6fb6295e8a98098aaa97"
dependencies = [
+ "futures-util",
"http",
"hyper",
- "rustls 0.21.2",
+ "rustls 0.21.5",
"tokio",
"tokio-rustls 0.24.1",
]
@@ -780,9 +809,9 @@ dependencies = [
[[package]]
name = "itoa"
-version = "1.0.6"
+version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6"
+checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38"
[[package]]
name = "jobserver"
@@ -871,17 +900,24 @@ dependencies = [
[[package]]
name = "mindus"
-version = "1.0.6"
+version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ba4b5c6ed0672aed344fe06fd06490b2e091359c400d0affe68cacff4e34acdf"
+checksum = "62177c3f4839d492b2528c9712375baec219c21c915e139cde3b5ae2d6fbbc36"
dependencies = [
"base64 0.21.2",
+ "blurslice",
+ "bobbin-bits",
"color-hex",
"const-str",
+ "dashmap",
+ "fast_image_resize",
"flate2",
"image",
"paste",
"strconv",
+ "thiserror",
+ "tinyrand",
+ "tinyrand-std",
"walkdir",
"zip",
]
@@ -1166,9 +1202,9 @@ dependencies = [
[[package]]
name = "paste"
-version = "1.0.12"
+version = "1.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79"
+checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c"
[[package]]
name = "percent-encoding"
@@ -1178,29 +1214,29 @@ checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94"
[[package]]
name = "pin-project"
-version = "1.1.1"
+version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6e138fdd8263907a2b0e1b4e80b7e58c721126479b6e6eedfb1b402acea7b9bd"
+checksum = "030ad2bc4db10a8944cb0d837f158bdfec4d4a4873ab701a95046770d11f8842"
dependencies = [
"pin-project-internal",
]
[[package]]
name = "pin-project-internal"
-version = "1.1.1"
+version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d1fef411b303e3e12d534fb6e7852de82da56edd937d895125821fb7c09436c7"
+checksum = "ec2e072ecce94ec471b13398d5402c188e76ac03cf74dd1a975161b23a3f6d9c"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.22",
+ "syn 2.0.26",
]
[[package]]
name = "pin-project-lite"
-version = "0.2.9"
+version = "0.2.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116"
+checksum = "4c40d25201921e5ff0c862a505c6557ea88568a4e3ace775ab55e93f2f4f9d57"
[[package]]
name = "pin-utils"
@@ -1266,18 +1302,18 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
[[package]]
name = "proc-macro2"
-version = "1.0.63"
+version = "1.0.66"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb"
+checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
-version = "1.0.29"
+version = "1.0.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "573015e8ab27661678357f27dc26460738fd2b6c86e46f386fde94cb5d913105"
+checksum = "5fe8a65d69dd0808184ebb5f836ab526bb259db23c657efa38711b1072ee47f0"
dependencies = [
"proc-macro2",
]
@@ -1323,9 +1359,21 @@ dependencies = [
[[package]]
name = "regex"
-version = "1.8.4"
+version = "1.9.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b2eae68fc220f7cf2532e4494aded17545fce192d59cd996e0fe7887f4ceb575"
+dependencies = [
+ "aho-corasick 1.0.2",
+ "memchr",
+ "regex-automata",
+ "regex-syntax",
+]
+
+[[package]]
+name = "regex-automata"
+version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d0ab3ca65655bb1e41f2a8c8cd662eb4fb035e67c3f78da1d61dffe89d07300f"
+checksum = "39354c10dd07468c2e73926b23bb9c2caca74c5501e38a35da70406f1d923310"
dependencies = [
"aho-corasick 1.0.2",
"memchr",
@@ -1334,9 +1382,9 @@ dependencies = [
[[package]]
name = "regex-syntax"
-version = "0.7.2"
+version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78"
+checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2"
[[package]]
name = "reqwest"
@@ -1362,7 +1410,7 @@ dependencies = [
"once_cell",
"percent-encoding",
"pin-project-lite",
- "rustls 0.21.2",
+ "rustls 0.21.5",
"rustls-pemfile",
"serde",
"serde_json",
@@ -1430,9 +1478,9 @@ dependencies = [
[[package]]
name = "rustls"
-version = "0.21.2"
+version = "0.21.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e32ca28af694bc1bbf399c33a516dbdf1c90090b8ab23c2bc24f834aa2247f5f"
+checksum = "79ea77c539259495ce8ca47f53e66ae0330a8819f67e23ac96ca02f50e7b7d36"
dependencies = [
"log",
"ring",
@@ -1451,9 +1499,9 @@ dependencies = [
[[package]]
name = "rustls-webpki"
-version = "0.100.1"
+version = "0.101.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d6207cd5ed3d8dca7816f8f3725513a34609c0c765bf652b8c3cb4cfd87db46b"
+checksum = "15f36a6828982f422756984e47912a7a51dcbc2a197aa791158f8ca61cd8204e"
dependencies = [
"ring",
"untrusted",
@@ -1461,15 +1509,15 @@ dependencies = [
[[package]]
name = "rustversion"
-version = "1.0.12"
+version = "1.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4f3208ce4d8448b3f3e7d168a73f5e0c43a61e32930de3bceeccedb388b6bf06"
+checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4"
[[package]]
name = "ryu"
-version = "1.0.13"
+version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041"
+checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741"
[[package]]
name = "same-file"
@@ -1482,9 +1530,9 @@ dependencies = [
[[package]]
name = "scopeguard"
-version = "1.1.0"
+version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
+checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
[[package]]
name = "sct"
@@ -1498,15 +1546,15 @@ dependencies = [
[[package]]
name = "semver"
-version = "1.0.17"
+version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed"
+checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918"
[[package]]
name = "serde"
-version = "1.0.164"
+version = "1.0.171"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d"
+checksum = "30e27d1e4fd7659406c492fd6cfaf2066ba8773de45ca75e855590f856dc34a9"
dependencies = [
"serde_derive",
]
@@ -1523,20 +1571,20 @@ dependencies = [
[[package]]
name = "serde_derive"
-version = "1.0.164"
+version = "1.0.171"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68"
+checksum = "389894603bd18c46fa56231694f8d827779c0951a667087194cf9de94ed24682"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.22",
+ "syn 2.0.26",
]
[[package]]
name = "serde_json"
-version = "1.0.99"
+version = "1.0.103"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "46266871c240a00b8f503b877622fe33430b3c7d963bdc0f2adc511e54a1eae3"
+checksum = "d03b412469450d4404fe8499a268edd7f8b79fecb074b0d812ad64ca21f4031b"
dependencies = [
"itoa",
"ryu",
@@ -1557,9 +1605,9 @@ dependencies = [
[[package]]
name = "serenity"
-version = "0.11.5"
+version = "0.11.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "82fd5e7b5858ad96e99d440138f34f5b98e1b959ebcd3a1036203b30e78eb788"
+checksum = "d007dc45584ecc47e791f2a9a7cf17bf98ac386728106f111159c846d624be3f"
dependencies = [
"async-trait",
"async-tungstenite",
@@ -1615,9 +1663,9 @@ dependencies = [
[[package]]
name = "smallvec"
-version = "1.10.0"
+version = "1.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0"
+checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9"
[[package]]
name = "socket2"
@@ -1641,7 +1689,7 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f32df10f08eec2c31bc4e24768cef452df8f7c44c40f3c92c268a1c61195f8c4"
dependencies = [
- "syn 2.0.22",
+ "syn 2.0.26",
]
[[package]]
@@ -1672,9 +1720,9 @@ dependencies = [
[[package]]
name = "syn"
-version = "2.0.22"
+version = "2.0.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2efbeae7acf4eabd6bcdcbd11c92f45231ddda7539edc7806bd1a04a03b24616"
+checksum = "45c3457aacde3c65315de5031ec191ce46604304d2446e803d71ade03308d970"
dependencies = [
"proc-macro2",
"quote",
@@ -1689,29 +1737,29 @@ checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160"
[[package]]
name = "thiserror"
-version = "1.0.40"
+version = "1.0.43"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac"
+checksum = "a35fc5b8971143ca348fa6df4f024d4d55264f3468c71ad1c2f365b0a4d58c42"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
-version = "1.0.40"
+version = "1.0.43"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f"
+checksum = "463fe12d7993d3b327787537ce8dd4dfa058de32fc2b195ef3cde03dc4771e8f"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.22",
+ "syn 2.0.26",
]
[[package]]
name = "time"
-version = "0.3.22"
+version = "0.3.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ea9e1b3cf1243ae005d9e74085d4d542f3125458f3a81af210d901dcd7411efd"
+checksum = "59e399c068f43a5d116fedaf73b203fa4f9c519f17e2b34f63221d3792f81446"
dependencies = [
"itoa",
"serde",
@@ -1727,14 +1775,29 @@ checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb"
[[package]]
name = "time-macros"
-version = "0.2.9"
+version = "0.2.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "372950940a5f07bf38dbe211d7283c9e6d7327df53794992d293e534c733d09b"
+checksum = "96ba15a897f3c86766b757e5ac7221554c6750054d74d5b28844fce5fb36a6c4"
dependencies = [
"time-core",
]
[[package]]
+name = "tinyrand"
+version = "0.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "87ffaad2263779579369d45f65cad0647c860893d27e4543cdcc1e428d07da2c"
+
+[[package]]
+name = "tinyrand-std"
+version = "0.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4328fbf2b798a35faaa4f1139fa7efe6ab0449efc31cac5d107d69844a5acd30"
+dependencies = [
+ "tinyrand",
+]
+
+[[package]]
name = "tinyvec"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1776,7 +1839,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.22",
+ "syn 2.0.26",
]
[[package]]
@@ -1796,7 +1859,7 @@ version = "0.24.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081"
dependencies = [
- "rustls 0.21.2",
+ "rustls 0.21.5",
"tokio",
]
@@ -1873,7 +1936,7 @@ checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.22",
+ "syn 2.0.26",
]
[[package]]
@@ -1941,9 +2004,9 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460"
[[package]]
name = "unicode-ident"
-version = "1.0.9"
+version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0"
+checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c"
[[package]]
name = "unicode-normalization"
@@ -2069,7 +2132,7 @@ dependencies = [
"once_cell",
"proc-macro2",
"quote",
- "syn 2.0.22",
+ "syn 2.0.26",
"wasm-bindgen-shared",
]
@@ -2103,7 +2166,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.22",
+ "syn 2.0.26",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
diff --git a/Cargo.toml b/Cargo.toml
index ffe2231..43e3ec6 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -40,7 +40,7 @@ parse_duration = "2.1.1"
serde = "1.0"
serde_json = "1.0"
btparse = "0.1.1"
-mindus = "1.0"
+mindus = "1.1"
image = { version = "0.24.6", features = ["png"], default-features = false }
[profile.release]
diff --git a/src/bot/maps.rs b/src/bot/maps.rs
index 758cae0..0af9fa2 100644
--- a/src/bot/maps.rs
+++ b/src/bot/maps.rs
@@ -1,9 +1,13 @@
use super::{get_nextblock, strip_colors, Context, Result, SUCCESS};
use crate::send;
use futures_util::StreamExt;
+use image::{codecs::png::PngEncoder, ImageEncoder};
+use mindus::*;
+use poise::serenity_prelude::*;
+use std::borrow::Cow;
+use std::sync::LazyLock;
use tokio::sync::broadcast;
use tokio::sync::OnceCell;
-
pub struct Maps;
impl Maps {
pub async fn find(map: &str, stdin: &broadcast::Sender<String>) -> usize {
@@ -40,13 +44,7 @@ pub async fn autocomplete<'a>(
.map(ToString::to_string)
}
-#[poise::command(
- slash_command,
- prefix_command,
- required_permissions = "ADMINISTRATOR",
- category = "Info",
- rename = "maps"
-)]
+#[poise::command(slash_command, prefix_command, category = "Info", rename = "maps")]
/// lists the maps.
pub async fn list(ctx: Context<'_>) -> Result<()> {
let _ = ctx.defer_or_broadcast().await;
@@ -62,3 +60,29 @@ pub async fn list(ctx: Context<'_>) -> Result<()> {
.await?;
Ok(())
}
+
+static REG: LazyLock<mindus::block::BlockRegistry> = LazyLock::new(build_registry);
+
+#[poise::command(slash_command, prefix_command, category = "Info")]
+/// look at the current game.
+pub async fn view(ctx: Context<'_>) -> Result<()> {
+ let _ = ctx.defer_or_broadcast().await;
+ send!(ctx.data().stdin, "save 0")?;
+ let _ = get_nextblock().await;
+
+ // parsing the thing doesnt negate the ineed for a env var sooo
+ let o = std::fs::read(std::env::var("SAVE_PATH").unwrap())?;
+ let m = MapSerializer(&REG).deserialize(&mut mindus::data::DataRead::new(&o))?;
+ let i = m.render();
+ let mut b = vec![];
+ PngEncoder::new(&mut b).write_image(&i, i.width(), i.height(), image::ColorType::Rgba8)?;
+ poise::send_reply(ctx, |m| {
+ m.attachment(AttachmentType::Bytes {
+ data: Cow::Owned(b),
+ filename: "0.png".to_string(),
+ })
+ .embed(|e| e.attachment("0.png").color(SUCCESS))
+ })
+ .await?;
+ Ok(())
+}
diff --git a/src/bot/mod.rs b/src/bot/mod.rs
index fb5a2ec..eb43724 100644
--- a/src/bot/mod.rs
+++ b/src/bot/mod.rs
@@ -65,6 +65,7 @@ impl Bot {
admin::remove(),
js::run(),
maps::list(),
+ maps::view(),
player::list(),
status::command(),
config::set(),
diff --git a/src/bot/schematic.rs b/src/bot/schematic.rs
index 0b05f1f..a7d435e 100644
--- a/src/bot/schematic.rs
+++ b/src/bot/schematic.rs
@@ -14,7 +14,7 @@ static RE: LazyLock<Regex> = LazyLock::new(|| Regex::new(r#"(```)?([^`]+)(```)?"
static REG: LazyLock<mindus::block::BlockRegistry> = LazyLock::new(build_registry);
#[poise::command(context_menu_command = "Render schematic", category = "Info")]
-/// server status.
+/// draw schematic.
pub async fn context_draw(ctx: Context<'_>, msg: Message) -> Result<()> {
let _ = ctx.defer_or_broadcast().await;
@@ -47,7 +47,7 @@ pub async fn draw(ctx: Context<'_>, schematic: String) -> Result<()> {
async fn send(ctx: &Context<'_>, s: &Schematic<'_>) -> Result<()> {
let mut b = vec![];
- let p = Renderer::render(s);
+ let p = s.render();
PngEncoder::new(&mut b).write_image(&p, p.width(), p.height(), image::ColorType::Rgba8)?;
let n = strip_colors(s.tags.get("name").unwrap());
let filename = "image.png";
@@ -64,7 +64,7 @@ async fn send(ctx: &Context<'_>, s: &Schematic<'_>) -> Result<()> {
})
})
.await?;
- return Ok(());
+ Ok(())
}
async fn draw_impl(ctx: Context<'_>, msg: &str) -> Result<()> {
diff --git a/src/bot/schematics.rs b/src/bot/schematics.rs
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/bot/schematics.rs
diff --git a/src/bot/status.rs b/src/bot/status.rs
index ce6d7e4..d8cd443 100644
--- a/src/bot/status.rs
+++ b/src/bot/status.rs
@@ -66,7 +66,7 @@ pub async fn command(ctx: Context<'_>) -> Result<()> {
block = get_nextblock() => block,
_ = sleep(Duration::from_secs(5)) => fail!(ctx, FAIL),
};
- let Some((tps,mem,pcount)) = parse(&block) else {
+ let Some((tps, mem, pcount)) = parse(&block) else {
fail!(ctx, FAIL);
};
poise::send_reply(ctx, |m| {
diff --git a/src/bot/voting.rs b/src/bot/voting.rs
index 9fa57a6..1521284 100644
--- a/src/bot/voting.rs
+++ b/src/bot/voting.rs
@@ -465,9 +465,9 @@ async fn fix(ctx: &Context<'_>, data: BufReader<std::fs::File>) -> Result<()> {
};
let v = VoteData::Before(v);
if end < now {
- v.push(&ctx).finish(&ctx).await
+ v.push(ctx).finish(ctx).await
} else {
- v.push(&ctx).input(&ctx).await?.finish(&ctx).await
+ v.push(ctx).input(ctx).await?.finish(ctx).await
}
}
diff --git a/src/webhook.rs b/src/webhook.rs
index f018917..9653925 100644
--- a/src/webhook.rs
+++ b/src/webhook.rs
@@ -181,7 +181,7 @@ impl OutputStyle for MindustryStyle {
}
static REGEX: LazyLock<Regex> = LazyLock::new(|| {
- Regex::new(r#"(.+) has (dis)?connected. \[([a-zA-Z0-9+/]+==)\]"#).unwrap()
+ Regex::new(r"(.+) has (dis)?connected. \[([a-zA-Z0-9+/]+==)\]").unwrap()
});
if let Some(captures) = REGEX.captures(line) {
let player = unify(captures.get(1).unwrap().as_str());