Dough Git

commit

Port proxyBot to Rust

commit
728b5d829121278217297aa08ecc1180965b483e
author
Clove <[email protected]>
date
2026-11-22 13:14
Co-Authored-By: Sandrone <[email protected]>

diff --git a/.env.example b/.env.example
index e9bf4b3..ab0cc35 100644
--- a/.env.example
+++ b/.env.example
@@ -1,2 +1,3 @@
 DISCORD_TOKEN=
 OWNER_ID=
+SITE_TOKEN=
diff --git a/.gitignore b/.gitignore
index 634f4a8..fa330f1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,9 @@
 .env
-node_modules/
 */supervise/
 data/
+
+.agents/
+.claude/
+.codex/
+.aws/
+/target/
diff --git a/Cargo.lock b/Cargo.lock
new file mode 100644
index 0000000..bfaec4f
--- /dev/null
+++ b/Cargo.lock
@@ -0,0 +1,2008 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 4
+
+[[package]]
+name = "adler2"
+version = "2.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
+
+[[package]]
+name = "aho-corasick"
+version = "1.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba"
+dependencies = [
+ "memchr",
+]
+
+[[package]]
+name = "anyhow"
+version = "1.0.102"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c"
+
+[[package]]
+name = "arrayvec"
+version = "0.7.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d3fb67a6e08acf24fdeccbac2cb6ac4305825bd1f117462e0e6f2f193345ad56"
+dependencies = [
+ "serde",
+]
+
+[[package]]
+name = "async-trait"
+version = "0.1.92"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "82f6aeea286b8eb4dd3431a1be1b59d290ace00f5bfd8e2a159bc2a05e2c1667"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 3.0.10",
+]
+
+[[package]]
+name = "atomic-waker"
+version = "1.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
+
+[[package]]
+name = "base64"
+version = "0.22.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
+
+[[package]]
+name = "base64"
+version = "0.23.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5"
+
+[[package]]
+name = "bitflags"
+version = "2.13.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06"
+
+[[package]]
+name = "block-buffer"
+version = "0.10.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
+dependencies = [
+ "generic-array",
+]
+
+[[package]]
+name = "bumpalo"
+version = "3.20.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "87a0cf66fd1eb2fb7b822cb78370d82303750809bc6ba855f3f58e517d3238db"
+
+[[package]]
+name = "byteorder"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
+
+[[package]]
+name = "bytes"
+version = "1.12.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "776dfebd015e2d8732c684a2c71003674ccb49457b539b9e82151ba38e96dd7c"
+
+[[package]]
+name = "cc"
+version = "1.11.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "02f0e023adb368345ce0ca6cdfc0f24a06554468d0e8503e14a0841de79bfa69"
+dependencies = [
+ "find-msvc-tools",
+ "shlex",
+]
+
+[[package]]
+name = "cfg-if"
+version = "1.0.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600"
+
+[[package]]
+name = "cfg_aliases"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527"
+
+[[package]]
+name = "chacha20"
+version = "0.10.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "65c35e4b699c7e15ccbe7ee35c005e4fc0a278d22238a2857e6ce2dadeda1b06"
+dependencies = [
+ "cfg-if",
+ "cpufeatures 0.3.1",
+ "rand_core 0.10.1",
+]
+
+[[package]]
+name = "cpufeatures"
+version = "0.2.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280"
+dependencies = [
+ "libc",
+]
+
+[[package]]
+name = "cpufeatures"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5ca28b0ae3115b884660db4118d803791fd6756b6e88f39c0f3f7859060d7566"
+dependencies = [
+ "libc",
+]
+
+[[package]]
+name = "crc32fast"
+version = "1.5.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2b929dd2a135771f40afabd1073f85eed59c800b7c61901e5c254270497dad64"
+dependencies = [
+ "cfg-if",
+]
+
+[[package]]
+name = "crypto-common"
+version = "0.1.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a"
+dependencies = [
+ "generic-array",
+ "typenum",
+]
+
+[[package]]
+name = "dashmap"
+version = "5.5.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856"
+dependencies = [
+ "cfg-if",
+ "hashbrown",
+ "lock_api",
+ "once_cell",
+ "parking_lot_core",
+ "serde",
+]
+
+[[package]]
+name = "data-encoding"
+version = "2.11.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4583a4551df46e2792f82ceeac45e850d2e2d5debba0b91f102385cda5b11f06"
+
+[[package]]
+name = "deranged"
+version = "0.5.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9e9de72ce2ad1f90dc62fa25f0f430ef85eb4b0d8fa0be4f30373bc40a21d28e"
+dependencies = [
+ "serde_core",
+]
+
+[[package]]
+name = "digest"
+version = "0.10.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
+dependencies = [
+ "block-buffer",
+ "crypto-common",
+]
+
+[[package]]
+name = "displaydoc"
+version = "0.2.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 3.0.10",
+]
+
+[[package]]
+name = "dotenvy"
+version = "0.15.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b"
+
+[[package]]
+name = "errno"
+version = "0.3.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e35d6e78f4cebb90e51d543db8fe41528851d6deeef6ef21ebd4bfdc1e784776"
+dependencies = [
+ "libc",
+ "windows-sys 0.61.2",
+]
+
+[[package]]
+name = "fastrand"
+version = "2.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9f1f227452a390804cdb637b74a86990f2a7d7ba4b7d5693aac9b4dd6defd8d6"
+
+[[package]]
+name = "find-msvc-tools"
+version = "0.1.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1c66915cc5391097de7a2b0b972e8505aa33c0df401fd3a6811dbdb32881ba48"
+
+[[package]]
+name = "flate2"
+version = "1.1.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "626d4928326b646e70f65ed36fc7cf9f206bdb68a0019ee7c6b4709da4e084c4"
+dependencies = [
+ "crc32fast",
+ "miniz_oxide",
+ "zlib-rs",
+]
+
+[[package]]
+name = "form_urlencoded"
+version = "1.2.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "afa489199eaffb1211795df1c6236ce1ad0d41a6fa45250add73e3b02420f06e"
+dependencies = [
+ "percent-encoding",
+]
+
+[[package]]
+name = "futures"
+version = "0.3.34"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9a31d2a3fbaaeb2af2368bbdd904aa8e812d3c04a1ee10d3171f52d556e5d0a3"
+dependencies = [
+ "futures-channel",
+ "futures-core",
+ "futures-io",
+ "futures-sink",
+ "futures-task",
+ "futures-util",
+]
+
+[[package]]
+name = "futures-channel"
+version = "0.3.34"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b1f9e3d69d39e4862ffed03ed071a76f9a13ba1d9109d355b0f0aa6b15e393c4"
+dependencies = [
+ "futures-core",
+ "futures-sink",
+]
+
+[[package]]
+name = "futures-core"
+version = "0.3.34"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e"
+
+[[package]]
+name = "futures-io"
+version = "0.3.34"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "53c0fa8157de1303bfffdaa1cc2a673bfffb60102f76b0ef4441659124373fed"
+
+[[package]]
+name = "futures-macro"
+version = "0.3.34"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9fb9654ba8355388abeb8dcb4fc62f511300867002afc858860463bdd9fe0c44"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 3.0.10",
+]
+
+[[package]]
+name = "futures-sink"
+version = "0.3.34"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1944426bf7d03f1d14f708785e4b33efd750b36d48a157b836b3efc15ede8e1d"
+
+[[package]]
+name = "futures-task"
+version = "0.3.34"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd"
+
+[[package]]
+name = "futures-util"
+version = "0.3.34"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc"
+dependencies = [
+ "futures-channel",
+ "futures-core",
+ "futures-io",
+ "futures-macro",
+ "futures-sink",
+ "futures-task",
+ "memchr",
+ "pin-project-lite",
+ "slab",
+]
+
+[[package]]
+name = "generic-array"
+version = "0.14.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
+dependencies = [
+ "typenum",
+ "version_check",
+]
+
+[[package]]
+name = "getrandom"
+version = "0.2.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0"
+dependencies = [
+ "cfg-if",
+ "js-sys",
+ "libc",
+ "wasi",
+ "wasm-bindgen",
+]
+
+[[package]]
+name = "getrandom"
+version = "0.4.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099"
+dependencies = [
+ "cfg-if",
+ "js-sys",
+ "libc",
+ "r-efi",
+ "rand_core 0.10.1",
+ "wasm-bindgen",
+]
+
+[[package]]
+name = "hashbrown"
+version = "0.14.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
+
+[[package]]
+name = "http"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "918d3568bebf352712bc2ef3d46a8bcf1a75b373be6539de198e9105cbbf9ce0"
+dependencies = [
+ "bytes",
+ "itoa",
+]
+
+[[package]]
+name = "http-body"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ca2a8f2913ee65f60facd6a5905613afaa448497a0230cc41ce022d93290bc2c"
+dependencies = [
+ "bytes",
+ "http",
+]
+
+[[package]]
+name = "http-body-util"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "23169fe34a5fbcdd3f3862e78fb9b6fccd5f02a6dc6f732547005d45631ce71c"
+dependencies = [
+ "bytes",
+ "futures-core",
+ "http",
+ "http-body",
+ "pin-project-lite",
+]
+
+[[package]]
+name = "httparse"
+version = "1.10.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87"
+
+[[package]]
+name = "hyper"
+version = "1.12.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2c3e324da4c95177d6291d4c8730197c0d1822f8a9766814a4a44fa5ab797c9c"
+dependencies = [
+ "atomic-waker",
+ "bytes",
+ "futures-core",
+ "http",
+ "http-body",
+ "httparse",
+ "itoa",
+ "pin-project-lite",
+ "smallvec",
+ "tokio",
+ "want",
+]
+
+[[package]]
+name = "hyper-rustls"
+version = "0.27.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dfa8e654703247911e29c23fbeaa261834bd9bb74efba2f9acddc37bfb127f53"
+dependencies = [
+ "http",
+ "hyper",
+ "hyper-util",
+ "rustls 0.23.46",
+ "tokio",
+ "tokio-rustls 0.26.6",
+ "tower-service",
+ "webpki-roots 1.0.12",
+]
+
+[[package]]
+name = "hyper-util"
+version = "0.1.21"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ddc03d96684f9226b8a787cdb71488417b53ab5ea8fdb1dac946cb9431cc8bff"
+dependencies = [
+ "base64 0.23.1",
+ "bytes",
+ "futures-channel",
+ "futures-util",
+ "http",
+ "http-body",
+ "httparse",
+ "hyper",
+ "ipnet",
+ "libc",
+ "percent-encoding",
+ "pin-project-lite",
+ "socket2",
+ "tokio",
+ "tower-service",
+ "tracing",
+]
+
+[[package]]
+name = "icu_collections"
+version = "2.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fe090a42a0d3140fed8c63263ed1fecc02422cb2f4bfe55cd8de2de1b8e105dd"
+dependencies = [
+ "displaydoc",
+ "potential_utf",
+ "utf8_iter",
+ "yoke",
+ "zerofrom",
+ "zerovec",
+]
+
+[[package]]
+name = "icu_locale_core"
+version = "2.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "25d29b57c17c6528d0dc4c2141cfa2d08200465acb537a3909c8b9b8a4a984c0"
+dependencies = [
+ "displaydoc",
+ "litemap",
+ "tinystr",
+ "writeable",
+ "zerovec",
+]
+
+[[package]]
+name = "icu_normalizer"
+version = "2.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "404a3b8c486f205c87fe7f23ab6894d84a4ad76d6e4671ae1981ba7def87c599"
+dependencies = [
+ "icu_collections",
+ "icu_normalizer_data",
+ "icu_properties",
+ "icu_provider",
+ "smallvec",
+ "zerovec",
+]
+
+[[package]]
+name = "icu_normalizer_data"
+version = "2.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "20f0088bfb7441f7a37fa0c9e20cb1e9cba1cac6b9ce8cd2a6dc44294f8e8cbc"
+
+[[package]]
+name = "icu_properties"
+version = "2.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2ea83d991c56158f7cf898bf86436c1dfe7c07ee82fe88951f2695c9f37a379f"
+dependencies = [
+ "displaydoc",
+ "icu_collections",
+ "icu_locale_core",
+ "icu_properties_data",
+ "icu_provider",
+ "zerotrie",
+ "zerovec",
+]
+
+[[package]]
+name = "icu_properties_data"
+version = "2.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b98f29af82d02b163fe50161388350e743bb3107cc8e8c2f7314cb505faddfcf"
+
+[[package]]
+name = "icu_provider"
+version = "2.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "413099315636c588ee8f011190b329b971a09a8fae9d157e01dcae8379468514"
+dependencies = [
+ "displaydoc",
+ "icu_locale_core",
+ "writeable",
+ "yoke",
+ "zerofrom",
+ "zerotrie",
+ "zerovec",
+]
+
+[[package]]
+name = "idna"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de"
+dependencies = [
+ "idna_adapter",
+ "smallvec",
+ "utf8_iter",
+]
+
+[[package]]
+name = "idna_adapter"
+version = "1.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714"
+dependencies = [
+ "icu_normalizer",
+ "icu_properties",
+]
+
+[[package]]
+name = "ipnet"
+version = "2.12.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "791930b43c0d5973160d90a8f3894509f2b273430f5c5c73b668636d0287c5c0"
+
+[[package]]
+name = "itoa"
+version = "1.0.19"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3bd1574e617a9a6c1f8f8181bd7e841e1f20e4277607ef28945765188d6284d4"
+
+[[package]]
+name = "jpcl"
+version = "2.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7382dd2f498998b20f643f96c5a89dc49baad7f5d1d28d3d44dc8b56e9b42da7"
+
+[[package]]
+name = "js-sys"
+version = "0.3.107"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8dc09d2154098bbf4ef54eab6b117a3c24cbbffe94046b16ee6d6d4510584d3a"
+dependencies = [
+ "cfg-if",
+ "futures-util",
+ "wasm-bindgen",
+]
+
+[[package]]
+name = "libc"
+version = "0.2.191"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"
+
+[[package]]
+name = "linux-raw-sys"
+version = "0.12.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53"
+
+[[package]]
+name = "litemap"
+version = "0.8.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae"
+
+[[package]]
+name = "lock_api"
+version = "0.4.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965"
+dependencies = [
+ "scopeguard",
+]
+
+[[package]]
+name = "log"
+version = "0.4.35"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5d15f86d12da44cd8d4ec3c73984537eb7f4cadcb9776a575a0a8a05ca11005c"
+
+[[package]]
+name = "lru-slab"
+version = "0.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4050469837a6ff301cd14c1f8f24f88549e6d548f24f64e2148eb0f72cebc51f"
+
+[[package]]
+name = "memchr"
+version = "2.8.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
+
+[[package]]
+name = "mime"
+version = "0.3.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d5848f5a9e8117cf94f2f90faac24a87ff81600ff8628c1e3deaab572e76bfa1"
+
+[[package]]
+name = "mime_guess"
+version = "2.0.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e"
+dependencies = [
+ "mime",
+ "unicase",
+]
+
+[[package]]
+name = "miniz_oxide"
+version = "0.9.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b63fbc4a50860e98e7b2aa7804ded1db5cbc3aff9193adaff57a6931bf7c4b4c"
+dependencies = [
+ "adler2",
+ "simd-adler32",
+]
+
+[[package]]
+name = "mio"
+version = "1.2.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "20521a903f02b0a573cd6840e9d0a5a0cc043d361fe924092cd70f8556cc9c4a"
+dependencies = [
+ "libc",
+ "wasi",
+ "windows-sys 0.61.2",
+]
+
+[[package]]
+name = "num-conv"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "521739c6d2bac4aa25192232afe6841231376b2b26d4d9fae5ecf8ca5772e441"
+
+[[package]]
+name = "once_cell"
+version = "1.21.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
+
+[[package]]
+name = "parking_lot"
+version = "0.12.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a"
+dependencies = [
+ "lock_api",
+ "parking_lot_core",
+]
+
+[[package]]
+name = "parking_lot_core"
+version = "0.9.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1"
+dependencies = [
+ "cfg-if",
+ "libc",
+ "redox_syscall",
+ "smallvec",
+ "windows-link",
+]
+
+[[package]]
+name = "percent-encoding"
+version = "2.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220"
+
+[[package]]
+name = "pin-project-lite"
+version = "0.2.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c938015719552d665fd0553b90d96cd7ff58e83e4c061ca99e6bb78865a72752"
+
+[[package]]
+name = "potential_utf"
+version = "0.1.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d83eb9bc6d8e5cf568e7a1101d60ee05e81ed50ea106026f3d18deeb046d7661"
+dependencies = [
+ "zerovec",
+]
+
+[[package]]
+name = "powerfmt"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4a6394b9e965e73d0a289ee54f589087e2c676aedf60885baf52c76b771e4958"
+
+[[package]]
+name = "ppv-lite86"
+version = "0.2.21"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9"
+dependencies = [
+ "zerocopy",
+]
+
+[[package]]
+name = "proc-macro2"
+version = "1.0.107"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
+dependencies = [
+ "unicode-ident",
+]
+
+[[package]]
+name = "proxybot"
+version = "1.0.0"
+dependencies = [
+ "anyhow",
+ "base64 0.22.1",
+ "dotenvy",
+ "futures-util",
+ "jpcl",
+ "percent-encoding",
+ "regex",
+ "reqwest",
+ "secrecy",
+ "serde",
+ "serde_json",
+ "serenity",
+ "tempfile",
+ "tokio",
+ "tokio-tungstenite",
+]
+
+[[package]]
+name = "quinn"
+version = "0.11.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4051e23e9185c255a7e33ef59cdbca87a22d359052eecd22fc6b901fb37d9d11"
+dependencies = [
+ "bytes",
+ "cfg_aliases",
+ "pin-project-lite",
+ "quinn-proto",
+ "quinn-udp",
+ "rustc-hash",
+ "rustls 0.23.46",
+ "socket2",
+ "thiserror 2.0.21",
+ "tokio",
+ "tracing",
+ "web-time",
+]
+
+[[package]]
+name = "quinn-proto"
+version = "0.11.19"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0e750cca55fe4f0439a15d0bb529da9651e79993e8e72c61a899a36d462befbe"
+dependencies = [
+ "bytes",
+ "getrandom 0.4.3",
+ "lru-slab",
+ "rand 0.10.4",
+ "rand_pcg",
+ "ring",
+ "rustc-hash",
+ "rustls 0.23.46",
+ "rustls-pki-types",
+ "slab",
+ "thiserror 2.0.21",
+ "tinyvec",
+ "tracing",
+ "web-time",
+]
+
+[[package]]
+name = "quinn-udp"
+version = "0.5.16"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "af66907df18639dcf4db56ca65490cabc4b27a97dbadd96f2926cca73298f016"
+dependencies = [
+ "cfg_aliases",
+ "libc",
+ "once_cell",
+ "socket2",
+ "tracing",
+ "windows-sys 0.61.2",
+]
+
+[[package]]
+name = "quote"
+version = "1.0.47"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
+dependencies = [
+ "proc-macro2",
+]
+
+[[package]]
+name = "r-efi"
+version = "6.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf"
+
+[[package]]
+name = "rand"
+version = "0.8.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e058c7de0b26af77780c769414d6257830bb240f3c38477dbc2c16e5f54d6d4c"
+dependencies = [
+ "libc",
+ "rand_chacha",
+ "rand_core 0.6.4",
+]
+
+[[package]]
+name = "rand"
+version = "0.10.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8f6fa277c67e6ea590466f04c3fe82cb509f0864fe470643e5570de9514a9b11"
+dependencies = [
+ "chacha20",
+ "getrandom 0.4.3",
+ "rand_core 0.10.1",
+]
+
+[[package]]
+name = "rand_chacha"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
+dependencies = [
+ "ppv-lite86",
+ "rand_core 0.6.4",
+]
+
+[[package]]
+name = "rand_core"
+version = "0.6.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
+dependencies = [
+ "getrandom 0.2.17",
+]
+
+[[package]]
+name = "rand_core"
+version = "0.10.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69"
+
+[[package]]
+name = "rand_pcg"
+version = "0.10.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "eb95882a1e14462c69aea9984bb261293ccfe6022ef8de0eda18bd5afb0052df"
+dependencies = [
+ "rand_core 0.10.1",
+]
+
+[[package]]
+name = "redox_syscall"
+version = "0.5.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d"
+dependencies = [
+ "bitflags",
+]
+
+[[package]]
+name = "regex"
+version = "1.13.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9807af0e638c12e753aa1b4e601791bf2a8f71274023c8bbeec12fc149950857"
+dependencies = [
+ "aho-corasick",
+ "memchr",
+ "regex-automata",
+ "regex-syntax",
+]
+
+[[package]]
+name = "regex-automata"
+version = "0.4.19"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "41d60ef07df457506a0a1a2073112eb4aae5733dbd2813c3da77d1b0fd441158"
+dependencies = [
+ "aho-corasick",
+ "memchr",
+ "regex-syntax",
+]
+
+[[package]]
+name = "regex-syntax"
+version = "0.8.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d902046e6a28a1e4c3cab97258a0ce11e994903f01c2d97a9447a0b3df85f4f6"
+
+[[package]]
+name = "reqwest"
+version = "0.12.28"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147"
+dependencies = [
+ "base64 0.22.1",
+ "bytes",
+ "futures-core",
+ "futures-util",
+ "http",
+ "http-body",
+ "http-body-util",
+ "hyper",
+ "hyper-rustls",
+ "hyper-util",
+ "js-sys",
+ "log",
+ "mime_guess",
+ "percent-encoding",
+ "pin-project-lite",
+ "quinn",
+ "rustls 0.23.46",
+ "rustls-pki-types",
+ "serde",
+ "serde_json",
+ "serde_urlencoded",
+ "sync_wrapper",
+ "tokio",
+ "tokio-rustls 0.26.6",
+ "tokio-util",
+ "tower",
+ "tower-http",
+ "tower-service",
+ "url",
+ "wasm-bindgen",
+ "wasm-bindgen-futures",
+ "wasm-streams",
+ "web-sys",
+ "webpki-roots 1.0.12",
+]
+
+[[package]]
+name = "ring"
+version = "0.17.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7"
+dependencies = [
+ "cc",
+ "cfg-if",
+ "getrandom 0.2.17",
+ "libc",
+ "untrusted",
+ "windows-sys 0.52.0",
+]
+
+[[package]]
+name = "rustc-hash"
+version = "2.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d"
+
+[[package]]
+name = "rustix"
+version = "1.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "891efababe418670775f199f0d233d84843c227a0949a883ce15b37c78d6629d"
+dependencies = [
+ "bitflags",
+ "errno",
+ "libc",
+ "linux-raw-sys",
+ "windows-sys 0.61.2",
+]
+
+[[package]]
+name = "rustls"
+version = "0.22.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432"
+dependencies = [
+ "log",
+ "ring",
+ "rustls-pki-types",
+ "rustls-webpki 0.102.8",
+ "subtle",
+ "zeroize",
+]
+
+[[package]]
+name = "rustls"
+version = "0.23.46"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "48e13bd8c0e9365c43cfa5c9e8f9ad49d3c8444926c9aac819e0e4dc503c8fdf"
+dependencies = [
+ "once_cell",
+ "ring",
+ "rustls-pki-types",
+ "rustls-webpki 0.103.17",
+ "subtle",
+ "zeroize",
+]
+
+[[package]]
+name = "rustls-pki-types"
+version = "1.16.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "102f35f7de7b06d8c61f1cff6592f5253e0dea431c74867aad5dfd70f44663fb"
+dependencies = [
+ "web-time",
+ "zeroize",
+]
+
+[[package]]
+name = "rustls-webpki"
+version = "0.102.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9"
+dependencies = [
+ "ring",
+ "rustls-pki-types",
+ "untrusted",
+]
+
+[[package]]
+name = "rustls-webpki"
+version = "0.103.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e3a0760a887c14823fca5a1c970b01d47c328c696c0c64829d1df50e8f853fd5"
+dependencies = [
+ "ring",
+ "rustls-pki-types",
+ "untrusted",
+]
+
+[[package]]
+name = "rustversion"
+version = "1.0.23"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f"
+
+[[package]]
+name = "ryu"
+version = "1.0.23"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f"
+
+[[package]]
+name = "scopeguard"
+version = "1.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
+
+[[package]]
+name = "secrecy"
+version = "0.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9bd1c54ea06cfd2f6b63219704de0b9b4f72dcc2b8fdef820be6cd799780e91e"
+dependencies = [
+ "serde",
+ "zeroize",
+]
+
+[[package]]
+name = "serde"
+version = "1.0.229"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba"
+dependencies = [
+ "serde_core",
+ "serde_derive",
+]
+
+[[package]]
+name = "serde_core"
+version = "1.0.229"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48"
+dependencies = [
+ "serde_derive",
+]
+
+[[package]]
+name = "serde_cow"
+version = "0.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1e7bbbec7196bfde255ab54b65e34087c0849629280028238e67ee25d6a4b7da"
+dependencies = [
+ "serde",
+]
+
+[[package]]
+name = "serde_derive"
+version = "1.0.229"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 3.0.10",
+]
+
+[[package]]
+name = "serde_json"
+version = "1.0.154"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6"
+dependencies = [
+ "itoa",
+ "memchr",
+ "serde",
+ "serde_core",
+ "zmij",
+]
+
+[[package]]
+name = "serde_urlencoded"
+version = "0.7.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd"
+dependencies = [
+ "form_urlencoded",
+ "itoa",
+ "ryu",
+ "serde",
+]
+
+[[package]]
+name = "serenity"
+version = "0.12.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9bde37f42765dfdc34e2a039e0c84afbf79a3101c1941763b0beb816c2f17541"
+dependencies = [
+ "arrayvec",
+ "async-trait",
+ "base64 0.22.1",
+ "bitflags",
+ "bytes",
+ "dashmap",
+ "flate2",
+ "futures",
+ "mime_guess",
+ "parking_lot",
+ "percent-encoding",
+ "reqwest",
+ "rustc-hash",
+ "secrecy",
+ "serde",
+ "serde_cow",
+ "serde_json",
+ "time",
+ "tokio",
+ "tokio-tungstenite",
+ "tracing",
+ "typemap_rev",
+ "url",
+]
+
+[[package]]
+name = "sha1"
+version = "0.10.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a978451301f4db1d02937a4ab3ccce137717b81826e79b7d49ffe3244a13c3b8"
+dependencies = [
+ "cfg-if",
+ "cpufeatures 0.2.17",
+ "digest",
+]
+
+[[package]]
+name = "shlex"
+version = "2.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba"
+
+[[package]]
+name = "signal-hook-registry"
+version = "1.4.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b"
+dependencies = [
+ "errno",
+ "libc",
+]
+
+[[package]]
+name = "simd-adler32"
+version = "0.3.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea"
+
+[[package]]
+name = "slab"
+version = "0.4.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
+
+[[package]]
+name = "smallvec"
+version = "1.16.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3244542535d5de959d90ec55d1b5ff0fd2bb7b1310223907d5f11932847f7b59"
+
+[[package]]
+name = "socket2"
+version = "0.6.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4"
+dependencies = [
+ "libc",
+ "windows-sys 0.61.2",
+]
+
+[[package]]
+name = "stable_deref_trait"
+version = "1.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596"
+
+[[package]]
+name = "subtle"
+version = "2.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
+
+[[package]]
+name = "syn"
+version = "2.0.119"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "unicode-ident",
+]
+
+[[package]]
+name = "syn"
+version = "3.0.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4ae9ccbea3a7b0b09443036490c8f34a8b1b760fd345e5c0dae0aac718faea79"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "unicode-ident",
+]
+
+[[package]]
+name = "sync_wrapper"
+version = "1.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263"
+dependencies = [
+ "futures-core",
+]
+
+[[package]]
+name = "synstructure"
+version = "0.14.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "901704edd0dfe137f1987838ee4f259e4e063c31371bdb423f7ae38ec6f77f02"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 3.0.10",
+]
+
+[[package]]
+name = "tempfile"
+version = "3.27.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd"
+dependencies = [
+ "fastrand",
+ "getrandom 0.4.3",
+ "once_cell",
+ "rustix",
+ "windows-sys 0.61.2",
+]
+
+[[package]]
+name = "thiserror"
+version = "1.0.69"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52"
+dependencies = [
+ "thiserror-impl 1.0.69",
+]
+
+[[package]]
+name = "thiserror"
+version = "2.0.21"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "09e52cb86a36cede5cb101bf8908837b3e4c6e5e59fe7fd85c23fb56200d189e"
+dependencies = [
+ "thiserror-impl 2.0.21",
+]
+
+[[package]]
+name = "thiserror-impl"
+version = "1.0.69"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.119",
+]
+
+[[package]]
+name = "thiserror-impl"
+version = "2.0.21"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 3.0.10",
+]
+
+[[package]]
+name = "time"
+version = "0.3.55"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cdb87b95ec50ddfa440816d227a17b2ccbdda963a316a727fda0fc4334f7d134"
+dependencies = [
+ "deranged",
+ "num-conv",
+ "powerfmt",
+ "serde_core",
+ "time-core",
+ "time-macros",
+]
+
+[[package]]
+name = "time-core"
+version = "0.1.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9e1c906769ad99c88eaa54e728060edef082f8e358ff32030cb7c7d315e81109"
+
+[[package]]
+name = "time-macros"
+version = "0.2.32"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7e689342a48d2ea927c87ea50cabf8594854bf940e9310208848d680d668ed85"
+dependencies = [
+ "num-conv",
+ "time-core",
+]
+
+[[package]]
+name = "tinystr"
+version = "0.8.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "abc840c238154d58f9e86b2792261edfde565a17696e1cda1a449de27979801a"
+dependencies = [
+ "displaydoc",
+ "zerovec",
+]
+
+[[package]]
+name = "tinyvec"
+version = "1.13.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fd3ca314f692efd6c868f8408f53fe444634a845f96c028b97d35f6a1f79f0ee"
+
+[[package]]
+name = "tokio"
+version = "1.54.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b52fd3255258d26fac7264ab5a76b53c13367136dc011d3d6ad4f8ed070396a3"
+dependencies = [
+ "bytes",
+ "libc",
+ "mio",
+ "pin-project-lite",
+ "signal-hook-registry",
+ "socket2",
+ "tokio-macros",
+ "windows-sys 0.61.2",
+]
+
+[[package]]
+name = "tokio-macros"
+version = "2.7.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "78773a2a397f451582ce068015985c33193cf6dea8b74d2a639fe457b2f07b0e"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 3.0.10",
+]
+
+[[package]]
+name = "tokio-rustls"
+version = "0.25.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f"
+dependencies = [
+ "rustls 0.22.4",
+ "rustls-pki-types",
+ "tokio",
+]
+
+[[package]]
+name = "tokio-rustls"
+version = "0.26.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c9cc2678c2cdd569ef8215e2afd7954ada2ae20b4fdd2c5fe6139a3b02d105db"
+dependencies = [
+ "rustls 0.23.46",
+ "tokio",
+]
+
+[[package]]
+name = "tokio-tungstenite"
+version = "0.21.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c83b561d025642014097b66e6c1bb422783339e0909e4429cde4749d1990bc38"
+dependencies = [
+ "futures-util",
+ "log",
+ "rustls 0.22.4",
+ "rustls-pki-types",
+ "tokio",
+ "tokio-rustls 0.25.0",
+ "tungstenite",
+ "webpki-roots 0.26.11",
+]
+
+[[package]]
+name = "tokio-util"
+version = "0.7.20"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e464cf451ba96ebfc6f9b6542f17ee8b8956e33f1e40d9690624e59d7a7f8a4b"
+dependencies = [
+ "bytes",
+ "futures-core",
+ "futures-sink",
+ "pin-project-lite",
+ "tokio",
+]
+
+[[package]]
+name = "tower"
+version = "0.5.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4"
+dependencies = [
+ "futures-core",
+ "futures-util",
+ "pin-project-lite",
+ "sync_wrapper",
+ "tokio",
+ "tower-layer",
+ "tower-service",
+]
+
+[[package]]
+name = "tower-http"
+version = "0.6.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4cfcf7e2740e6fc6d4d688b4ef00650406bb94adf4731e43c096c3a19fe40840"
+dependencies = [
+ "bitflags",
+ "bytes",
+ "futures-util",
+ "http",
+ "http-body",
+ "pin-project-lite",
+ "tower",
+ "tower-layer",
+ "tower-service",
+ "url",
+]
+
+[[package]]
+name = "tower-layer"
+version = "0.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e"
+
+[[package]]
+name = "tower-service"
+version = "0.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3"
+
+[[package]]
+name = "tracing"
+version = "0.1.44"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100"
+dependencies = [
+ "log",
+ "pin-project-lite",
+ "tracing-attributes",
+ "tracing-core",
+]
+
+[[package]]
+name = "tracing-attributes"
+version = "0.1.31"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.119",
+]
+
+[[package]]
+name = "tracing-core"
+version = "0.1.36"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a"
+dependencies = [
+ "once_cell",
+]
+
+[[package]]
+name = "try-lock"
+version = "0.2.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
+
+[[package]]
+name = "tungstenite"
+version = "0.21.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9ef1a641ea34f399a848dea702823bbecfb4c486f911735368f1f137cb8257e1"
+dependencies = [
+ "byteorder",
+ "bytes",
+ "data-encoding",
+ "http",
+ "httparse",
+ "log",
+ "rand 0.8.8",
+ "rustls 0.22.4",
+ "rustls-pki-types",
+ "sha1",
+ "thiserror 1.0.69",
+ "url",
+ "utf-8",
+]
+
+[[package]]
+name = "typemap_rev"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "74b08b0c1257381af16a5c3605254d529d3e7e109f3c62befc5d168968192998"
+
+[[package]]
+name = "typenum"
+version = "1.20.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20"
+
+[[package]]
+name = "unicase"
+version = "2.10.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "357cc3acc6a036009fd6c973ed009037c732d60d0b4f6c673e9041497482a28f"
+
+[[package]]
+name = "unicode-ident"
+version = "1.0.27"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563"
+
+[[package]]
+name = "untrusted"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
+
+[[package]]
+name = "url"
+version = "2.5.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f00cd2407bb42c0ef17be88d4cf020f5cceffd121665bac9b8b9493a369b3b1a"
+dependencies = [
+ "form_urlencoded",
+ "idna",
+ "percent-encoding",
+ "serde",
+ "serde_derive",
+]
+
+[[package]]
+name = "utf-8"
+version = "0.7.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9"
+
+[[package]]
+name = "utf8_iter"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "af3bd9d3e571c26fcce9d033b87ea5ab061b8d2ffe9b7a5675d810d68f03edf0"
+dependencies = [
+ "utf_types",
+]
+
+[[package]]
+name = "utf_types"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3a3b425286980a367278453f3b6d28cdcb134b574e5a35824a6ff5eebad50bb6"
+
+[[package]]
+name = "version_check"
+version = "0.9.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
+
+[[package]]
+name = "want"
+version = "0.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ec4cdd0dd910afe868b7ef477227d8d538b46b3075031afee8a9f2acb0a2ed0b"
+dependencies = [
+ "try-lock",
+]
+
+[[package]]
+name = "wasi"
+version = "0.11.1+wasi-snapshot-preview1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
+
+[[package]]
+name = "wasm-bindgen"
+version = "0.2.130"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a0181c14ddd6c7b8b0b0132a5f1ea2f32be0d893cd3ea97b6e3b28886b8a3d1c"
+dependencies = [
+ "cfg-if",
+ "rustversion",
+ "wasm-bindgen-macro",
+ "wasm-bindgen-shared",
+]
+
+[[package]]
+name = "wasm-bindgen-futures"
+version = "0.4.80"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5e14e0327cb5368ad60ccb22d04a9827a693c95a926d8d125e9fa39e0baec501"
+dependencies = [
+ "js-sys",
+ "tokio",
+ "wasm-bindgen",
+]
+
+[[package]]
+name = "wasm-bindgen-macro"
+version = "0.2.130"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6e931a02a39abdbf66966fc35902b5ed58344750a70885bed4ebb3d8eaf28ed9"
+dependencies = [
+ "quote",
+ "wasm-bindgen-macro-support",
+]
+
+[[package]]
+name = "wasm-bindgen-macro-support"
+version = "0.2.130"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2ca4b54280e455bd831e33a6b8e734baf432fe63fbc35c42ac14ce67a043a53a"
+dependencies = [
+ "bumpalo",
+ "proc-macro2",
+ "quote",
+ "syn 3.0.10",
+ "wasm-bindgen-shared",
+]
+
+[[package]]
+name = "wasm-bindgen-shared"
+version = "0.2.130"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3b1f9c3798725016c6ee5f2f57869ec0831e8bbc0ab0310a86e787e97f41389e"
+dependencies = [
+ "unicode-ident",
+]
+
+[[package]]
+name = "wasm-streams"
+version = "0.4.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "15053d8d85c7eccdbefef60f06769760a563c7f0a9d6902a13d35c7800b0ad65"
+dependencies = [
+ "futures-util",
+ "js-sys",
+ "wasm-bindgen",
+ "wasm-bindgen-futures",
+ "web-sys",
+]
+
+[[package]]
+name = "web-sys"
+version = "0.3.107"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d7d179596ff5ec0f6de4db64d54011bde6289cc49603d3a6e4ce3f329207ab88"
+dependencies = [
+ "js-sys",
+ "wasm-bindgen",
+]
+
+[[package]]
+name = "web-time"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb"
+dependencies = [
+ "js-sys",
+ "wasm-bindgen",
+]
+
+[[package]]
+name = "webpki-roots"
+version = "0.26.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "521bc38abb08001b01866da9f51eb7c5d647a19260e00054a8c7fd5f9e57f7a9"
+dependencies = [
+ "webpki-roots 1.0.12",
+]
+
+[[package]]
+name = "webpki-roots"
+version = "1.0.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7265c9301c16a8711c992c2d8da90ee77ef54b1ed51482d6dfeb00dc756b1297"
+dependencies = [
+ "rustls-pki-types",
+]
+
+[[package]]
+name = "windows-link"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
+
+[[package]]
+name = "windows-sys"
+version = "0.52.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
+dependencies = [
+ "windows-targets",
+]
+
+[[package]]
+name = "windows-sys"
+version = "0.61.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"
+dependencies = [
+ "windows-link",
+]
+
+[[package]]
+name = "windows-targets"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
+dependencies = [
+ "windows_aarch64_gnullvm",
+ "windows_aarch64_msvc",
+ "windows_i686_gnu",
+ "windows_i686_gnullvm",
+ "windows_i686_msvc",
+ "windows_x86_64_gnu",
+ "windows_x86_64_gnullvm",
+ "windows_x86_64_msvc",
+]
+
+[[package]]
+name = "windows_aarch64_gnullvm"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
+
+[[package]]
+name = "windows_aarch64_msvc"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
+
+[[package]]
+name = "windows_i686_gnu"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
+
+[[package]]
+name = "windows_i686_gnullvm"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
+
+[[package]]
+name = "windows_i686_msvc"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
+
+[[package]]
+name = "windows_x86_64_gnu"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
+
+[[package]]
+name = "windows_x86_64_gnullvm"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
+
+[[package]]
+name = "windows_x86_64_msvc"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
+
+[[package]]
+name = "writeable"
+version = "0.6.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc"
+
+[[package]]
+name = "yoke"
+version = "0.8.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "417ef3fcf6c300b7dbd25c85531a746931c02ad536f3cf4786ed1e88223340b3"
+dependencies = [
+ "stable_deref_trait",
+ "yoke-derive",
+ "zerofrom",
+]
+
+[[package]]
+name = "yoke-derive"
+version = "0.8.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ec8ebde2db3681e8c9980cc27822030e68752690ddfa9473e739aeb4dbde6d71"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 3.0.10",
+ "synstructure",
+]
+
+[[package]]
+name = "zerocopy"
+version = "0.8.64"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ed43f3060383c64b000f3c630550aebdfa9d3b76d48de32390483dd2cc7e0865"
+dependencies = [
+ "zerocopy-derive",
+]
+
+[[package]]
+name = "zerocopy-derive"
+version = "0.8.64"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a5cbd820fe3e35fb38c83b6dc7e6b1618bc46e0cd10073ae94e8d52dc468d8b9"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.119",
+]
+
+[[package]]
+name = "zerofrom"
+version = "0.1.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272"
+dependencies = [
+ "zerofrom-derive",
+]
+
+[[package]]
+name = "zerofrom-derive"
+version = "0.1.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f75b4683f6c7f45248d4d64056a24298c6281e0993356d7d1b4a1a962ef10d4a"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 3.0.10",
+ "synstructure",
+]
+
+[[package]]
+name = "zeroize"
+version = "1.9.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "85ccff8a4805aba1eaa4cd4afcd49f7557dd2cf5fd79ffc37f8959466effc5aa"
+
+[[package]]
+name = "zerotrie"
+version = "0.2.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4ea269c3bd32f0a32c321907a2ae912ba6f4649bb0fc764a15627e99a7095a3f"
+dependencies = [
+ "displaydoc",
+ "yoke",
+ "zerofrom",
+]
+
+[[package]]
+name = "zerovec"
+version = "0.11.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f58a2799cfe9a1670c7ea8edbd52ef8edb93cb37a7f83bf31ba9e35d9dae6a40"
+dependencies = [
+ "yoke",
+ "zerofrom",
+ "zerovec-derive",
+]
+
+[[package]]
+name = "zerovec-derive"
+version = "0.11.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c3743ddbf47738d929cd1ae2e199d40d0162979dfe31aef8ae646d2bf00bf97a"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 3.0.10",
+]
+
+[[package]]
+name = "zlib-rs"
+version = "0.6.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b268e58e7c693d7c271f93ffc4ba3b380412554231c85bf61ca7af91042a4112"
+
+[[package]]
+name = "zmij"
+version = "1.0.23"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b"
diff --git a/Cargo.toml b/Cargo.toml
new file mode 100644
index 0000000..e2a4646
--- /dev/null
+++ b/Cargo.toml
@@ -0,0 +1,23 @@
+# Cargo.toml
+[package]
+name = "proxybot"
+version = "1.0.0"
+edition = "2024"
+license-file = "LICENCE.md"
+
+[dependencies]
+anyhow = "1"
+base64 = "0.22"
+dotenvy = "0.15"
+futures-util = "0.3"
+tempfile = "3"
+jpcl = "2.0.0"
+percent-encoding = "2"
+regex = "1"
+reqwest = { version = "0.12", default-features = false, features = ["json", "multipart", "rustls-tls"] }
+serde = { version = "1", features = ["derive"] }
+serde_json = "1"
+secrecy = "0.8"
+serenity = { version = "0.12.5", default-features = false, features = ["cache", "client", "gateway", "model", "rustls_backend"] }
+tokio = { version = "1", features = ["macros", "rt-multi-thread", "sync", "time", "process"] }
+tokio-tungstenite = { version = "0.21", features = ["rustls-tls-webpki-roots"] }
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..9d376ee
--- /dev/null
+++ b/README.md
@@ -0,0 +1,12 @@
+# proxyBot
+
+Build the Rust bot with `cargo build --release --locked`. Run
+`target/release/proxybot` from the repository root, where it reads `.env` and
+`data/settings.jp`. The existing JPCL v2 settings file works with this build.
+
+The bot requires `DISCORD_TOKEN` and `OWNER_ID`. Set `SITE_TOKEN` to enable
+`d$switch`. Install ImageMagick 7 and put `magick` on the service's PATH for
+merged avatars. If merging fails, the bot uses its own avatar.
+
+The runit launcher expects the release binary under
+`/srv/bot/proxyBot/target/release/`. Build it before restarting the service.
diff --git a/deno.json b/deno.json
deleted file mode 100644
index d4bb1f0..0000000
--- a/deno.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
-  "$schema": "https://raw.githubusercontent.com/denoland/deno/main/cli/schemas/config-file.v1.json",
-  "nodeModulesDir": "auto",
-  "version": "1.0.0",
-  "minimumDependencyAge": 0,
-  "tasks": {
-    "start": "deno run --watch --allow-net --allow-env --allow-read --allow-write=./data --env-file=.env src/main.ts"
-  },
-  "imports": {
-    "@std/assert": "jsr:@std/assert@^1.0.19",
-    "discord.js": "npm:discord.js@^14.28.1",
-    "imagescript": "npm:[email protected]",
-    "jpcl-lang": "npm:jpcl-lang@^2.0.0"
-  },
-  "license": "DASL-1.2"
-}
diff --git a/deno.lock b/deno.lock
deleted file mode 100644
index 8be470b..0000000
--- a/deno.lock
+++ /dev/null
@@ -1,172 +0,0 @@
-{
-  "version": "5",
-  "specifiers": {
-    "jsr:@std/assert@^1.0.19": "1.0.19",
-    "jsr:@std/internal@^1.0.12": "1.0.14",
-    "npm:discord.js@^14.28.1": "14.28.1",
-    "npm:[email protected]": "3.20.5",
-    "npm:jpcl-lang@2": "2.0.0"
-  },
-  "jsr": {
-    "@std/[email protected]": {
-      "integrity": "eaada96ee120cb980bc47e040f82814d786fe8162ecc53c91d8df60b8755991e",
-      "dependencies": [
-        "jsr:@std/internal"
-      ]
-    },
-    "@std/[email protected]": {
-      "integrity": "291516b3d4c35024d6ffbc0a9df5bf4c64116e05b50012cf846710152d2ffdf7"
-    }
-  },
-  "npm": {
-    "@discordjs/[email protected]": {
-      "integrity": "sha512-AifaDWTw6WUDhKBn8E6mwwoyjDAcfsYq+ZE0nKSu1dMH1NLR22D3hGkNx+ctEv8NqHEHdAZnP5REteHDmn1lkA==",
-      "dependencies": [
-        "@discordjs/formatters",
-        "@discordjs/util",
-        "@sapphire/shapeshift",
-        "discord-api-types",
-        "fast-deep-equal",
-        "ts-mixer",
-        "tslib"
-      ]
-    },
-    "@discordjs/[email protected]": {
-      "integrity": "sha512-SVb428OMd3WO1paV3rm6tSjM4wC+Kecaa1EUGX7vc6/fddvw/6lg90z4QtCqm21zvVe92vMMDt9+DkIvjXImQQ=="
-    },
-    "@discordjs/[email protected]": {
-      "integrity": "sha512-LiSusze9Tc7qF03sLCujF5iZp7K+vRNEDBZ86FT9aQAv3vxMLihUvKvpsCWiQ2DJq1tVckopKm1rxomgNUc9hg=="
-    },
-    "@discordjs/[email protected]": {
-      "integrity": "sha512-y4UPwWhH6vChKRkGdMB4odasUbHOUwy7KL+OVwF86PvT6QVOwElx+TiI1/6kcmcEe+g5YRXJFiXSXUdabqZOvQ==",
-      "dependencies": [
-        "discord-api-types"
-      ]
-    },
-    "@discordjs/[email protected]": {
-      "integrity": "sha512-wvOylxNYJkwKjctS/Mn5GP1w9r3/rzyH+ThD1JlAca6zEdlHs8QWBBUQJpU5Q+W6DoIj/Ljh1IPlZs7hTU+UAg==",
-      "dependencies": [
-        "@discordjs/[email protected]",
-        "@discordjs/util",
-        "@sapphire/async-queue",
-        "@sapphire/snowflake",
-        "@vladfrangu/async_event_emitter",
-        "discord-api-types",
-        "magic-bytes.js",
-        "tslib",
-        "undici"
-      ]
-    },
-    "@discordjs/[email protected]": {
-      "integrity": "sha512-3LKP7F2+atl9vJFhaBjn4nOaSWahZ/yWjOvA4e5pnXkt2qyXRCHLxoBQy81GFtLGCq7K9lPm9R517M1U+/90Qg==",
-      "dependencies": [
-        "discord-api-types"
-      ]
-    },
-    "@discordjs/[email protected]": {
-      "integrity": "sha512-wPlQDxEmlDg5IxhJPuxXr3Vy9AjYq5xCvFWGJyD7w7Np8ZGu+Mc+97LCoEc/+AYCo2IDpKioiH0/c/mj5ZR9Uw==",
-      "dependencies": [
-        "@discordjs/[email protected]",
-        "@discordjs/rest",
-        "@discordjs/util",
-        "@sapphire/async-queue",
-        "@types/ws",
-        "@vladfrangu/async_event_emitter",
-        "discord-api-types",
-        "tslib",
-        "ws"
-      ]
-    },
-    "@sapphire/[email protected]": {
-      "integrity": "sha512-cvGzxbba6sav2zZkH8GPf2oGk9yYoD5qrNWdu9fRehifgnFZJMV+nuy2nON2roRO4yQQ+v7MK/Pktl/HgfsUXg=="
-    },
-    "@sapphire/[email protected]": {
-      "integrity": "sha512-d9dUmWVA7MMiKobL3VpLF8P2aeanRTu6ypG2OIaEv/ZHH/SUQ2iHOVyi5wAPjQ+HmnMuL0whK9ez8I/raWbtIg==",
-      "dependencies": [
-        "fast-deep-equal",
-        "lodash"
-      ]
-    },
-    "@sapphire/[email protected]": {
-      "integrity": "sha512-xzvBr1Q1c4lCe7i6sRnrofxeO1QTP/LKQ6A6qy0iB4x5yfiSfARMEQEghojzTNALDTcv8En04qYNIco9/K9eZQ=="
-    },
-    "@types/[email protected]": {
-      "integrity": "sha512-MzQj+8Kx3XI40OmUAE6Qoh58ZMNstNNMwn2nfd3qWsfe7nDNSqJNzes4njhz6AHwrSHOffSLwXU6yb474Q4aog==",
-      "dependencies": [
-        "undici-types"
-      ]
-    },
-    "@types/[email protected]": {
-      "integrity": "sha512-67MQl+fpWKVTT1NYdnmo3U4sc/xPo/zQBncVnI74qmQa0z/b+1g6iYqNmGCPbxO+zz2aklb08a0oHfegiVd0/w==",
-      "dependencies": [
-        "@types/node"
-      ]
-    },
-    "@vladfrangu/[email protected]": {
-      "integrity": "sha512-Xfe6rpCTxSxfbswi/W/Pz7zp1WWSNn4A0eW4mLkQUewCrXXtMj31lCg+iQyTkh/CkusZSq9eDflu7tjEDXUY6g=="
-    },
-    "[email protected]": {
-      "integrity": "sha512-6utghVho47hBzmx8nIp+pKEDDNIlVk6On/J5Y1Q529payNLZjBsrw+mt+G5Y3NYRE3kgta6eBx5hRYVyfHGdOA=="
-    },
-    "[email protected]": {
-      "integrity": "sha512-Je5OcqgurnIUQK4vR+gQnmzOf/lNQsD6d/UkV8ZOj+bFa5zJXPyiGXlbywp2EagwshVT18y7YNQNSRd3FjYkDw==",
-      "dependencies": [
-        "@discordjs/builders",
-        "@discordjs/[email protected]",
-        "@discordjs/formatters",
-        "@discordjs/rest",
-        "@discordjs/util",
-        "@discordjs/ws",
-        "@sapphire/snowflake",
-        "discord-api-types",
-        "fast-deep-equal",
-        "lodash.snakecase",
-        "magic-bytes.js",
-        "tslib",
-        "undici"
-      ]
-    },
-    "[email protected]": {
-      "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="
-    },
-    "[email protected]": {
-      "integrity": "sha512-w/+45j0CYBdsdzKc2hGKmC5OmpdXX/hVszGqVYvJes2OFwXwcrwzypchVBay8pCzJMs+oDjeMVnlTsxTWHL3bQ=="
-    },
-    "[email protected]": {
-      "integrity": "sha512-n99Fj10ntxhu83lcnhgIZ/PAMwSgs4zpamOM73Uy5gtCQlvBYIkEnGFIxwTGGRo+zvh+oY4W7RNFErNxF9uuAQ==",
-      "bin": true
-    },
-    "[email protected]": {
-      "integrity": "sha512-QZ1d4xoBHYUeuouhEq3lk3Uq7ldgyFXGBhg04+oRLnIz8o9T65Eh+8YdroUwn846zchkA9yDsDl5CVVaV2nqYw=="
-    },
-    "[email protected]": {
-      "integrity": "sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q=="
-    },
-    "[email protected]": {
-      "integrity": "sha512-x5sn4UX2k5gCWlcfmoFwG4TPie8+dctESyqOBdhB5p6MsgWXdBKGmt9nXPObj/JI50TTL928lc5Yt1WntMn1bw=="
-    },
-    "[email protected]": {
-      "integrity": "sha512-ufKpbmrugz5Aou4wcr5Wc1UUFWOLhq+Fm6qa6P0w0K5Qw2yhaUoiWszhCVuNQyNwrlGiscHOmqYoAox1PtvgjA=="
-    },
-    "[email protected]": {
-      "integrity": "sha512-a4Ux9VKuIMHsOS7ENbEq6hK2ZGYIT27Rtl0E4eD9KqwxhKiQeMZE/9xb3IdYwWaSOyIBQLExhQgXDTYoiCxnWA=="
-    },
-    "[email protected]": {
-      "integrity": "sha512-KTDyRTYX8sWmKXAikPHHSyc63CRPETMctyjKFupcC6OBLXT3xsN0e9aF7m+mIXutFWpUXuedtowG7iLOzp0kQg=="
-    },
-    "[email protected]": {
-      "integrity": "sha512-EvRlUt/QqAEvXdQeRMYUfwOQsfzpDztykrG2owGEE/rBOBoYv9uF39ZzsNDh4lTFHhTr2XOZjKkYgueD12ZmGA=="
-    },
-    "[email protected]": {
-      "integrity": "sha512-/rEZ2ejown2N5gxVTHUu9bVVC7ttu0/Tgzf5hbTOixR3Fs7mbbXgn2DbdbcKgJOmpQMtrIUWivtYuVMnp/W/yA=="
-    }
-  },
-  "workspace": {
-    "dependencies": [
-      "jsr:@std/assert@^1.0.19",
-      "npm:discord.js@^14.28.1",
-      "npm:[email protected]",
-      "npm:jpcl-lang@2"
-    ]
-  }
-}
diff --git a/deploy/run b/deploy/run
index dab89d8..bce9456 100755
--- a/deploy/run
+++ b/deploy/run
@@ -2,10 +2,4 @@
 exec 2>&1
 
 cd /srv/bot/proxyBot || exit 1
-
-# Run as clove rather than root. chpst doesn't change HOME, so set it for Deno's cache
-export HOME=/home/clove
-
-# Secrets (SSO client, session secret, guestbook key) live in /srv/clove/web/.env,
-# which Deno skips if it's missing. Reads are limited to this folder
-exec chpst -u clove /usr/bin/deno task start
\ No newline at end of file
+exec chpst -u clove /srv/bot/proxyBot/target/release/proxybot
diff --git a/src/api/fronters.ts b/src/api/fronters.ts
deleted file mode 100644
index 6fff9bb..0000000
--- a/src/api/fronters.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-/* src/api/fronters.ts */
-
-import { apiBase } from "../config/constants.ts";
-import { premergeAvatar } from "../discord/avatar.ts";
-import { updateStatus } from "../discord/status.ts";
-import type { Member } from "../proxy/types.ts";
-import { system } from "../state/system.ts";
-
-export function setFronters(fronters: Member[]): void {
-    system.fronters = fronters;
-    updateStatus();
-    premergeAvatar(fronters);
-}
-
-export async function fetchFronters(): Promise<void> {
-    try {
-        const response = await fetch(`${apiBase}/fronters`);
-        if (!response.ok) throw new Error(`HTTP ${response.status}`);
-
-        const fronting = await response.json() as { members: Member[] };
-        setFronters(fronting.members);
-    } catch (error) {
-        // Keep the last known front rather than dropping autoproxy
-        console.error("Fronting fetch failed:", error);
-    }
-}
diff --git a/src/api/live.ts b/src/api/live.ts
deleted file mode 100644
index 304c887..0000000
--- a/src/api/live.ts
+++ /dev/null
@@ -1,66 +0,0 @@
-/* src/api/live.ts */
-
-import { pingMs, reconnectMs, socketUrl } from "../config/constants.ts";
-import type { Member } from "../proxy/types.ts";
-import { fetchFronters, setFronters } from "./fronters.ts";
-import { refreshMembers } from "./members.ts";
-
-interface LiveEvent {
-    type?: string;
-    data?: {
-        members?: Member[];
-    };
-}
-
-function receive(raw: string): void {
-    let event: LiveEvent;
-
-    try {
-        event = JSON.parse(raw);
-    } catch {
-        return;
-    }
-
-    if (event.type === "fronters_update" && event.data?.members) {
-        setFronters(event.data.members);
-    }
-
-    // The site sends this after any member edit, so tags and avatars apply at once
-    if (event.type === "members_update" || event.type === "force_refresh") {
-        refreshMembers();
-    }
-}
-
-// Same socket the website listens to; resync on every connect to cover missed events
-export function connectLive(): void {
-    const socket = new WebSocket(socketUrl);
-    let awaitingPong = false;
-    let pingTimer: ReturnType<typeof setInterval> | undefined;
-
-    socket.onopen = () => {
-        console.log("Live socket open");
-        fetchFronters();
-
-        pingTimer = setInterval(() => {
-            if (awaitingPong) return socket.close();
-
-            awaitingPong = true;
-            socket.send("ping");
-        }, pingMs);
-    };
-
-    socket.onmessage = (event) => {
-        if (event.data === "pong") {
-            awaitingPong = false;
-            return;
-        }
-
-        receive(String(event.data));
-    };
-
-    socket.onclose = () => {
-        clearInterval(pingTimer);
-        console.log("Live socket closed, reconnecting");
-        setTimeout(connectLive, reconnectMs);
-    };
-}
diff --git a/src/api/members.ts b/src/api/members.ts
deleted file mode 100644
index f364a9e..0000000
--- a/src/api/members.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-/* src/api/members.ts */
-
-import { apiBase } from "../config/constants.ts";
-import type { Member } from "../proxy/types.ts";
-import { system } from "../state/system.ts";
-
-export async function refreshMembers(): Promise<void> {
-    try {
-        const response = await fetch(`${apiBase}/members`);
-        if (!response.ok) throw new Error(`HTTP ${response.status}`);
-
-        system.members = await response.json() as Member[];
-        console.log(`Loaded ${system.members.length} members`);
-    } catch (error) {
-        // Keep the old list so proxying survives a site outage
-        console.error("Member refresh failed:", error);
-    }
-}
diff --git a/src/api/switch.ts b/src/api/switch.ts
deleted file mode 100644
index 128c866..0000000
--- a/src/api/switch.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-/* src/api/switch.ts */
-
-import { apiBase } from "../config/constants.ts";
-import { siteToken } from "../config/env.ts";
-
-// The new front comes back over the live socket, so nothing is set here.
-// Returns an error to show, or null when the switch went through
-export async function switchFront(memberIds: string[]): Promise<string | null> {
-    if (!siteToken) return "Switching isn't set up. Add `SITE_TOKEN` to the bot's `.env`.";
-
-    try {
-        const response = await fetch(`${apiBase}/switch`, {
-            method: "POST",
-            headers: {
-                "Authorization": `Bearer ${siteToken}`,
-                "Content-Type": "application/json",
-            },
-            body: JSON.stringify({
-                members: memberIds,
-            }),
-        });
-
-        if (response.status === 401) return "The site rejected the bot's token. Check `SITE_TOKEN` matches `BOT_TOKEN`.";
-        if (!response.ok) return `The site couldn't switch (HTTP ${response.status}).`;
-
-        return null;
-    } catch (error) {
-        console.error("Switch failed:", error);
-        return "Couldn't reach the site to switch.";
-    }
-}
diff --git a/src/api/system.ts b/src/api/system.ts
deleted file mode 100644
index 7d0c040..0000000
--- a/src/api/system.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-/* src/api/system.ts */
-
-import { apiBase } from "../config/constants.ts";
-import { system } from "../state/system.ts";
-
-export async function refreshSystem(): Promise<void> {
-    try {
-        const response = await fetch(`${apiBase}/system`);
-        if (!response.ok) throw new Error(`HTTP ${response.status}`);
-
-        const info = await response.json() as {
-            name: string | null;
-            tag: string | null;
-        };
-
-        system.name = info.name;
-        system.tag = info.tag;
-    } catch (error) {
-        // Keep the old tag so names don't flicker during an outage
-        console.error("System refresh failed:", error);
-    }
-}
diff --git a/src/avatars.rs b/src/avatars.rs
new file mode 100644
index 0000000..41e2362
--- /dev/null
+++ b/src/avatars.rs
@@ -0,0 +1,171 @@
+// src/avatars.rs
+
+use std::collections::HashMap;
+use std::sync::Arc;
+
+use base64::{Engine, engine::general_purpose::STANDARD};
+use secrecy::ExposeSecret;
+use serenity::all::{Context, Webhook, WebhookId};
+use tokio::sync::{Mutex, OnceCell};
+
+use crate::{
+    Bot,
+    proxy::{MAX_NAMED, Member},
+};
+
+type Merge = (Vec<String>, Arc<OnceCell<Vec<u8>>>);
+
+#[derive(Default)]
+pub struct Avatars {
+    merged: Mutex<Option<Merge>>,
+    installed: Mutex<HashMap<WebhookId, Vec<String>>>,
+}
+
+pub fn avatar_urls(speakers: &[Member]) -> Vec<String> {
+    speakers
+        .iter()
+        .filter_map(Member::webhook_avatar)
+        .map(str::to_owned)
+        .collect()
+}
+
+impl Avatars {
+    pub async fn png(&self, web: &reqwest::Client, urls: Vec<String>) -> anyhow::Result<Vec<u8>> {
+        if urls.is_empty() {
+            return Ok(Vec::new());
+        }
+        let cell = {
+            let mut cached = self.merged.lock().await;
+            match &*cached {
+                Some((key, cell)) if key == &urls => cell.clone(),
+                _ => {
+                    let cell = Arc::new(OnceCell::new());
+                    *cached = Some((urls.clone(), cell.clone()));
+                    cell
+                }
+            }
+        };
+        let png = cell.get_or_try_init(|| merge(web, &urls)).await?;
+        Ok(png.clone())
+    }
+}
+
+impl Bot {
+    pub async fn avatar(
+        &self,
+        ctx: &Context,
+        webhook: &Webhook,
+        speakers: &[Member],
+    ) -> Option<String> {
+        let fallback = || Some(ctx.cache.current_user().face());
+        match speakers {
+            [member] => return member.webhook_avatar().map(str::to_owned).or_else(fallback),
+            many if many.len() > MAX_NAMED => {
+                return Some("https://doughmination.co.uk/favicon.png".into());
+            }
+            _ => {}
+        }
+
+        let urls = avatar_urls(speakers);
+        if self.avatars.installed.lock().await.get(&webhook.id) == Some(&urls) {
+            return None;
+        }
+
+        let result = async {
+            let png = self.avatars.png(&self.web, urls.clone()).await?;
+            if png.is_empty() {
+                return Ok::<_, anyhow::Error>(false);
+            }
+            let token = webhook
+                .token
+                .as_ref()
+                .map(ExposeSecret::expose_secret)
+                .ok_or_else(|| anyhow::anyhow!("webhook had no token"))?;
+            let data = serde_json::json!({
+                "avatar": format!("data:image/png;base64,{}", STANDARD.encode(png)),
+            });
+            ctx.http
+                .edit_webhook_with_token(webhook.id, token, &data, None)
+                .await?;
+            self.avatars.installed.lock().await.insert(webhook.id, urls);
+            Ok(true)
+        }
+        .await;
+
+        match result {
+            Ok(true) => None,
+            Ok(false) => fallback(),
+            Err(error) => {
+                eprintln!("Avatar merge failed: {error}");
+                fallback()
+            }
+        }
+    }
+}
+
+async fn merge(web: &reqwest::Client, urls: &[String]) -> anyhow::Result<Vec<u8>> {
+    let images = futures_util::future::try_join_all(urls.iter().map(|url| async move {
+        let mut response = web.get(url).send().await?.error_for_status()?;
+        let mut bytes = Vec::new();
+        while let Some(chunk) = response.chunk().await? {
+            anyhow::ensure!(
+                bytes.len() + chunk.len() <= 16 * 1024 * 1024,
+                "avatar exceeds 16 MiB"
+            );
+            bytes.extend_from_slice(&chunk);
+        }
+        Ok::<_, anyhow::Error>(bytes)
+    }))
+    .await?;
+
+    let directory = tempfile::tempdir()?;
+    let strip_width = 512 / images.len();
+    let mut command = tokio::process::Command::new("magick");
+    command.current_dir(directory.path()).kill_on_drop(true);
+    command.args([
+        "-limit", "thread", "2", "-limit", "memory", "128MiB", "-limit", "disk", "128MiB",
+    ]);
+
+    for (index, bytes) in images.iter().enumerate() {
+        let format = if bytes.starts_with(b"\x89PNG\r\n\x1a\n") {
+            "png"
+        } else if bytes.starts_with(b"\xff\xd8\xff") {
+            "jpeg"
+        } else if bytes.starts_with(b"GIF87a") || bytes.starts_with(b"GIF89a") {
+            "gif"
+        } else if bytes.starts_with(b"RIFF") && bytes.get(8..12) == Some(b"WEBP") {
+            "webp"
+        } else {
+            anyhow::bail!("unsupported avatar format");
+        };
+        let filename = format!("avatar-{index}");
+        std::fs::write(directory.path().join(&filename), bytes)?;
+        let width = if index + 1 == images.len() {
+            512 - strip_width * index
+        } else {
+            strip_width
+        };
+        let dimensions = format!("{width}x512");
+        command.args([
+            "(".to_owned(),
+            format!("{format}:{filename}[0]"),
+            "-resize".into(),
+            format!("{dimensions}^"),
+            "-gravity".into(),
+            "center".into(),
+            "-extent".into(),
+            dimensions,
+            "+repage".into(),
+            ")".into(),
+        ]);
+    }
+    command.args(["+append", "png:-"]);
+    let output =
+        tokio::time::timeout(std::time::Duration::from_secs(15), command.output()).await??;
+    anyhow::ensure!(
+        output.status.success(),
+        "ImageMagick failed: {}",
+        String::from_utf8_lossy(&output.stderr)
+    );
+    Ok(output.stdout)
+}
diff --git a/src/cards.rs b/src/cards.rs
new file mode 100644
index 0000000..7424c2a
--- /dev/null
+++ b/src/cards.rs
@@ -0,0 +1,196 @@
+// src/cards.rs
+
+use percent_encoding::{NON_ALPHANUMERIC, utf8_percent_encode};
+use serde_json::{Value, json};
+use serenity::all::{Message, UserId};
+
+use crate::proxy::{MAX_NAMED, Member, truncate, utf16_len};
+
+const ACCENT: u32 = 0xeb459e;
+pub const COMPONENTS_V2: u32 = 1 << 15;
+
+pub fn text(content: impl AsRef<str>) -> Value {
+    json!({
+        "type": 10,
+        "content": content.as_ref(),
+    })
+}
+
+pub fn link(label: &str, url: String) -> Value {
+    json!({
+        "type": 1,
+        "components": [{
+            "type": 2,
+            "style": 5,
+            "label": truncate(label, 80),
+            "url": url,
+        }],
+    })
+}
+
+fn header(content: String, avatar: Option<&str>) -> Value {
+    let Some(url) = avatar.filter(|url| !url.is_empty()) else {
+        return text(content);
+    };
+    json!({
+        "type": 9,
+        "components": [text(content)],
+        "accessory": {
+            "type": 11,
+            "media": { "url": url },
+        },
+    })
+}
+
+fn container(colour: u32, components: Vec<Value>) -> Value {
+    json!({
+        "type": 17,
+        "accent_color": colour,
+        "components": components,
+    })
+}
+
+fn shorten(content: &str) -> String {
+    if utf16_len(content) > 1000 {
+        return format!("{}…", truncate(content, 999));
+    }
+    content.into()
+}
+
+fn colour(input: Option<&str>) -> u32 {
+    let hex = input.unwrap_or_default().trim().trim_start_matches('#');
+    let full;
+    let hex = if hex.len() == 3 && hex.is_ascii() {
+        full = hex
+            .chars()
+            .flat_map(|digit| [digit, digit])
+            .collect::<String>();
+        &full
+    } else {
+        hex
+    };
+
+    if hex.len() == 6 && hex.bytes().all(|byte| byte.is_ascii_hexdigit()) {
+        return u32::from_str_radix(hex, 16).unwrap_or(ACCENT);
+    }
+    ACCENT
+}
+
+pub fn member_card(member: &Member) -> Value {
+    let name = member
+        .display_name
+        .as_deref()
+        .filter(|name| !name.is_empty())
+        .unwrap_or(&member.name);
+    let mut heading = format!("## {name}");
+    if let Some(pronouns) = member
+        .pronouns
+        .as_deref()
+        .filter(|pronouns| !pronouns.is_empty())
+    {
+        heading.push_str(&format!("\n{pronouns}"));
+    }
+    if let Some(status) = &member.status {
+        let status_line = format!(
+            "{} {}",
+            status.emoji.as_deref().unwrap_or_default(),
+            status.text
+        );
+        heading.push_str(&format!("\n{}", status_line.trim()));
+    }
+
+    let mut components = vec![header(heading, member.avatar_url.as_deref())];
+    let mut details = Vec::new();
+    if let Some(description) = member
+        .description
+        .as_deref()
+        .filter(|value| !value.is_empty())
+    {
+        details.push(format!("**About**\n{}", shorten(description)));
+    }
+    for (label, entries) in [("Tags", &member.tags), ("Pride", &member.pride)] {
+        if !entries.is_empty() {
+            details.push(format!("**{label}**\n{}", entries.join(", ")));
+        }
+    }
+    if !details.is_empty() {
+        components.push(json!({ "type": 14 }));
+        components.push(text(details.join("\n\n")));
+    }
+
+    let id = utf8_percent_encode(&member.id, NON_ALPHANUMERIC);
+    components.push(link(
+        "Open page",
+        format!("https://doughmination.co.uk/{id}"),
+    ));
+    container(colour(member.color.as_deref()), components)
+}
+
+pub fn info(
+    message: &Message,
+    members: Option<&[Member]>,
+    owner: UserId,
+    system: Option<&str>,
+) -> Vec<Value> {
+    let mut footer = vec![format!("Sent by <@{owner}>")];
+    if let Some(name) = system.filter(|name| !name.is_empty()) {
+        footer.push(name.into());
+    }
+
+    let mut components = match members {
+        Some(members) => {
+            let hidden = members.len().saturating_sub(MAX_NAMED);
+            if hidden > 0 {
+                footer.insert(0, format!("& {hidden} more"));
+            }
+            members.iter().take(MAX_NAMED).map(member_card).collect()
+        }
+        None => vec![container(
+            ACCENT,
+            vec![header(
+                format!("## {}", message.author.name),
+                Some(&message.author.face()),
+            )],
+        )],
+    };
+    components.push(text(format!("-# {}", footer.join(" · "))));
+    components.push(link("Jump to message", message.link()));
+    components
+}
+
+pub fn display_name(message: &Message) -> &str {
+    message
+        .member
+        .as_ref()
+        .and_then(|member| member.nick.as_deref())
+        .or(message.author.global_name.as_deref())
+        .unwrap_or(&message.author.name)
+}
+
+pub fn reply(message: &Message, target: &Message) -> Vec<Value> {
+    let body = if message.content.is_empty() {
+        "*Sent an attachment*".to_owned()
+    } else {
+        shorten(&message.content)
+            .split('\n')
+            .map(|line| format!("> {line}"))
+            .collect::<Vec<_>>()
+            .join("\n")
+    };
+    let heading = format!(
+        "### ↪ {} replied to {}\n{body}",
+        display_name(message),
+        target.author.name
+    );
+    let mut components = vec![container(
+        ACCENT,
+        vec![
+            header(heading, Some(&message.author.face())),
+            link("Jump to reply", message.link()),
+        ],
+    )];
+    if !message.content.is_empty() && !message.attachments.is_empty() {
+        components.push(text("-# Also sent an attachment"));
+    }
+    components
+}
diff --git a/src/commands.rs b/src/commands.rs
new file mode 100644
index 0000000..9778574
--- /dev/null
+++ b/src/commands.rs
@@ -0,0 +1,229 @@
+// src/commands.rs
+
+use std::time::Instant;
+
+use serde_json::json;
+use serenity::all::{Context, GuildId, Message};
+
+use crate::{Bot, cards, discord, proxy, site::API};
+
+const HELP: &str = include_str!("help.txt");
+const EXPLAIN: &str = include_str!("explain.txt");
+
+impl Bot {
+    pub async fn command(
+        &self,
+        ctx: &Context,
+        message: &Message,
+        guild: GuildId,
+    ) -> anyhow::Result<bool> {
+        let Some((name, args, rest)) = proxy::command(&message.content) else {
+            return Ok(false);
+        };
+
+        let reply = match name.as_str() {
+            "help" => HELP.trim_end().into(),
+            "explain" | "ex" => EXPLAIN
+                .trim_end()
+                .replace("<@OWNER>", &format!("<@{}>", self.owner)),
+            "autoproxy" | "ap" => self.autoproxy(guild, &args).await?,
+            "ping" => {
+                self.ping(ctx, message).await?;
+                return Ok(true);
+            }
+            "edit" | "e" => {
+                let Some(problem) = self.edit(ctx, message, rest).await? else {
+                    return Ok(true);
+                };
+                problem.into()
+            }
+            "member" | "m" => {
+                if args.len() != 1 {
+                    "Use `d$member <member>`, like `d$member aether`.".into()
+                } else {
+                    let state = self.system.read().await;
+                    let match_card = state
+                        .members
+                        .iter()
+                        .find(|member| member.name.to_lowercase() == args[0])
+                        .map(cards::member_card);
+                    drop(state);
+                    if let Some(card) = match_card {
+                        discord::reply(
+                            ctx,
+                            message,
+                            json!({
+                                "flags": cards::COMPONENTS_V2,
+                                "components": [card],
+                            }),
+                        )
+                        .await?;
+                        return Ok(true);
+                    }
+                    format!("No member called `{}`.", args[0])
+                }
+            }
+            "reproxy" | "rp" | "switch" | "sw" => {
+                let switching = matches!(name.as_str(), "switch" | "sw");
+                if args.is_empty() {
+                    if switching {
+                        "Use `d$switch <member>`, like `d$switch c1`, several like `d$sw c1 c2`, or `d$sw out`.".into()
+                    } else {
+                        "Use `d$reproxy <member>`, like `d$reproxy c1`. Several work too: `d$rp c1 c2`.".into()
+                    }
+                } else if switching && args == ["out"] {
+                    match self.switch_front(&[]).await {
+                        Ok(()) => "Switched out. Nobody is fronting.".into(),
+                        Err(problem) => problem,
+                    }
+                } else {
+                    let state = self.system.read().await;
+                    let mut found = Vec::new();
+                    let mut missing = Vec::new();
+                    for name in &args {
+                        match state
+                            .members
+                            .iter()
+                            .find(|member| member.name.to_lowercase() == *name)
+                        {
+                            Some(member) => found.push(member.clone()),
+                            None => missing.push(format!("`{name}`")),
+                        }
+                    }
+                    drop(state);
+                    if !missing.is_empty() {
+                        format!(
+                            "No member called {}. Use their short name, like `c1`.",
+                            missing.join(", ")
+                        )
+                    } else if switching {
+                        let ids = found
+                            .iter()
+                            .map(|member| member.id.as_str())
+                            .collect::<Vec<_>>();
+                        match self.switch_front(&ids).await {
+                            Ok(()) => {
+                                let speakers = found.iter().collect::<Vec<_>>();
+                                format!("Switched in **{}**.", proxy::webhook_name(&speakers, None))
+                            }
+                            Err(problem) => problem,
+                        }
+                    } else {
+                        let Some(problem) = self.reproxy(ctx, message, found).await? else {
+                            return Ok(true);
+                        };
+                        problem.into()
+                    }
+                }
+            }
+            _ => format!("Unknown command `{name}`. Try `d$help`."),
+        };
+
+        discord::reply(ctx, message, json!({ "content": reply })).await?;
+        Ok(true)
+    }
+
+    async fn autoproxy(&self, guild: GuildId, args: &[String]) -> anyhow::Result<String> {
+        let global = args.iter().any(|arg| arg == "-g");
+        let choice = args
+            .iter()
+            .find(|arg| arg.as_str() != "-g")
+            .map(String::as_str);
+        let mut settings = self.settings.lock().await;
+        let current = settings.guilds.get(&guild).copied().unwrap_or(false);
+        let current_name = if current { "on" } else { "off" };
+        let total = settings.guilds.len();
+
+        let enabled = match choice {
+            Some("on") => true,
+            Some("off") => false,
+            None if global => {
+                let enabled_count = settings.guilds.values().filter(|&&enabled| enabled).count();
+                return Ok(format!(
+                    "Autoproxy is **on** in {enabled_count} of {total} servers."
+                ));
+            }
+            None => return Ok(format!("Autoproxy in this server is **{current_name}**.")),
+            _ if global => return Ok("Use `d$autoproxy -g on` or `d$autoproxy -g off`.".into()),
+            _ => {
+                return Ok(
+                    "Use `d$autoproxy on|off`, or `d$autoproxy -g on|off` for every server.".into(),
+                );
+            }
+        };
+
+        let choice = if enabled { "on" } else { "off" };
+        let mut updated = settings.clone();
+        let response = if global {
+            updated
+                .guilds
+                .values_mut()
+                .for_each(|value| *value = enabled);
+            format!("Autoproxy is now **{choice}** in all {total} servers.")
+        } else if current == enabled {
+            return Ok(format!("Autoproxy in this server is already **{choice}**."));
+        } else {
+            updated.guilds.insert(guild, enabled);
+            format!("Autoproxy in this server is now **{choice}**.")
+        };
+        updated.save()?;
+        *settings = updated;
+        Ok(response)
+    }
+
+    async fn ping(&self, ctx: &Context, message: &Message) -> anyhow::Result<()> {
+        let manager = self.shards.get().expect("shard manager has been set");
+        let heartbeat = manager
+            .runners
+            .lock()
+            .await
+            .get(&ctx.shard_id)
+            .and_then(|runner| runner.latency)
+            .map_or_else(
+                || "not measured yet".into(),
+                |duration| format!("{} ms", duration.as_millis()),
+            );
+        let report = |discord: &str, api: &str| {
+            format!(
+                "🏓 Pong!\nDiscord heartbeat: {heartbeat}\nDiscord round trip: {discord}\nSystem API: {api}"
+            )
+        };
+
+        let api = async {
+            let started = Instant::now();
+            let response = self.web.get(format!("{API}/system")).send().await;
+            let elapsed = started.elapsed().as_millis();
+            match response {
+                Ok(response) if response.status().is_success() => format!("{elapsed} ms"),
+                Ok(response) => format!("HTTP {} after {elapsed} ms", response.status().as_u16()),
+                Err(error) => format!("failed ({error})"),
+            }
+        };
+        let discord = async {
+            let started = Instant::now();
+            let response = discord::reply(
+                ctx,
+                message,
+                json!({
+                    "content": report("measuring…", "measuring…"),
+                }),
+            )
+            .await?;
+            Ok::<_, anyhow::Error>((response, format!("{} ms", started.elapsed().as_millis())))
+        };
+        let (api, discord) = tokio::join!(api, discord);
+        let (response, elapsed) = discord?;
+        ctx.http
+            .edit_message(
+                message.channel_id,
+                response,
+                &json!({
+                    "content": report(&elapsed, &api),
+                    "allowed_mentions": discord::user_mentions(),
+                }),
+                Vec::new(),
+            )
+            .await?;
+        Ok(())
+    }
+}
diff --git a/src/commands/autoproxy.ts b/src/commands/autoproxy.ts
deleted file mode 100644
index 6a06713..0000000
--- a/src/commands/autoproxy.ts
+++ /dev/null
@@ -1,67 +0,0 @@
-/* src/commands/autoproxy.ts */
-
-import type { Message } from "discord.js";
-
-import {
-    guildSettings,
-    saveSettings,
-    setAutoproxyEverywhere,
-    settings,
-} from "../state/settings.ts";
-
-export async function autoproxyCommand(
-    message: Message,
-    args: string[],
-): Promise<void> {
-    // -g can go anywhere, so "-g on" and "on -g" both work
-    const [choice] = args.filter((arg) => arg !== "-g");
-
-    if (args.includes("-g")) {
-        await globalAutoproxy(message, choice);
-        return;
-    }
-
-    // Commands only run from server messages, so guildId is always set
-    const autoproxy = guildSettings(message.guildId!).autoproxy;
-    const current = autoproxy.enabled ? "on" : "off";
-
-    if (choice === undefined) {
-        await message.reply(`Autoproxy in this server is **${current}**.`);
-        return;
-    }
-
-    if (choice !== "on" && choice !== "off") {
-        await message.reply("Use `d$autoproxy on|off`, or `d$autoproxy -g on|off` for every server.");
-        return;
-    }
-
-    if (choice === current) {
-        await message.reply(`Autoproxy in this server is already **${current}**.`);
-        return;
-    }
-
-    autoproxy.enabled = choice === "on";
-    await saveSettings();
-    await message.reply(`Autoproxy in this server is now **${choice}**.`);
-}
-
-async function globalAutoproxy(
-    message: Message,
-    choice: string | undefined,
-): Promise<void> {
-    if (choice === undefined) {
-        const guilds = Object.values(settings);
-        const enabledCount = guilds.filter((guild) => guild.autoproxy.enabled).length;
-        await message.reply(`Autoproxy is **on** in ${enabledCount} of ${guilds.length} servers.`);
-        return;
-    }
-
-    if (choice !== "on" && choice !== "off") {
-        await message.reply("Use `d$autoproxy -g on` or `d$autoproxy -g off`.");
-        return;
-    }
-
-    const serverCount = setAutoproxyEverywhere(choice === "on");
-    await saveSettings();
-    await message.reply(`Autoproxy is now **${choice}** in all ${serverCount} servers.`);
-}
diff --git a/src/commands/edit.ts b/src/commands/edit.ts
deleted file mode 100644
index b001388..0000000
--- a/src/commands/edit.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-/* src/commands/edit.ts */
-
-import type { Message } from "discord.js";
-
-import { editProxied } from "../discord/editMessage.ts";
-
-export async function editCommand(
-    message: Message,
-    _args: string[],
-    rest: string,
-): Promise<void> {
-    const problem = await editProxied(message, rest);
-
-    if (problem) {
-        await message.reply(problem);
-        return;
-    }
-
-    // Tidy like a real edit: the command itself disappears
-    await message.delete();
-}
diff --git a/src/commands/explain.ts b/src/commands/explain.ts
deleted file mode 100644
index 2b4e151..0000000
--- a/src/commands/explain.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-/* src/commands/explain.ts */
-
-import type { Message } from "discord.js";
-
-const explainText = [
-    `This bot is created by, and for <@1464890289922641993>, for faer plural system.`,
-    ``,
-    `> How does it work?`,
-    `The bot detects messages enclosed in specific tags associated with a profile, then replaces that message under a "pseudo-account" of that profile using Discord webhooks.`,
-    `Due to Discord limitations, these messages will show up with the [APP] or [BOT] tag.`,
-    ``,
-    `> What is Plurality?`,
-    `Plurality is the state of more than 1 person or entity in a single body. You can find out more [here](<https://morethanone.info>)`,
-    ``,
-    `> Is this the same as PluralKit?`,
-    `Yes! However, the maker dislikes PluralKit, due to previous experiences with the team. This bot was made as a replacement, using the Doughmination System API`
-].join("\n");
-
-export async function explainCommand(
-    message: Message,
-): Promise<void> {
-    await message.reply(explainText);
-}
diff --git a/src/commands/help.ts b/src/commands/help.ts
deleted file mode 100644
index f2691d8..0000000
--- a/src/commands/help.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-/* src/commands/help.ts */
-
-import type { Message } from "discord.js";
-
-const helpText = [
-    "`d$edit <text>` edits the message you reply to, or your latest proxied message. `d$e` works too.",
-    "`d$explain` explains the bot, and plurality. `d$ex` works too,",
-    "`d$autoproxy` shows the state for this server, `d$autoproxy on|off` sets it. Add `-g` for every server, like `d$autoproxy -g off`. `d$ap` works too.",
-    "`d$reproxy <member>` resends the message you reply to, or your latest proxied message, as someone else, like `d$reproxy c1`. `d$rp` works too.",
-    "`d$switch <member>` sets who's fronting on the site, like `d$switch c1 c2`. `d$switch out` clears it. `d$sw` works too.",
-    "`d$member <member>` shows a member's card, like `d$member aether`. `d$m` works too.",
-    "`d$ping` shows how fast Discord and the system API respond.",
-    "-# React ❌ to delete a proxied message, ❓ to see who sent it.",
-].join("\n");
-
-export async function helpCommand(
-    message: Message,
-): Promise<void> {
-    await message.reply(helpText);
-}
diff --git a/src/commands/index.ts b/src/commands/index.ts
deleted file mode 100644
index f0aaa58..0000000
--- a/src/commands/index.ts
+++ /dev/null
@@ -1,51 +0,0 @@
-/* src/commands/index.ts */
-
-import type { Message } from "discord.js";
-
-import { autoproxyCommand } from "./autoproxy.ts";
-import { editCommand } from "./edit.ts";
-import { explainCommand } from "./explain.ts";
-import { helpCommand } from "./help.ts";
-import { memberCommand } from "./member.ts";
-import { parseCommand } from "./parse.ts";
-import { pingCommand } from "./ping.ts";
-import { reproxyCommand } from "./reproxy.ts";
-import { switchCommand } from "./switch.ts";
-
-type CommandHandler = (
-    message: Message,
-    args: string[],
-    rest: string,
-) => Promise<void>;
-
-const commands: Record<string, CommandHandler> = {
-    edit: editCommand,
-    e: editCommand,
-    ex: explainCommand,
-    explain: explainCommand,
-    autoproxy: autoproxyCommand,
-    ap: autoproxyCommand,
-    reproxy: reproxyCommand,
-    rp: reproxyCommand,
-    switch: switchCommand,
-    sw: switchCommand,
-    member: memberCommand,
-    m: memberCommand,
-    ping: pingCommand,
-    help: helpCommand
-};
-
-// True when the message was a command, so it isn't proxied as well
-export async function runCommand(message: Message): Promise<boolean> {
-    const parsed = parseCommand(message.content);
-    if (!parsed) return false;
-
-    const handler = commands[parsed.name];
-    if (!handler) {
-        await message.reply(`Unknown command \`${parsed.name}\`. Try \`d$help\`.`);
-        return true;
-    }
-
-    await handler(message, parsed.args, parsed.rest);
-    return true;
-}
diff --git a/src/commands/member.ts b/src/commands/member.ts
deleted file mode 100644
index ace38ed..0000000
--- a/src/commands/member.ts
+++ /dev/null
@@ -1,33 +0,0 @@
-/* src/commands/member.ts */
-
-import {
-    type APIMessageTopLevelComponent,
-    type Message,
-    MessageFlags,
-} from "discord.js";
-
-import { memberCard } from "../discord/infoCard.ts";
-import { membersByName } from "../proxy/names.ts";
-import { system } from "../state/system.ts";
-
-export async function memberCommand(
-    message: Message,
-    args: string[],
-): Promise<void> {
-    if (args.length !== 1) {
-        await message.reply("Use `d$member <member>`, like `d$member aether`.");
-        return;
-    }
-
-    const match = membersByName(system.members, args).found[0];
-
-    if (!match) {
-        await message.reply(`No member called \`${args[0]}\`.`);
-        return;
-    }
-
-    await message.reply({
-        flags: MessageFlags.IsComponentsV2,
-        components: [memberCard(match)] as APIMessageTopLevelComponent[],
-    });
-}
diff --git a/src/commands/parse.ts b/src/commands/parse.ts
deleted file mode 100644
index 68666cb..0000000
--- a/src/commands/parse.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-/* src/commands/parse.ts */
-
-export const commandPrefix = "d$";
-export const noProxyPrefix = "$";
-
-export interface ParsedCommand {
-  name: string;
-  args: string[];
-  // Everything after the name, untouched, for commands that take free text
-  rest: string;
-}
-
-export function parseCommand(content: string): ParsedCommand | null {
-  if (!content.toLowerCase().startsWith(commandPrefix)) return null;
-
-  const body = content.slice(commandPrefix.length).trimStart();
-  const name = body.split(/\s/, 1)[0];
-
-  if (!name) return null;
-
-  const rest = body.slice(name.length).trim();
-
-  return {
-    name: name.toLowerCase(),
-    args: rest ? rest.toLowerCase().split(/\s+/) : [],
-    rest,
-  };
-}
diff --git a/src/commands/ping.ts b/src/commands/ping.ts
deleted file mode 100644
index 59400ec..0000000
--- a/src/commands/ping.ts
+++ /dev/null
@@ -1,41 +0,0 @@
-/* src/commands/ping.ts */
-
-import type { Message } from "discord.js";
-
-import { apiBase } from "../config/constants.ts";
-
-// Round trip to the system site's API, or why it failed
-async function apiPing(): Promise<string> {
-    const started = performance.now();
-
-    try {
-        const response = await fetch(`${apiBase}/system`);
-        await response.body?.cancel();
-        const took = Math.round(performance.now() - started);
-
-        return response.ok ? `${took} ms` : `HTTP ${response.status} after ${took} ms`;
-    } catch (error) {
-        return `failed (${error instanceof Error ? error.message : "unknown error"})`;
-    }
-}
-
-function report(heartbeat: number, discord: number | null, api: string): string {
-    return [
-        "🏓 Pong!",
-        `Discord heartbeat: ${heartbeat < 0 ? "not measured yet" : `${heartbeat} ms`}`,
-        `Discord round trip: ${discord === null ? "measuring…" : `${discord} ms`}`,
-        `System API: ${api}`,
-    ].join("\n");
-}
-
-export async function pingCommand(message: Message): Promise<void> {
-    const apiResult = apiPing();
-    const heartbeat = message.client.ws.ping;
-
-    // Send, then edit with the time the send took
-    const started = performance.now();
-    const reply = await message.reply(report(heartbeat, null, "measuring…"));
-    const discord = Math.round(performance.now() - started);
-
-    await reply.edit(report(heartbeat, discord, await apiResult));
-}
diff --git a/src/commands/reproxy.ts b/src/commands/reproxy.ts
deleted file mode 100644
index 1c80158..0000000
--- a/src/commands/reproxy.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-/* src/commands/reproxy.ts */
-
-import type { Message } from "discord.js";
-
-import { reproxyProxied } from "../discord/reproxyMessage.ts";
-import { membersByName } from "../proxy/names.ts";
-import { system } from "../state/system.ts";
-
-export async function reproxyCommand(
-    message: Message,
-    args: string[],
-): Promise<void> {
-    if (args.length === 0) {
-        await message.reply("Use `d$reproxy <member>`, like `d$reproxy c1`. Several work too: `d$rp c1 c2`.");
-        return;
-    }
-
-    const { found, missing } = membersByName(system.members, args);
-
-    if (missing.length > 0) {
-        const names = missing.map((name) => `\`${name}\``).join(", ");
-        await message.reply(`No member called ${names}. Use their short name, like \`c1\`.`);
-        return;
-    }
-
-    const problem = await reproxyProxied(message, found);
-
-    if (problem) {
-        await message.reply(problem);
-        return;
-    }
-
-    // Tidy like edit: the command itself disappears
-    await message.delete();
-}
diff --git a/src/commands/switch.ts b/src/commands/switch.ts
deleted file mode 100644
index 429570c..0000000
--- a/src/commands/switch.ts
+++ /dev/null
@@ -1,41 +0,0 @@
-/* src/commands/switch.ts */
-
-import type { Message } from "discord.js";
-
-import { switchFront } from "../api/switch.ts";
-import { membersByName, webhookName } from "../proxy/names.ts";
-import { system } from "../state/system.ts";
-
-export async function switchCommand(
-    message: Message,
-    args: string[],
-): Promise<void> {
-    if (args.length === 0) {
-        await message.reply("Use `d$switch <member>`, like `d$switch c1`, several like `d$sw c1 c2`, or `d$sw out`.");
-        return;
-    }
-
-    const switchingOut = args.length === 1 && args[0] === "out";
-    const { found, missing } = switchingOut
-        ? { found: [], missing: [] }
-        : membersByName(system.members, args);
-
-    if (missing.length > 0) {
-        const names = missing.map((name) => `\`${name}\``).join(", ");
-        await message.reply(`No member called ${names}. Use their short name, like \`c1\`.`);
-        return;
-    }
-
-    const problem = await switchFront(found.map((member) => member.id));
-
-    if (problem) {
-        await message.reply(problem);
-        return;
-    }
-
-    await message.reply(
-        switchingOut
-            ? "Switched out. Nobody is fronting."
-            : `Switched in **${webhookName(found, null)}**.`,
-    );
-}
diff --git a/src/config/constants.ts b/src/config/constants.ts
deleted file mode 100644
index 332d969..0000000
--- a/src/config/constants.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-/* src/config/constants.ts */
-
-export const apiBase = "https://doughmination.co.uk/api/plural";
-export const socketUrl = "wss://doughmination.co.uk/api/plural/ws";
-
-export const memberRefreshMs = 5 * 60 * 1000;
-export const pingMs = 30 * 1000;
-export const reconnectMs = 5 * 1000;
-
-export const webhookDefaultName = "proxyBot";
-export const mergedAvatarSize = 512;
-
-// Too many faces for a merge, so a crowd gets the site's icon
-export const crowdAvatarUrl = "https://doughmination.co.uk/favicon.png";
diff --git a/src/config/env.ts b/src/config/env.ts
deleted file mode 100644
index d0cc102..0000000
--- a/src/config/env.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-/* src/config/env.ts */
-
-const token = Deno.env.get("DISCORD_TOKEN");
-const ownerId = Deno.env.get("OWNER_ID");
-
-if (!token || !ownerId) {
-    throw new Error("Set DISCORD_TOKEN and OWNER_ID in .env");
-}
-
-export const discordToken: string = token;
-export const ownerUserId: string = ownerId;
-
-// Optional: without it everything works except d$switch
-export const siteToken: string | undefined = Deno.env.get("SITE_TOKEN");
diff --git a/src/discord.rs b/src/discord.rs
new file mode 100644
index 0000000..9d25d27
--- /dev/null
+++ b/src/discord.rs
@@ -0,0 +1,748 @@
+// src/discord.rs
+
+use std::sync::{Arc, LazyLock};
+use std::time::Instant;
+
+use percent_encoding::percent_decode_str;
+use regex::Regex;
+use secrecy::ExposeSecret;
+use serde_json::{Value, json};
+use serenity::all::*;
+use serenity::http::{LightMethod, Request, Route};
+use tokio::sync::Mutex;
+
+use crate::{
+    Bot,
+    cards::{self, COMPONENTS_V2},
+    proxy::{self, Member},
+};
+
+pub const NO_TARGET: &str =
+    "No proxied message found. Reply to one, or send one in the last 50 messages.";
+
+pub fn user_mentions() -> Value {
+    json!({ "parse": ["users"], "replied_user": false })
+}
+
+pub fn owned(ctx: &Context, message: &Message) -> bool {
+    message.webhook_id.is_some()
+        && ctx
+            .http
+            .application_id()
+            .is_some_and(|id| Some(id) == message.application_id)
+}
+
+pub fn classic(content: &str) -> bool {
+    static LINK: LazyLock<Regex> = LazyLock::new(|| Regex::new(r"https?://\S").unwrap());
+    proxy::utf16_len(content) <= 2000
+        && LINK
+            .find_iter(content)
+            .any(|hit| !content[..hit.start()].ends_with('<'))
+}
+
+fn is_thread(kind: ChannelType) -> bool {
+    matches!(
+        kind,
+        ChannelType::NewsThread | ChannelType::PublicThread | ChannelType::PrivateThread
+    )
+}
+
+pub async fn reference(ctx: &Context, message: &Message) -> Option<Message> {
+    let reference = message.message_reference.as_ref()?;
+    if reference.kind != MessageReferenceKind::Default {
+        return None;
+    }
+
+    if let Some(original) = &message.referenced_message {
+        return Some((**original).clone());
+    }
+
+    let mut target = fetch_target(ctx, reference.channel_id, reference.message_id?)
+        .await?
+        .message;
+    target.guild_id = target.guild_id.or(reference.guild_id).or(message.guild_id);
+    Some(target)
+}
+
+pub async fn reply(
+    ctx: &Context,
+    message: &Message,
+    mut payload: Value,
+) -> anyhow::Result<MessageId> {
+    payload["message_reference"] = json!({
+        "message_id": message.id,
+        "fail_if_not_exists": true,
+    });
+    payload["allowed_mentions"] = user_mentions();
+    let sent = send_json(ctx, message.channel_id, &payload).await?;
+    Ok(serde_json::from_value(sent["id"].clone())?)
+}
+
+pub async fn dm(ctx: &Context, user: UserId, components: Vec<Value>) -> anyhow::Result<Value> {
+    let channel = user.create_dm_channel(&ctx.http).await?;
+    send_json(
+        ctx,
+        channel.id,
+        &json!({
+            "flags": COMPONENTS_V2,
+            "components": components,
+            "allowed_mentions": { "parse": [] },
+        }),
+    )
+    .await
+}
+
+async fn send_json(ctx: &Context, channel_id: ChannelId, payload: &Value) -> anyhow::Result<Value> {
+    Ok(ctx
+        .http
+        .fire(
+            Request::new(Route::ChannelMessages { channel_id }, LightMethod::Post)
+                .body(Some(serde_json::to_vec(payload)?)),
+        )
+        .await?)
+}
+
+struct Target {
+    message: Message,
+    components: Vec<Value>,
+    classic: bool,
+}
+
+impl Target {
+    fn from_json(mut raw: Value) -> serde_json::Result<Self> {
+        let classic = raw["flags"].as_u64().unwrap_or_default() & u64::from(COMPONENTS_V2) == 0;
+        let components = raw
+            .as_object_mut()
+            .and_then(|object| object.remove("components"))
+            .and_then(|components| components.as_array().cloned())
+            .unwrap_or_default();
+        raw.as_object_mut()
+            .map(|object| object.remove("referenced_message"));
+        Ok(Self {
+            message: serde_json::from_value(raw)?,
+            components,
+            classic,
+        })
+    }
+}
+
+async fn fetch_target(
+    ctx: &Context,
+    channel_id: ChannelId,
+    message_id: MessageId,
+) -> Option<Target> {
+    let raw = ctx
+        .http
+        .fire::<Value>(Request::new(
+            Route::ChannelMessage {
+                channel_id,
+                message_id,
+            },
+            LightMethod::Get,
+        ))
+        .await
+        .ok()?;
+    Target::from_json(raw).ok()
+}
+
+struct Destination {
+    parent: ChannelId,
+    thread: Option<ChannelId>,
+}
+
+impl Destination {
+    async fn resolve(
+        ctx: &Context,
+        channel: ChannelId,
+        guild_id: GuildId,
+    ) -> anyhow::Result<Option<Self>> {
+        let cached = ctx
+            .cache
+            .guild(guild_id)
+            .and_then(|guild| guild.channels.get(&channel).cloned());
+        let guild = match cached {
+            Some(guild) => guild,
+            None => match channel.to_channel(&ctx.http).await? {
+                Channel::Guild(guild) => guild,
+                _ => return Ok(None),
+            },
+        };
+        if is_thread(guild.kind) {
+            return Ok(guild.parent_id.map(|parent| Self {
+                parent,
+                thread: Some(channel),
+            }));
+        }
+        if !matches!(
+            guild.kind,
+            ChannelType::Text | ChannelType::News | ChannelType::Voice | ChannelType::Stage
+        ) {
+            return Ok(None);
+        }
+        Ok(Some(Self {
+            parent: channel,
+            thread: None,
+        }))
+    }
+}
+
+type LockedWebhook = Arc<Mutex<Option<Webhook>>>;
+
+impl Bot {
+    async fn channel_webhook(&self, dest: &Destination) -> LockedWebhook {
+        self.webhooks
+            .lock()
+            .await
+            .entry(dest.parent)
+            .or_default()
+            .clone()
+    }
+
+    async fn ensure_webhook(
+        ctx: &Context,
+        dest: &Destination,
+        slot: &mut Option<Webhook>,
+    ) -> anyhow::Result<Webhook> {
+        if let Some(webhook) = slot {
+            return Ok(webhook.clone());
+        }
+        let bot = ctx.cache.current_user().id;
+        let existing = dest
+            .parent
+            .webhooks(&ctx.http)
+            .await?
+            .into_iter()
+            .find(|hook| {
+                hook.user.as_ref().is_some_and(|user| user.id == bot) && hook.token.is_some()
+            });
+        let webhook = match existing {
+            Some(webhook) => webhook,
+            None => {
+                dest.parent
+                    .create_webhook(&ctx.http, CreateWebhook::new("proxyBot"))
+                    .await?
+            }
+        };
+        *slot = Some(webhook.clone());
+        Ok(webhook)
+    }
+
+    pub async fn proxy_message(
+        &self,
+        ctx: &Context,
+        message: &Message,
+        guild: GuildId,
+    ) -> anyhow::Result<()> {
+        let started = Instant::now();
+        let enabled = self
+            .settings
+            .lock()
+            .await
+            .guilds
+            .get(&guild)
+            .copied()
+            .unwrap_or(false);
+        let (speakers, content) = {
+            let state = self.system.read().await;
+            let fronters = if enabled {
+                state.fronters.as_slice()
+            } else {
+                &[]
+            };
+            let Some((speakers, content)) = proxy::pick(&state.members, fronters, &message.content)
+            else {
+                return Ok(());
+            };
+            (
+                speakers.into_iter().cloned().collect::<Vec<_>>(),
+                content.to_owned(),
+            )
+        };
+        if content.is_empty() && message.attachments.is_empty() {
+            return Ok(());
+        }
+        let Some(dest) = Destination::resolve(ctx, message.channel_id, guild).await? else {
+            return Ok(());
+        };
+
+        let (payload, files) = self.layout(ctx, message, &content).await?;
+        let slot = self.channel_webhook(&dest).await;
+        let mut locked = slot.lock().await;
+        let webhook = Self::ensure_webhook(ctx, &dest, &mut locked).await?;
+        let (sent, send_ms) = self
+            .send_proxy(ctx, &dest, &webhook, &speakers, payload, files)
+            .await?;
+        drop(locked);
+        self.remember(sent, speakers).await;
+
+        // Keep the original until Discord has acknowledged the replacement.
+        message.delete(&ctx.http).await?;
+        println!(
+            "Proxied in {}ms (send {send_ms}ms)",
+            started.elapsed().as_millis()
+        );
+        Ok(())
+    }
+
+    async fn send_proxy(
+        &self,
+        ctx: &Context,
+        dest: &Destination,
+        webhook: &Webhook,
+        speakers: &[Member],
+        mut payload: Value,
+        files: Vec<CreateAttachment>,
+    ) -> anyhow::Result<(MessageId, u128)> {
+        let tag = self.system.read().await.info.tag.clone();
+        let speakers_ref = speakers.iter().collect::<Vec<_>>();
+        payload["username"] = json!(proxy::webhook_name(&speakers_ref, tag.as_deref()));
+        if let Some(url) = self.avatar(ctx, webhook, speakers).await {
+            payload["avatar_url"] = json!(url);
+        }
+        payload["allowed_mentions"] = user_mentions();
+
+        let token = webhook
+            .token
+            .as_ref()
+            .map(ExposeSecret::expose_secret)
+            .ok_or_else(|| anyhow::anyhow!("webhook had no token"))?;
+        let started = Instant::now();
+        let sent = if files.is_empty() {
+            let mut params = vec![("wait", "true".into()), ("with_components", "true".into())];
+            if let Some(thread) = dest.thread {
+                params.push(("thread_id", thread.to_string()));
+            }
+            ctx.http
+                .fire::<Value>(
+                    Request::new(
+                        Route::WebhookWithToken {
+                            webhook_id: webhook.id,
+                            token,
+                        },
+                        LightMethod::Post,
+                    )
+                    .body(Some(serde_json::to_vec(&payload)?))
+                    .params(Some(params)),
+                )
+                .await?
+        } else {
+            // Serenity's raw webhook helper leaves every upload ID at zero.
+            // Build the multipart form with the same indices as the attachment metadata.
+            self.upload_webhook(webhook.id, token, dest.thread, &payload, &files)
+                .await?
+        };
+        Ok((
+            serde_json::from_value(sent["id"].clone())?,
+            started.elapsed().as_millis(),
+        ))
+    }
+
+    async fn upload_webhook(
+        &self,
+        webhook: WebhookId,
+        token: &str,
+        thread: Option<ChannelId>,
+        payload: &Value,
+        files: &[CreateAttachment],
+    ) -> anyhow::Result<Value> {
+        let mut url = reqwest::Url::parse("https://discord.com/api/v10/webhooks/")?;
+        url.path_segments_mut()
+            .expect("Discord API URL has a path")
+            .pop_if_empty()
+            .push(&webhook.to_string())
+            .push(token);
+        url.query_pairs_mut()
+            .append_pair("wait", "true")
+            .append_pair("with_components", "true");
+        if let Some(thread) = thread {
+            url.query_pairs_mut()
+                .append_pair("thread_id", &thread.to_string());
+        }
+
+        let payload_json = serde_json::to_string(payload)?;
+        for attempt in 0..3 {
+            let mut form =
+                reqwest::multipart::Form::new().text("payload_json", payload_json.clone());
+            for (index, file) in files.iter().enumerate() {
+                let part = reqwest::multipart::Part::bytes(file.data.clone())
+                    .file_name(file.filename.clone());
+                form = form.part(format!("files[{index}]"), part);
+            }
+
+            let response = self
+                .web
+                .post(url.clone())
+                .multipart(form)
+                .send()
+                .await
+                .map_err(reqwest::Error::without_url)?;
+            let status = response.status();
+            if status == reqwest::StatusCode::TOO_MANY_REQUESTS && attempt < 2 {
+                let rate_limit = response
+                    .json::<Value>()
+                    .await
+                    .map_err(reqwest::Error::without_url)?;
+                if let Some(seconds) = rate_limit["retry_after"].as_f64()
+                    && (0.0..=60.0).contains(&seconds)
+                {
+                    tokio::time::sleep(std::time::Duration::from_secs_f64(seconds)).await;
+                    continue;
+                }
+            } else if status.is_success() {
+                return response
+                    .json()
+                    .await
+                    .map_err(|error| error.without_url().into());
+            }
+            anyhow::bail!("Discord rejected webhook upload (HTTP {status})");
+        }
+        anyhow::bail!("Discord webhook upload exceeded the retry limit")
+    }
+
+    async fn download(&self, url: &str, filename: String) -> anyhow::Result<CreateAttachment> {
+        let bytes = self
+            .web
+            .get(url)
+            .send()
+            .await?
+            .error_for_status()?
+            .bytes()
+            .await?;
+        Ok(CreateAttachment::bytes(bytes.to_vec(), filename))
+    }
+
+    async fn layout(
+        &self,
+        ctx: &Context,
+        message: &Message,
+        content: &str,
+    ) -> anyhow::Result<(Value, Vec<CreateAttachment>)> {
+        static BAD_FILENAME: LazyLock<Regex> =
+            LazyLock::new(|| Regex::new(r"[^A-Za-z0-9_.-]").unwrap());
+        let classic = classic(content);
+        let mut components = Vec::new();
+        if !classic && !content.is_empty() {
+            components.push(cards::text(content));
+        }
+        if let Some(original) = reference(ctx, message).await {
+            components.push(cards::link(
+                &format!("↪ {}", cards::display_name(&original)),
+                original.link(),
+            ));
+        }
+
+        let mut gallery = Vec::new();
+        let mut other = Vec::new();
+        let mut downloads = Vec::new();
+        let mut attachments = Vec::new();
+        for (index, attachment) in message.attachments.iter().enumerate() {
+            let name = format!(
+                "{index}-{}",
+                BAD_FILENAME.replace_all(&attachment.filename, "_")
+            );
+            let spoiler = attachment.filename.starts_with("SPOILER_");
+            let filename = if classic && spoiler {
+                format!("SPOILER_{name}")
+            } else {
+                name.clone()
+            };
+            attachments.push(json!({ "id": index, "filename": filename }));
+            downloads.push(self.download(&attachment.url, filename));
+
+            if classic {
+                continue;
+            }
+            let url = format!("attachment://{name}");
+            let kind = attachment.content_type.as_deref().unwrap_or_default();
+            if kind.starts_with("image/") || kind.starts_with("video/") {
+                gallery.push(json!({
+                    "media": { "url": url },
+                    "spoiler": spoiler,
+                }));
+            } else {
+                other.push(json!({
+                    "type": 13,
+                    "file": { "url": url },
+                    "spoiler": spoiler,
+                }));
+            }
+        }
+        if !gallery.is_empty() {
+            components.push(json!({ "type": 12, "items": gallery }));
+        }
+        components.extend(other);
+
+        let mut payload = json!({
+            "components": components,
+            "attachments": attachments,
+        });
+        if classic {
+            payload["content"] = json!(content);
+        } else {
+            payload["flags"] = json!(COMPONENTS_V2);
+        }
+        Ok((
+            payload,
+            futures_util::future::try_join_all(downloads).await?,
+        ))
+    }
+
+    async fn target(&self, ctx: &Context, command: &Message) -> anyhow::Result<Option<Target>> {
+        if let Some(reference) = command
+            .message_reference
+            .as_ref()
+            .filter(|reference| reference.kind == MessageReferenceKind::Default)
+        {
+            let Some(id) = reference.message_id else {
+                return Ok(None);
+            };
+            return Ok(fetch_target(ctx, reference.channel_id, id)
+                .await
+                .filter(|target| owned(ctx, &target.message)));
+        }
+
+        let cached = ctx
+            .cache
+            .channel_messages(command.channel_id)
+            .and_then(|messages| {
+                messages
+                    .values()
+                    .filter(|message| message.id < command.id && owned(ctx, message))
+                    .map(|message| message.id)
+                    .max()
+            });
+        if let Some(id) = cached
+            && let Some(target) = fetch_target(ctx, command.channel_id, id).await
+            && owned(ctx, &target.message)
+        {
+            return Ok(Some(target));
+        }
+
+        let request = Request::new(
+            Route::ChannelMessages {
+                channel_id: command.channel_id,
+            },
+            LightMethod::Get,
+        )
+        .params(Some(vec![
+            ("before", command.id.to_string()),
+            ("limit", "50".into()),
+        ]));
+        let recent = ctx.http.fire::<Vec<Value>>(request).await?;
+        Ok(recent
+            .into_iter()
+            .filter_map(|raw| Target::from_json(raw).ok())
+            .find(|target| owned(ctx, &target.message)))
+    }
+
+    pub async fn edit(
+        &self,
+        ctx: &Context,
+        command: &Message,
+        content: &str,
+    ) -> anyhow::Result<Option<&'static str>> {
+        let Some(Target {
+            message: target,
+            components,
+            classic,
+        }) = self.target(ctx, command).await?
+        else {
+            return Ok(Some(NO_TARGET));
+        };
+        if content.is_empty() && target.attachments.is_empty() {
+            return Ok(Some(
+                "That would leave the message empty. Use ❌ to delete it instead.",
+            ));
+        }
+        if classic && proxy::utf16_len(content) > 2000 {
+            return Ok(Some(
+                "Messages with links can only be 2000 characters long.",
+            ));
+        }
+
+        let Some(dest) =
+            Destination::resolve(ctx, command.channel_id, command.guild_id.unwrap()).await?
+        else {
+            return Ok(Some("Can't use webhooks in this channel."));
+        };
+        let id = target.webhook_id.unwrap();
+        let webhook = id.to_webhook(&ctx.http).await?;
+        let token = webhook
+            .token
+            .as_ref()
+            .map(ExposeSecret::expose_secret)
+            .ok_or_else(|| anyhow::anyhow!("webhook had no token"))?;
+        let mut payload = json!({ "allowed_mentions": user_mentions() });
+        if classic {
+            payload["content"] = json!(content);
+        } else {
+            let (mut components, attachments) = existing_media(&target, components, true);
+            if !content.is_empty() {
+                components.insert(0, cards::text(content));
+            }
+            payload["components"] = json!(components);
+            payload["attachments"] = json!(attachments);
+        }
+
+        ctx.http
+            .edit_webhook_message(id, dest.thread, token, target.id, &payload, Vec::new())
+            .await
+            .map_err(|_| anyhow::anyhow!("Discord rejected webhook edit"))?;
+        command.delete(&ctx.http).await?;
+        Ok(None)
+    }
+
+    pub async fn reproxy(
+        &self,
+        ctx: &Context,
+        command: &Message,
+        speakers: Vec<Member>,
+    ) -> anyhow::Result<Option<&'static str>> {
+        let Some(Target {
+            message: target,
+            components,
+            classic,
+        }) = self.target(ctx, command).await?
+        else {
+            return Ok(Some(NO_TARGET));
+        };
+        let Some(dest) =
+            Destination::resolve(ctx, command.channel_id, command.guild_id.unwrap()).await?
+        else {
+            return Ok(Some("Can't use webhooks in this channel."));
+        };
+
+        let (components, _) = existing_media(&target, components, false);
+        let attachments: Vec<_> = target
+            .attachments
+            .iter()
+            .enumerate()
+            .map(|(index, file)| json!({ "id": index, "filename": file.filename }))
+            .collect();
+        let mut payload = json!({ "attachments": attachments });
+        if classic {
+            payload["content"] = json!(target.content);
+        } else {
+            payload["flags"] = json!(COMPONENTS_V2);
+            payload["components"] = json!(components);
+        }
+        let files = futures_util::future::try_join_all(
+            target
+                .attachments
+                .iter()
+                .map(|file| self.download(&file.url, file.filename.clone())),
+        )
+        .await?;
+
+        let slot = self.channel_webhook(&dest).await;
+        let mut locked = slot.lock().await;
+        let webhook = Self::ensure_webhook(ctx, &dest, &mut locked).await?;
+        let (sent, _) = self
+            .send_proxy(ctx, &dest, &webhook, &speakers, payload, files)
+            .await?;
+        drop(locked);
+        self.remember(sent, speakers).await;
+        target.delete(&ctx.http).await?;
+        command.delete(&ctx.http).await?;
+        Ok(None)
+    }
+}
+
+fn existing_media(
+    message: &Message,
+    mut components: Vec<Value>,
+    remove_text: bool,
+) -> (Vec<Value>, Vec<Value>) {
+    if remove_text {
+        components.retain(|component| component["type"] != 10);
+    }
+
+    let attachment_uri = |media: &mut Value| {
+        let Some(url) = media["url"].as_str() else {
+            return;
+        };
+        let Ok(parsed) = reqwest::Url::parse(url) else {
+            return;
+        };
+        let Some(last) = parsed
+            .path_segments()
+            .and_then(|mut parts| parts.next_back())
+        else {
+            return;
+        };
+        let name = percent_decode_str(last).decode_utf8_lossy();
+        if message.attachments.iter().any(|file| file.filename == name) {
+            *media = json!({ "url": format!("attachment://{name}") });
+        }
+    };
+    for component in &mut components {
+        match component["type"].as_u64() {
+            Some(12) => {
+                if let Some(items) = component["items"].as_array_mut() {
+                    for item in items {
+                        attachment_uri(&mut item["media"]);
+                    }
+                }
+            }
+            Some(13) => attachment_uri(&mut component["file"]),
+            _ => {}
+        }
+    }
+    let attachments = message
+        .attachments
+        .iter()
+        .map(|file| json!({ "id": file.id, "filename": file.filename }))
+        .collect();
+    (components, attachments)
+}
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+
+    #[test]
+    fn edits_and_reproxies_keep_raw_components_and_attachment_links() {
+        let message = crate::tests::message(
+            "speaker",
+            "",
+            vec![
+                crate::tests::attachment("cat.png"),
+                crate::tests::attachment("notes v2.txt"),
+            ],
+        );
+        let components = vec![
+            cards::text("old"),
+            cards::link("Jump to reply", "https://discord.com/channels/1/2/3".into()),
+            json!({
+                "type": 12,
+                "items": [{
+                    "media": { "url": "https://cdn.example/cat.png?ex=abc", "proxy_url": "x" },
+                    "spoiler": true,
+                }],
+            }),
+            json!({ "type": 13, "file": { "url": "https://cdn.example/notes%20v2.txt" } }),
+        ];
+        let mut raw = serde_json::to_value(message).unwrap();
+        raw["components"] = json!(components);
+        raw["flags"] = json!(COMPONENTS_V2);
+        let target = Target::from_json(raw).unwrap();
+        assert!(!target.classic);
+
+        let (edited, attachments) =
+            existing_media(&target.message, target.components.clone(), true);
+        assert_eq!(edited.len(), 3);
+        assert_eq!(edited[0]["type"], 1);
+        assert_eq!(
+            edited[1]["items"][0],
+            json!({
+                "media": { "url": "attachment://cat.png" },
+                "spoiler": true,
+            })
+        );
+        assert_eq!(edited[2]["file"]["url"], "attachment://notes v2.txt");
+        assert_eq!(attachments.len(), 2);
+
+        let (reproxied, _) = existing_media(&target.message, target.components, false);
+        assert_eq!(reproxied[0]["content"], "old");
+    }
+}
diff --git a/src/discord/avatar.ts b/src/discord/avatar.ts
deleted file mode 100644
index 8f3a99b..0000000
--- a/src/discord/avatar.ts
+++ /dev/null
@@ -1,79 +0,0 @@
-/* src/discord/avatar.ts */
-
-import { Buffer } from "node:buffer";
-import type { Webhook } from "discord.js";
-
-import { crowdAvatarUrl } from "../config/constants.ts";
-import { avatarOf, mergeAvatars } from "../images/merge.ts";
-import { maxNamedSpeakers } from "../proxy/names.ts";
-import type { Member } from "../proxy/types.ts";
-import { client } from "./client.ts";
-
-// Which front each webhook's own avatar was merged for, by webhook id
-const webhookAvatarKeys = new Map<string, string>();
-// Held as a promise, so a merge started on front change is reused by the next message
-let mergedAvatar: { key: string; png: Promise<Uint8Array | null> } | null = null;
-
-function speakerKey(speakers: Member[]): string {
-    return speakers.map((member) => member.id).join(",");
-}
-
-function mergedPng(speakers: Member[], key: string): Promise<Uint8Array | null> {
-    if (mergedAvatar?.key !== key) {
-        mergedAvatar = {
-            key,
-            png: mergeAvatars(speakers),
-        };
-    }
-
-    return mergedAvatar.png;
-}
-
-// Drops a failed merge so the next message retries it
-function forgetMerge(key: string): void {
-    if (mergedAvatar?.key === key) mergedAvatar = null;
-}
-
-// Starts the download and merge as soon as the front changes, off the message path
-export function premergeAvatar(speakers: Member[]): void {
-    if (speakers.length < 2 || speakers.length > maxNamedSpeakers) return;
-
-    const key = speakerKey(speakers);
-    mergedPng(speakers, key).catch((error) => {
-        console.error("Avatar premerge failed:", error);
-        forgetMerge(key);
-    });
-}
-
-// One member: per-message avatar URL. Several: the webhook's own avatar becomes the merge
-export async function avatarFor(
-    webhook: Webhook,
-    speakers: Member[],
-): Promise<string | undefined> {
-    const botAvatar = client.user?.displayAvatarURL();
-
-    if (speakers.length === 1) {
-        return avatarOf(speakers[0]) ?? botAvatar;
-    }
-
-    if (speakers.length > maxNamedSpeakers) return crowdAvatarUrl;
-
-    const key = speakerKey(speakers);
-    if (webhookAvatarKeys.get(webhook.id) === key) return undefined;
-
-    try {
-        const png = await mergedPng(speakers, key);
-        if (!png) return botAvatar;
-
-        await webhook.edit({
-            avatar: Buffer.from(png),
-        });
-        webhookAvatarKeys.set(webhook.id, key);
-        return undefined;
-    } catch (error) {
-        // A broken merge shouldn't stop the message going out
-        console.error("Avatar merge failed:", error);
-        forgetMerge(key);
-        return botAvatar;
-    }
-}
diff --git a/src/discord/client.ts b/src/discord/client.ts
deleted file mode 100644
index 5451c81..0000000
--- a/src/discord/client.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-/* src/discord/client.ts */
-
-import { Client, GatewayIntentBits, Partials } from "discord.js";
-
-export const client = new Client({
-    intents: [
-        GatewayIntentBits.Guilds,
-        GatewayIntentBits.GuildMessages,
-        GatewayIntentBits.MessageContent,
-        GatewayIntentBits.GuildMessageReactions,
-        // Typing counts as being in chat, so reply DMs hold off
-        GatewayIntentBits.GuildMessageTyping,
-    ],
-    // Lets ❌ and ❓ work on messages sent before the bot last started
-    partials: [
-        Partials.Message,
-        Partials.Reaction,
-        Partials.User,
-    ],
-    // Command replies shouldn't ping whoever ran the command
-    allowedMentions: {
-        repliedUser: false,
-    },
-});
diff --git a/src/discord/editComponents.ts b/src/discord/editComponents.ts
deleted file mode 100644
index ff6806a..0000000
--- a/src/discord/editComponents.ts
+++ /dev/null
@@ -1,87 +0,0 @@
-/* src/discord/editComponents.ts */
-
-// Discord's component type numbers; importing discord.js here would make tests need env access
-export const ComponentType = {
-    ActionRow: 1,
-    Button: 2,
-    Section: 9,
-    TextDisplay: 10,
-    Thumbnail: 11,
-    MediaGallery: 12,
-    File: 13,
-    Separator: 14,
-    Container: 17,
-} as const;
-
-// Loose JSON so the existing message's components can pass straight through
-// deno-lint-ignore no-explicit-any
-type ComponentJson = Record<string, any>;
-
-// Discord hands back CDN URLs, but File components only accept attachment://
-function toAttachmentUrl(url: string, attachmentNames: Set<string>): string {
-    try {
-        const name = decodeURIComponent(new URL(url).pathname.split("/").pop() ?? "");
-        return attachmentNames.has(name) ? `attachment://${name}` : url;
-    } catch {
-        return url;
-    }
-}
-
-function rewriteMedia(
-    component: ComponentJson,
-    attachmentNames: Set<string>,
-): ComponentJson {
-    if (component.type === ComponentType.MediaGallery) {
-        return {
-            ...component,
-            items: component.items.map((item: ComponentJson) => ({
-                ...item,
-                media: {
-                    url: toAttachmentUrl(item.media.url, attachmentNames),
-                },
-            })),
-        };
-    }
-
-    if (component.type === ComponentType.File) {
-        return {
-            ...component,
-            file: {
-                url: toAttachmentUrl(component.file.url, attachmentNames),
-            },
-        };
-    }
-
-    return component;
-}
-
-// Points media back at the attachments, so the components can be sent again
-export function keepMedia(
-    components: ComponentJson[],
-    attachmentNames: string[],
-): ComponentJson[] {
-    const names = new Set(attachmentNames);
-    return components.map((component) => rewriteMedia(component, names));
-}
-
-// Swaps the text block for new text, keeping buttons and attachments as they were
-export function replaceText(
-    components: ComponentJson[],
-    text: string,
-    attachmentNames: string[],
-): ComponentJson[] {
-    const kept = keepMedia(
-        components.filter((component) => component.type !== ComponentType.TextDisplay),
-        attachmentNames,
-    );
-
-    if (!text) return kept;
-
-    return [
-        {
-            type: ComponentType.TextDisplay,
-            content: text,
-        },
-        ...kept,
-    ];
-}
diff --git a/src/discord/editMessage.ts b/src/discord/editMessage.ts
deleted file mode 100644
index 8d72fd0..0000000
--- a/src/discord/editMessage.ts
+++ /dev/null
@@ -1,94 +0,0 @@
-/* src/discord/editMessage.ts */
-
-import {
-    type APIMessageTopLevelComponent,
-    MessageFlags,
-    MessageReferenceType,
-    type Message,
-} from "discord.js";
-
-import { client } from "./client.ts";
-import { replaceText } from "./editComponents.ts";
-import { isProxied } from "./ownership.ts";
-import { getWebhook } from "./webhooks.ts";
-
-export const searchDepth = 50;
-
-// The replied-to message if there is one, otherwise the newest proxied message here
-export async function findTarget(command: Message): Promise<Message | null> {
-    if (command.reference?.type === MessageReferenceType.Default) {
-        const replied = await command.fetchReference().catch(() => null);
-        return replied && isProxied(replied) ? replied : null;
-    }
-
-    // The gateway already cached recent messages; only ask Discord when that misses
-    const cached = command.channel.messages.cache
-        .filter((message) =>
-            BigInt(message.id) < BigInt(command.id) && isProxied(message)
-        )
-        .sort((first, second) => (BigInt(second.id) > BigInt(first.id) ? 1 : -1))
-        .first();
-    if (cached) return cached;
-
-    const recent = await command.channel.messages.fetch({
-        limit: searchDepth,
-        before: command.id,
-    });
-
-    return recent.find(isProxied) ?? null;
-}
-
-// Returns an error to show, or null when the edit went through
-export async function editProxied(
-    command: Message,
-    text: string,
-): Promise<string | null> {
-    const target = await findTarget(command);
-    if (!target?.webhookId) {
-        return `No proxied message found. Reply to one, or send one in the last ${searchDepth} messages.`;
-    }
-
-    if (!text && target.attachments.size === 0) {
-        return "That would leave the message empty. Use ❌ to delete it instead.";
-    }
-
-    const channelWebhook = await getWebhook(command);
-    const webhook = channelWebhook?.id === target.webhookId
-        ? channelWebhook
-        : await client.fetchWebhook(target.webhookId);
-
-    const threadId = command.channel.isThread() ? command.channel.id : undefined;
-
-    // Link messages were sent classic; the flag can't be added or removed later
-    if (!target.flags.has(MessageFlags.IsComponentsV2)) {
-        if (text.length > 2000) {
-            return "Messages with links can only be 2000 characters long.";
-        }
-
-        await webhook.editMessage(target.id, {
-            content: text,
-            threadId,
-            allowedMentions: {
-                parse: ["users"],
-            },
-        });
-
-        return null;
-    }
-
-    await webhook.editMessage(target.id, {
-        components: replaceText(
-            target.components.map((component) => component.toJSON()),
-            text,
-            target.attachments.map((attachment) => attachment.name),
-        ) as APIMessageTopLevelComponent[],
-        // Passing them back is what keeps them; leaving this out would drop them
-        attachments: [...target.attachments.values()],
-        threadId,
-        allowedMentions: {
-            parse: ["users"],
-        },
-    });
-
-    return null;
-}
diff --git a/src/discord/infoCard.ts b/src/discord/infoCard.ts
deleted file mode 100644
index aa019a3..0000000
--- a/src/discord/infoCard.ts
+++ /dev/null
@@ -1,147 +0,0 @@
-/* src/discord/infoCard.ts */
-
-import { maxNamedSpeakers } from "../proxy/names.ts";
-import type { Member } from "../proxy/types.ts";
-import { ComponentType } from "./editComponents.ts";
-
-// Same values the system site uses for its member pages and Discord embeds
-const siteUrl = "https://doughmination.co.uk";
-export const accentColour = 0xeb459e;
-const maxDescription = 1000;
-const linkButtonStyle = 5;
-
-// deno-lint-ignore no-explicit-any
-export type ComponentJson = Record<string, any>;
-
-export interface InfoCardInput {
-    members: Member[] | undefined;
-    username: string;
-    avatarUrl: string;
-    messageUrl: string;
-    ownerId: string;
-    systemName: string | null;
-}
-
-// Discord wants an integer; unset or non-hex colours get the site accent
-function colourOf(color: string | null): number {
-    const hex = color?.trim().replace(/^#/, "") ?? "";
-    const full = hex.length === 3
-        ? hex.split("").map((digit) => digit + digit).join("")
-        : hex;
-
-    return /^[0-9a-fA-F]{6}$/.test(full) ? parseInt(full, 16) : accentColour;
-}
-
-export function shorten(text: string): string {
-    return text.length > maxDescription
-        ? `${text.slice(0, maxDescription - 1)}…`
-        : text;
-}
-
-export function linkButton(label: string, url: string): ComponentJson {
-    return {
-        type: ComponentType.Button,
-        style: linkButtonStyle,
-        label,
-        url,
-    };
-}
-
-// A Section needs an accessory, so members without an avatar get plain text
-export function header(text: string, avatarUrl: string | null): ComponentJson {
-    const display = {
-        type: ComponentType.TextDisplay,
-        content: text,
-    };
-
-    if (!avatarUrl) return display;
-
-    return {
-        type: ComponentType.Section,
-        components: [display],
-        accessory: {
-            type: ComponentType.Thumbnail,
-            media: {
-                url: avatarUrl,
-            },
-        },
-    };
-}
-
-// Mirrors the site's member page: name, pronouns, status, then about, tags, pride
-export function memberCard(member: Member): ComponentJson {
-    const top = [`## ${member.display_name || member.name}`];
-    if (member.pronouns) top.push(member.pronouns);
-    if (member.status) {
-        top.push(`${member.status.emoji ?? ""} ${member.status.text}`.trim());
-    }
-
-    const details: string[] = [];
-    if (member.description) details.push(`**About**\n${shorten(member.description)}`);
-    if (member.tags?.length) details.push(`**Tags**\n${member.tags.join(", ")}`);
-    if (member.pride?.length) details.push(`**Pride**\n${member.pride.join(", ")}`);
-
-    const components = [header(top.join("\n"), member.avatar_url)];
-
-    if (details.length > 0) {
-        components.push(
-            {
-                type: ComponentType.Separator,
-            },
-            {
-                type: ComponentType.TextDisplay,
-                content: details.join("\n\n"),
-            },
-        );
-    }
-
-    components.push({
-        type: ComponentType.ActionRow,
-        components: [
-            linkButton("Open page", `${siteUrl}/${encodeURIComponent(member.id)}`),
-        ],
-    });
-
-    return {
-        type: ComponentType.Container,
-        accent_color: colourOf(member.color),
-        components,
-    };
-}
-
-// Messages from before a restart only have the webhook's name and avatar
-function unknownCard(username: string, avatarUrl: string): ComponentJson {
-    return {
-        type: ComponentType.Container,
-        accent_color: accentColour,
-        components: [header(`## ${username}`, avatarUrl)],
-    };
-}
-
-// Capped like the proxy names, which keeps it under Discord's 40 component limit
-export function buildInfoCard(input: InfoCardInput): ComponentJson[] {
-    const shown = input.members?.slice(0, maxNamedSpeakers);
-    const hidden = (input.members?.length ?? 0) - (shown?.length ?? 0);
-
-    const cards = shown
-        ? shown.map(memberCard)
-        : [unknownCard(input.username, input.avatarUrl)];
-
-    const footer = [`Sent by <@${input.ownerId}>`];
-    if (input.systemName) footer.push(input.systemName);
-    if (hidden > 0) footer.unshift(`& ${hidden} more`);
-
-    return [
-        ...cards,
-        {
-            type: ComponentType.TextDisplay,
-            content: `-# ${footer.join(" · ")}`,
-        },
-        {
-            type: ComponentType.ActionRow,
-            components: [
-                linkButton("Jump to message", input.messageUrl),
-            ],
-        },
-    ];
-}
diff --git a/src/discord/layout.ts b/src/discord/layout.ts
deleted file mode 100644
index 4ca700a..0000000
--- a/src/discord/layout.ts
+++ /dev/null
@@ -1,104 +0,0 @@
-/* src/discord/layout.ts */
-
-import {
-    ActionRowBuilder,
-    type AttachmentPayload,
-    ButtonBuilder,
-    ButtonStyle,
-    FileBuilder,
-    MediaGalleryBuilder,
-    MediaGalleryItemBuilder,
-    MessageReferenceType,
-    TextDisplayBuilder,
-    type Message,
-    type MessageActionRowComponentBuilder,
-} from "discord.js";
-
-type TopLevelComponent =
-    | TextDisplayBuilder
-    | ActionRowBuilder<MessageActionRowComponentBuilder>
-    | MediaGalleryBuilder
-    | FileBuilder;
-
-export interface Layout {
-    components: TopLevelComponent[];
-    files: AttachmentPayload[];
-}
-
-// Webhooks can't truly reply, so link back with a button instead
-async function replyButton(message: Message): Promise<ButtonBuilder | null> {
-    if (message.reference?.type !== MessageReferenceType.Default) return null;
-
-    const original = await message.fetchReference().catch(() => null);
-    if (!original) return null;
-
-    const name = original.member?.displayName ?? original.author.displayName;
-
-    return new ButtonBuilder()
-        .setStyle(ButtonStyle.Link)
-        .setLabel(`↪ ${name}`.slice(0, 80))
-        .setURL(original.url);
-}
-
-// Components v2 only shows attachments that a component points at.
-// Classic: the text goes in content and files show as plain attachments
-export async function buildLayout(
-    message: Message,
-    content: string,
-    classic: boolean,
-): Promise<Layout> {
-    const components: TopLevelComponent[] = [];
-    const files: AttachmentPayload[] = [];
-    const button = await replyButton(message);
-
-    if (content && !classic) {
-        components.push(new TextDisplayBuilder().setContent(content));
-    }
-
-    // Own row under the text; a Section accessory sits beside it and looks wrong
-    if (button) {
-        components.push(
-            new ActionRowBuilder<MessageActionRowComponentBuilder>()
-                .addComponents(button),
-        );
-    }
-
-    const gallery = new MediaGalleryBuilder();
-    const otherFiles: FileBuilder[] = [];
-
-    for (const [index, attachment] of [...message.attachments.values()].entries()) {
-        // attachment:// must match Discord's sanitised filename exactly
-        const name = `${index}-${attachment.name.replace(/[^\w.-]/g, "_")}`;
-        const type = attachment.contentType ?? "";
-
-        // Classic attachments carry the spoiler in the filename instead
-        files.push({
-            attachment: attachment.url,
-            name: classic && attachment.spoiler ? `SPOILER_${name}` : name,
-        });
-
-        if (classic) continue;
-
-        if (type.startsWith("image/") || type.startsWith("video/")) {
-            gallery.addItems(
-                new MediaGalleryItemBuilder()
-                    .setURL(`attachment://${name}`)
-                    .setSpoiler(attachment.spoiler),
-            );
-        } else {
-            otherFiles.push(
-                new FileBuilder()
-                    .setURL(`attachment://${name}`)
-                    .setSpoiler(attachment.spoiler),
-            );
-        }
-    }
-
-    if (gallery.items.length > 0) components.push(gallery);
-    components.push(...otherFiles);
-
-    return {
-        components,
-        files,
-    };
-}
diff --git a/src/discord/linkPreview.ts b/src/discord/linkPreview.ts
deleted file mode 100644
index c8132df..0000000
--- a/src/discord/linkPreview.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-/* src/discord/linkPreview.ts */
-
-// Normal webhook messages cap content at 2000; Text Display allows 4000
-const classicContentLimit = 2000;
-
-// <https://...> is Discord's own way to hide a preview, so it doesn't count
-const previewableLink = /(^|[^<])https?:\/\/\S/;
-
-// Components v2 messages never get link previews, so links go out as normal messages
-export function wantsLinkPreview(content: string): boolean {
-    return content.length <= classicContentLimit && previewableLink.test(content);
-}
diff --git a/src/discord/ownership.ts b/src/discord/ownership.ts
deleted file mode 100644
index ce44ab9..0000000
--- a/src/discord/ownership.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-/* src/discord/ownership.ts */
-
-import type { Message, PartialMessage } from "discord.js";
-
-import { client } from "./client.ts";
-
-// Webhooks the bot created stamp its application id on every message they send
-export function isProxied(message: Message | PartialMessage): boolean {
-    return Boolean(message.webhookId)
-        && message.applicationId !== null
-        && message.applicationId === client.application?.id;
-}
diff --git a/src/discord/proxyMessage.ts b/src/discord/proxyMessage.ts
deleted file mode 100644
index 4f4fa60..0000000
--- a/src/discord/proxyMessage.ts
+++ /dev/null
@@ -1,65 +0,0 @@
-/* src/discord/proxyMessage.ts */
-
-import { MessageFlags, type Message } from "discord.js";
-
-import { runCommand } from "../commands/index.ts";
-import { ownerUserId } from "../config/env.ts";
-import { pickProxy } from "../proxy/autoproxy.ts";
-import { webhookName } from "../proxy/names.ts";
-import { guildSettings } from "../state/settings.ts";
-import { system } from "../state/system.ts";
-import { avatarFor } from "./avatar.ts";
-import { buildLayout } from "./layout.ts";
-import { wantsLinkPreview } from "./linkPreview.ts";
-import { rememberSenders } from "./senders.ts";
-import { getWebhook } from "./webhooks.ts";
-
-export async function proxyMessage(message: Message): Promise<void> {
-    if (message.author.id !== ownerUserId) return;
-    if (message.webhookId || !message.inGuild()) return;
-
-    // Commands never get proxied
-    if (await runCommand(message)) return;
-
-    const started = performance.now();
-    const fronters = guildSettings(message.guildId).autoproxy.enabled ? system.fronters : [];
-    const match = pickProxy(system.members, fronters, message.content);
-    if (!match) return;
-    if (!match.content && message.attachments.size === 0) return;
-
-    const webhook = await getWebhook(message);
-    if (!webhook) return;
-
-    const classic = wantsLinkPreview(match.content);
-
-    // Reply lookup and avatar merge don't depend on each other
-    const [layout, avatarURL] = await Promise.all([
-        buildLayout(message, match.content, classic),
-        avatarFor(webhook, match.members),
-    ]);
-
-    const sendStarted = performance.now();
-    const sent = await webhook.send({
-        flags: classic ? undefined : MessageFlags.IsComponentsV2,
-        content: classic ? match.content : undefined,
-        components: layout.components,
-        files: layout.files,
-        username: webhookName(match.members, system.tag),
-        avatarURL,
-        threadId: message.channel.isThread() ? message.channel.id : undefined,
-        // shortcut: only user pings pass through, add role checks if you need @role or @everyone
-        allowedMentions: {
-            parse: ["users"],
-        },
-    });
-
-    const sendMs = Math.round(performance.now() - sendStarted);
-    rememberSenders(sent.id, match.members);
-
-    // Delete only after the proxied copy is sent, so nothing is lost
-    await message.delete();
-
-    // Shows where the time goes: Discord's round trips, or our own work
-    const totalMs = Math.round(performance.now() - started);
-    console.log(`Proxied in ${totalMs}ms (send ${sendMs}ms)`);
-}
diff --git a/src/discord/reactions.ts b/src/discord/reactions.ts
deleted file mode 100644
index e14d739..0000000
--- a/src/discord/reactions.ts
+++ /dev/null
@@ -1,64 +0,0 @@
-/* src/discord/reactions.ts */
-
-import {
-    type APIMessageTopLevelComponent,
-    MessageFlags,
-    type MessageReaction,
-    type PartialMessageReaction,
-    type PartialUser,
-    type User,
-} from "discord.js";
-
-import { ownerUserId } from "../config/env.ts";
-import { system } from "../state/system.ts";
-import { buildInfoCard } from "./infoCard.ts";
-import { isProxied } from "./ownership.ts";
-import { sendersOf } from "./senders.ts";
-
-const deleteEmoji = "❌";
-const infoEmoji = "❓";
-
-export async function handleReaction(
-    partialReaction: MessageReaction | PartialMessageReaction,
-    partialUser: User | PartialUser,
-): Promise<void> {
-    const emoji = partialReaction.emoji.name;
-    if (emoji !== deleteEmoji && emoji !== infoEmoji) return;
-
-    // Reactions on messages from before startup arrive as partials
-    const reaction = partialReaction.partial
-        ? await partialReaction.fetch()
-        : partialReaction;
-    const user = partialUser.partial ? await partialUser.fetch() : partialUser;
-    const message = reaction.message.partial
-        ? await reaction.message.fetch()
-        : reaction.message;
-
-    if (user.bot || !isProxied(message)) return;
-
-    if (emoji === deleteEmoji) {
-        // Only the system can delete its own messages
-        if (user.id === ownerUserId) await message.delete();
-        return;
-    }
-
-    const components = buildInfoCard({
-        members: sendersOf(message.id),
-        username: message.author.username,
-        avatarUrl: message.author.displayAvatarURL(),
-        messageUrl: message.url,
-        ownerId: ownerUserId,
-        systemName: system.name,
-    });
-
-    // DMs can be closed; the info just doesn't arrive then
-    await user.send({
-        flags: MessageFlags.IsComponentsV2,
-        components: components as APIMessageTopLevelComponent[],
-    }).catch((error) => {
-        // Closed DMs are expected; anything else means the card itself is wrong
-        if (error?.code !== 50007) console.error("Info DM failed:", error);
-    });
-
-    await reaction.users.remove(user.id).catch(() => {});
-}
diff --git a/src/discord/replyCard.ts b/src/discord/replyCard.ts
deleted file mode 100644
index 803a04e..0000000
--- a/src/discord/replyCard.ts
+++ /dev/null
@@ -1,57 +0,0 @@
-/* src/discord/replyCard.ts */
-
-import { ComponentType } from "./editComponents.ts";
-import {
-    accentColour,
-    type ComponentJson,
-    header,
-    linkButton,
-    shorten,
-} from "./infoCard.ts";
-
-export interface ReplyCardInput {
-    replierName: string;
-    replierAvatarUrl: string;
-    proxiedName: string;
-    content: string;
-    hasAttachments: boolean;
-    replyUrl: string;
-}
-
-// Quote every line so a multi-line reply stays inside the quote
-function quote(text: string): string {
-    return text.split("\n").map((line) => `> ${line}`).join("\n");
-}
-
-export function buildReplyCard(input: ReplyCardInput): ComponentJson[] {
-    const body = input.content
-        ? quote(shorten(input.content))
-        : "*Sent an attachment*";
-
-    return [
-        {
-            type: ComponentType.Container,
-            accent_color: accentColour,
-            components: [
-                header(
-                    `### ↪ ${input.replierName} replied to ${input.proxiedName}\n${body}`,
-                    input.replierAvatarUrl,
-                ),
-                {
-                    type: ComponentType.ActionRow,
-                    components: [
-                        linkButton("Jump to reply", input.replyUrl),
-                    ],
-                },
-            ],
-        },
-        ...(input.content && input.hasAttachments
-            ? [
-                {
-                    type: ComponentType.TextDisplay,
-                    content: "-# Also sent an attachment",
-                },
-            ]
-            : []),
-    ];
-}
diff --git a/src/discord/replyNotice.ts b/src/discord/replyNotice.ts
deleted file mode 100644
index 43e7350..0000000
--- a/src/discord/replyNotice.ts
+++ /dev/null
@@ -1,42 +0,0 @@
-/* src/discord/replyNotice.ts */
-
-import {
-    type APIMessageTopLevelComponent,
-    type Message,
-    MessageFlags,
-    MessageReferenceType,
-} from "discord.js";
-
-import { ownerUserId } from "../config/env.ts";
-import { isActive } from "../state/activity.ts";
-import { client } from "./client.ts";
-import { isProxied } from "./ownership.ts";
-import { buildReplyCard } from "./replyCard.ts";
-
-// Webhooks aren't accounts, so Discord never pings anyone for replies to them
-export async function notifyReply(message: Message): Promise<void> {
-    if (!message.inGuild() || message.webhookId || message.author.bot) return;
-    if (message.author.id === ownerUserId) return;
-    if (message.reference?.type !== MessageReferenceType.Default) return;
-
-    // They're already in this channel and will see it
-    if (isActive(message.channelId)) return;
-
-    const target = await message.fetchReference().catch(() => null);
-    if (!target || !isProxied(target)) return;
-
-    const owner = await client.users.fetch(ownerUserId);
-    const components = buildReplyCard({
-        replierName: message.member?.displayName ?? message.author.displayName,
-        replierAvatarUrl: message.author.displayAvatarURL(),
-        proxiedName: target.author.username,
-        content: message.content,
-        hasAttachments: message.attachments.size > 0,
-        replyUrl: message.url,
-    });
-
-    await owner.send({
-        flags: MessageFlags.IsComponentsV2,
-        components: components as APIMessageTopLevelComponent[],
-    });
-}
diff --git a/src/discord/reproxyMessage.ts b/src/discord/reproxyMessage.ts
deleted file mode 100644
index 8752aec..0000000
--- a/src/discord/reproxyMessage.ts
+++ /dev/null
@@ -1,61 +0,0 @@
-/* src/discord/reproxyMessage.ts */
-
-import {
-    type APIMessageTopLevelComponent,
-    MessageFlags,
-    type Message,
-} from "discord.js";
-
-import { webhookName } from "../proxy/names.ts";
-import type { Member } from "../proxy/types.ts";
-import { system } from "../state/system.ts";
-import { avatarFor } from "./avatar.ts";
-import { keepMedia } from "./editComponents.ts";
-import { findTarget, searchDepth } from "./editMessage.ts";
-import { rememberSenders } from "./senders.ts";
-import { getWebhook } from "./webhooks.ts";
-
-// Webhooks can't rename a sent message, so it is sent again and the old one removed.
-// Returns an error to show, or null when it went through
-export async function reproxyProxied(
-    command: Message,
-    members: Member[],
-): Promise<string | null> {
-    const target = await findTarget(command);
-    if (!target?.webhookId) {
-        return `No proxied message found. Reply to one, or send one in the last ${searchDepth} messages.`;
-    }
-
-    const webhook = await getWebhook(command);
-    if (!webhook) return "Can't use webhooks in this channel.";
-
-    const classic = !target.flags.has(MessageFlags.IsComponentsV2);
-    const attachmentNames = target.attachments.map((attachment) => attachment.name);
-
-    const sent = await webhook.send({
-        flags: classic ? undefined : MessageFlags.IsComponentsV2,
-        content: classic ? target.content : undefined,
-        components: classic
-            ? undefined
-            : keepMedia(
-                target.components.map((component) => component.toJSON()),
-                attachmentNames,
-            ) as APIMessageTopLevelComponent[],
-        files: target.attachments.map((attachment) => ({
-            attachment: attachment.url,
-            name: attachment.name,
-        })),
-        username: webhookName(members, system.tag),
-        avatarURL: await avatarFor(webhook, members),
-        threadId: command.channel.isThread() ? command.channel.id : undefined,
-        allowedMentions: {
-            parse: ["users"],
-        },
-    });
-
-    rememberSenders(sent.id, members);
-
-    // Delete only after the new copy is sent, so nothing is lost
-    await target.delete();
-    return null;
-}
diff --git a/src/discord/senders.ts b/src/discord/senders.ts
deleted file mode 100644
index f9936db..0000000
--- a/src/discord/senders.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-/* src/discord/senders.ts */
-
-import type { Member } from "../proxy/types.ts";
-
-// Keeps memory flat; older messages fall back to the webhook name
-const maxRemembered = 1000;
-
-// shortcut: in memory only, so ❓ on messages from before a restart shows just the name
-const senders = new Map<string, Member[]>();
-
-export function rememberSenders(messageId: string, members: Member[]): void {
-    senders.set(messageId, members);
-
-    if (senders.size > maxRemembered) {
-        senders.delete(senders.keys().next().value!);
-    }
-}
-
-export function sendersOf(messageId: string): Member[] | undefined {
-    return senders.get(messageId);
-}
diff --git a/src/discord/status.ts b/src/discord/status.ts
deleted file mode 100644
index d24aad3..0000000
--- a/src/discord/status.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-/* src/discord/status.ts */
-
-import { ActivityType } from "discord.js";
-
-import { frontingStatus } from "../proxy/names.ts";
-import { system } from "../state/system.ts";
-import { client } from "./client.ts";
-
-// Safe to call before login; the ready handler calls it again
-export function updateStatus(): void {
-    if (!client.isReady()) return;
-
-    client.user.setPresence({
-        activities: [
-            {
-                name: "Custom Status",
-                type: ActivityType.Custom,
-                state: frontingStatus(system.fronters),
-            },
-        ],
-    });
-}
diff --git a/src/discord/webhooks.ts b/src/discord/webhooks.ts
deleted file mode 100644
index 5278935..0000000
--- a/src/discord/webhooks.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-/* src/discord/webhooks.ts */
-
-import type { Message, Webhook } from "discord.js";
-
-import { webhookDefaultName } from "../config/constants.ts";
-import { client } from "./client.ts";
-
-const webhooks = new Map<string, Webhook>();
-
-// Threads can't own webhooks, so they borrow the parent channel's
-export async function getWebhook(message: Message): Promise<Webhook | null> {
-    const channel = message.channel.isThread()
-        ? message.channel.parent
-        : message.channel;
-
-    if (!channel || !("fetchWebhooks" in channel)) return null;
-
-    const cached = webhooks.get(channel.id);
-    if (cached) return cached;
-
-    const existing = await channel.fetchWebhooks();
-    const webhook = existing.find(
-        (hook) => hook.owner?.id === client.user?.id,
-    ) ?? await channel.createWebhook({
-        name: webhookDefaultName,
-    });
-
-    webhooks.set(channel.id, webhook);
-    return webhook;
-}
diff --git a/src/explain.txt b/src/explain.txt
new file mode 100644
index 0000000..36b7836
--- /dev/null
+++ b/src/explain.txt
@@ -0,0 +1,11 @@
+This bot is created by, and for <@OWNER>, for faer plural system.
+
+> How does it work?
+The bot detects messages enclosed in specific tags associated with a profile, then replaces that message under a "pseudo-account" of that profile using Discord webhooks.
+Due to Discord limitations, these messages will show up with the [APP] or [BOT] tag.
+
+> What is Plurality?
+Plurality is the state of more than 1 person or entity in a single body. You can find out more [here](<https://morethanone.info>)
+
+> Is this the same as PluralKit?
+Yes! However, the maker dislikes PluralKit, due to previous experiences with the team. This bot was made as a replacement, using the Doughmination System API
diff --git a/src/help.txt b/src/help.txt
new file mode 100644
index 0000000..ead1329
--- /dev/null
+++ b/src/help.txt
@@ -0,0 +1,8 @@
+`d$edit <text>` edits the message you reply to, or your latest proxied message. `d$e` works too.
+`d$explain` explains the bot, and plurality. `d$ex` works too,
+`d$autoproxy` shows the state for this server, `d$autoproxy on|off` sets it. Add `-g` for every server, like `d$autoproxy -g off`. `d$ap` works too.
+`d$reproxy <member>` resends the message you reply to, or your latest proxied message, as someone else, like `d$reproxy c1`. `d$rp` works too.
+`d$switch <member>` sets who's fronting on the site, like `d$switch c1 c2`. `d$switch out` clears it. `d$sw` works too.
+`d$member <member>` shows a member's card, like `d$member aether`. `d$m` works too.
+`d$ping` shows how fast Discord and the system API respond.
+-# React ❌ to delete a proxied message, ❓ to see who sent it.
diff --git a/src/images/merge.ts b/src/images/merge.ts
deleted file mode 100644
index c6244bd..0000000
--- a/src/images/merge.ts
+++ /dev/null
@@ -1,44 +0,0 @@
-/* src/images/merge.ts */
-
-import { Image } from "imagescript";
-
-import { mergedAvatarSize } from "../config/constants.ts";
-import type { Member } from "../proxy/types.ts";
-
-export function avatarOf(member: Member): string | null {
-    return member.webhook_avatar_url ?? member.avatar_url;
-}
-
-// One vertical strip per member, left to right in front order
-export async function mergeAvatars(members: Member[]): Promise<Uint8Array | null> {
-    const size = mergedAvatarSize;
-    const urls = members
-        .map(avatarOf)
-        .filter((url): url is string => url !== null);
-
-    if (urls.length === 0) return null;
-
-    const stripWidth = Math.floor(size / urls.length);
-    const canvas = new Image(size, size);
-
-    // Download all at once; the strips are still placed in front order
-    const images = await Promise.all(urls.map(async (url) => {
-        const response = await fetch(url);
-        if (!response.ok) throw new Error(`Avatar ${url}: HTTP ${response.status}`);
-
-        return await Image.decode(new Uint8Array(await response.arrayBuffer()));
-    }));
-
-    for (const [index, decoded] of images.entries()) {
-        if (!(decoded instanceof Image)) continue;
-
-        // Last strip takes the rounding remainder so there's no gap on the right
-        const width = index === images.length - 1
-            ? size - stripWidth * index
-            : stripWidth;
-
-        canvas.composite(decoded.cover(width, size), stripWidth * index, 0);
-    }
-
-    return await canvas.encode();
-}
diff --git a/src/main.rs b/src/main.rs
new file mode 100644
index 0000000..e0bb6a5
--- /dev/null
+++ b/src/main.rs
@@ -0,0 +1,292 @@
+// src/main.rs
+
+mod avatars;
+mod cards;
+mod commands;
+mod discord;
+mod proxy;
+mod settings;
+mod site;
+
+#[cfg(test)]
+mod tests;
+
+use std::collections::{HashMap, VecDeque};
+use std::sync::Arc;
+use std::sync::atomic::{AtomicBool, Ordering};
+use std::time::{Duration, Instant};
+
+use anyhow::Context as _;
+use serenity::all::*;
+use tokio::sync::{Mutex, OnceCell, RwLock};
+
+use avatars::Avatars;
+use proxy::Member;
+use settings::Settings;
+use site::System;
+
+type WebhookCache = HashMap<ChannelId, Arc<Mutex<Option<Webhook>>>>;
+
+struct Bot {
+    owner: UserId,
+    site_token: Option<String>,
+    web: reqwest::Client,
+    system: RwLock<System>,
+    settings: Mutex<Settings>,
+    webhooks: Mutex<WebhookCache>,
+    avatars: Arc<Avatars>,
+    activity: Mutex<HashMap<ChannelId, Instant>>,
+    senders: Mutex<VecDeque<(MessageId, Vec<Member>)>>,
+    shards: OnceCell<Arc<ShardManager>>,
+    started: AtomicBool,
+}
+
+impl Bot {
+    async fn remember(&self, message: MessageId, members: Vec<Member>) {
+        let mut senders = self.senders.lock().await;
+        if senders.len() == 1000 {
+            senders.pop_front();
+        }
+        senders.push_back((message, members));
+    }
+
+    async fn mark_active(&self, channel: ChannelId) {
+        self.activity.lock().await.insert(channel, Instant::now());
+    }
+
+    async fn update_settings(&self, change: impl FnOnce(&mut Settings)) -> anyhow::Result<()> {
+        let mut settings = self.settings.lock().await;
+        let mut updated = settings.clone();
+        change(&mut updated);
+        if updated.guilds != settings.guilds {
+            updated.save()?;
+            *settings = updated;
+        }
+        Ok(())
+    }
+
+    async fn on_message(&self, ctx: &Context, message: &Message) -> anyhow::Result<()> {
+        let Some(guild) = message.guild_id else {
+            return Ok(());
+        };
+        if message.webhook_id.is_some() || message.author.bot {
+            return Ok(());
+        }
+        if message.author.id == self.owner {
+            self.mark_active(message.channel_id).await;
+            if !self.command(ctx, message, guild).await? {
+                self.proxy_message(ctx, message, guild).await?;
+            }
+        } else {
+            let active = self
+                .activity
+                .lock()
+                .await
+                .get(&message.channel_id)
+                .is_some_and(|seen| seen.elapsed() < Duration::from_secs(300));
+            if !active
+                && let Some(target) = discord::reference(ctx, message).await
+                && discord::owned(ctx, &target)
+            {
+                discord::dm(ctx, self.owner, cards::reply(message, &target)).await?;
+            }
+        }
+        Ok(())
+    }
+
+    async fn on_reaction(
+        &self,
+        ctx: &Context,
+        reaction: &Reaction,
+        user: UserId,
+    ) -> anyhow::Result<()> {
+        let ReactionType::Unicode(emoji) = &reaction.emoji else {
+            return Ok(());
+        };
+        if !matches!(emoji.as_str(), "❌" | "❓") || (emoji == "❌" && user != self.owner) {
+            return Ok(());
+        }
+        let bot = match &reaction.member {
+            Some(member) => member.user.bot,
+            None => user.to_user(ctx).await?.bot,
+        };
+        if bot {
+            return Ok(());
+        }
+
+        let message = reaction
+            .channel_id
+            .message(&ctx.http, reaction.message_id)
+            .await?;
+        if !discord::owned(ctx, &message) {
+            return Ok(());
+        }
+        if emoji == "❌" {
+            message.delete(&ctx.http).await?;
+            return Ok(());
+        }
+
+        let members = self
+            .senders
+            .lock()
+            .await
+            .iter()
+            .rev()
+            .find(|(id, _)| *id == message.id)
+            .map(|(_, members)| members.clone());
+        let system_name = self.system.read().await.info.name.clone();
+        let result = discord::dm(
+            ctx,
+            user,
+            cards::info(
+                &message,
+                members.as_deref(),
+                self.owner,
+                system_name.as_deref(),
+            ),
+        )
+        .await;
+
+        let _ = ctx
+            .http
+            .delete_reaction(reaction.channel_id, message.id, user, &reaction.emoji)
+            .await;
+        if let Err(error) = result
+            && !matches!(error.downcast_ref::<serenity::Error>(), Some(serenity::Error::Http(HttpError::UnsuccessfulRequest(response))) if response.error.code == 50007)
+        {
+            return Err(error);
+        }
+        Ok(())
+    }
+}
+
+struct Handler(Arc<Bot>);
+
+#[serenity::async_trait]
+impl EventHandler for Handler {
+    async fn ready(&self, ctx: Context, ready: Ready) {
+        ctx.http.set_application_id(ready.application.id);
+        ctx.set_activity(Some(ActivityData::custom(proxy::fronting_status(
+            &self.0.system.read().await.fronters,
+        ))));
+        println!("Logged in as {}", ready.user.name);
+
+        let ids: std::collections::HashSet<_> = ready.guilds.iter().map(|guild| guild.id).collect();
+        if let Err(error) = self
+            .0
+            .update_settings(|settings| {
+                settings.guilds.retain(|guild, _| ids.contains(guild));
+                for guild in ids {
+                    settings.guilds.entry(guild).or_default();
+                }
+            })
+            .await
+        {
+            eprintln!("Guild sync failed: {error}");
+        }
+
+        if !self.0.started.swap(true, Ordering::Relaxed) {
+            tokio::spawn(self.0.clone().poll(ctx.clone()));
+            tokio::spawn(self.0.clone().live(ctx));
+        }
+    }
+
+    async fn guild_create(&self, _ctx: Context, guild: Guild, _is_new: Option<bool>) {
+        if let Err(error) = self
+            .0
+            .update_settings(|settings| {
+                settings.guilds.entry(guild.id).or_default();
+            })
+            .await
+        {
+            eprintln!("Guild add failed: {error}");
+        }
+    }
+
+    async fn guild_delete(&self, _ctx: Context, guild: UnavailableGuild, _full: Option<Guild>) {
+        if !guild.unavailable
+            && let Err(error) = self
+                .0
+                .update_settings(|settings| {
+                    settings.guilds.remove(&guild.id);
+                })
+                .await
+        {
+            eprintln!("Guild remove failed: {error}");
+        }
+    }
+
+    async fn message(&self, ctx: Context, message: Message) {
+        if let Err(error) = self.0.on_message(&ctx, &message).await {
+            eprintln!("Message handling failed: {error}");
+        }
+    }
+
+    async fn reaction_add(&self, ctx: Context, reaction: Reaction) {
+        if let Some(user) = reaction.user_id {
+            if user == self.0.owner {
+                self.0.mark_active(reaction.channel_id).await;
+            }
+            if let Err(error) = self.0.on_reaction(&ctx, &reaction, user).await {
+                eprintln!("Reaction handling failed: {error}");
+            }
+        }
+    }
+
+    async fn typing_start(&self, _ctx: Context, event: TypingStartEvent) {
+        if event.user_id == self.0.owner {
+            self.0.mark_active(event.channel_id).await;
+        }
+    }
+}
+
+#[tokio::main]
+async fn main() -> anyhow::Result<()> {
+    match dotenvy::from_path(".env") {
+        Ok(()) => {}
+        Err(dotenvy::Error::Io(error)) if error.kind() == std::io::ErrorKind::NotFound => {}
+        Err(error) => return Err(error).context("could not load .env"),
+    }
+    let token = std::env::var("DISCORD_TOKEN").context("DISCORD_TOKEN is required")?;
+    anyhow::ensure!(!token.is_empty(), "DISCORD_TOKEN is required");
+    let owner = std::env::var("OWNER_ID")
+        .context("OWNER_ID is required")?
+        .parse::<UserId>()
+        .context("OWNER_ID must be a Discord user ID")?;
+    let settings = Settings::load(Settings::PATH).context("could not load data/settings.jp")?;
+
+    let bot = Arc::new(Bot {
+        owner,
+        site_token: std::env::var("SITE_TOKEN")
+            .ok()
+            .filter(|token| !token.is_empty()),
+        web: reqwest::Client::builder()
+            .timeout(Duration::from_secs(15))
+            .build()?,
+        system: RwLock::default(),
+        settings: Mutex::new(settings),
+        webhooks: Mutex::default(),
+        avatars: Arc::default(),
+        activity: Mutex::default(),
+        senders: Mutex::default(),
+        shards: OnceCell::new(),
+        started: AtomicBool::new(false),
+    });
+    bot.initial_refresh().await;
+
+    let intents = GatewayIntents::GUILDS
+        | GatewayIntents::GUILD_MESSAGES
+        | GatewayIntents::MESSAGE_CONTENT
+        | GatewayIntents::GUILD_MESSAGE_REACTIONS
+        | GatewayIntents::GUILD_MESSAGE_TYPING;
+    let mut cache = serenity::cache::Settings::default();
+    cache.max_messages = 200;
+    let mut client = Client::builder(token, intents)
+        .event_handler(Handler(bot.clone()))
+        .cache_settings(cache)
+        .await?;
+    // Set before the first gateway event can be processed.
+    let _ = bot.shards.set(client.shard_manager.clone());
+    client.start().await?;
+    Ok(())
+}
diff --git a/src/main.ts b/src/main.ts
deleted file mode 100644
index 87c35fe..0000000
--- a/src/main.ts
+++ /dev/null
@@ -1,81 +0,0 @@
-/* src/main.ts */
-
-import { Events } from "discord.js";
-
-import { fetchFronters } from "./api/fronters.ts";
-import { refreshMembers } from "./api/members.ts";
-import { refreshSystem } from "./api/system.ts";
-import { connectLive } from "./api/live.ts";
-import { memberRefreshMs } from "./config/constants.ts";
-import { discordToken, ownerUserId } from "./config/env.ts";
-import { client } from "./discord/client.ts";
-import { proxyMessage } from "./discord/proxyMessage.ts";
-import { handleReaction } from "./discord/reactions.ts";
-import { notifyReply } from "./discord/replyNotice.ts";
-import { updateStatus } from "./discord/status.ts";
-import { markActive } from "./state/activity.ts";
-import {
-    addGuild,
-    loadSettings,
-    removeGuild,
-    syncGuilds,
-} from "./state/settings.ts";
-
-client.once(Events.ClientReady, (ready) => {
-    console.log(`Logged in as ${ready.user.tag}`);
-    updateStatus();
-
-    syncGuilds(ready.guilds.cache.keys()).catch((error) => {
-        console.error("Guild sync failed:", error);
-    });
-});
-
-client.on(Events.GuildCreate, (guild) => {
-    addGuild(guild.id).catch((error) => {
-        console.error("Guild add failed:", error);
-    });
-});
-
-client.on(Events.GuildDelete, (guild) => {
-    // An outage also fires this; only a real leave or kick drops the settings
-    if (!guild.available) return;
-
-    removeGuild(guild.id).catch((error) => {
-        console.error("Guild remove failed:", error);
-    });
-});
-
-client.on(Events.MessageCreate, (message) => {
-    if (message.author.id === ownerUserId) markActive(message.channelId);
-
-    proxyMessage(message).catch((error) => {
-        console.error("Proxy failed:", error);
-    });
-
-    notifyReply(message).catch((error) => {
-        console.error("Reply notice failed:", error);
-    });
-});
-
-client.on(Events.MessageReactionAdd, (reaction, user) => {
-    if (user.id === ownerUserId) markActive(reaction.message.channelId);
-
-    handleReaction(reaction, user).catch((error) => {
-        console.error("Reaction failed:", error);
-    });
-});
-
-client.on(Events.TypingStart, (typing) => {
-    if (typing.user.id === ownerUserId) markActive(typing.channel.id);
-});
-
-await loadSettings();
-await refreshSystem();
-await refreshMembers();
-setInterval(refreshSystem, memberRefreshMs);
-setInterval(refreshMembers, memberRefreshMs);
-
-// The site doesn't retry failed broadcasts, so a slow poll catches anything missed
-setInterval(fetchFronters, memberRefreshMs);
-connectLive();
-await client.login(discordToken);
diff --git a/src/proxy.rs b/src/proxy.rs
new file mode 100644
index 0000000..9b5c72d
--- /dev/null
+++ b/src/proxy.rs
@@ -0,0 +1,181 @@
+// src/proxy.rs
+
+use regex::Regex;
+use serde::Deserialize;
+use std::sync::LazyLock;
+
+#[derive(Clone, Debug, Default, Deserialize)]
+pub struct Member {
+    pub id: String,
+    pub name: String,
+    pub display_name: Option<String>,
+    pub pronouns: Option<String>,
+    pub color: Option<String>,
+    pub description: Option<String>,
+    #[serde(default)]
+    pub tags: Vec<String>,
+    #[serde(default)]
+    pub pride: Vec<String>,
+    pub status: Option<MemberStatus>,
+    pub avatar_url: Option<String>,
+    pub webhook_avatar_url: Option<String>,
+    #[serde(default)]
+    pub proxy_tags: Vec<ProxyTag>,
+    #[serde(default)]
+    pub keep_proxy: bool,
+    pub autoproxy_enabled: Option<bool>,
+}
+
+#[derive(Clone, Debug, Deserialize)]
+pub struct MemberStatus {
+    pub text: String,
+    pub emoji: Option<String>,
+}
+
+#[derive(Clone, Debug, Deserialize)]
+pub struct ProxyTag {
+    pub prefix: Option<String>,
+    pub suffix: Option<String>,
+}
+
+impl Member {
+    pub fn display_name(&self) -> &str {
+        self.display_name.as_deref().unwrap_or(&self.name)
+    }
+
+    pub fn webhook_avatar(&self) -> Option<&str> {
+        self.webhook_avatar_url
+            .as_deref()
+            .or(self.avatar_url.as_deref())
+    }
+}
+
+pub fn utf16_len(text: &str) -> usize {
+    text.encode_utf16().count()
+}
+
+pub fn truncate(text: &str, limit: usize) -> &str {
+    let mut remaining = limit;
+    for (index, character) in text.char_indices() {
+        let Some(next) = remaining.checked_sub(character.len_utf16()) else {
+            return &text[..index];
+        };
+        remaining = next;
+    }
+    text
+}
+
+fn tag_pattern(tag: &str) -> String {
+    static WHITESPACE: LazyLock<Regex> = LazyLock::new(|| Regex::new(r"[\s\u{feff}]+").unwrap());
+    WHITESPACE
+        .replace_all(&regex::escape(tag), r"[\s\u{feff}]+")
+        .into_owned()
+}
+
+pub fn pick<'a>(
+    members: &'a [Member],
+    fronters: &'a [Member],
+    content: &'a str,
+) -> Option<(Vec<&'a Member>, &'a str)> {
+    if content.starts_with('$') {
+        return None;
+    }
+
+    let mut best_length = 0;
+    let mut best = None;
+
+    for member in members {
+        for tag in &member.proxy_tags {
+            let prefix = tag.prefix.as_deref().unwrap_or_default();
+            let suffix = tag.suffix.as_deref().unwrap_or_default();
+            let length = utf16_len(prefix) + utf16_len(suffix);
+            if length <= best_length {
+                continue;
+            }
+
+            let pattern = format!(
+                r"(?is)\A{}(.*?){}\z",
+                tag_pattern(prefix),
+                tag_pattern(suffix),
+            );
+            let Ok(regex) = Regex::new(&pattern) else {
+                continue;
+            };
+            if let Some(captures) = regex.captures(content) {
+                let text = if member.keep_proxy {
+                    content
+                } else {
+                    captures.get(1).unwrap().as_str().trim()
+                };
+                best = Some((vec![member], text));
+                best_length = length;
+            }
+        }
+    }
+
+    if best.is_some() || content.starts_with('\\') {
+        return best;
+    }
+
+    let speaking: Vec<_> = fronters
+        .iter()
+        .filter(|member| member.autoproxy_enabled != Some(false))
+        .collect();
+    (!speaking.is_empty()).then_some((speaking, content))
+}
+
+pub const MAX_NAMED: usize = 3;
+
+pub fn webhook_name(members: &[&Member], tag: Option<&str>) -> String {
+    static DISCORD: LazyLock<Regex> = LazyLock::new(|| Regex::new("(?i)discord").unwrap());
+    let mut names: Vec<_> = members
+        .iter()
+        .take(MAX_NAMED)
+        .map(|member| member.display_name())
+        .collect();
+    let hidden = members.len().saturating_sub(MAX_NAMED);
+    let extra = format!("{hidden} more");
+    if hidden > 0 {
+        names.push(&extra);
+    }
+
+    let last = names.pop().unwrap_or_default();
+    let names = if names.is_empty() {
+        last.to_owned()
+    } else {
+        format!("{} & {last}", names.join(", "))
+    };
+    let suffix = tag
+        .filter(|tag| !tag.is_empty())
+        .map(|tag| format!(" ~ {tag}"))
+        .unwrap_or_default();
+    let names = truncate(&names, 80_usize.saturating_sub(utf16_len(&suffix)));
+    let name = DISCORD
+        .replace_all(&format!("{names}{suffix}"), "dïscord")
+        .into_owned();
+    truncate(&name, 80).to_owned()
+}
+
+pub fn fronting_status(fronters: &[Member]) -> String {
+    if fronters.is_empty() {
+        return "Nobody fronting".into();
+    }
+    let names = fronters
+        .iter()
+        .map(Member::display_name)
+        .collect::<Vec<_>>()
+        .join(", ");
+    truncate(&format!("Fronting: {names}"), 128).to_owned()
+}
+
+pub fn command(content: &str) -> Option<(String, Vec<String>, &str)> {
+    let prefix = content.get(..2)?;
+    if !prefix.eq_ignore_ascii_case("d$") {
+        return None;
+    }
+    let body = content[2..].trim_start();
+    let name = body.split_whitespace().next()?;
+    let rest = body[name.len()..].trim();
+    let args = rest.split_whitespace().map(str::to_lowercase).collect();
+    Some((name.to_lowercase(), args, rest))
+}
diff --git a/src/proxy/autoproxy.ts b/src/proxy/autoproxy.ts
deleted file mode 100644
index ce3376d..0000000
--- a/src/proxy/autoproxy.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-/* src/proxy/autoproxy.ts */
-
-import { noProxyPrefix } from "../commands/parse.ts";
-import { matchProxyTags } from "./tags.ts";
-import type { Member, ProxyMatch } from "./types.ts";
-
-// A leading "$" never proxies. Tags win; otherwise everyone fronting speaks together. A leading "\" skips that
-export function pickProxy(
-    members: Member[],
-    fronters: Member[],
-    content: string,
-): ProxyMatch | null {
-    if (content.startsWith(noProxyPrefix)) return null;
-
-    const tagged = matchProxyTags(members, content);
-    if (tagged) return tagged;
-    if (content.startsWith("\\")) return null;
-
-    const speaking = fronters.filter(
-        (member) => member.autoproxy_enabled !== false,
-    );
-    if (speaking.length === 0) return null;
-
-    return {
-        members: speaking,
-        content,
-    };
-}
diff --git a/src/proxy/names.ts b/src/proxy/names.ts
deleted file mode 100644
index 5e34bd1..0000000
--- a/src/proxy/names.ts
+++ /dev/null
@@ -1,63 +0,0 @@
-/* src/proxy/names.ts */
-
-import type { Member } from "./types.ts";
-
-// Past this many speakers, names collapse to "& N more"
-export const maxNamedSpeakers = 3;
-
-const webhookNameLimit = 80;
-
-function displayName(member: Member): string {
-    return member.display_name ?? member.name;
-}
-
-function speakerNames(members: Member[]): string {
-    const named = members.slice(0, maxNamedSpeakers).map(displayName);
-    const hidden = members.length - named.length;
-
-    if (hidden > 0) named.push(`${hidden} more`);
-
-    // "A", "A & B", "A, B & C", "A, B, C & 2 more"
-    const last = named.pop();
-    return named.length > 0 ? `${named.join(", ")} & ${last}` : last ?? "";
-}
-
-// Discord rejects webhook names over 80 chars or containing "discord"
-export function webhookName(members: Member[], tag: string | null): string {
-    const suffix = tag ? ` ~ ${tag}` : "";
-    const names = speakerNames(members).slice(0, webhookNameLimit - suffix.length);
-
-    return `${names}${suffix}`
-        .replace(/discord/gi, "dïscord")
-        .slice(0, webhookNameLimit);
-}
-
-// Matches the short name, like "c1", not the display name; case doesn't matter
-export function membersByName(
-    members: Member[],
-    names: string[],
-): { found: Member[]; missing: string[] } {
-    const found: Member[] = [];
-    const missing: string[] = [];
-
-    for (const name of names) {
-        const match = members.find(
-            (member) => member.name.toLowerCase() === name.toLowerCase(),
-        );
-
-        if (match) found.push(match);
-        else missing.push(name);
-    }
-
-    return {
-        found,
-        missing,
-    };
-}
-
-// Custom status text is capped at 128 chars
-export function frontingStatus(fronters: Member[]): string {
-    if (fronters.length === 0) return "Nobody fronting";
-
-    return `Fronting: ${fronters.map(displayName).join(", ")}`.slice(0, 128);
-}
diff --git a/src/proxy/tags.ts b/src/proxy/tags.ts
deleted file mode 100644
index d9e01f8..0000000
--- a/src/proxy/tags.ts
+++ /dev/null
@@ -1,45 +0,0 @@
-/* src/proxy/tags.ts */
-
-import type { Member, ProxyMatch } from "./types.ts";
-
-// Case is ignored, and any whitespace matches any whitespace, so "ae hi" and a non-breaking space still hit "Ae "
-function tagPattern(tag: string): string {
-    return tag
-        .replace(/[.*+?^${}()|[\]\\]/g, "\\$&")
-        .replace(/\s+/g, "\\s+");
-}
-
-// Longest tag wins, so "C1:" beats "C:"
-export function matchProxyTags(
-    members: Member[],
-    content: string,
-): ProxyMatch | null {
-    let best: ProxyMatch | null = null;
-    let bestLength = -1;
-
-    for (const member of members) {
-        for (const tag of member.proxy_tags) {
-            const prefix = tag.prefix ?? "";
-            const suffix = tag.suffix ?? "";
-            const tagLength = prefix.length + suffix.length;
-
-            if (tagLength === 0) continue;
-            if (tagLength <= bestLength) continue;
-
-            const found = new RegExp(
-                `^${tagPattern(prefix)}([\\s\\S]*?)${tagPattern(suffix)}$`,
-                "iu",
-            ).exec(content);
-
-            if (!found) continue;
-
-            best = {
-                members: [member],
-                content: member.keep_proxy ? content : found[1].trim(),
-            };
-            bestLength = tagLength;
-        }
-    }
-
-    return best;
-}
diff --git a/src/proxy/types.ts b/src/proxy/types.ts
deleted file mode 100644
index 8ed79db..0000000
--- a/src/proxy/types.ts
+++ /dev/null
@@ -1,33 +0,0 @@
-/* src/proxy/types.ts */
-
-export interface ProxyTag {
-    prefix: string | null;
-    suffix: string | null;
-}
-
-export interface MemberStatus {
-    text: string;
-    emoji: string | null;
-}
-
-export interface Member {
-    id: string;
-    name: string;
-    display_name: string | null;
-    pronouns: string | null;
-    color: string | null;
-    description: string | null;
-    tags?: string[];
-    pride?: string[];
-    status?: MemberStatus | null;
-    avatar_url: string | null;
-    webhook_avatar_url: string | null;
-    proxy_tags: ProxyTag[];
-    keep_proxy: boolean;
-    autoproxy_enabled: boolean | null;
-}
-
-export interface ProxyMatch {
-    members: Member[];
-    content: string;
-}
diff --git a/src/settings.rs b/src/settings.rs
new file mode 100644
index 0000000..0ca56bc
--- /dev/null
+++ b/src/settings.rs
@@ -0,0 +1,56 @@
+// src/settings.rs
+
+use std::collections::BTreeMap;
+use std::path::Path;
+
+use serenity::all::GuildId;
+
+#[derive(Clone, Default)]
+pub struct Settings {
+    pub guilds: BTreeMap<GuildId, bool>,
+}
+
+impl Settings {
+    pub const PATH: &str = "data/settings.jp";
+
+    pub fn load(path: impl AsRef<Path>) -> anyhow::Result<Self> {
+        let root = match jpcl::load(path, &jpcl::ParseOptions::default()) {
+            Ok(root) => root,
+            Err(jpcl::Error::Io { source, .. })
+                if source.kind() == std::io::ErrorKind::NotFound =>
+            {
+                return Ok(Self::default());
+            }
+            Err(error) => return Err(error.into()),
+        };
+
+        let guilds = root
+            .iter()
+            .filter_map(|(key, _)| {
+                let guild = key.parse::<u64>().ok().filter(|id| *id > 0)?;
+                let path = format!("{key}.autoproxy.enabled");
+                let enabled = jpcl::get_path(&root, &path) == Some(&jpcl::Value::Bool(true));
+                Some((GuildId::new(guild), enabled))
+            })
+            .collect();
+
+        Ok(Self { guilds })
+    }
+
+    pub fn save(&self) -> anyhow::Result<()> {
+        self.save_to(Self::PATH)
+    }
+
+    pub(crate) fn save_to(&self, path: impl AsRef<Path>) -> anyhow::Result<()> {
+        let mut root = jpcl::Object::new();
+        for (guild, enabled) in &self.guilds {
+            let mut autoproxy = jpcl::Object::new();
+            autoproxy.insert("enabled", jpcl::Value::Bool(*enabled));
+            let mut entry = jpcl::Object::new();
+            entry.insert("autoproxy", jpcl::Value::Object(autoproxy));
+            root.insert(guild.to_string(), jpcl::Value::Object(entry));
+        }
+        jpcl::dump(&root, path, &jpcl::StringifyOptions::default())?;
+        Ok(())
+    }
+}
diff --git a/src/site.rs b/src/site.rs
new file mode 100644
index 0000000..a730bfd
--- /dev/null
+++ b/src/site.rs
@@ -0,0 +1,196 @@
+// src/site.rs
+
+use std::sync::Arc;
+use std::time::Duration;
+
+use futures_util::{SinkExt, StreamExt};
+use serde::Deserialize;
+use serenity::all::{ActivityData, Context};
+use tokio_tungstenite::{connect_async, tungstenite::Message};
+
+use crate::{
+    Bot,
+    proxy::{Member, fronting_status},
+};
+
+pub const API: &str = "https://doughmination.co.uk/api/plural";
+pub const REFRESH: Duration = Duration::from_secs(300);
+
+#[derive(Default, Deserialize)]
+pub struct SystemInfo {
+    pub name: Option<String>,
+    pub tag: Option<String>,
+}
+
+#[derive(Default)]
+pub struct System {
+    pub info: SystemInfo,
+    pub members: Vec<Member>,
+    pub fronters: Vec<Member>,
+}
+
+#[derive(Deserialize)]
+struct Front {
+    members: Vec<Member>,
+}
+
+#[derive(Deserialize)]
+struct LiveEvent {
+    #[serde(rename = "type")]
+    kind: String,
+    data: Option<serde_json::Value>,
+}
+
+impl Bot {
+    async fn get<T: serde::de::DeserializeOwned>(&self, endpoint: &str) -> anyhow::Result<T> {
+        Ok(self
+            .web
+            .get(format!("{API}/{endpoint}"))
+            .send()
+            .await?
+            .error_for_status()?
+            .json()
+            .await?)
+    }
+
+    async fn refresh_members(&self) {
+        match self.get::<Vec<Member>>("members").await {
+            Ok(members) => {
+                println!("Loaded {} members", members.len());
+                self.system.write().await.members = members;
+            }
+            Err(error) => eprintln!("Member refresh failed: {error}"),
+        }
+    }
+
+    pub async fn refresh_info(&self) {
+        match self.get("system").await {
+            Ok(info) => self.system.write().await.info = info,
+            Err(error) => eprintln!("System refresh failed: {error}"),
+        }
+    }
+
+    async fn set_front(&self, ctx: &Context, front: Front) {
+        let status = fronting_status(&front.members);
+        let speakers: Vec<_> = front
+            .members
+            .iter()
+            .filter(|member| member.autoproxy_enabled != Some(false))
+            .cloned()
+            .collect();
+        self.system.write().await.fronters = front.members;
+        ctx.set_activity(Some(ActivityData::custom(status)));
+        if (2..=crate::proxy::MAX_NAMED).contains(&speakers.len()) {
+            let avatars = self.avatars.clone();
+            let web = self.web.clone();
+            tokio::spawn(async move {
+                let urls = crate::avatars::avatar_urls(&speakers);
+                if let Err(error) = avatars.png(&web, urls).await {
+                    eprintln!("Avatar premerge failed: {error}");
+                }
+            });
+        }
+    }
+
+    async fn refresh_front(&self, ctx: &Context) {
+        match self.get("fronters").await {
+            Ok(front) => self.set_front(ctx, front).await,
+            Err(error) => eprintln!("Fronting fetch failed: {error}"),
+        }
+    }
+
+    pub async fn initial_refresh(&self) {
+        tokio::join!(self.refresh_info(), self.refresh_members());
+    }
+
+    pub async fn poll(self: Arc<Self>, ctx: Context) {
+        let mut timer = tokio::time::interval(REFRESH);
+        timer.tick().await;
+        loop {
+            timer.tick().await;
+            tokio::join!(
+                self.refresh_info(),
+                self.refresh_members(),
+                self.refresh_front(&ctx)
+            );
+        }
+    }
+
+    pub async fn live(self: Arc<Self>, ctx: Context) {
+        loop {
+            if let Err(error) = self.live_session(&ctx).await {
+                eprintln!("Live socket closed: {error}");
+            }
+            tokio::time::sleep(Duration::from_secs(5)).await;
+        }
+    }
+
+    async fn live_session(&self, ctx: &Context) -> anyhow::Result<()> {
+        let (mut socket, _) = tokio::time::timeout(
+            Duration::from_secs(15),
+            connect_async("wss://doughmination.co.uk/api/plural/ws"),
+        )
+        .await??;
+        println!("Live socket open");
+        self.refresh_front(ctx).await;
+
+        let mut timer = tokio::time::interval(Duration::from_secs(30));
+        timer.tick().await;
+        let mut awaiting_pong = false;
+
+        loop {
+            tokio::select! {
+                _ = timer.tick() => {
+                    anyhow::ensure!(!awaiting_pong, "did not receive pong");
+                    socket.send(Message::Text("ping".into())).await?;
+                    awaiting_pong = true;
+                }
+                frame = socket.next() => {
+                    match frame.transpose()? {
+                        Some(Message::Text(text)) if text == "pong" => awaiting_pong = false,
+                        Some(Message::Text(text)) => {
+                            if let Ok(event) = serde_json::from_str::<LiveEvent>(&text) {
+                                match (event.kind.as_str(), event.data) {
+                                    ("fronters_update", Some(data)) => {
+                                        if let Ok(front) = serde_json::from_value(data) {
+                                            self.set_front(ctx, front).await;
+                                        }
+                                    }
+                                    ("members_update" | "force_refresh", _) => self.refresh_members().await,
+                                    _ => {}
+                                }
+                            }
+                        }
+                        Some(Message::Close(_)) | None => return Ok(()),
+                        _ => {}
+                    }
+                }
+            }
+        }
+    }
+
+    pub async fn switch_front(&self, ids: &[&str]) -> Result<(), String> {
+        let token = self
+            .site_token
+            .as_ref()
+            .ok_or("Switching isn't set up. Add `SITE_TOKEN` to the bot's `.env`.")?;
+        let response = self
+            .web
+            .post(format!("{API}/switch"))
+            .bearer_auth(token)
+            .json(&serde_json::json!({ "members": ids }))
+            .send()
+            .await
+            .map_err(|error| {
+                eprintln!("Switch failed: {error}");
+                "Couldn't reach the site to switch.".to_owned()
+            })?;
+        match response.status().as_u16() {
+            200..=299 => Ok(()),
+            401 => Err(
+                "The site rejected the bot's token. Check `SITE_TOKEN` matches `BOT_TOKEN`.".into(),
+            ),
+            status => Err(format!("The site couldn't switch (HTTP {status}).")),
+        }
+    }
+}
diff --git a/src/state/activity.ts b/src/state/activity.ts
deleted file mode 100644
index 9806db0..0000000
--- a/src/state/activity.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-/* src/state/activity.ts */
-
-// No sign of the owner in a channel for this long counts as away from it
-export const awayAfterMs = 5 * 60 * 1000;
-
-// Last time the owner typed, sent or reacted, by channel id
-const lastSeen = new Map<string, number>();
-
-export function markActive(channelId: string, now = Date.now()): void {
-    lastSeen.set(channelId, now);
-}
-
-export function isActive(channelId: string, now = Date.now()): boolean {
-    const seen = lastSeen.get(channelId);
-    return seen !== undefined && now - seen < awayAfterMs;
-}
diff --git a/src/state/settings.ts b/src/state/settings.ts
deleted file mode 100644
index 32c0fa7..0000000
--- a/src/state/settings.ts
+++ /dev/null
@@ -1,97 +0,0 @@
-/* src/state/settings.ts */
-
-import { dump, load } from "jpcl-lang";
-
-// Resolved from this file, so it works whatever directory the service starts in
-const settingsFile = new URL("../../data/settings.jp", import.meta.url);
-
-// One [guildId] section per server in the .jp file
-export interface GuildSettings {
-    autoproxy: {
-        enabled: boolean;
-    };
-}
-
-const defaults: GuildSettings = {
-    autoproxy: {
-        enabled: false,
-    },
-};
-
-// One entry per server the bot is in
-export const settings: Record<string, GuildSettings> = {};
-
-// Merge per section, so keys added later keep their defaults
-function withDefaults(saved: Partial<GuildSettings> = {}): GuildSettings {
-    return {
-        autoproxy: {
-            ...defaults.autoproxy,
-            ...saved.autoproxy,
-        },
-    };
-}
-
-// Returns the stored entry, creating it, so edits are kept by saveSettings
-export function guildSettings(guildId: string): GuildSettings {
-    settings[guildId] ??= withDefaults();
-    return settings[guildId];
-}
-
-// Adds servers joined and drops servers left, including while the bot was offline
-export async function syncGuilds(guildIds: Iterable<string>): Promise<void> {
-    const current = new Set(guildIds);
-    let changed = false;
-
-    for (const guildId of current) {
-        if (settings[guildId]) continue;
-        settings[guildId] = withDefaults();
-        changed = true;
-    }
-
-    for (const guildId of Object.keys(settings)) {
-        if (current.has(guildId)) continue;
-        delete settings[guildId];
-        changed = true;
-    }
-
-    if (changed) await saveSettings();
-}
-
-// Every server the bot is in has an entry, via syncGuilds and addGuild
-export function setAutoproxyEverywhere(enabled: boolean): number {
-    const guilds = Object.values(settings);
-    for (const guild of guilds) guild.autoproxy.enabled = enabled;
-    return guilds.length;
-}
-
-export async function addGuild(guildId: string): Promise<void> {
-    guildSettings(guildId);
-    await saveSettings();
-}
-
-export async function removeGuild(guildId: string): Promise<void> {
-    delete settings[guildId];
-    await saveSettings();
-}
-
-export async function loadSettings(): Promise<void> {
-    try {
-        const saved = await load(settingsFile) as Record<string, Partial<GuildSettings>>;
-
-        for (const [guildId, guild] of Object.entries(saved)) {
-            // Skips leftovers from the old global format, like [autoproxy]
-            if (!/^\d+$/.test(guildId)) continue;
-            settings[guildId] = withDefaults(guild);
-        }
-    } catch (error) {
-        // First run has no file yet; anything else is worth a log
-        if ((error as { code?: string }).code !== "ENOENT") {
-            console.error("Settings load failed, using defaults:", error);
-        }
-    }
-}
-
-export async function saveSettings(): Promise<void> {
-    // dump creates data/ and writes atomically
-    await dump(settings, settingsFile, { indent: 4 });
-}
diff --git a/src/state/system.ts b/src/state/system.ts
deleted file mode 100644
index 2a89c36..0000000
--- a/src/state/system.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-/* src/state/system.ts */
-
-import type { Member } from "../proxy/types.ts";
-
-// Last known data from the site, kept through outages
-export const system: {
-    name: string | null;
-    tag: string | null;
-    members: Member[];
-    fronters: Member[];
-} = {
-    name: null,
-    tag: null,
-    members: [],
-    fronters: [],
-};
diff --git a/src/tests.rs b/src/tests.rs
new file mode 100644
index 0000000..4d93f6b
--- /dev/null
+++ b/src/tests.rs
@@ -0,0 +1,250 @@
+// src/tests.rs
+
+use serde_json::{Value, json};
+use serenity::all::{GuildId, Message, UserId};
+
+use crate::{
+    cards, discord,
+    proxy::{self, Member, MemberStatus, ProxyTag},
+    settings::Settings,
+};
+
+fn member(name: &str, prefix: Option<&str>, suffix: Option<&str>) -> Member {
+    Member {
+        id: name.into(),
+        name: name.into(),
+        proxy_tags: vec![ProxyTag {
+            prefix: prefix.map(str::to_owned),
+            suffix: suffix.map(str::to_owned),
+        }],
+        ..Member::default()
+    }
+}
+
+#[test]
+fn tags_strip_prefixes_and_suffixes() {
+    let members = [
+        member("short", Some("C:"), None),
+        member("long", Some("C1:"), None),
+        member("brackets", Some("["), Some("]")),
+        member("spaced", Some("Ae "), None),
+    ];
+    for (input, name, expected) in [
+        ("C: hi", "short", "hi"),
+        ("C1: hi", "long", "hi"),
+        ("[hello]", "brackets", "hello"),
+        ("ae hi", "spaced", "hi"),
+        ("Ae\u{a0}hi", "spaced", "hi"),
+    ] {
+        let (speakers, content) = proxy::pick(&members, &[], input).unwrap();
+        assert_eq!(speakers[0].id, name);
+        assert_eq!(content, expected);
+    }
+    assert!(proxy::pick(&members, &[], "Aehi").is_none());
+    assert!(proxy::pick(&members, &[], "plain message").is_none());
+}
+
+#[test]
+fn longest_overlapping_tag_wins_and_keep_proxy_preserves_text() {
+    let mut keep = member("long", Some("C: "), None);
+    keep.keep_proxy = true;
+    let members = [member("short", Some("C:"), None), keep];
+    let (speakers, content) = proxy::pick(&members, &[], "C: hi").unwrap();
+    assert_eq!(speakers[0].name, "long");
+    assert_eq!(content, "C: hi");
+}
+
+#[test]
+fn autoproxy_preserves_front_order_and_respects_opt_outs() {
+    let members = [member("tagged", Some("T:"), None)];
+    let mut quiet = member("quiet", None, None);
+    quiet.autoproxy_enabled = Some(false);
+    let front = [member("host", None, None), quiet, member("co", None, None)];
+
+    let (tagged, _) = proxy::pick(&members, &front, "T: hi").unwrap();
+    assert_eq!(tagged[0].name, "tagged");
+    let (speakers, content) = proxy::pick(&members, &front, "hi").unwrap();
+    assert_eq!(
+        speakers
+            .iter()
+            .map(|member| member.name.as_str())
+            .collect::<Vec<_>>(),
+        ["host", "co"]
+    );
+    assert_eq!(content, "hi");
+    assert!(proxy::pick(&members, &front, "\\hi").is_none());
+    assert!(proxy::pick(&members, &front, "$hi").is_none());
+    assert!(proxy::pick(&members, &[], "hi").is_none());
+}
+
+#[test]
+fn names_use_display_names_and_cap_crowds() {
+    let mut host = member("first", None, None);
+    host.display_name = Some("Host".into());
+    let crowd = [
+        host,
+        member("b", None, None),
+        member("c", None, None),
+        member("d", None, None),
+        member("e", None, None),
+    ];
+    let speakers: Vec<_> = crowd.iter().collect();
+    assert_eq!(proxy::webhook_name(&speakers[..2], None), "Host & b");
+    assert_eq!(proxy::webhook_name(&speakers[..3], None), "Host, b & c");
+    assert_eq!(proxy::webhook_name(&speakers, None), "Host, b, c & 2 more");
+    assert_eq!(proxy::fronting_status(&crowd[..2]), "Fronting: Host, b");
+    assert_eq!(proxy::fronting_status(&[]), "Nobody fronting");
+}
+
+#[test]
+fn webhook_name_preserves_the_tag_and_uses_discords_length_units() {
+    let name = member(&format!("Discord {}", "🌙".repeat(80)), None, None);
+    let result = proxy::webhook_name(&[&name], Some("TAG"));
+    assert!(result.starts_with("dïscord "));
+    assert!(result.ends_with(" ~ TAG"));
+    assert!(proxy::utf16_len(&result) <= 80);
+}
+
+#[test]
+fn command_args_fold_case_without_losing_edit_text() {
+    assert_eq!(
+        proxy::command("D$AutoProxy  OFF"),
+        Some(("autoproxy".into(), vec!["off".into()], "OFF"))
+    );
+    assert_eq!(
+        proxy::command("d$edit  Hello  World").unwrap().2,
+        "Hello  World"
+    );
+    assert!(proxy::command("d$help").unwrap().1.is_empty());
+    assert!(proxy::command("hello d$autoproxy").is_none());
+    assert!(proxy::command("d$   ").is_none());
+}
+
+#[test]
+fn visible_short_links_use_classic_messages() {
+    assert!(discord::classic("look https://example.com"));
+    assert!(!discord::classic("just words"));
+    assert!(!discord::classic("<https://example.com>"));
+    assert!(!discord::classic(&format!(
+        "https://example.com {}",
+        "a".repeat(2000)
+    )));
+}
+
+#[test]
+fn jpcl_v2_loads_old_settings_and_round_trips_guild_preferences() {
+    let directory = tempfile::tempdir().unwrap();
+    let path = directory.path().join("settings.jp");
+    assert!(Settings::load(&path).unwrap().guilds.is_empty());
+    std::fs::write(
+        &path,
+        "[123]\nautoproxy: { enabled: true }\n[456]\n[autoproxy]\nenabled: true\n",
+    )
+    .unwrap();
+
+    let settings = Settings::load(&path).unwrap();
+    assert_eq!(settings.guilds.len(), 2);
+    assert!(settings.guilds[&GuildId::new(123)]);
+    assert!(!settings.guilds[&GuildId::new(456)]);
+
+    settings.save_to(&path).unwrap();
+    assert_eq!(Settings::load(&path).unwrap().guilds, settings.guilds);
+}
+
+pub(crate) fn message(author: &str, content: &str, attachments: Vec<Value>) -> Message {
+    serde_json::from_value(json!({
+        "id": "3",
+        "channel_id": "2",
+        "guild_id": "1",
+        "author": { "id": "42", "username": author, "discriminator": "0" },
+        "content": content,
+        "timestamp": "2026-11-22T00:00:00Z",
+        "tts": false,
+        "mention_everyone": false,
+        "mentions": [],
+        "mention_roles": [],
+        "attachments": attachments,
+        "embeds": [],
+        "pinned": false,
+        "type": 0,
+    }))
+    .unwrap()
+}
+
+pub(crate) fn attachment(name: &str) -> Value {
+    json!({
+        "id": "8",
+        "filename": name,
+        "size": 1,
+        "url": format!("https://cdn.example/{name}"),
+        "proxy_url": format!("https://cdn.example/{name}"),
+    })
+}
+
+#[test]
+fn member_card_displays_profile_and_info_caps_crowds() {
+    let mut first = member("example", None, None);
+    first.display_name = Some("Example".into());
+    first.pronouns = Some("fae/faer".into());
+    first.color = Some("cba6f7".into());
+    first.avatar_url = Some("https://example.com/avatar.png".into());
+    first.pride = vec!["Transgender".into()];
+    first.status = Some(MemberStatus {
+        text: "Coding again...".into(),
+        emoji: Some("💻".into()),
+    });
+
+    let card = cards::member_card(&first);
+    assert_eq!(card["accent_color"], 0xcba6f7);
+    assert_eq!(card["components"][0]["type"], 9);
+    assert_eq!(
+        card["components"][0]["components"][0]["content"],
+        "## Example\nfae/faer\n💻 Coding again..."
+    );
+    assert!(card.to_string().contains("**Pride**\\nTransgender"));
+    assert!(
+        card.to_string()
+            .contains("https://doughmination.co.uk/example")
+    );
+
+    let plain = cards::member_card(&member("plain", None, None));
+    assert_eq!(plain["accent_color"], 0xeb459e);
+    assert_eq!(plain["components"][0]["type"], 10);
+
+    let webhook = message("Webhook Name", "", vec![]);
+    let owner = UserId::new(42);
+    let unknown = cards::info(&webhook, None, owner, None);
+    assert!(unknown[0].to_string().contains("## Webhook Name"));
+
+    let crowd = vec![first; 10];
+    let shown = cards::info(&webhook, Some(&crowd), owner, None);
+    fn count(component: &Value) -> usize {
+        let children = component["components"]
+            .as_array()
+            .map_or(0, |items| items.iter().map(count).sum());
+        let accessory = component.get("accessory").map_or(0, count);
+        1 + children + accessory
+    }
+    assert!(shown.iter().map(count).sum::<usize>() <= 40);
+    assert!(shown[3]["content"].as_str().unwrap().contains("& 7 more"));
+}
+
+#[test]
+fn reply_card_quotes_every_line_and_marks_attachments() {
+    let target = message("Webhook", "", vec![]);
+    let normal = message("Replier", "hi\nthere", vec![]);
+    let reply = cards::reply(&normal, &target);
+    assert_eq!(
+        reply[0]["components"][0]["components"][0]["content"],
+        "### ↪ Replier replied to Webhook\n> hi\n> there"
+    );
+
+    let only_file = message("Replier", "", vec![attachment("cat.png")]);
+    let reply = cards::reply(&only_file, &target);
+    assert_eq!(reply.len(), 1);
+    assert!(reply[0].to_string().contains("*Sent an attachment*"));
+
+    let mixed = message("Replier", "look", vec![attachment("cat.png")]);
+    let reply = cards::reply(&mixed, &target);
+    assert_eq!(reply[1]["content"], "-# Also sent an attachment");
+}
diff --git a/tests/commands/parse_test.ts b/tests/commands/parse_test.ts
deleted file mode 100644
index 0e5283a..0000000
--- a/tests/commands/parse_test.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-/* tests/commands/parse_test.ts */
-
-import { assertEquals } from "@std/assert";
-
-import { parseCommand } from "../../src/commands/parse.ts";
-
-Deno.test("parses name and args, case-insensitive", () => {
-    assertEquals(parseCommand("D$AutoProxy  OFF"), {
-        name: "autoproxy",
-        args: ["off"],
-        rest: "OFF",
-    });
-});
-
-Deno.test("rest keeps the original text for edits", () => {
-    assertEquals(parseCommand("d$edit  Hello  World")?.rest, "Hello  World");
-});
-
-Deno.test("no args gives an empty list", () => {
-    assertEquals(parseCommand("d$help")?.args, []);
-});
-
-Deno.test("plain messages are not commands", () => {
-    assertEquals(parseCommand("hello d$autoproxy"), null);
-});
-
-Deno.test("bare prefix is not a command", () => {
-    assertEquals(parseCommand("d$   "), null);
-});
diff --git a/tests/discord/editComponents_test.ts b/tests/discord/editComponents_test.ts
deleted file mode 100644
index 2a44a20..0000000
--- a/tests/discord/editComponents_test.ts
+++ /dev/null
@@ -1,72 +0,0 @@
-/* tests/discord/editComponents_test.ts */
-
-import { assertEquals } from "@std/assert";
-import { ComponentType, replaceText } from "../../src/discord/editComponents.ts";
-
-const cdn = "https://cdn.discordapp.com/attachments/1/2";
-
-const sent = [
-    {
-        type: ComponentType.TextDisplay,
-        id: 1,
-        content: "old",
-    },
-    {
-        type: ComponentType.ActionRow,
-        id: 2,
-        components: [],
-    },
-    {
-        type: ComponentType.MediaGallery,
-        id: 3,
-        items: [
-            {
-                media: {
-                    url: `${cdn}/0-cat.png?ex=abc`,
-                    proxy_url: "x",
-                },
-                spoiler: true,
-            },
-        ],
-    },
-    {
-        type: ComponentType.File,
-        id: 4,
-        file: {
-            url: `${cdn}/1-notes%20v2.txt`,
-        },
-    },
-];
-
-const names = ["0-cat.png", "1-notes v2.txt"];
-
-Deno.test("new text replaces the old and goes first", () => {
-    const edited = replaceText(sent, "new", names);
-
-    assertEquals(edited[0], {
-        type: ComponentType.TextDisplay,
-        content: "new",
-    });
-    assertEquals(edited.length, 4);
-});
-
-Deno.test("attachments point back at attachment:// and keep spoilers", () => {
-    const edited = replaceText(sent, "new", names);
-
-    assertEquals(edited[2].items[0], {
-        media: {
-            url: "attachment://0-cat.png",
-        },
-        spoiler: true,
-    });
-    assertEquals(edited[3].file.url, "attachment://1-notes v2.txt");
-});
-
-Deno.test("empty text drops the text block", () => {
-    const edited = replaceText(sent, "", names);
-
-    assertEquals(
-        edited.some((component) => component.type === ComponentType.TextDisplay),
-        false,
-    );
-});
diff --git a/tests/discord/infoCard_test.ts b/tests/discord/infoCard_test.ts
deleted file mode 100644
index be780e0..0000000
--- a/tests/discord/infoCard_test.ts
+++ /dev/null
@@ -1,90 +0,0 @@
-/* tests/discord/infoCard_test.ts */
-
-import { assert, assertEquals, assertStringIncludes } from "@std/assert";
-
-import { ComponentType } from "../../src/discord/editComponents.ts";
-import { buildInfoCard } from "../../src/discord/infoCard.ts";
-import { member } from "../fixtures.ts";
-
-const base = {
-    username: "Webhook Name",
-    avatarUrl: "https://cdn.example/avatar.png",
-    messageUrl: "https://discord.com/channels/1/2/3",
-    ownerId: "42",
-    systemName: "Doughmination System",
-};
-
-// deno-lint-ignore no-explicit-any
-function countComponents(components: any[]): number {
-    return components.reduce((total, component) => {
-        const children = [
-            ...(component.components ?? []),
-            ...(component.accessory ? [component.accessory] : []),
-        ];
-        return total + 1 + countComponents(children);
-    }, 0);
-}
-
-Deno.test("member card shows site details in their colour", () => {
-    const clove = {
-        ...member("kzsbyo"),
-        display_name: "Clove",
-        pronouns: "fae/faer",
-        color: "cba6f7",
-        avatar_url: "https://site.example/clove.png",
-        description: "Host",
-        tags: ["Host"],
-        pride: ["Transgender"],
-        status: {
-            text: "Coding again...",
-            emoji: "💻",
-        },
-    };
-
-    const [card] = buildInfoCard({
-        ...base,
-        members: [clove],
-    });
-    const text = JSON.stringify(card);
-
-    assertEquals(card.accent_color, 0xcba6f7);
-    assertEquals(card.components[0].type, ComponentType.Section);
-    assertStringIncludes(text, "## Clove\\nfae/faer\\n💻 Coding again...");
-    assertStringIncludes(text, "**Pride**\\nTransgender");
-    assertStringIncludes(text, "https://doughmination.co.uk/kzsbyo");
-});
-
-Deno.test("member without avatar or details is plain text", () => {
-    const [card] = buildInfoCard({
-        ...base,
-        members: [member("a")],
-    });
-
-    assertEquals(card.accent_color, 0xeb459e);
-    assertEquals(card.components[0].type, ComponentType.TextDisplay);
-});
-
-Deno.test("unknown sender falls back to the webhook name", () => {
-    const [card] = buildInfoCard({
-        ...base,
-        members: undefined,
-    });
-
-    assertStringIncludes(JSON.stringify(card), "## Webhook Name");
-});
-
-Deno.test("big front stays under 40 components and counts the rest", () => {
-    const crowd = Array.from({ length: 10 }, (_, index) => ({
-        ...member(`m${index}`),
-        avatar_url: "https://site.example/a.png",
-        description: "x".repeat(5000),
-    }));
-
-    const components = buildInfoCard({
-        ...base,
-        members: crowd,
-    });
-
-    assert(countComponents(components) <= 40);
-    assertStringIncludes(JSON.stringify(components), "& 7 more");
-});
diff --git a/tests/discord/linkPreview_test.ts b/tests/discord/linkPreview_test.ts
deleted file mode 100644
index e242a95..0000000
--- a/tests/discord/linkPreview_test.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-/* tests/discord/linkPreview_test.ts */
-
-import { assertEquals } from "@std/assert";
-import { wantsLinkPreview } from "../../src/discord/linkPreview.ts";
-
-Deno.test("plain link wants a preview", () => {
-    assertEquals(wantsLinkPreview("look https://example.com"), true);
-});
-
-Deno.test("text without a link doesn't", () => {
-    assertEquals(wantsLinkPreview("just words"), false);
-});
-
-Deno.test("angle-bracket link stays hidden", () => {
-    assertEquals(wantsLinkPreview("<https://example.com>"), false);
-});
-
-Deno.test("over 2000 chars stays components v2", () => {
-    assertEquals(wantsLinkPreview(`https://example.com ${"a".repeat(2000)}`), false);
-});
diff --git a/tests/discord/replyCard_test.ts b/tests/discord/replyCard_test.ts
deleted file mode 100644
index 058326e..0000000
--- a/tests/discord/replyCard_test.ts
+++ /dev/null
@@ -1,44 +0,0 @@
-/* tests/discord/replyCard_test.ts */
-
-import { assertEquals, assertStringIncludes } from "@std/assert";
-
-import { buildReplyCard } from "../../src/discord/replyCard.ts";
-
-const base = {
-    replierName: "Ari",
-    replierAvatarUrl: "https://cdn.example/ari.png",
-    proxiedName: "Clove ~ 🌙",
-    content: "",
-    hasAttachments: false,
-    replyUrl: "https://discord.com/channels/1/2/3",
-};
-
-Deno.test("reply text is quoted line by line", () => {
-    const text = JSON.stringify(buildReplyCard({
-        ...base,
-        content: "hi\nthere",
-    }));
-
-    assertStringIncludes(text, "↪ Ari replied to Clove ~ 🌙\\n> hi\\n> there");
-    assertStringIncludes(text, "https://discord.com/channels/1/2/3");
-});
-
-Deno.test("attachment-only reply says so", () => {
-    const components = buildReplyCard({
-        ...base,
-        hasAttachments: true,
-    });
-
-    assertEquals(components.length, 1);
-    assertStringIncludes(JSON.stringify(components), "*Sent an attachment*");
-});
-
-Deno.test("text plus attachment adds a note", () => {
-    const components = buildReplyCard({
-        ...base,
-        content: "look",
-        hasAttachments: true,
-    });
-
-    assertEquals(components.length, 2);
-});
diff --git a/tests/fixtures.ts b/tests/fixtures.ts
deleted file mode 100644
index e807d91..0000000
--- a/tests/fixtures.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-/* tests/fixtures.ts */
-
-import type { Member } from "../src/proxy/types.ts";
-
-export function member(
-    id: string,
-    prefix: string | null = null,
-    suffix: string | null = null,
-): Member {
-    return {
-        id,
-        name: id,
-        display_name: null,
-        pronouns: null,
-        color: null,
-        description: null,
-        avatar_url: null,
-        webhook_avatar_url: null,
-        proxy_tags: [{ prefix, suffix }],
-        keep_proxy: false,
-        autoproxy_enabled: null,
-    };
-}
diff --git a/tests/proxy/autoproxy_test.ts b/tests/proxy/autoproxy_test.ts
deleted file mode 100644
index 69ea638..0000000
--- a/tests/proxy/autoproxy_test.ts
+++ /dev/null
@@ -1,44 +0,0 @@
-/* tests/proxy/autoproxy_test.ts */
-
-import { assertEquals } from "@std/assert";
-
-import { pickProxy } from "../../src/proxy/autoproxy.ts";
-import { member } from "../fixtures.ts";
-
-const tagged = member("tagged", "T:");
-const host = member("host");
-const quiet = {
-    ...member("quiet"),
-    autoproxy_enabled: false,
-};
-
-Deno.test("tags beat autoproxy", () => {
-    const match = pickProxy([tagged], [host], "T: hi");
-
-    assertEquals(match?.members.map((speaker) => speaker.id), ["tagged"]);
-});
-
-Deno.test("untagged messages go to everyone fronting", () => {
-    const match = pickProxy([tagged], [host, member("co")], "hi");
-
-    assertEquals(match?.members.map((speaker) => speaker.id), ["host", "co"]);
-    assertEquals(match?.content, "hi");
-});
-
-Deno.test("members with autoproxy off are left out", () => {
-    const match = pickProxy([], [host, quiet], "hi");
-
-    assertEquals(match?.members.map((speaker) => speaker.id), ["host"]);
-});
-
-Deno.test("backslash skips autoproxy", () => {
-    assertEquals(pickProxy([], [host], "\\not proxied"), null);
-});
-
-Deno.test("dollar sign skips tags and autoproxy", () => {
-    assertEquals(pickProxy([host], [host], "$not proxied"), null);
-});
-
-Deno.test("nobody fronting means no proxy", () => {
-    assertEquals(pickProxy([], [], "hi"), null);
-});
diff --git a/tests/proxy/names_test.ts b/tests/proxy/names_test.ts
deleted file mode 100644
index e9d5e3a..0000000
--- a/tests/proxy/names_test.ts
+++ /dev/null
@@ -1,74 +0,0 @@
-/* tests/proxy/names_test.ts */
-
-import { assertEquals } from "@std/assert";
-
-import {
-    frontingStatus,
-    membersByName,
-    webhookName,
-} from "../../src/proxy/names.ts";
-import { member } from "../fixtures.ts";
-
-const host = {
-    ...member("c1"),
-    display_name: "Clove (Host)",
-};
-
-Deno.test("webhook name joins co-fronters", () => {
-    assertEquals(webhookName([host, member("02")], null), "Clove (Host) & 02");
-});
-
-Deno.test("more than three speakers collapse to a count", () => {
-    const crowd = ["a", "b", "c", "d", "e"].map((id) => member(id));
-
-    assertEquals(webhookName(crowd, null), "a, b, c & 2 more");
-});
-
-Deno.test("three speakers use commas then &", () => {
-    const trio = ["a", "b", "c"].map((id) => member(id));
-
-    assertEquals(webhookName(trio, null), "a, b & c");
-});
-
-Deno.test("system tag goes on the end and always survives", () => {
-    const longName = {
-        ...member("x"),
-        display_name: "n".repeat(100),
-    };
-    const name = webhookName([longName], "TAG");
-
-    assertEquals(name.length, 80);
-    assertEquals(name.endsWith(" ~ TAG"), true);
-});
-
-Deno.test("webhook name dodges the discord ban", () => {
-    const named = {
-        ...member("x"),
-        display_name: "Discord fan",
-    };
-
-    assertEquals(webhookName([named], null), "dïscord fan");
-});
-
-Deno.test("fronting status lists display names", () => {
-    assertEquals(
-        frontingStatus([host, member("02")]),
-        "Fronting: Clove (Host), 02",
-    );
-    assertEquals(frontingStatus([]), "Nobody fronting");
-});
-
-Deno.test("membersByName matches short names, not display names", () => {
-    const named = {
-        ...host,
-        name: "C1",
-    };
-
-    assertEquals(
-        membersByName([named, member("02")], ["c1", "02", "clove (host)"]),
-        {
-            found: [named, member("02")],
-            missing: ["clove (host)"],
-        },
-    );
-});
diff --git a/tests/proxy/tags_test.ts b/tests/proxy/tags_test.ts
deleted file mode 100644
index b289ba9..0000000
--- a/tests/proxy/tags_test.ts
+++ /dev/null
@@ -1,39 +0,0 @@
-/* tests/proxy/tags_test.ts */
-
-import { assertEquals } from "@std/assert";
-
-import { matchProxyTags } from "../../src/proxy/tags.ts";
-import { member } from "../fixtures.ts";
-
-const members = [
-    member("short", "C:"),
-    member("long", "C1:"),
-    member("brackets", "[", "]"),
-];
-
-Deno.test("prefix match strips the tag", () => {
-    assertEquals(matchProxyTags(members, "C: hi")?.content, "hi");
-});
-
-Deno.test("longest tag wins", () => {
-    assertEquals(matchProxyTags(members, "C1: hi")?.members[0].id, "long");
-});
-
-Deno.test("prefix and suffix match", () => {
-    const match = matchProxyTags(members, "[hello]");
-
-    assertEquals(match?.members[0].id, "brackets");
-    assertEquals(match?.content, "hello");
-});
-
-Deno.test("no tag means no match", () => {
-    assertEquals(matchProxyTags(members, "plain message"), null);
-});
-
-Deno.test("tags ignore case and the kind of space", () => {
-    const spaced = [member("aether", "Ae ")];
-
-    assertEquals(matchProxyTags(spaced, "ae hi")?.content, "hi");
-    assertEquals(matchProxyTags(spaced, "Ae hi")?.content, "hi");
-    assertEquals(matchProxyTags(spaced, "Aehi"), null);
-});
diff --git a/tests/state/activity_test.ts b/tests/state/activity_test.ts
deleted file mode 100644
index 9af3b59..0000000
--- a/tests/state/activity_test.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-/* tests/state/activity_test.ts */
-
-import { assertEquals } from "@std/assert";
-
-import { awayAfterMs, isActive, markActive } from "../../src/state/activity.ts";
-
-Deno.test("never seen in a channel means away", () => {
-    assertEquals(isActive("never"), false);
-});
-
-Deno.test("recent activity counts, old activity doesn't", () => {
-    markActive("chat", 1000);
-
-    assertEquals(isActive("chat", 1000 + awayAfterMs - 1), true);
-    assertEquals(isActive("chat", 1000 + awayAfterMs), false);
-});
-
-Deno.test("activity is per channel", () => {
-    markActive("general", 1000);
-
-    assertEquals(isActive("art", 1000), false);
-});
diff --git a/tests/state/settings_test.ts b/tests/state/settings_test.ts
deleted file mode 100644
index ed78a8f..0000000
--- a/tests/state/settings_test.ts
+++ /dev/null
@@ -1,34 +0,0 @@
-/* tests/state/settings_test.ts */
-
-import { assertEquals } from "@std/assert";
-
-import {
-    guildSettings,
-    setAutoproxyEverywhere,
-    settings,
-} from "../../src/state/settings.ts";
-
-Deno.test("setAutoproxyEverywhere changes every server", () => {
-    guildSettings("1").autoproxy.enabled = true;
-    guildSettings("2");
-
-    assertEquals(setAutoproxyEverywhere(false), 2);
-    assertEquals(guildSettings("1").autoproxy.enabled, false);
-
-    assertEquals(setAutoproxyEverywhere(true), 2);
-    assertEquals(guildSettings("2").autoproxy.enabled, true);
-
-    delete settings["1"];
-    delete settings["2"];
-});
-
-Deno.test("autoproxy is per server and off by default", () => {
-    guildSettings("1").autoproxy.enabled = true;
-
-    assertEquals(guildSettings("1").autoproxy.enabled, true);
-    assertEquals(guildSettings("2").autoproxy.enabled, false);
-
-    // Leaves no test entries behind for other tests
-    delete settings["1"];
-    delete settings["2"];
-});