From f82e8904fbcce64ea15bc1f7e72c5ab2f9eaeb9d Mon Sep 17 00:00:00 2001 From: Simon Ledoux Date: Sat, 2 Sep 2023 13:21:26 +0200 Subject: [PATCH 1/9] =?UTF-8?q?Rewrite=20in=20=F0=9F=9A=80=20Rust=20?= =?UTF-8?q?=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .dockerignore | 6 + .env.example | 23 - .github/workflows/build.yml | 33 + .gitignore | 13 +- Cargo.lock | 1880 +++++++++++++++++++++++++++++++ Cargo.toml | 13 + Dockerfile | 39 +- README.md | 17 +- compose.yml | 7 + config.example.yml | 77 ++ package-lock.json | 876 -------------- package.json | 26 - src/app.ts | 54 - src/commands/advent-reward.ts | 170 --- src/commands/buddy-manage.ts | 45 - src/commands/buddy-optout.ts | 43 - src/commands/buddy-signup.ts | 51 - src/commands/mcwhitelist.ts | 48 - src/commands/mod.rs | 2 + src/commands/signup.rs | 45 + src/commands/signup.ts | 49 - src/commands/switch-class.ts | 64 -- src/commands/switch_class.rs | 52 + src/config.rs | 52 + src/events/interactionCreate.ts | 10 - src/handlers/CommandHandler.ts | 19 - src/main.rs | 60 + src/slash_arguments/group.rs | 41 + src/slash_arguments/mod.rs | 1 + src/structures/Command.ts | 45 - src/utils/Constants.ts | 29 - tsconfig.json | 20 - yarn.lock | 354 ------ 33 files changed, 2299 insertions(+), 1965 deletions(-) create mode 100644 .dockerignore delete mode 100644 .env.example create mode 100644 .github/workflows/build.yml create mode 100644 Cargo.lock create mode 100644 Cargo.toml create mode 100644 compose.yml create mode 100644 config.example.yml delete mode 100644 package-lock.json delete mode 100644 package.json delete mode 100644 src/app.ts delete mode 100644 src/commands/advent-reward.ts delete mode 100644 src/commands/buddy-manage.ts delete mode 100644 src/commands/buddy-optout.ts delete mode 100644 src/commands/buddy-signup.ts delete mode 100644 src/commands/mcwhitelist.ts create mode 100644 src/commands/mod.rs create mode 100644 src/commands/signup.rs delete mode 100644 src/commands/signup.ts delete mode 100644 src/commands/switch-class.ts create mode 100644 src/commands/switch_class.rs create mode 100644 src/config.rs delete mode 100644 src/events/interactionCreate.ts delete mode 100644 src/handlers/CommandHandler.ts create mode 100644 src/main.rs create mode 100644 src/slash_arguments/group.rs create mode 100644 src/slash_arguments/mod.rs delete mode 100644 src/structures/Command.ts delete mode 100644 src/utils/Constants.ts delete mode 100644 tsconfig.json delete mode 100644 yarn.lock diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..a6bde0b --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +/target + +.vscode +.idea + +config.yml \ No newline at end of file diff --git a/.env.example b/.env.example deleted file mode 100644 index d6713d0..0000000 --- a/.env.example +++ /dev/null @@ -1,23 +0,0 @@ -# Discord Secrets -DISCORD_CLIENT_ID= -DISCORD_TOKEN= - -# The server in which the bot is supposed to be used -MAIN_SERVER_ID= - -# Roles -ROLE_ID_STUDENT= -ROLE_ID_TEACHER= -ROLE_ID_ALUMNI= -ROLE_ID_GUEST= - -# Details to make the Advent calendar work -ADHERENT_ROLE_ID= -FAKE_BINHARRY_ROLE_ID= -ADVENT_CHANNEL_ID= - -# Minecraft server's RCON authentication details and where whitelistings should be logged -MC_CHANNEL_WHITELISTED= -MC_SERVER_RCON_HOST= -MC_SERVER_RCON_PORT= -MC_SERVER_RCON_PASS= diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..199143d --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,33 @@ +name: build + +on: + push: + branches: + - "main" + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ secrets.GHCR_USERNAME }} + password: ${{ secrets.GHCR_TOKEN }} + - name: Build and push + uses: docker/build-push-action@v3 + with: + context: . + target: production + platforms: linux/amd64,linux/arm64 + push: true + tags: ghcr.io/ciborn/harry:latest + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/.gitignore b/.gitignore index d8e775e..a6bde0b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,6 @@ -# Build Artifacts -dist/ +/target -# Runtime Artifacts -cache/ +.vscode +.idea -# Dependencies -node_modules/ - -# Secrets -.env +config.yml \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..8a2f9db --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,1880 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "addr2line" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "ahash" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" +dependencies = [ + "getrandom", + "once_cell", + "version_check", +] + +[[package]] +name = "aho-corasick" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c378d78423fdad8089616f827526ee33c19f2fddbd5de1629152c9593ba4783" +dependencies = [ + "memchr", +] + +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "async-trait" +version = "0.1.73" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.29", +] + +[[package]] +name = "async-tungstenite" +version = "0.17.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1b71b31561643aa8e7df3effe284fa83ab1a840e52294c5f4bd7bfd8b2becbb" +dependencies = [ + "futures-io", + "futures-util", + "log", + "pin-project-lite", + "tokio", + "tokio-rustls 0.23.4", + "tungstenite", + "webpki-roots 0.22.6", +] + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "backtrace" +version = "0.3.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + +[[package]] +name = "base64" +version = "0.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "414dcefbc63d77c526a76b3afcf6fbb9b5e2791c19c3aa2297733208750c6e53" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[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.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" + +[[package]] +name = "byteorder" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" + +[[package]] +name = "bytes" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" + +[[package]] +name = "cc" +version = "1.0.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +dependencies = [ + "libc", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "chrono" +version = "0.4.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f56b4c72906975ca04becb8a30e102dfecddd0c06181e3e95ddc444be28881f8" +dependencies = [ + "android-tzdata", + "iana-time-zone", + "num-traits", + "serde", + "windows-targets", +] + +[[package]] +name = "config" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d379af7f68bfc21714c6c7dea883544201741d2ce8274bb12fa54f89507f52a7" +dependencies = [ + "async-trait", + "json5", + "lazy_static", + "nom", + "pathdiff", + "ron", + "rust-ini", + "serde", + "serde_json", + "toml", + "yaml-rust", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" + +[[package]] +name = "cpufeatures" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" +dependencies = [ + "libc", +] + +[[package]] +name = "crc32fast" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "darling" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b750cb3417fd1b327431a470f388520309479ab0bf5e323505daf0290cd3850" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "109c1ca6e6b7f82cc233a97004ea8ed7ca123a9af07a8230878fcfda9b158bf0" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 1.0.109", +] + +[[package]] +name = "darling_macro" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4aab4dbc9f7611d8b55048a3a16d2d010c2c8334e46304b40ac1cc14bf3b48e" +dependencies = [ + "darling_core", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "dashmap" +version = "5.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" +dependencies = [ + "cfg-if", + "hashbrown 0.14.0", + "lock_api", + "once_cell", + "parking_lot_core", + "serde", +] + +[[package]] +name = "deranged" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2696e8a945f658fd14dc3b87242e6b80cd0f36ff04ea560fa39082368847946" +dependencies = [ + "serde", +] + +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[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 = "dlv-list" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0688c2a7f92e427f44895cd63841bff7b29f8d7a1648b9e7e07a4a365b2e1257" + +[[package]] +name = "encoding_rs" +version = "0.8.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "flate2" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6c98ee8095e9d1dcbf2fcc6d95acccb90d1c81db1e44725c6a984b1dbdfb010" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "form_urlencoded" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" + +[[package]] +name = "futures-io" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" + +[[package]] +name = "futures-macro" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.29", +] + +[[package]] +name = "futures-sink" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" + +[[package]] +name = "futures-task" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" + +[[package]] +name = "futures-util" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "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.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "gimli" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" + +[[package]] +name = "h2" +version = "0.3.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "harry" +version = "0.1.0" +dependencies = [ + "config", + "once_cell", + "poise", + "serde", + "tokio", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +dependencies = [ + "ahash", +] + +[[package]] +name = "hashbrown" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" + +[[package]] +name = "hermit-abi" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" + +[[package]] +name = "http" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +dependencies = [ + "bytes", + "http", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "hyper" +version = "0.14.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2 0.4.9", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d78e1e73ec14cf7375674f74d7dde185c8206fd9dea6fb6295e8a98098aaa97" +dependencies = [ + "futures-util", + "http", + "hyper", + "rustls 0.21.7", + "tokio", + "tokio-rustls 0.24.1", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "windows", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "idna" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", +] + +[[package]] +name = "ipnet" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" + +[[package]] +name = "itoa" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" + +[[package]] +name = "js-sys" +version = "0.3.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "json5" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96b0db21af676c1ce64250b5f40f3ce2cf27e4e47cb91ed91eb6fe9350b430c1" +dependencies = [ + "pest", + "pest_derive", + "serde", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.147" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" + +[[package]] +name = "linked-hash-map" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" + +[[package]] +name = "lock_api" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" + +[[package]] +name = "memchr" +version = "2.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5486aed0026218e61b8a01d5fbd5a0a134649abb71a0e53b7bc088529dced86e" + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "mime_guess" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4192263c238a5f0d0c6bfd21f336a313a4ce1c450542449ca191bb657b4642ef" +dependencies = [ + "mime", + "unicase", +] + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "miniz_oxide" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +dependencies = [ + "adler", +] + +[[package]] +name = "mio" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" +dependencies = [ + "libc", + "wasi", + "windows-sys", +] + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "num-traits" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_cpus" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "object" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ac5bbd07aea88c60a577a1ce218075ffd59208b2d7ca97adf9bfc5aeb21ebe" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" + +[[package]] +name = "ordered-float" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7940cf2ca942593318d07fcf2596cdca60a85c9e7fab408a5e21a4f9dcd40d87" +dependencies = [ + "num-traits", +] + +[[package]] +name = "ordered-multimap" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccd746e37177e1711c20dd619a1620f34f5c8b569c53590a72dedd5344d8924a" +dependencies = [ + "dlv-list", + "hashbrown 0.12.3", +] + +[[package]] +name = "parking_lot" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-targets", +] + +[[package]] +name = "pathdiff" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" + +[[package]] +name = "percent-encoding" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" + +[[package]] +name = "pest" +version = "2.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7a4d085fd991ac8d5b05a147b437791b4260b76326baf0fc60cf7c9c27ecd33" +dependencies = [ + "memchr", + "thiserror", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2bee7be22ce7918f641a33f08e3f43388c7656772244e2bbb2477f44cc9021a" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1511785c5e98d79a05e8a6bc34b4ac2168a0e3e92161862030ad84daa223141" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn 2.0.29", +] + +[[package]] +name = "pest_meta" +version = "2.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b42f0394d3123e33353ca5e1e89092e533d2cc490389f2bd6131c43c634ebc5f" +dependencies = [ + "once_cell", + "pest", + "sha2", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "poise" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d591af1c934c29adda172665f69b837e642d4fee85598baffb95dd98110467d" +dependencies = [ + "async-trait", + "derivative", + "futures-core", + "futures-util", + "log", + "once_cell", + "parking_lot", + "poise_macros", + "regex", + "serenity", + "tokio", +] + +[[package]] +name = "poise_macros" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40270099e1527efae99fdc0609d397e76310b529d4980ad38ab14d81803ca0fa" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + +[[package]] +name = "proc-macro2" +version = "1.0.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[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", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + +[[package]] +name = "redox_syscall" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +dependencies = [ + "bitflags", +] + +[[package]] +name = "regex" +version = "1.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12de2eff854e5fa4b1295edd650e227e9d8fb0c9e90b12e7f36d6a6811791a29" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49530408a136e16e5b486e883fbb6ba058e8e4e8ae6621a77b048b314336e629" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" + +[[package]] +name = "reqwest" +version = "0.11.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e9ad3fe7488d7e34558a2033d45a0c90b72d97b4f80705666fea71472e2e6a1" +dependencies = [ + "base64 0.21.3", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "hyper", + "hyper-rustls", + "ipnet", + "js-sys", + "log", + "mime", + "mime_guess", + "once_cell", + "percent-encoding", + "pin-project-lite", + "rustls 0.21.7", + "rustls-pemfile", + "serde", + "serde_json", + "serde_urlencoded", + "tokio", + "tokio-rustls 0.24.1", + "tokio-util", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "wasm-streams", + "web-sys", + "webpki-roots 0.25.2", + "winreg", +] + +[[package]] +name = "ring" +version = "0.16.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +dependencies = [ + "cc", + "libc", + "once_cell", + "spin", + "untrusted", + "web-sys", + "winapi", +] + +[[package]] +name = "ron" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88073939a61e5b7680558e6be56b419e208420c2adb92be54921fa6b72283f1a" +dependencies = [ + "base64 0.13.1", + "bitflags", + "serde", +] + +[[package]] +name = "rust-ini" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6d5f2436026b4f6e79dc829837d467cc7e9a55ee40e750d716713540715a2df" +dependencies = [ + "cfg-if", + "ordered-multimap", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" + +[[package]] +name = "rustls" +version = "0.20.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b80e3dec595989ea8510028f30c408a4630db12c9cbb8de34203b89d6577e99" +dependencies = [ + "log", + "ring", + "sct", + "webpki", +] + +[[package]] +name = "rustls" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd8d6c9f025a446bc4d18ad9632e69aec8f287aa84499ee335599fabd20c3fd8" +dependencies = [ + "log", + "ring", + "rustls-webpki", + "sct", +] + +[[package]] +name = "rustls-pemfile" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" +dependencies = [ + "base64 0.21.3", +] + +[[package]] +name = "rustls-webpki" +version = "0.101.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d93931baf2d282fff8d3a532bbfd7653f734643161b87e3e01e59a04439bf0d" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" + +[[package]] +name = "ryu" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "sct" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "serde" +version = "1.0.188" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde-value" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3a1a3341211875ef120e117ea7fd5228530ae7e7036a779fdc9117be6b3282c" +dependencies = [ + "ordered-float", + "serde", +] + +[[package]] +name = "serde_derive" +version = "1.0.188" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.29", +] + +[[package]] +name = "serde_json" +version = "1.0.105" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "693151e1ac27563d6dbcec9dee9fbd5da8539b20fa14ad3752b2e6d363ace360" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[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.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d007dc45584ecc47e791f2a9a7cf17bf98ac386728106f111159c846d624be3f" +dependencies = [ + "async-trait", + "async-tungstenite", + "base64 0.13.1", + "bitflags", + "bytes", + "cfg-if", + "chrono", + "dashmap", + "flate2", + "futures", + "mime", + "mime_guess", + "parking_lot", + "percent-encoding", + "reqwest", + "rustversion", + "serde", + "serde-value", + "serde_json", + "time", + "tokio", + "tracing", + "typemap_rev", + "url", +] + +[[package]] +name = "sha-1" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5058ada175748e33390e40e872bd0fe59a19f265d0158daa551c5a88a76009c" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sha2" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "signal-hook-registry" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" +dependencies = [ + "libc", +] + +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + +[[package]] +name = "smallvec" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" + +[[package]] +name = "socket2" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "socket2" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2538b18701741680e0322a2302176d3253a35388e2e62f172f64f4f16605f877" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c324c494eba9d92503e6f1ef2e6df781e78f6a7705a0202d9801b198807d518a" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "thiserror" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97a802ec30afc17eee47b2855fc72e0c4cd62be9b4efe6591edde0ec5bd68d8f" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bb623b56e39ab7dcd4b1b98bb6c8f8d907ed255b18de254088016b27a8ee19b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.29", +] + +[[package]] +name = "time" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17f6bb557fd245c28e6411aa56b6403c689ad95061f50e4be16c274e70a17e48" +dependencies = [ + "deranged", + "itoa", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" + +[[package]] +name = "time-macros" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a942f44339478ef67935ab2bbaec2fb0322496cf3cbe84b261e06ac3814c572" +dependencies = [ + "time-core", +] + +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17ed6077ed6cd6c74735e21f37eb16dc3935f96878b1fe961074089cc80893f9" +dependencies = [ + "backtrace", + "bytes", + "libc", + "mio", + "num_cpus", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "socket2 0.5.3", + "tokio-macros", + "windows-sys", +] + +[[package]] +name = "tokio-macros" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.29", +] + +[[package]] +name = "tokio-rustls" +version = "0.23.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" +dependencies = [ + "rustls 0.20.9", + "tokio", + "webpki", +] + +[[package]] +name = "tokio-rustls" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" +dependencies = [ + "rustls 0.21.7", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", + "tracing", +] + +[[package]] +name = "toml" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" +dependencies = [ + "serde", +] + +[[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + +[[package]] +name = "tracing" +version = "0.1.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +dependencies = [ + "cfg-if", + "log", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.29", +] + +[[package]] +name = "tracing-core" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" +dependencies = [ + "once_cell", +] + +[[package]] +name = "try-lock" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" + +[[package]] +name = "tungstenite" +version = "0.17.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e27992fd6a8c29ee7eef28fc78349aa244134e10ad447ce3b9f0ac0ed0fa4ce0" +dependencies = [ + "base64 0.13.1", + "byteorder", + "bytes", + "http", + "httparse", + "log", + "rand", + "rustls 0.20.9", + "sha-1", + "thiserror", + "url", + "utf-8", + "webpki", +] + +[[package]] +name = "typemap_rev" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed5b74f0a24b5454580a79abb6994393b09adf0ab8070f15827cb666255de155" + +[[package]] +name = "typenum" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" + +[[package]] +name = "ucd-trie" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" + +[[package]] +name = "unicase" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" +dependencies = [ + "version_check", +] + +[[package]] +name = "unicode-bidi" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" + +[[package]] +name = "unicode-ident" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" + +[[package]] +name = "unicode-normalization" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + +[[package]] +name = "url" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "utf-8" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn 2.0.29", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.29", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" + +[[package]] +name = "wasm-streams" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4609d447824375f43e1ffbc051b50ad8f4b3ae8219680c94452ea05eb240ac7" +dependencies = [ + "futures-util", + "js-sys", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "web-sys" +version = "0.3.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "webpki-roots" +version = "0.22.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87" +dependencies = [ + "webpki", +] + +[[package]] +name = "webpki-roots" +version = "0.25.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc" + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "winreg" +version = "0.50.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" +dependencies = [ + "cfg-if", + "windows-sys", +] + +[[package]] +name = "yaml-rust" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" +dependencies = [ + "linked-hash-map", +] diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..d3f7cd8 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "harry" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +config = { version = "0.13.3", features = ["yaml"] } +once_cell = "1.18.0" +poise = "0.5.5" +serde = { version = "1.0.188", features = ["derive"] } +tokio = { version = "1.32.0", features = ["full"] } diff --git a/Dockerfile b/Dockerfile index 39cda08..6ee4cca 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,36 +1,19 @@ -# ========== Stage 1: Base Image ========== # -FROM node:18-alpine AS base +# ========== Stage 1: Builder ========== # +FROM rust:1-alpine3.17 as builder -WORKDIR /app -COPY package.json ./ - - -# ========= Stage 2: Dependencies ========= # -FROM base AS dependencies - -RUN apk update -RUN apk add --no-cache git g++ make python3 +RUN apk add musl-dev -RUN git config --global url."https://".insteadOf ssh:// +WORKDIR /usr/src/harry -COPY yarn.lock ./ -RUN yarn install --production +COPY . . +RUN cargo install --path . -# ============= Stage 3: Build ============ # -FROM dependencies AS build +# ========= Stage 2: Production ========= # +FROM alpine as production -COPY src/ src/ -COPY tsconfig.json ./ - -RUN yarn install -RUN yarn build - - -# ========== Stage 4: Production ========== # -FROM base AS production +WORKDIR /app -COPY --from=dependencies /app/node_modules node_modules/ -COPY --from=build /app/dist dist/ +COPY --from=builder /usr/local/cargo/bin/harry /app/harry -CMD yarn start \ No newline at end of file +CMD ./harry \ No newline at end of file diff --git a/README.md b/README.md index f13cd58..e0b222c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,19 @@ # Harry Harry est un bot Discord utilisé par le serveur Discord étudiant du BUT informatique à l'IUT de Reims. Pour l'instant, Harry n'est pas très utile, il ne permet que de configurer son identité sur le serveur. Harry sera sans doute plus utile dans un futur proche. Harry est actuellement développé par [Robin Bourachot](https://github.com/Ciborn), et certaines parties de son code ont été repris du bot [Aldebaran](https://github.com/Nightorn/Aldebaran). Harry est maintenu en vie par le [BDE de l'IUT](http://404cm.com/). ## Utilisation d'Harry -Harry peut être démarré en utilisant la commande `yarn install` puis `npm start`. Ses variables d'environnement doivent avoir préalablement été configurées dans un fichier `.env`, vous pouvez pour cela vous aider du fichier `.env.example`. + +Harry peut être démarré avec docker en utilisant ce `compose.yml` : +```yml +services: + harry: + image: ghcr.io/ciborn/harry:latest + volumes: + - ./config.yml:/app/config.yml +``` + +Le fichier `config.yml` doit être préalablement créé en s'inspirant du [config.example.yml](./config.example.yml). + ## Développement d'Harry -Harry est codé avec le langage TypeScript. Lorsque vous modifiez les fichiers d'Harry, vous devez les compiler avec `npm start` avant de pouvoir démarrer le bot. +Harry est codé avec le langage 🚀 Rust 🚀. + +Lorsque vous modifiez les fichiers d'Harry, vous pouvez le démarrer en utilisant le [compose.yml](./compose.yml) de développement. \ No newline at end of file diff --git a/compose.yml b/compose.yml new file mode 100644 index 0000000..25e8938 --- /dev/null +++ b/compose.yml @@ -0,0 +1,7 @@ +services: + harry: + build: + context: . + target: production + volumes: + - ./config.yaml:/app/config.yaml \ No newline at end of file diff --git a/config.example.yml b/config.example.yml new file mode 100644 index 0000000..3061530 --- /dev/null +++ b/config.example.yml @@ -0,0 +1,77 @@ +token: XXXXXXXX + +current_year: 2023 + +role_student: &role_student 970004649044242526 +role_alumni: &role_alumni 1000881342420103198 +role_vieux: &role_guest 1015650748845019156 +role_teacher: &role_teacher 1027620276080492605 + +groups: + - id: s1-td1 + name: S1/S2 - TD1 + roles: + - *role_student + - 1132599322505117716 + - id: s1-td2 + name: S1/S2 - TD2 + roles: + - *role_student + - 1132599408542883911 + - id: s1-td3 + name: S1/S2 - TD3 + roles: + - *role_student + - 1132599515531190302 + - id: s1-td4 + name: S1/S2 - TD4 + roles: + - *role_student + - 1132599566001258536 + - id: s3-td1 + name: S3/S4 - TD1 (Data) + roles: + - *role_student + - 1132599835669839923 + - id: s3-td2 + name: S3/S4 - TD2 (Dév. C++) + roles: + - *role_student + - 1132600095410495552 + - id: s3-td3 + name: S3/S4 - TD3 (Dév. C++) + roles: + - *role_student + - 1132600214063173753 + - id: s3-td4 + name: S3/S4 - TD4 (Dév. C#) + roles: + - *role_student + - 1132600273685188608 + - id: s5-td1 + name: S5/S6 - TD1 (Data) + roles: + - *role_student + - 1132601581322391674 + - id: s5-td2 + name: S5/S6 - TD2 (Dév.) + roles: + - *role_student + - 1132601802689355827 + - id: s5-td3 + name: S5/S6 - TD3 (Dév.) + roles: + - *role_student + - 1132601861858414662 + - id: alumni + name: Alumni + roles: + - *role_alumni + - id: guest + name: Invité + roles: + - *role_guest + - id: teacher + name: Professeur + roles: + - *role_teacher diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index 4714a0f..0000000 --- a/package-lock.json +++ /dev/null @@ -1,876 +0,0 @@ -{ - "name": "Harry", - "lockfileVersion": 2, - "requires": true, - "packages": { - "": { - "dependencies": { - "@discordjs/rest": "^1.0.1", - "array-shuffle": "^3.0.0", - "bufferutil": "^4.0.6", - "csv-parse": "^5.3.0", - "csv-stringify": "^6.2.0", - "discord-api-types": "^0.37.2", - "discord.js": "^14.2.0", - "dotenv": "^16.0.1", - "erlpack": "discord/erlpack", - "node-cron": "^3.0.2", - "rcon-client": "^4.2.3", - "typescript": "^4.7.4", - "utf-8-validate": "^5.0.9", - "zlib-sync": "^0.1.7" - } - }, - "node_modules/@discordjs/builders": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-1.1.0.tgz", - "integrity": "sha512-EO8TSltiIc9Z1wE854wAFvv5AccqEtvjFmao9PPoxQhRaJ0hEb7FwWRTCA1jGg4ZWI3hcp4m+RET5ufZQz3rOg==", - "license": "Apache-2.0", - "dependencies": { - "@sapphire/shapeshift": "^3.5.1", - "discord-api-types": "^0.36.3", - "fast-deep-equal": "^3.1.3", - "ts-mixer": "^6.0.1", - "tslib": "^2.4.0" - }, - "engines": { - "node": ">=16.9.0" - } - }, - "node_modules/@discordjs/builders/node_modules/discord-api-types": { - "version": "0.36.3", - "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.36.3.tgz", - "integrity": "sha512-bz/NDyG0KBo/tY14vSkrwQ/n3HKPf87a0WFW/1M9+tXYK+vp5Z5EksawfCWo2zkAc6o7CClc0eff1Pjrqznlwg==", - "license": "MIT" - }, - "node_modules/@discordjs/collection": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-1.0.1.tgz", - "integrity": "sha512-5V/wswzR3r2RVYXLxxg4TvrAnBhVCNgHTXhC+OUtLoriJ072rPMHo+Iw1SS1vrCckp8Es40XM411+WkNRPaXFw==", - "license": "Apache-2.0", - "engines": { - "node": ">=16.9.0" - } - }, - "node_modules/@discordjs/rest": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@discordjs/rest/-/rest-1.0.1.tgz", - "integrity": "sha512-w08CTKVzzYYvKxEjXKOs9AdS7KQ1J502TrPfF8eCZ2lF6AfKuMP/32YgDakiwIyYTDjEQS/v0nKLSFcncHRMtg==", - "license": "Apache-2.0", - "dependencies": { - "@discordjs/collection": "^1.0.1", - "@sapphire/async-queue": "^1.3.2", - "@sapphire/snowflake": "^3.2.2", - "discord-api-types": "^0.36.3", - "file-type": "^17.1.4", - "tslib": "^2.4.0", - "undici": "^5.8.0" - }, - "engines": { - "node": ">=16.9.0" - } - }, - "node_modules/@discordjs/rest/node_modules/discord-api-types": { - "version": "0.36.3", - "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.36.3.tgz", - "integrity": "sha512-bz/NDyG0KBo/tY14vSkrwQ/n3HKPf87a0WFW/1M9+tXYK+vp5Z5EksawfCWo2zkAc6o7CClc0eff1Pjrqznlwg==", - "license": "MIT" - }, - "node_modules/@sapphire/async-queue": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/@sapphire/async-queue/-/async-queue-1.4.0.tgz", - "integrity": "sha512-1npoLO1YPPXCsWCfuonsSdtHbPUo6dvjWUJtmUHiK8yDTmy00LbkpRkdV/UycA1fh+QsxwOPhgx2zu64Z+19ww==", - "license": "MIT", - "engines": { - "node": ">=v14.0.0", - "npm": ">=7.0.0" - } - }, - "node_modules/@sapphire/shapeshift": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/@sapphire/shapeshift/-/shapeshift-3.5.1.tgz", - "integrity": "sha512-7JFsW5IglyOIUQI1eE0g6h06D/Far6HqpcowRScgCiLSqTf3hhkPWCWotVTtVycnDCMYIwPeaw6IEPBomKC8pA==", - "license": "MIT", - "dependencies": { - "fast-deep-equal": "^3.1.3", - "lodash.uniqwith": "^4.5.0" - }, - "engines": { - "node": ">=v14.0.0", - "npm": ">=7.0.0" - } - }, - "node_modules/@sapphire/snowflake": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/@sapphire/snowflake/-/snowflake-3.2.2.tgz", - "integrity": "sha512-ula2O0kpSZtX9rKXNeQMrHwNd7E4jPDJYUXmEGTFdMRfyfMw+FPyh04oKMjAiDuOi64bYgVkOV3MjK+loImFhQ==", - "license": "MIT", - "engines": { - "node": ">=v14.0.0", - "npm": ">=7.0.0" - } - }, - "node_modules/@tokenizer/token": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/@tokenizer/token/-/token-0.3.0.tgz", - "integrity": "sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A==", - "license": "MIT" - }, - "node_modules/@types/node": { - "version": "18.7.6", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.6.tgz", - "integrity": "sha512-EdxgKRXgYsNITy5mjjXjVE/CS8YENSdhiagGrLqjG0pvA2owgJ6i4l7wy/PFZGC0B1/H20lWKN7ONVDNYDZm7A==", - "license": "MIT" - }, - "node_modules/@types/ws": { - "version": "8.5.3", - "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.3.tgz", - "integrity": "sha512-6YOoWjruKj1uLf3INHH7D3qTXwFfEsg1kf3c0uDdSBJwfa/llkwIjrAGV7j7mVgGNbzTQ3HiHKKDXl6bJPD97w==", - "license": "MIT", - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/array-shuffle": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/array-shuffle/-/array-shuffle-3.0.0.tgz", - "integrity": "sha512-rogEGxHOQPhslOhpg12LJkB+bbAl484/s2AJq0BxtzQDQfKl76fS2u9zWgg3p3b9ENcuvE7K8A7l5ddiPjCRnw==", - "license": "MIT", - "engines": { - "node": ">=12.20" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/bindings": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", - "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", - "license": "MIT", - "dependencies": { - "file-uri-to-path": "1.0.0" - } - }, - "node_modules/bufferutil": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.6.tgz", - "integrity": "sha512-jduaYOYtnio4aIAyc6UbvPCVcgq7nYpVnucyxr6eCYg/Woad9Hf/oxxBRDnGGjPfjUm6j5O/uBWhIu4iLebFaw==", - "hasInstallScript": true, - "license": "MIT", - "dependencies": { - "node-gyp-build": "^4.3.0" - }, - "engines": { - "node": ">=6.14.2" - } - }, - "node_modules/csv-parse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/csv-parse/-/csv-parse-5.3.0.tgz", - "integrity": "sha512-UXJCGwvJ2fep39purtAn27OUYmxB1JQto+zhZ4QlJpzsirtSFbzLvip1aIgziqNdZp/TptvsKEV5BZSxe10/DQ==", - "license": "MIT" - }, - "node_modules/csv-stringify": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/csv-stringify/-/csv-stringify-6.2.0.tgz", - "integrity": "sha512-dcUbQLRTTDcgQxgEU8V9IctkaCwHZjZfzUZ5ZB3RY8Y+pXtdtl5iVQHfGzANytFFkRKanYzBXrkfpNdGR7eviA==", - "license": "MIT" - }, - "node_modules/discord-api-types": { - "version": "0.37.2", - "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.37.2.tgz", - "integrity": "sha512-JS4q0LGRxqY7TIsfORlIMzcmews+Qu3RmOWrxoEY+BR0g0sZlplEyY/Ltb3om6ZaBm+WNcAmAJxlsmAu4068Vw==", - "license": "MIT" - }, - "node_modules/discord.js": { - "version": "14.2.0", - "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-14.2.0.tgz", - "integrity": "sha512-kIGhEeOB1d9k7whL9HCCuRuzK2GL7i/hTesYINOZ2szWm4TOsBVwRU+i9O/zDb2M+Gvff4SJ4EpAtCVV0okgVw==", - "license": "Apache-2.0", - "dependencies": { - "@discordjs/builders": "^1.1.0", - "@discordjs/collection": "^1.0.1", - "@discordjs/rest": "^1.0.1", - "@sapphire/snowflake": "^3.2.2", - "@types/ws": "^8.5.3", - "discord-api-types": "^0.36.3", - "fast-deep-equal": "^3.1.3", - "lodash.snakecase": "^4.1.1", - "tslib": "^2.4.0", - "undici": "^5.8.2", - "ws": "^8.8.1" - }, - "engines": { - "node": ">=16.9.0" - } - }, - "node_modules/discord.js/node_modules/discord-api-types": { - "version": "0.36.3", - "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.36.3.tgz", - "integrity": "sha512-bz/NDyG0KBo/tY14vSkrwQ/n3HKPf87a0WFW/1M9+tXYK+vp5Z5EksawfCWo2zkAc6o7CClc0eff1Pjrqznlwg==", - "license": "MIT" - }, - "node_modules/dotenv": { - "version": "16.0.1", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.1.tgz", - "integrity": "sha512-1K6hR6wtk2FviQ4kEiSjFiH5rpzEVi8WW0x96aztHVMhEspNpc4DVOUTEHtEva5VThQ8IaBX1Pe4gSzpVVUsKQ==", - "license": "BSD-2-Clause", - "engines": { - "node": ">=12" - } - }, - "node_modules/erlpack": { - "version": "0.1.3", - "resolved": "git+ssh://git@github.com/discord/erlpack.git#cbe76be04c2210fc9cb6ff95910f0937c1011d04", - "hasInstallScript": true, - "license": "MIT", - "dependencies": { - "bindings": "^1.5.0", - "nan": "^2.15.0" - } - }, - "node_modules/fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", - "license": "MIT" - }, - "node_modules/file-type": { - "version": "17.1.6", - "resolved": "https://registry.npmjs.org/file-type/-/file-type-17.1.6.tgz", - "integrity": "sha512-hlDw5Ev+9e883s0pwUsuuYNu4tD7GgpUnOvykjv1Gya0ZIjuKumthDRua90VUn6/nlRKAjcxLUnHNTIUWwWIiw==", - "license": "MIT", - "dependencies": { - "readable-web-to-node-stream": "^3.0.2", - "strtok3": "^7.0.0-alpha.9", - "token-types": "^5.0.0-alpha.2" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sindresorhus/file-type?sponsor=1" - } - }, - "node_modules/file-uri-to-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", - "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", - "license": "MIT" - }, - "node_modules/ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "BSD-3-Clause" - }, - "node_modules/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "license": "ISC" - }, - "node_modules/lodash.snakecase": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/lodash.snakecase/-/lodash.snakecase-4.1.1.tgz", - "integrity": "sha512-QZ1d4xoBHYUeuouhEq3lk3Uq7ldgyFXGBhg04+oRLnIz8o9T65Eh+8YdroUwn846zchkA9yDsDl5CVVaV2nqYw==", - "license": "MIT" - }, - "node_modules/lodash.uniqwith": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/lodash.uniqwith/-/lodash.uniqwith-4.5.0.tgz", - "integrity": "sha512-7lYL8bLopMoy4CTICbxygAUq6CdRJ36vFc80DucPueUee+d5NBRxz3FdT9Pes/HEx5mPoT9jwnsEJWz1N7uq7Q==", - "license": "MIT" - }, - "node_modules/nan": { - "version": "2.16.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.16.0.tgz", - "integrity": "sha512-UdAqHyFngu7TfQKsCBgAA6pWDkT8MAO7d0jyOecVhN5354xbLqdn8mV9Tat9gepAupm0bt2DbeaSC8vS52MuFA==", - "license": "MIT" - }, - "node_modules/node-cron": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/node-cron/-/node-cron-3.0.2.tgz", - "integrity": "sha512-iP8l0yGlNpE0e6q1o185yOApANRe47UPbLf4YxfbiNHt/RU5eBcGB/e0oudruheSf+LQeDMezqC5BVAb5wwRcQ==", - "dependencies": { - "uuid": "8.3.2" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/node-gyp-build": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.5.0.tgz", - "integrity": "sha512-2iGbaQBV+ITgCz76ZEjmhUKAKVf7xfY1sRl4UiKQspfZMH2h06SyhNsnSVy50cwkFQDGLyif6m/6uFXHkOZ6rg==", - "license": "MIT", - "bin": { - "node-gyp-build": "bin.js", - "node-gyp-build-optional": "optional.js", - "node-gyp-build-test": "build-test.js" - } - }, - "node_modules/peek-readable": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/peek-readable/-/peek-readable-5.0.0.tgz", - "integrity": "sha512-YtCKvLUOvwtMGmrniQPdO7MwPjgkFBtFIrmfSbYmYuq3tKDV/mcfAhBth1+C3ru7uXIZasc/pHnb+YDYNkkj4A==", - "license": "MIT", - "engines": { - "node": ">=14.16" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/Borewit" - } - }, - "node_modules/rcon-client": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/rcon-client/-/rcon-client-4.2.3.tgz", - "integrity": "sha512-g+DEzI3O0Nl4Y3mPp6DHhSpYeiv+wTq8iKxCumFGO0/SMCsdNfx9bpT5RyHa7phR5dvspKfQK0ZYJp1YCtXNng==", - "license": "MIT", - "dependencies": { - "typed-emitter": "^0.1.0" - } - }, - "node_modules/readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", - "license": "MIT", - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/readable-web-to-node-stream": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/readable-web-to-node-stream/-/readable-web-to-node-stream-3.0.2.tgz", - "integrity": "sha512-ePeK6cc1EcKLEhJFt/AebMCLL+GgSKhuygrZ/GLaKZYEecIgIECf4UaUuaByiGtzckwR4ain9VzUh95T1exYGw==", - "license": "MIT", - "dependencies": { - "readable-stream": "^3.6.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/Borewit" - } - }, - "node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT" - }, - "node_modules/string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "license": "MIT", - "dependencies": { - "safe-buffer": "~5.2.0" - } - }, - "node_modules/strtok3": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/strtok3/-/strtok3-7.0.0.tgz", - "integrity": "sha512-pQ+V+nYQdC5H3Q7qBZAz/MO6lwGhoC2gOAjuouGf/VO0m7vQRh8QNMl2Uf6SwAtzZ9bOw3UIeBukEGNJl5dtXQ==", - "license": "MIT", - "dependencies": { - "@tokenizer/token": "^0.3.0", - "peek-readable": "^5.0.0" - }, - "engines": { - "node": ">=14.16" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/Borewit" - } - }, - "node_modules/token-types": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/token-types/-/token-types-5.0.1.tgz", - "integrity": "sha512-Y2fmSnZjQdDb9W4w4r1tswlMHylzWIeOKpx0aZH9BgGtACHhrk3OkT52AzwcuqTRBZtvvnTjDBh8eynMulu8Vg==", - "license": "MIT", - "dependencies": { - "@tokenizer/token": "^0.3.0", - "ieee754": "^1.2.1" - }, - "engines": { - "node": ">=14.16" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/Borewit" - } - }, - "node_modules/ts-mixer": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/ts-mixer/-/ts-mixer-6.0.1.tgz", - "integrity": "sha512-hvE+ZYXuINrx6Ei6D6hz+PTim0Uf++dYbK9FFifLNwQj+RwKquhQpn868yZsCtJYiclZF1u8l6WZxxKi+vv7Rg==", - "license": "MIT" - }, - "node_modules/tslib": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", - "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==", - "license": "0BSD" - }, - "node_modules/typed-emitter": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/typed-emitter/-/typed-emitter-0.1.0.tgz", - "integrity": "sha512-Tfay0l6gJMP5rkil8CzGbLthukn+9BN/VXWcABVFPjOoelJ+koW8BuPZYk+h/L+lEeIp1fSzVRiWRPIjKVjPdg==", - "license": "MIT" - }, - "node_modules/typescript": { - "version": "4.7.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz", - "integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==", - "license": "Apache-2.0", - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=4.2.0" - } - }, - "node_modules/undici": { - "version": "5.8.2", - "resolved": "https://registry.npmjs.org/undici/-/undici-5.8.2.tgz", - "integrity": "sha512-3KLq3pXMS0Y4IELV045fTxqz04Nk9Ms7yfBBHum3yxsTR4XNn+ZCaUbf/mWitgYDAhsplQ0B1G4S5D345lMO3A==", - "license": "MIT", - "engines": { - "node": ">=12.18" - } - }, - "node_modules/utf-8-validate": { - "version": "5.0.9", - "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.9.tgz", - "integrity": "sha512-Yek7dAy0v3Kl0orwMlvi7TPtiCNrdfHNd7Gcc/pLq4BLXqfAmd0J7OWMizUQnTTJsyjKn02mU7anqwfmUP4J8Q==", - "hasInstallScript": true, - "license": "MIT", - "dependencies": { - "node-gyp-build": "^4.3.0" - }, - "engines": { - "node": ">=6.14.2" - } - }, - "node_modules/util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", - "license": "MIT" - }, - "node_modules/uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", - "bin": { - "uuid": "dist/bin/uuid" - } - }, - "node_modules/ws": { - "version": "8.8.1", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.8.1.tgz", - "integrity": "sha512-bGy2JzvzkPowEJV++hF07hAD6niYSr0JzBNo/J29WsB57A2r7Wlc1UFcTR9IzrPvuNVO4B8LGqF8qcpsVOhJCA==", - "license": "MIT", - "engines": { - "node": ">=10.0.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": "^5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } - } - }, - "node_modules/zlib-sync": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/zlib-sync/-/zlib-sync-0.1.7.tgz", - "integrity": "sha512-UmciU6ZrIwtwPC8noMzq+kGMdiWwNRZ3wC0SbED4Ew5Ikqx14MqDPRs/Pbk+3rZPh5SzsOgUBs1WRE0iieddpg==", - "license": "MIT", - "dependencies": { - "nan": "^2.14.0" - } - } - }, - "dependencies": { - "@discordjs/builders": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-1.1.0.tgz", - "integrity": "sha512-EO8TSltiIc9Z1wE854wAFvv5AccqEtvjFmao9PPoxQhRaJ0hEb7FwWRTCA1jGg4ZWI3hcp4m+RET5ufZQz3rOg==", - "requires": { - "@sapphire/shapeshift": "^3.5.1", - "discord-api-types": "^0.36.3", - "fast-deep-equal": "^3.1.3", - "ts-mixer": "^6.0.1", - "tslib": "^2.4.0" - }, - "dependencies": { - "discord-api-types": { - "version": "0.36.3", - "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.36.3.tgz", - "integrity": "sha512-bz/NDyG0KBo/tY14vSkrwQ/n3HKPf87a0WFW/1M9+tXYK+vp5Z5EksawfCWo2zkAc6o7CClc0eff1Pjrqznlwg==" - } - } - }, - "@discordjs/collection": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-1.0.1.tgz", - "integrity": "sha512-5V/wswzR3r2RVYXLxxg4TvrAnBhVCNgHTXhC+OUtLoriJ072rPMHo+Iw1SS1vrCckp8Es40XM411+WkNRPaXFw==" - }, - "@discordjs/rest": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@discordjs/rest/-/rest-1.0.1.tgz", - "integrity": "sha512-w08CTKVzzYYvKxEjXKOs9AdS7KQ1J502TrPfF8eCZ2lF6AfKuMP/32YgDakiwIyYTDjEQS/v0nKLSFcncHRMtg==", - "requires": { - "@discordjs/collection": "^1.0.1", - "@sapphire/async-queue": "^1.3.2", - "@sapphire/snowflake": "^3.2.2", - "discord-api-types": "^0.36.3", - "file-type": "^17.1.4", - "tslib": "^2.4.0", - "undici": "^5.8.0" - }, - "dependencies": { - "discord-api-types": { - "version": "0.36.3", - "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.36.3.tgz", - "integrity": "sha512-bz/NDyG0KBo/tY14vSkrwQ/n3HKPf87a0WFW/1M9+tXYK+vp5Z5EksawfCWo2zkAc6o7CClc0eff1Pjrqznlwg==" - } - } - }, - "@sapphire/async-queue": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/@sapphire/async-queue/-/async-queue-1.4.0.tgz", - "integrity": "sha512-1npoLO1YPPXCsWCfuonsSdtHbPUo6dvjWUJtmUHiK8yDTmy00LbkpRkdV/UycA1fh+QsxwOPhgx2zu64Z+19ww==" - }, - "@sapphire/shapeshift": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/@sapphire/shapeshift/-/shapeshift-3.5.1.tgz", - "integrity": "sha512-7JFsW5IglyOIUQI1eE0g6h06D/Far6HqpcowRScgCiLSqTf3hhkPWCWotVTtVycnDCMYIwPeaw6IEPBomKC8pA==", - "requires": { - "fast-deep-equal": "^3.1.3", - "lodash.uniqwith": "^4.5.0" - } - }, - "@sapphire/snowflake": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/@sapphire/snowflake/-/snowflake-3.2.2.tgz", - "integrity": "sha512-ula2O0kpSZtX9rKXNeQMrHwNd7E4jPDJYUXmEGTFdMRfyfMw+FPyh04oKMjAiDuOi64bYgVkOV3MjK+loImFhQ==" - }, - "@tokenizer/token": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/@tokenizer/token/-/token-0.3.0.tgz", - "integrity": "sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A==" - }, - "@types/node": { - "version": "18.7.6", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.6.tgz", - "integrity": "sha512-EdxgKRXgYsNITy5mjjXjVE/CS8YENSdhiagGrLqjG0pvA2owgJ6i4l7wy/PFZGC0B1/H20lWKN7ONVDNYDZm7A==" - }, - "@types/ws": { - "version": "8.5.3", - "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.3.tgz", - "integrity": "sha512-6YOoWjruKj1uLf3INHH7D3qTXwFfEsg1kf3c0uDdSBJwfa/llkwIjrAGV7j7mVgGNbzTQ3HiHKKDXl6bJPD97w==", - "requires": { - "@types/node": "*" - } - }, - "array-shuffle": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/array-shuffle/-/array-shuffle-3.0.0.tgz", - "integrity": "sha512-rogEGxHOQPhslOhpg12LJkB+bbAl484/s2AJq0BxtzQDQfKl76fS2u9zWgg3p3b9ENcuvE7K8A7l5ddiPjCRnw==" - }, - "bindings": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", - "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", - "requires": { - "file-uri-to-path": "1.0.0" - } - }, - "bufferutil": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.6.tgz", - "integrity": "sha512-jduaYOYtnio4aIAyc6UbvPCVcgq7nYpVnucyxr6eCYg/Woad9Hf/oxxBRDnGGjPfjUm6j5O/uBWhIu4iLebFaw==", - "requires": { - "node-gyp-build": "^4.3.0" - } - }, - "csv-parse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/csv-parse/-/csv-parse-5.3.0.tgz", - "integrity": "sha512-UXJCGwvJ2fep39purtAn27OUYmxB1JQto+zhZ4QlJpzsirtSFbzLvip1aIgziqNdZp/TptvsKEV5BZSxe10/DQ==" - }, - "csv-stringify": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/csv-stringify/-/csv-stringify-6.2.0.tgz", - "integrity": "sha512-dcUbQLRTTDcgQxgEU8V9IctkaCwHZjZfzUZ5ZB3RY8Y+pXtdtl5iVQHfGzANytFFkRKanYzBXrkfpNdGR7eviA==" - }, - "discord-api-types": { - "version": "0.37.2", - "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.37.2.tgz", - "integrity": "sha512-JS4q0LGRxqY7TIsfORlIMzcmews+Qu3RmOWrxoEY+BR0g0sZlplEyY/Ltb3om6ZaBm+WNcAmAJxlsmAu4068Vw==" - }, - "discord.js": { - "version": "14.2.0", - "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-14.2.0.tgz", - "integrity": "sha512-kIGhEeOB1d9k7whL9HCCuRuzK2GL7i/hTesYINOZ2szWm4TOsBVwRU+i9O/zDb2M+Gvff4SJ4EpAtCVV0okgVw==", - "requires": { - "@discordjs/builders": "^1.1.0", - "@discordjs/collection": "^1.0.1", - "@discordjs/rest": "^1.0.1", - "@sapphire/snowflake": "^3.2.2", - "@types/ws": "^8.5.3", - "discord-api-types": "^0.36.3", - "fast-deep-equal": "^3.1.3", - "lodash.snakecase": "^4.1.1", - "tslib": "^2.4.0", - "undici": "^5.8.2", - "ws": "^8.8.1" - }, - "dependencies": { - "discord-api-types": { - "version": "0.36.3", - "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.36.3.tgz", - "integrity": "sha512-bz/NDyG0KBo/tY14vSkrwQ/n3HKPf87a0WFW/1M9+tXYK+vp5Z5EksawfCWo2zkAc6o7CClc0eff1Pjrqznlwg==" - } - } - }, - "dotenv": { - "version": "16.0.1", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.1.tgz", - "integrity": "sha512-1K6hR6wtk2FviQ4kEiSjFiH5rpzEVi8WW0x96aztHVMhEspNpc4DVOUTEHtEva5VThQ8IaBX1Pe4gSzpVVUsKQ==" - }, - "erlpack": { - "version": "git+ssh://git@github.com/discord/erlpack.git#cbe76be04c2210fc9cb6ff95910f0937c1011d04", - "from": "erlpack@discord/erlpack", - "requires": { - "bindings": "^1.5.0", - "nan": "^2.15.0" - } - }, - "fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" - }, - "file-type": { - "version": "17.1.6", - "resolved": "https://registry.npmjs.org/file-type/-/file-type-17.1.6.tgz", - "integrity": "sha512-hlDw5Ev+9e883s0pwUsuuYNu4tD7GgpUnOvykjv1Gya0ZIjuKumthDRua90VUn6/nlRKAjcxLUnHNTIUWwWIiw==", - "requires": { - "readable-web-to-node-stream": "^3.0.2", - "strtok3": "^7.0.0-alpha.9", - "token-types": "^5.0.0-alpha.2" - } - }, - "file-uri-to-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", - "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==" - }, - "ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" - }, - "inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" - }, - "lodash.snakecase": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/lodash.snakecase/-/lodash.snakecase-4.1.1.tgz", - "integrity": "sha512-QZ1d4xoBHYUeuouhEq3lk3Uq7ldgyFXGBhg04+oRLnIz8o9T65Eh+8YdroUwn846zchkA9yDsDl5CVVaV2nqYw==" - }, - "lodash.uniqwith": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/lodash.uniqwith/-/lodash.uniqwith-4.5.0.tgz", - "integrity": "sha512-7lYL8bLopMoy4CTICbxygAUq6CdRJ36vFc80DucPueUee+d5NBRxz3FdT9Pes/HEx5mPoT9jwnsEJWz1N7uq7Q==" - }, - "nan": { - "version": "2.16.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.16.0.tgz", - "integrity": "sha512-UdAqHyFngu7TfQKsCBgAA6pWDkT8MAO7d0jyOecVhN5354xbLqdn8mV9Tat9gepAupm0bt2DbeaSC8vS52MuFA==" - }, - "node-cron": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/node-cron/-/node-cron-3.0.2.tgz", - "integrity": "sha512-iP8l0yGlNpE0e6q1o185yOApANRe47UPbLf4YxfbiNHt/RU5eBcGB/e0oudruheSf+LQeDMezqC5BVAb5wwRcQ==", - "requires": { - "uuid": "8.3.2" - } - }, - "node-gyp-build": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.5.0.tgz", - "integrity": "sha512-2iGbaQBV+ITgCz76ZEjmhUKAKVf7xfY1sRl4UiKQspfZMH2h06SyhNsnSVy50cwkFQDGLyif6m/6uFXHkOZ6rg==" - }, - "peek-readable": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/peek-readable/-/peek-readable-5.0.0.tgz", - "integrity": "sha512-YtCKvLUOvwtMGmrniQPdO7MwPjgkFBtFIrmfSbYmYuq3tKDV/mcfAhBth1+C3ru7uXIZasc/pHnb+YDYNkkj4A==" - }, - "rcon-client": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/rcon-client/-/rcon-client-4.2.3.tgz", - "integrity": "sha512-g+DEzI3O0Nl4Y3mPp6DHhSpYeiv+wTq8iKxCumFGO0/SMCsdNfx9bpT5RyHa7phR5dvspKfQK0ZYJp1YCtXNng==", - "requires": { - "typed-emitter": "^0.1.0" - } - }, - "readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", - "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - } - }, - "readable-web-to-node-stream": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/readable-web-to-node-stream/-/readable-web-to-node-stream-3.0.2.tgz", - "integrity": "sha512-ePeK6cc1EcKLEhJFt/AebMCLL+GgSKhuygrZ/GLaKZYEecIgIECf4UaUuaByiGtzckwR4ain9VzUh95T1exYGw==", - "requires": { - "readable-stream": "^3.6.0" - } - }, - "safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" - }, - "string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "requires": { - "safe-buffer": "~5.2.0" - } - }, - "strtok3": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/strtok3/-/strtok3-7.0.0.tgz", - "integrity": "sha512-pQ+V+nYQdC5H3Q7qBZAz/MO6lwGhoC2gOAjuouGf/VO0m7vQRh8QNMl2Uf6SwAtzZ9bOw3UIeBukEGNJl5dtXQ==", - "requires": { - "@tokenizer/token": "^0.3.0", - "peek-readable": "^5.0.0" - } - }, - "token-types": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/token-types/-/token-types-5.0.1.tgz", - "integrity": "sha512-Y2fmSnZjQdDb9W4w4r1tswlMHylzWIeOKpx0aZH9BgGtACHhrk3OkT52AzwcuqTRBZtvvnTjDBh8eynMulu8Vg==", - "requires": { - "@tokenizer/token": "^0.3.0", - "ieee754": "^1.2.1" - } - }, - "ts-mixer": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/ts-mixer/-/ts-mixer-6.0.1.tgz", - "integrity": "sha512-hvE+ZYXuINrx6Ei6D6hz+PTim0Uf++dYbK9FFifLNwQj+RwKquhQpn868yZsCtJYiclZF1u8l6WZxxKi+vv7Rg==" - }, - "tslib": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", - "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" - }, - "typed-emitter": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/typed-emitter/-/typed-emitter-0.1.0.tgz", - "integrity": "sha512-Tfay0l6gJMP5rkil8CzGbLthukn+9BN/VXWcABVFPjOoelJ+koW8BuPZYk+h/L+lEeIp1fSzVRiWRPIjKVjPdg==" - }, - "typescript": { - "version": "4.7.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz", - "integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==" - }, - "undici": { - "version": "5.8.2", - "resolved": "https://registry.npmjs.org/undici/-/undici-5.8.2.tgz", - "integrity": "sha512-3KLq3pXMS0Y4IELV045fTxqz04Nk9Ms7yfBBHum3yxsTR4XNn+ZCaUbf/mWitgYDAhsplQ0B1G4S5D345lMO3A==" - }, - "utf-8-validate": { - "version": "5.0.9", - "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.9.tgz", - "integrity": "sha512-Yek7dAy0v3Kl0orwMlvi7TPtiCNrdfHNd7Gcc/pLq4BLXqfAmd0J7OWMizUQnTTJsyjKn02mU7anqwfmUP4J8Q==", - "requires": { - "node-gyp-build": "^4.3.0" - } - }, - "util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" - }, - "uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==" - }, - "ws": { - "version": "8.8.1", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.8.1.tgz", - "integrity": "sha512-bGy2JzvzkPowEJV++hF07hAD6niYSr0JzBNo/J29WsB57A2r7Wlc1UFcTR9IzrPvuNVO4B8LGqF8qcpsVOhJCA==", - "requires": {} - }, - "zlib-sync": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/zlib-sync/-/zlib-sync-0.1.7.tgz", - "integrity": "sha512-UmciU6ZrIwtwPC8noMzq+kGMdiWwNRZ3wC0SbED4Ew5Ikqx14MqDPRs/Pbk+3rZPh5SzsOgUBs1WRE0iieddpg==", - "requires": { - "nan": "^2.14.0" - } - } - } -} diff --git a/package.json b/package.json deleted file mode 100644 index 6c21059..0000000 --- a/package.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "dependencies": { - "@discordjs/builders": "^1.6.4", - "@discordjs/rest": "^1.0.1", - "array-shuffle": "^3.0.0", - "bufferutil": "^4.0.6", - "csv-parse": "^5.3.0", - "csv-stringify": "^6.2.0", - "discord-api-types": "^0.37.2", - "discord.js": "^14.2.0", - "dotenv": "^16.0.1", - "erlpack": "discord/erlpack", - "node-cron": "^3.0.2", - "rcon-client": "^4.2.3", - "utf-8-validate": "^5.0.9", - "zlib-sync": "^0.1.7" - }, - "devDependencies": { - "typescript": "^4.7.4" - }, - "scripts": { - "build": "tsc", - "start": "node --require dotenv/config dist/app.js" - }, - "type": "module" -} diff --git a/src/app.ts b/src/app.ts deleted file mode 100644 index 4c51bb9..0000000 --- a/src/app.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { REST } from "@discordjs/rest"; -import { Routes } from "discord-api-types/v10"; -import { Client } from "discord.js"; -import AdventReward from "./commands/advent-reward.js"; -import BuddyManageCommand from "./commands/buddy-manage.js"; -import BuddyOptoutCommand from "./commands/buddy-optout.js"; -import BuddySignupCommand from "./commands/buddy-signup.js"; -import McwhitelistCommand from "./commands/mcwhitelist.js"; -import SignupCommand from "./commands/signup.js"; -import interactionCreate from "./events/interactionCreate.js"; -import CommandHandler from "./handlers/CommandHandler.js"; -import SwitchclassCommand from "./commands/switch-class.js"; - -const clientId = process.env.DISCORD_CLIENT_ID; -const token = process.env.DISCORD_TOKEN; - -const commands = new CommandHandler(); -commands.register( - SignupCommand, - McwhitelistCommand, - BuddyManageCommand, - BuddyOptoutCommand, - BuddySignupCommand, - AdventReward, - SwitchclassCommand, -); - -if (process.env.DEPLOY_SLASH) { - const rest = new REST({ version: "10" }).setToken(token); - const slash = Array.from(commands.commands.values()); - const body = slash.map(c => c.toSlashCommand().toJSON()); - rest.put(Routes.applicationCommands(clientId), { body }) - .then(() => console.log("Slash commands registered")) - .catch(console.error); -} - -const client = new Client({ - intents: [ "GuildMembers" ] -}); - -client.login(process.env.token).then(() => { - console.log(`Connecté aux serveurs Discord !`); - - Promise.all([ - client.application.commands.fetch(), - client.guilds.cache.get(process.env.MAIN_SERVER_ID).channels.fetch(), - client.guilds.cache.get(process.env.MAIN_SERVER_ID).members.fetch(), - client.guilds.cache.get(process.env.MAIN_SERVER_ID).roles.fetch(), - ]).then(() => { - client.on("interactionCreate", interaction => { - interactionCreate(commands, interaction); - }); - }); -}); diff --git a/src/commands/advent-reward.ts b/src/commands/advent-reward.ts deleted file mode 100644 index 1e1d1e5..0000000 --- a/src/commands/advent-reward.ts +++ /dev/null @@ -1,170 +0,0 @@ -import { ActionRowBuilder, Attachment, ButtonBuilder, ButtonStyle, Client, CommandInteraction, EmbedBuilder, TextChannel } from "discord.js"; -import { readFile, writeFile } from "fs/promises"; -import Command from "../structures/Command.js"; - -const ADVENT_FILE = "cache/advent.json"; - -const looksGoodButton = new ButtonBuilder() - .setCustomId("good") - .setEmoji("✅") - .setLabel("ça rend bien") - .setStyle(ButtonStyle.Success); - -const looksBadButton = new ButtonBuilder() - .setCustomId("bad") - .setEmoji("❌") - .setLabel("on annule tout") - .setStyle(ButtonStyle.Danger); - -const claimGiftButton = new ButtonBuilder() - .setCustomId("claim") - .setEmoji("✅") - .setLabel("Récupérer le cadeau") - .setStyle(ButtonStyle.Success); - -const giveGiftButton = new ButtonBuilder() - .setCustomId("give") - .setEmoji("🎁") - .setLabel("Donner le cadeau") - .setStyle(ButtonStyle.Secondary); - -const looksButtons = new ActionRowBuilder() - .addComponents(looksGoodButton, looksBadButton); - -const claimButtons = new ActionRowBuilder() - .addComponents(claimGiftButton, giveGiftButton); - -async function readWinners() { - try { - const file = await readFile(ADVENT_FILE, { encoding: "utf-8" }); - - return JSON.parse(file).winners as string[]; - } catch(err) { - writeIntoFile([]); - } - - return [] -} - -async function writeIntoFile(winners: string[]) { - await writeFile(ADVENT_FILE, JSON.stringify({ winners })); -} - -async function writeWinner(id: string) { - return writeIntoFile([...await readWinners(), id]); -} - -async function reward( - client: Client, - text: string, - embed: EmbedBuilder, - skip: string[] = [] -) { - const channel = client.channels.cache.get(process.env.ADVENT_CHANNEL_ID) as TextChannel; - - const winners = await readWinners(); - const user = client.guilds.cache - .get(process.env.MAIN_SERVER_ID).members.cache - .filter(m => - m.roles.cache.has(process.env.ADHERENT_ROLE_ID) - && !m.roles.cache.has(process.env.FAKE_BINHARRY_ROLE_ID) - && !skip.includes(m.id) - && !winners.includes(m.id)) - .random(); - - const content = text.replace("{user}", `${user}`); - channel.send({ - content: `${user}`, - embeds: [embed.setDescription(content)], - components: [claimButtons], - }).then(message => { - message.awaitMessageComponent({ - filter: i => i.user.equals(user.user), - time: 18000000, - }).then(claim => { - if (claim.customId === "claim") { - claim.update({ - content: `*${user} a récupéré son cadeau !*`, - components: [], - }); - writeWinner(user.id); - } else if (claim.customId === "give") { - claim.update({ - content: `${user} a décidé de donner son cadeau à quelqu'un d'autre...`, - components: [], - embeds: [], - }); - reward(client, text, embed, [...skip, user.id]); - } - }).catch(() => { - message.edit({ - content: `${user} n'a pas récupéré son cadeau...`, - components: [], - embeds: [] - }); - writeWinner(user.id); - reward(client, text, embed, [...skip, user.id]); - }); - }); -} - -export default class AdventReward extends Command { - constructor() { - super("advent-reward", { - description: "Donnez un cadeau de l'Avent à votre adhérent préféré", - args: { - text: { as: "string", desc: "Ce que vous voulez dire au grand gagnant" }, - image: { as: "attachment", desc: "Une image correspondant au lot à faire gagner", optional: true }, - }, - }); - } - - async run(interaction: CommandInteraction) { - const image = interaction.options.get("image")?.attachment as Attachment | null; - const text = interaction.options.get("text").value as string; - - const embed = new EmbedBuilder() - .setAuthor({ - iconURL: interaction.client.user.avatarURL(), - name: "BDE Bin'Harry", - }) - .setDescription(text.replace("{user}", `${interaction.user}`)) - .setColor("#00a6ed"); - - if (image) { - embed.setImage(image.url); - } - - interaction.reply({ - content: `Le message suivant sera envoyé à 8h :\n\n${interaction.user}`, - components: [looksButtons], - embeds: [embed], - }).then(message => { - message - .awaitMessageComponent({ filter: i => i.user.equals(interaction.user) }) - .then(confirm => { - if (confirm.customId === "good") { - const now = new Date(); - const next = now.getHours() >= 8 - ? new Date(now.getFullYear(), now.getMonth(), now.getDate() + 1, 8) - : new Date(now.getFullYear(), now.getMonth(), now.getDate(), 8); - const delay = next.getTime() - now.getTime(); - - confirm.update({ - content: "il y a plus qu'à attendre", - components: [], - embeds: [] - }); - - setTimeout(reward, delay, interaction.client, text, embed); - } else if (confirm.customId === "bad") { - confirm.update({ - content: "on annule tout", - components: [], - embeds: [], - }); - } - }); - }); - } -} diff --git a/src/commands/buddy-manage.ts b/src/commands/buddy-manage.ts deleted file mode 100644 index 672d015..0000000 --- a/src/commands/buddy-manage.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { AttachmentBuilder, CommandInteraction } from "discord.js"; -import { readFile, writeFile } from "fs/promises"; -import { stringify } from "csv-stringify/sync"; -import { parse } from "csv-parse/sync"; -import Command from "../structures/Command.js"; - -const magicUtf8 = Buffer.from([0xef, 0xbb, 0xbf]); // let Excel know the CSV is UTF8-formatted - -function exportCsv(couples: string[][], interaction: CommandInteraction) { - const users = interaction.guild.members.cache; - const userCouples = []; - - for (const [s1Id, s3Id] of couples) { - const s1 = users.get(s1Id)?.displayName || ""; - const s3 = users.get(s3Id)?.displayName || ""; - userCouples.push([s1, s3]); - } - - const csvBuffer = Buffer.from(stringify(userCouples, { delimiter: ";" })); - const buffer = Buffer.concat([magicUtf8, csvBuffer]); - const attachment = new AttachmentBuilder(buffer, { name: "buddy.csv" }); - - return interaction.reply({ files: [attachment], ephemeral: true }); -} - -export default class BuddyManageCommand extends Command { - constructor() { - super("buddy-manage", { - description: "Gérez la liste des associations parrain-filleul" - }); - } - - async run(interaction: CommandInteraction) { - readFile("./cache/buddy.csv", { encoding: "utf-8" }).then(file => { - const csv: string[][] = parse(file, { delimiter: ";" }); - return exportCsv(csv, interaction); - }).catch(async () => { - const couples = [["", ""]] - const csv = stringify(couples, { delimiter: ";" }) - await writeFile("./cache/buddy.csv", csv); - - return exportCsv(couples, interaction); - }); - } -} diff --git a/src/commands/buddy-optout.ts b/src/commands/buddy-optout.ts deleted file mode 100644 index c4cfddb..0000000 --- a/src/commands/buddy-optout.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { parse } from "csv-parse/sync"; -import { stringify } from "csv-stringify/sync"; -import { CommandInteraction } from "discord.js"; -import { readFile, writeFile } from "fs/promises"; -import Command from "../structures/Command.js"; - -export default class BuddyOptoutCommand extends Command { - constructor() { - super("buddy-optout", { - description: "Désinscrivez-vous du système de parrainage" - }); - } - - async run(interaction: CommandInteraction) { - const userId = interaction.user.id; - - const file = await readFile("./cache/buddy.csv", { encoding: "utf-8" }); - const couples: string[][] = parse(file, { delimiter: ";" }); - - const s1 = couples.map(c => c[0]); - const s3 = couples.map(c => c[1]); - - if (s1.includes(userId)) { - s1[s1.indexOf(userId)] = ""; - } else if (s3.includes(userId)) { - s3[s3.indexOf(userId)] = ""; - } else { - return interaction.reply({ - content: "Vous n'êtes pas inscrits au système de parrainage !", - ephemeral: true - }); - } - - interaction.reply({ - content: "Vous vous êtes désinscrits du système de parrainage !", - ephemeral: true - }); - - const csvCouples = s1.map((s, i) => [s, s3[i]]); - const csv = stringify(csvCouples, { delimiter: ";" }); - await writeFile("./cache/buddy.csv", csv); - } -} diff --git a/src/commands/buddy-signup.ts b/src/commands/buddy-signup.ts deleted file mode 100644 index c7c8f10..0000000 --- a/src/commands/buddy-signup.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { parse } from "csv-parse/sync"; -import { stringify } from "csv-stringify/sync"; -import { CommandInteraction, GuildMember } from "discord.js"; -import { readFile, writeFile } from "fs/promises"; -import Command from "../structures/Command.js"; - -const promoRegex = /TD[1-5] \((?S[13])&[24]\)/; - -export default class BuddySignupCommand extends Command { - constructor() { - super("buddy-signup", { - description: "Inscrivez-vous au système de parrainage" - }); - } - - async run(interaction: CommandInteraction) { - const member = interaction.member as GuildMember; - const { promo } = member.roles.cache - .find(r => r.name.includes("TD"))?.name - .match(promoRegex).groups; - - const file = await readFile("./cache/buddy.csv", { encoding: "utf-8" }); - const couples: string[][] = parse(file, { delimiter: ";" }); - const s1 = couples.map(c => c[0]); - const s3 = couples.map(c => c[1]); - - if (promo === "S1" && !s1.includes(member.id)) { - const i = s1.findIndex(s => s === ""); - i !== -1 ? s1[i] = member.id : s1.push(member.id); - } else if (promo === "S3" && !s3.includes(member.id)) { - const i = s3.findIndex(s => s === ""); - i !== -1 ? s3[i] = member.id : s3.push(member.id); - } else { - return interaction.reply({ - content: "Vous vous êtes déjà inscrits au système de parrainage !", - ephemeral: true - }); - } - - const csvCouples = s1.length > s3.length - ? s1.map((s, i) => [s, s3[i]]) - : s3.map((s, i) => [s1[i], s]); - const csv = stringify(csvCouples, { delimiter: ";" }); - await writeFile("./cache/buddy.csv", csv); - - interaction.reply({ - content: "Vous vous êtes inscrits au système de parrainage !", - ephemeral: true - }); - } -} diff --git a/src/commands/mcwhitelist.ts b/src/commands/mcwhitelist.ts deleted file mode 100644 index 5ff23cb..0000000 --- a/src/commands/mcwhitelist.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { BaseGuildTextChannel, CommandInteraction, GuildMember } from "discord.js"; -import { Rcon } from "rcon-client"; -import Command from "../structures/Command.js"; - -const host = process.env.MC_SERVER_RCON_HOST; -const port = Number(process.env.MC_SERVER_RCON_PORT); -const password = process.env.MC_SERVER_RCON_PASS; -const channel = process.env.MC_CHANNEL_WHITELISTED; - -export default class McwhitelistCommand extends Command { - constructor() { - super("mcwhitelist", { - description: "Whitelistez-vous sur le serveur Minecraft du BDE", - args: { - nickname: { as: "string", desc: "Votre pseudo Minecraft" } - } - }); - } - - async run(interaction: CommandInteraction) { - const nickname = interaction.options.get("nickname").value as string; - - const member = interaction.member as GuildMember; - const minecraftRole = interaction.guild.roles.cache - .find(r => r.name === "Minecraft"); - const whitelisted = await interaction.guild.channels - .fetch(channel) as BaseGuildTextChannel; - - const rcon = await Rcon.connect({ host, port, password }); - - Promise.all([ - rcon.send(`whitelist add ${nickname}`), - member.roles.add(minecraftRole) - ]).then(() => { - interaction.reply({ - content: "Vous avez été whitelisté sur le serveur Minecraft avec succès !", - ephemeral: true - }); - whitelisted.send(`${interaction.user} s'est whitelisté en tant que **${nickname}**.`); - }).catch(err => { - console.error(err); - interaction.reply({ - content: "Quelque chose s'est mal passé ! Veuillez contacter un administrateur du serveur.", - ephemeral: true - }); - }); - } -} diff --git a/src/commands/mod.rs b/src/commands/mod.rs new file mode 100644 index 0000000..4627cef --- /dev/null +++ b/src/commands/mod.rs @@ -0,0 +1,2 @@ +pub mod signup; +pub mod switch_class; diff --git a/src/commands/signup.rs b/src/commands/signup.rs new file mode 100644 index 0000000..60be955 --- /dev/null +++ b/src/commands/signup.rs @@ -0,0 +1,45 @@ +use poise::serenity_prelude::CacheHttp; + +use crate::{ + config::{Group, CONFIG}, + Context, Error, +}; + +/// Renseignez votre identité pour accéder au serveur +#[poise::command(slash_command)] +pub async fn inscription( + ctx: Context<'_>, + #[description = "Votre prénom"] prenom: String, + #[description = "Votre nom"] nom: String, + #[description = "Votre classe (ou catégorie)"] groupe: Group, +) -> Result<(), Error> { + let member = ctx.author_member().await.unwrap(); + + // checks that the user is not already registered + if CONFIG.roles_contains(member.roles.as_slice()) { + ctx.send(|reply| { + reply + .content("Il semblerait que vous soyez déjà inscrit. Pour changer de classe, utilisez la commande /changer-classe.") + .ephemeral(true) + }).await?; + + return Ok(()); + } + + member + .edit(ctx.http(), |edit| { + edit.nickname(format!("{} {}", prenom, nom)) + }) + .await? + .add_roles(ctx.http(), groupe.to_roleids().as_slice()) + .await?; + + ctx.send(|reply| { + reply + .content("Vous avez été identifié avec succès !") + .ephemeral(true) + }) + .await?; + + Ok(()) +} diff --git a/src/commands/signup.ts b/src/commands/signup.ts deleted file mode 100644 index 285f3ac..0000000 --- a/src/commands/signup.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { CommandInteraction, GuildMember } from "discord.js"; -import Command from "../structures/Command.js"; -import { groups } from "../utils/Constants.js"; - -const choices = Object.entries(groups) - .map(([value, { name }]) => ({ name, value })); - -function capitalize(name: string) { - return name - .toLowerCase() - .replace(/[ -]([a-z]){1}|(^[a-z]){1}/g, m => m.toUpperCase()); -} - -export default class SignupCommand extends Command { - constructor() { - super("inscription", { - description: "Renseignez votre identité pour accéder au serveur", - args: { - prenom: { as: "string", desc: "Votre prénom" }, - nom: { as: "string", desc: "Votre nom de famille" }, - groupe: { as: "choice", desc: "Votre classe (ou catégorie)", choices } - } - }); - } - - run(interaction: CommandInteraction) { - const firstname = interaction.options.get("prenom").value as string; - const lastname = interaction.options.get("nom").value as string; - const group = interaction.options.get("groupe").value as string; - - const member = interaction.member as GuildMember; - - Promise.all([ - member.setNickname(capitalize(`${firstname} ${lastname}`)), - member.roles.add(groups[group].roles) - ]).then(() => { - interaction.reply({ - content: "Vous avez été identifié avec succès !", - ephemeral: true - }); - }).catch(err => { - console.error(err); - interaction.reply({ - content: "Quelque chose s'est mal passé ! Veuillez contacter un administrateur du serveur.", - ephemeral: true - }); - }); - } -} diff --git a/src/commands/switch-class.ts b/src/commands/switch-class.ts deleted file mode 100644 index c9c0a24..0000000 --- a/src/commands/switch-class.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { CommandInteraction, GuildMember } from "discord.js"; -import Command from "../structures/Command.js"; -import { groups } from "../utils/Constants.js"; - -const choices = Object.entries(groups) - .map(([value, { name }]) => ({ name, value })); - -const globalRoles = [ - process.env.ROLE_ID_STUDENT, - process.env.ROLE_ID_TEACHER, - process.env.ROLE_ID_ALUMNI, - process.env.ROLE_ID_GUEST, -]; - -export default class SwitchclassCommand extends Command { - constructor() { - super("changer-classe", { - description: "Nouvelle année, nouveau groupe !", - args: { - groupe: { as: "choice", desc: "Votre classe (ou catégorie)", choices }, - } - }) - } - - async run(interaction: CommandInteraction) { - const group = interaction.options.get("groupe").value as string; - - const member = interaction.member as GuildMember; - - if (member.roles.cache.find(r => r.name.includes('[2023] '))) { - interaction.reply({ - content: "Il semblerait que vous ayez déjà sélectionné votre groupe pour l'année universitaire 2023-2024.\nSi vous avez fait une erreur dans la sélection de votre classe, veuillez le signaler aux administrateurs du serveur.", - ephemeral: true, - }); - } else { - const roles = groups[group].roles; - - // warning: bad workaround for stupid issue - // https://github.com/discordjs/discord.js/issues/8165 - - // Add roles matching the selected group and remove previously given roles no longer matching the active group - member.roles.add(roles).then(() => { - member.roles.remove(globalRoles.filter(r => !roles.includes(r))).then(() => { - interaction.reply({ - content: "Votre nouveau groupe pour la nouvelle année universitaire a bien été sélectionné !\nDans le doute, vérifiez que vos rôles sont bien en adéquation avec votre groupe.", - ephemeral: true - }); - }).catch(err => { - console.error(err); - interaction.reply({ - content: "Quelque chose s'est mal passé ! Veuillez contacter les administrateurs du serveur.", - ephemeral: true - }); - }); - }).catch(err => { - console.error(err); - interaction.reply({ - content: "Quelque chose s'est mal passé ! Veuillez contacter les administrateurs du serveur.", - ephemeral: true - }); - }); - } - } -} diff --git a/src/commands/switch_class.rs b/src/commands/switch_class.rs new file mode 100644 index 0000000..59856f3 --- /dev/null +++ b/src/commands/switch_class.rs @@ -0,0 +1,52 @@ +use poise::serenity_prelude::CacheHttp; + +use crate::{ + config::{Group, CONFIG}, + Context, Error, +}; + +/// Nouvelle année, nouveau groupe ! +#[poise::command(slash_command, rename = "changer-classe")] +pub async fn changer_classe( + ctx: Context<'_>, + #[description = "Votre classe (ou catégorie)"] groupe: Group, +) -> Result<(), Error> { + let mut member = ctx.author_member().await.unwrap(); + + if member.roles(ctx).unwrap().into_iter().any(|role| { + role.name + .contains(format!("[{}] ", CONFIG.current_year).as_str()) + }) { + ctx.send(|reply| { + reply + .content(format!( + "Il semblerait que vous ayez déjà sélectionné votre groupe pour l'année universitaire {}-{}.\nSi vous avez fait une erreur dans la sélection de votre classe, veuillez le signaler aux administrateurs du serveur.", + CONFIG.current_year, + CONFIG.current_year.parse::().unwrap() + 1) + ) + .ephemeral(true) + }).await?; + + return Ok(()); + } + + // Add roles matching the selected group and remove previously given roles no longer matching the active group + + member + .to_mut() + .remove_roles(ctx.http(), groupe.to_roleids().as_slice()) + .await?; + + member + .to_mut() + .add_roles(ctx.http(), groupe.to_roleids().as_slice()) + .await?; + + ctx.send(|reply| { + reply + .content("Votre nouveau groupe pour la nouvelle année universitaire a bien été sélectionné !\nDans le doute, vérifiez que vos rôles sont bien en adéquation avec votre groupe.") + .ephemeral(true) + }).await?; + + Ok(()) +} diff --git a/src/config.rs b/src/config.rs new file mode 100644 index 0000000..22f1050 --- /dev/null +++ b/src/config.rs @@ -0,0 +1,52 @@ +use config::Config as ConfigConfig; +use config::ConfigError; +use once_cell::sync::Lazy; +use poise::serenity_prelude::RoleId; +use serde::Deserialize; + +// Global Config +pub static CONFIG: Lazy = Lazy::new(|| Config::new().unwrap()); + +#[derive(Debug, Deserialize, Clone)] +pub struct Group { + pub id: String, + pub name: String, + pub roles: Vec, +} + +impl Group { + pub fn to_roleids(&self) -> Vec { + self.roles + .iter() + .map(|role| RoleId(role.to_owned())) + .collect::>() + } +} + +#[derive(Debug, Deserialize)] +pub struct Config { + pub token: String, + pub current_year: String, + pub groups: Vec, +} + +impl Config { + pub fn new() -> Result { + ConfigConfig::builder() + .add_source(config::File::with_name("config")) + .build()? + .try_deserialize() + } + + pub fn roles_contains(&self, roles: &[RoleId]) -> bool { + for role in roles { + for group in &self.groups { + if group.roles.contains(role.as_u64()) { + return true; + } + } + } + + false + } +} diff --git a/src/events/interactionCreate.ts b/src/events/interactionCreate.ts deleted file mode 100644 index 093353e..0000000 --- a/src/events/interactionCreate.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { BaseInteraction } from "discord.js"; -import CommandHandler from "../handlers/CommandHandler.js"; - -export default function interactionCreate( - handler: CommandHandler, - interaction: BaseInteraction -) { - if (!interaction.isCommand() || !interaction.command) return; - handler.execute(interaction); -} diff --git a/src/handlers/CommandHandler.ts b/src/handlers/CommandHandler.ts deleted file mode 100644 index fceedff..0000000 --- a/src/handlers/CommandHandler.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { CommandInteraction } from "discord.js"; -import Command from "../structures/Command.js"; - -export default class CommandHandler { - public commands: Map = new Map(); - - execute(interaction: CommandInteraction) { - if (this.commands.has(interaction.command.name)) { - this.commands.get(interaction.command.name).run(interaction); - } - } - - register(...commands: (new () => Command)[]) { - commands.forEach(Structure => { - const command = new Structure(); - this.commands.set(command.name, command); - }); - } -} diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..9c564b7 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,60 @@ +use config::CONFIG; +use poise::serenity_prelude as serenity; + +mod commands; +mod config; +mod slash_arguments; + +// Types used by all command functions +type Error = Box; +type Context<'a> = poise::Context<'a, (), Error>; + +async fn on_error(error: poise::FrameworkError<'_, (), Error>) { + // This is our custom error handler + // They are many errors that can occur, so we only handle the ones we want to customize + // and forward the rest to the default handler + match error { + poise::FrameworkError::Setup { error, .. } => panic!("Failed to start bot: {:?}", error), + poise::FrameworkError::Command { error, ctx } => { + println!("Error in command `{}`: {:?}", ctx.command().name, error,); + + ctx.send(|reply| + reply.content("Quelque chose s'est mal passé ! Veuillez contacter un administrateur du serveur.") + .ephemeral(true) + ).await.unwrap(); + } + error => { + if let Err(e) = poise::builtins::on_error(error).await { + println!("Error while handling error: {}", e) + } + } + } +} + +#[tokio::main] +async fn main() { + poise::Framework::builder() + .token(&CONFIG.token) + .options(poise::FrameworkOptions { + on_error: |error| Box::pin(on_error(error)), + commands: vec![ + commands::signup::inscription(), + commands::switch_class::changer_classe(), + ], + ..Default::default() + }) + .setup(move |ctx, _ready, framework| { + Box::pin(async move { + println!( + "Connecté aux serveurs Discord en tant que {}!", + _ready.user.name + ); + poise::builtins::register_globally(ctx, &framework.options().commands).await?; + Ok(()) + }) + }) + .intents(serenity::GatewayIntents::privileged() | serenity::GatewayIntents::GUILDS) + .run() + .await + .unwrap(); +} diff --git a/src/slash_arguments/group.rs b/src/slash_arguments/group.rs new file mode 100644 index 0000000..a1c22d9 --- /dev/null +++ b/src/slash_arguments/group.rs @@ -0,0 +1,41 @@ +use crate::config::{Group, CONFIG}; + +#[poise::async_trait] +impl poise::SlashArgument for Group { + async fn extract( + _: &poise::serenity_prelude::Context, + _: poise::ApplicationCommandOrAutocompleteInteraction<'_>, + value: &poise::serenity_prelude::json::Value, + ) -> ::std::result::Result { + let choice = value + .as_u64() + .ok_or(poise::SlashArgError::CommandStructureMismatch( + "expected u64", + ))?; + + let choice_usize = choice as usize; + + if choice_usize >= CONFIG.groups.len() { + return Err(poise::SlashArgError::CommandStructureMismatch( + "choice index out of bounds", + )); + } + + Ok(CONFIG.groups[choice_usize].clone()) + } + + fn create(builder: &mut poise::serenity_prelude::CreateApplicationCommandOption) { + builder.kind(poise::serenity_prelude::CommandOptionType::Integer); + } + + fn choices() -> Vec { + CONFIG + .groups + .iter() + .map(|group| poise::CommandParameterChoice { + name: group.name.to_owned(), + localizations: std::collections::HashMap::new(), + }) + .collect() + } +} diff --git a/src/slash_arguments/mod.rs b/src/slash_arguments/mod.rs new file mode 100644 index 0000000..ba43bc0 --- /dev/null +++ b/src/slash_arguments/mod.rs @@ -0,0 +1 @@ +pub mod group; diff --git a/src/structures/Command.ts b/src/structures/Command.ts deleted file mode 100644 index 61b723b..0000000 --- a/src/structures/Command.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { CommandInteraction, SlashCommandBuilder, ApplicationCommandOptionBase as Option } from "discord.js"; -import { Arg, CommandMetadata } from "../utils/Constants.js"; - -function patchOption(option: T, name: string, metadata: Arg) { - try { - return option.setName(name.toLowerCase()) - .setDescription(metadata.desc) - .setRequired(!metadata.optional || false); - } catch (err) { - throw new TypeError(`There is an issue with the '${name}' command.\n${err}`); - } -} - -export default abstract class Command { - public metadata: CommandMetadata; - public name: string; - - constructor(name: string, metadata: CommandMetadata) { - this.metadata = metadata; - this.name = name; - } - - abstract run(interaction: CommandInteraction): any; - - toSlashCommand() { - const slash = new SlashCommandBuilder() - .setName(this.name) - .setDescription(this.metadata.description); - - if (this.metadata.args) { - for (const [name, meta] of Object.entries(this.metadata.args)) { - if (meta.as === "choice") { - slash.addStringOption(o => patchOption(o, name, meta) - .setChoices(...meta.choices)); - } else if (meta.as === "string") { - slash.addStringOption(o => patchOption(o, name, meta)); - } else if (meta.as === "attachment") { - slash.addAttachmentOption(o => patchOption(o, name, meta)) - } - } - } - - return slash; - } -} diff --git a/src/utils/Constants.ts b/src/utils/Constants.ts deleted file mode 100644 index 57af1ed..0000000 --- a/src/utils/Constants.ts +++ /dev/null @@ -1,29 +0,0 @@ -type BaseArg = { desc: string, optional?: boolean }; -type Choice = { name: string, value: string }; - -export type AttachmentArg = BaseArg & { as: "attachment" }; -export type StringArg = BaseArg & { as: "string" }; -export type ChoiceArg = BaseArg & { as: "choice", choices: Choice[] }; -export type Arg = AttachmentArg | StringArg | ChoiceArg; - -export type CommandMetadata = { - args?: { [key: string]: Arg } - description: string -}; - -export const groups: Record = { - "s1-td1": { name: "S1/S2 - TD1", roles: ["1132599322505117716", process.env.ROLE_ID_STUDENT] }, - "s1-td2": { name: "S1/S2 - TD2", roles: ["1132599408542883911", process.env.ROLE_ID_STUDENT] }, - "s1-td3": { name: "S1/S2 - TD3", roles: ["1132599515531190302", process.env.ROLE_ID_STUDENT] }, - "s1-td4": { name: "S1/S2 - TD4", roles: ["1132599566001258536", process.env.ROLE_ID_STUDENT] }, - "s3-td1": { name: "S3/S4 - TD1 (Data)", roles: ["1132599835669839923", process.env.ROLE_ID_STUDENT] }, - "s3-td2": { name: "S3/S4 - TD2 (Dév. C++)", roles: ["1132600095410495552", process.env.ROLE_ID_STUDENT] }, - "s3-td3": { name: "S3/S4 - TD3 (Dév. C++)", roles: ["1132600214063173753", process.env.ROLE_ID_STUDENT] }, - "s3-td4": { name: "S3/S4 - TD4 (Dév. C#)", roles: ["1132600273685188608", process.env.ROLE_ID_STUDENT] }, - "s5-td1": { name: "S5/S6 - TD1 (Data)", roles: ["1132601581322391674", process.env.ROLE_ID_STUDENT] }, - "s5-td2": { name: "S5/S6 - TD2 (Dév.)", roles: ["1132601802689355827", process.env.ROLE_ID_STUDENT] }, - "s5-td3": { name: "S5/S6 - TD3 (Dév.)", roles: ["1132601861858414662", process.env.ROLE_ID_STUDENT] }, - "alumni": { name: "Alumni", roles: [process.env.ROLE_ID_ALUMNI] }, - "guest": { name: "Invité", roles: [process.env.ROLE_ID_GUEST] }, - "teacher": { name: "Professeur", roles: [process.env.ROLE_ID_TEACHER] }, -}; diff --git a/tsconfig.json b/tsconfig.json deleted file mode 100644 index 2a6d179..0000000 --- a/tsconfig.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "compilerOptions": { - "target": "es6", - "module": "ES2020", - "moduleResolution": "node", - "noImplicitAny": false, - "removeComments": true, - "preserveConstEnums": true, - "sourceMap": true, - "outDir": "dist", - "declaration": true - }, - "include": [ - "src/**/*.ts" - ], - "exclude": [ - "src/**/*.spec.ts", - "node_modules" - ] -} diff --git a/yarn.lock b/yarn.lock deleted file mode 100644 index c3cf3c1..0000000 --- a/yarn.lock +++ /dev/null @@ -1,354 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -"@discordjs/builders@^1.1.0": - version "1.1.0" - resolved "https://registry.npmjs.org/@discordjs/builders/-/builders-1.1.0.tgz" - integrity sha512-EO8TSltiIc9Z1wE854wAFvv5AccqEtvjFmao9PPoxQhRaJ0hEb7FwWRTCA1jGg4ZWI3hcp4m+RET5ufZQz3rOg== - dependencies: - "@sapphire/shapeshift" "^3.5.1" - discord-api-types "^0.36.3" - fast-deep-equal "^3.1.3" - ts-mixer "^6.0.1" - tslib "^2.4.0" - -"@discordjs/builders@^1.6.4": - version "1.6.4" - resolved "https://registry.yarnpkg.com/@discordjs/builders/-/builders-1.6.4.tgz#d99f4e76684ef9b1c3b9e1c4d0bc17fafb19b960" - integrity sha512-ARFKvmAkLhfkQQiNxqi0YIWqwUExvBRtvdtMFVJXvJoibsGkFrB/DWTf9byU7BTVUfsmW8w7NM55tYXR5S/iSg== - dependencies: - "@discordjs/formatters" "^0.3.1" - "@discordjs/util" "^1.0.0" - "@sapphire/shapeshift" "^3.9.2" - discord-api-types "^0.37.50" - fast-deep-equal "^3.1.3" - ts-mixer "^6.0.3" - tslib "^2.6.1" - -"@discordjs/collection@^1.0.1": - version "1.0.1" - resolved "https://registry.npmjs.org/@discordjs/collection/-/collection-1.0.1.tgz" - integrity sha512-5V/wswzR3r2RVYXLxxg4TvrAnBhVCNgHTXhC+OUtLoriJ072rPMHo+Iw1SS1vrCckp8Es40XM411+WkNRPaXFw== - -"@discordjs/formatters@^0.3.1": - version "0.3.1" - resolved "https://registry.yarnpkg.com/@discordjs/formatters/-/formatters-0.3.1.tgz#81393cf25e6e3223361061629752ea727475e842" - integrity sha512-M7X4IGiSeh4znwcRGcs+49B5tBkNDn4k5bmhxJDAUhRxRHTiFAOTVUNQ6yAKySu5jZTnCbSvTYHW3w0rAzV1MA== - dependencies: - discord-api-types "^0.37.41" - -"@discordjs/rest@^1.0.1": - version "1.0.1" - resolved "https://registry.npmjs.org/@discordjs/rest/-/rest-1.0.1.tgz" - integrity sha512-w08CTKVzzYYvKxEjXKOs9AdS7KQ1J502TrPfF8eCZ2lF6AfKuMP/32YgDakiwIyYTDjEQS/v0nKLSFcncHRMtg== - dependencies: - "@discordjs/collection" "^1.0.1" - "@sapphire/async-queue" "^1.3.2" - "@sapphire/snowflake" "^3.2.2" - discord-api-types "^0.36.3" - file-type "^17.1.4" - tslib "^2.4.0" - undici "^5.8.0" - -"@discordjs/util@^1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@discordjs/util/-/util-1.0.0.tgz#8b4d3756ee725f6fc1a4999834d6ca7c4a353837" - integrity sha512-U2Iiab0mo8cFe+o4ZY4GROoAetGjFYA1PhhxiXEW82LuPUjOU/seHZDtVjDpOf6n3rz4IRm84wNtgHdpqRY5CA== - -"@sapphire/async-queue@^1.3.2": - version "1.4.0" - resolved "https://registry.npmjs.org/@sapphire/async-queue/-/async-queue-1.4.0.tgz" - integrity sha512-1npoLO1YPPXCsWCfuonsSdtHbPUo6dvjWUJtmUHiK8yDTmy00LbkpRkdV/UycA1fh+QsxwOPhgx2zu64Z+19ww== - -"@sapphire/shapeshift@^3.5.1": - version "3.5.1" - resolved "https://registry.npmjs.org/@sapphire/shapeshift/-/shapeshift-3.5.1.tgz" - integrity sha512-7JFsW5IglyOIUQI1eE0g6h06D/Far6HqpcowRScgCiLSqTf3hhkPWCWotVTtVycnDCMYIwPeaw6IEPBomKC8pA== - dependencies: - fast-deep-equal "^3.1.3" - lodash.uniqwith "^4.5.0" - -"@sapphire/shapeshift@^3.9.2": - version "3.9.2" - resolved "https://registry.yarnpkg.com/@sapphire/shapeshift/-/shapeshift-3.9.2.tgz#a9c12cd51e1bc467619bb56df804450dd14871ac" - integrity sha512-YRbCXWy969oGIdqR/wha62eX8GNHsvyYi0Rfd4rNW6tSVVa8p0ELiMEuOH/k8rgtvRoM+EMV7Csqz77YdwiDpA== - dependencies: - fast-deep-equal "^3.1.3" - lodash "^4.17.21" - -"@sapphire/snowflake@^3.2.2": - version "3.2.2" - resolved "https://registry.npmjs.org/@sapphire/snowflake/-/snowflake-3.2.2.tgz" - integrity sha512-ula2O0kpSZtX9rKXNeQMrHwNd7E4jPDJYUXmEGTFdMRfyfMw+FPyh04oKMjAiDuOi64bYgVkOV3MjK+loImFhQ== - -"@tokenizer/token@^0.3.0": - version "0.3.0" - resolved "https://registry.npmjs.org/@tokenizer/token/-/token-0.3.0.tgz" - integrity sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A== - -"@types/node@*": - version "18.7.6" - resolved "https://registry.npmjs.org/@types/node/-/node-18.7.6.tgz" - integrity sha512-EdxgKRXgYsNITy5mjjXjVE/CS8YENSdhiagGrLqjG0pvA2owgJ6i4l7wy/PFZGC0B1/H20lWKN7ONVDNYDZm7A== - -"@types/ws@^8.5.3": - version "8.5.3" - resolved "https://registry.npmjs.org/@types/ws/-/ws-8.5.3.tgz" - integrity sha512-6YOoWjruKj1uLf3INHH7D3qTXwFfEsg1kf3c0uDdSBJwfa/llkwIjrAGV7j7mVgGNbzTQ3HiHKKDXl6bJPD97w== - dependencies: - "@types/node" "*" - -array-shuffle@^3.0.0: - version "3.0.0" - resolved "https://registry.npmjs.org/array-shuffle/-/array-shuffle-3.0.0.tgz" - integrity sha512-rogEGxHOQPhslOhpg12LJkB+bbAl484/s2AJq0BxtzQDQfKl76fS2u9zWgg3p3b9ENcuvE7K8A7l5ddiPjCRnw== - -bindings@^1.5.0: - version "1.5.0" - resolved "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz" - integrity sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ== - dependencies: - file-uri-to-path "1.0.0" - -bufferutil@^4.0.6: - version "4.0.6" - resolved "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.6.tgz" - integrity sha512-jduaYOYtnio4aIAyc6UbvPCVcgq7nYpVnucyxr6eCYg/Woad9Hf/oxxBRDnGGjPfjUm6j5O/uBWhIu4iLebFaw== - dependencies: - node-gyp-build "^4.3.0" - -csv-parse@^5.3.0: - version "5.3.0" - resolved "https://registry.npmjs.org/csv-parse/-/csv-parse-5.3.0.tgz" - integrity sha512-UXJCGwvJ2fep39purtAn27OUYmxB1JQto+zhZ4QlJpzsirtSFbzLvip1aIgziqNdZp/TptvsKEV5BZSxe10/DQ== - -csv-stringify@^6.2.0: - version "6.2.0" - resolved "https://registry.npmjs.org/csv-stringify/-/csv-stringify-6.2.0.tgz" - integrity sha512-dcUbQLRTTDcgQxgEU8V9IctkaCwHZjZfzUZ5ZB3RY8Y+pXtdtl5iVQHfGzANytFFkRKanYzBXrkfpNdGR7eviA== - -discord-api-types@^0.36.3: - version "0.36.3" - resolved "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.36.3.tgz" - integrity sha512-bz/NDyG0KBo/tY14vSkrwQ/n3HKPf87a0WFW/1M9+tXYK+vp5Z5EksawfCWo2zkAc6o7CClc0eff1Pjrqznlwg== - -discord-api-types@^0.37.2: - version "0.37.2" - resolved "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.37.2.tgz" - integrity sha512-JS4q0LGRxqY7TIsfORlIMzcmews+Qu3RmOWrxoEY+BR0g0sZlplEyY/Ltb3om6ZaBm+WNcAmAJxlsmAu4068Vw== - -discord-api-types@^0.37.41, discord-api-types@^0.37.50: - version "0.37.52" - resolved "https://registry.yarnpkg.com/discord-api-types/-/discord-api-types-0.37.52.tgz#0d47a4409f1e17252dc895f2615dea3d161f7b5f" - integrity sha512-TP99aMgY6rHuDIy056GDm1j2nGOcaLbFpjVbvAmv6N6vhkjHNqHXCHVqKtGisaQ8D15slbxTHNl/SSkPdx2syg== - -discord.js@^14.2.0: - version "14.2.0" - resolved "https://registry.npmjs.org/discord.js/-/discord.js-14.2.0.tgz" - integrity sha512-kIGhEeOB1d9k7whL9HCCuRuzK2GL7i/hTesYINOZ2szWm4TOsBVwRU+i9O/zDb2M+Gvff4SJ4EpAtCVV0okgVw== - dependencies: - "@discordjs/builders" "^1.1.0" - "@discordjs/collection" "^1.0.1" - "@discordjs/rest" "^1.0.1" - "@sapphire/snowflake" "^3.2.2" - "@types/ws" "^8.5.3" - discord-api-types "^0.36.3" - fast-deep-equal "^3.1.3" - lodash.snakecase "^4.1.1" - tslib "^2.4.0" - undici "^5.8.2" - ws "^8.8.1" - -dotenv@^16.0.1: - version "16.0.1" - resolved "https://registry.npmjs.org/dotenv/-/dotenv-16.0.1.tgz" - integrity sha512-1K6hR6wtk2FviQ4kEiSjFiH5rpzEVi8WW0x96aztHVMhEspNpc4DVOUTEHtEva5VThQ8IaBX1Pe4gSzpVVUsKQ== - -erlpack@discord/erlpack: - version "0.1.3" - resolved "git+ssh://git@github.com/discord/erlpack.git#cbe76be04c2210fc9cb6ff95910f0937c1011d04" - dependencies: - bindings "^1.5.0" - nan "^2.15.0" - -fast-deep-equal@^3.1.3: - version "3.1.3" - resolved "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz" - integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== - -file-type@^17.1.4: - version "17.1.6" - resolved "https://registry.npmjs.org/file-type/-/file-type-17.1.6.tgz" - integrity sha512-hlDw5Ev+9e883s0pwUsuuYNu4tD7GgpUnOvykjv1Gya0ZIjuKumthDRua90VUn6/nlRKAjcxLUnHNTIUWwWIiw== - dependencies: - readable-web-to-node-stream "^3.0.2" - strtok3 "^7.0.0-alpha.9" - token-types "^5.0.0-alpha.2" - -file-uri-to-path@1.0.0: - version "1.0.0" - resolved "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz" - integrity sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw== - -ieee754@^1.2.1: - version "1.2.1" - resolved "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz" - integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== - -inherits@^2.0.3: - version "2.0.4" - resolved "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz" - integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== - -lodash.snakecase@^4.1.1: - version "4.1.1" - resolved "https://registry.npmjs.org/lodash.snakecase/-/lodash.snakecase-4.1.1.tgz" - integrity sha512-QZ1d4xoBHYUeuouhEq3lk3Uq7ldgyFXGBhg04+oRLnIz8o9T65Eh+8YdroUwn846zchkA9yDsDl5CVVaV2nqYw== - -lodash.uniqwith@^4.5.0: - version "4.5.0" - resolved "https://registry.npmjs.org/lodash.uniqwith/-/lodash.uniqwith-4.5.0.tgz" - integrity sha512-7lYL8bLopMoy4CTICbxygAUq6CdRJ36vFc80DucPueUee+d5NBRxz3FdT9Pes/HEx5mPoT9jwnsEJWz1N7uq7Q== - -lodash@^4.17.21: - version "4.17.21" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" - integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== - -nan@^2.14.0, nan@^2.15.0: - version "2.16.0" - resolved "https://registry.npmjs.org/nan/-/nan-2.16.0.tgz" - integrity sha512-UdAqHyFngu7TfQKsCBgAA6pWDkT8MAO7d0jyOecVhN5354xbLqdn8mV9Tat9gepAupm0bt2DbeaSC8vS52MuFA== - -node-cron@^3.0.2: - version "3.0.2" - resolved "https://registry.npmjs.org/node-cron/-/node-cron-3.0.2.tgz" - integrity sha512-iP8l0yGlNpE0e6q1o185yOApANRe47UPbLf4YxfbiNHt/RU5eBcGB/e0oudruheSf+LQeDMezqC5BVAb5wwRcQ== - dependencies: - uuid "8.3.2" - -node-gyp-build@^4.3.0: - version "4.5.0" - resolved "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.5.0.tgz" - integrity sha512-2iGbaQBV+ITgCz76ZEjmhUKAKVf7xfY1sRl4UiKQspfZMH2h06SyhNsnSVy50cwkFQDGLyif6m/6uFXHkOZ6rg== - -peek-readable@^5.0.0: - version "5.0.0" - resolved "https://registry.npmjs.org/peek-readable/-/peek-readable-5.0.0.tgz" - integrity sha512-YtCKvLUOvwtMGmrniQPdO7MwPjgkFBtFIrmfSbYmYuq3tKDV/mcfAhBth1+C3ru7uXIZasc/pHnb+YDYNkkj4A== - -rcon-client@^4.2.3: - version "4.2.3" - resolved "https://registry.npmjs.org/rcon-client/-/rcon-client-4.2.3.tgz" - integrity sha512-g+DEzI3O0Nl4Y3mPp6DHhSpYeiv+wTq8iKxCumFGO0/SMCsdNfx9bpT5RyHa7phR5dvspKfQK0ZYJp1YCtXNng== - dependencies: - typed-emitter "^0.1.0" - -readable-stream@^3.6.0: - version "3.6.0" - resolved "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz" - integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA== - dependencies: - inherits "^2.0.3" - string_decoder "^1.1.1" - util-deprecate "^1.0.1" - -readable-web-to-node-stream@^3.0.2: - version "3.0.2" - resolved "https://registry.npmjs.org/readable-web-to-node-stream/-/readable-web-to-node-stream-3.0.2.tgz" - integrity sha512-ePeK6cc1EcKLEhJFt/AebMCLL+GgSKhuygrZ/GLaKZYEecIgIECf4UaUuaByiGtzckwR4ain9VzUh95T1exYGw== - dependencies: - readable-stream "^3.6.0" - -safe-buffer@~5.2.0: - version "5.2.1" - resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz" - integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== - -string_decoder@^1.1.1: - version "1.3.0" - resolved "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz" - integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== - dependencies: - safe-buffer "~5.2.0" - -strtok3@^7.0.0-alpha.9: - version "7.0.0" - resolved "https://registry.npmjs.org/strtok3/-/strtok3-7.0.0.tgz" - integrity sha512-pQ+V+nYQdC5H3Q7qBZAz/MO6lwGhoC2gOAjuouGf/VO0m7vQRh8QNMl2Uf6SwAtzZ9bOw3UIeBukEGNJl5dtXQ== - dependencies: - "@tokenizer/token" "^0.3.0" - peek-readable "^5.0.0" - -token-types@^5.0.0-alpha.2: - version "5.0.1" - resolved "https://registry.npmjs.org/token-types/-/token-types-5.0.1.tgz" - integrity sha512-Y2fmSnZjQdDb9W4w4r1tswlMHylzWIeOKpx0aZH9BgGtACHhrk3OkT52AzwcuqTRBZtvvnTjDBh8eynMulu8Vg== - dependencies: - "@tokenizer/token" "^0.3.0" - ieee754 "^1.2.1" - -ts-mixer@^6.0.1: - version "6.0.1" - resolved "https://registry.npmjs.org/ts-mixer/-/ts-mixer-6.0.1.tgz" - integrity sha512-hvE+ZYXuINrx6Ei6D6hz+PTim0Uf++dYbK9FFifLNwQj+RwKquhQpn868yZsCtJYiclZF1u8l6WZxxKi+vv7Rg== - -ts-mixer@^6.0.3: - version "6.0.3" - resolved "https://registry.yarnpkg.com/ts-mixer/-/ts-mixer-6.0.3.tgz#69bd50f406ff39daa369885b16c77a6194c7cae6" - integrity sha512-k43M7uCG1AkTyxgnmI5MPwKoUvS/bRvLvUb7+Pgpdlmok8AoqmUaZxUUw8zKM5B1lqZrt41GjYgnvAi0fppqgQ== - -tslib@^2.4.0: - version "2.4.0" - resolved "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz" - integrity sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ== - -tslib@^2.6.1: - version "2.6.1" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.1.tgz#fd8c9a0ff42590b25703c0acb3de3d3f4ede0410" - integrity sha512-t0hLfiEKfMUoqhG+U1oid7Pva4bbDPHYfJNiB7BiIjRkj1pyC++4N3huJfqY6aRH6VTB0rvtzQwjM4K6qpfOig== - -typed-emitter@^0.1.0: - version "0.1.0" - resolved "https://registry.npmjs.org/typed-emitter/-/typed-emitter-0.1.0.tgz" - integrity sha512-Tfay0l6gJMP5rkil8CzGbLthukn+9BN/VXWcABVFPjOoelJ+koW8BuPZYk+h/L+lEeIp1fSzVRiWRPIjKVjPdg== - -typescript@^4.7.4: - version "4.7.4" - resolved "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz" - integrity sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ== - -undici@^5.8.0, undici@^5.8.2: - version "5.8.2" - resolved "https://registry.npmjs.org/undici/-/undici-5.8.2.tgz" - integrity sha512-3KLq3pXMS0Y4IELV045fTxqz04Nk9Ms7yfBBHum3yxsTR4XNn+ZCaUbf/mWitgYDAhsplQ0B1G4S5D345lMO3A== - -utf-8-validate@^5.0.9: - version "5.0.9" - resolved "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.9.tgz" - integrity sha512-Yek7dAy0v3Kl0orwMlvi7TPtiCNrdfHNd7Gcc/pLq4BLXqfAmd0J7OWMizUQnTTJsyjKn02mU7anqwfmUP4J8Q== - dependencies: - node-gyp-build "^4.3.0" - -util-deprecate@^1.0.1: - version "1.0.2" - resolved "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz" - integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw== - -uuid@8.3.2: - version "8.3.2" - resolved "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz" - integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== - -ws@^8.8.1: - version "8.8.1" - resolved "https://registry.npmjs.org/ws/-/ws-8.8.1.tgz" - integrity sha512-bGy2JzvzkPowEJV++hF07hAD6niYSr0JzBNo/J29WsB57A2r7Wlc1UFcTR9IzrPvuNVO4B8LGqF8qcpsVOhJCA== - -zlib-sync@^0.1.7: - version "0.1.7" - resolved "https://registry.npmjs.org/zlib-sync/-/zlib-sync-0.1.7.tgz" - integrity sha512-UmciU6ZrIwtwPC8noMzq+kGMdiWwNRZ3wC0SbED4Ew5Ikqx14MqDPRs/Pbk+3rZPh5SzsOgUBs1WRE0iieddpg== - dependencies: - nan "^2.14.0" From 76f1c037a8a79591cfcfe571fccda95d45b3ef26 Mon Sep 17 00:00:00 2001 From: Simon Ledoux Date: Sat, 2 Sep 2023 13:51:15 +0200 Subject: [PATCH 2/9] Add Simon to the credits --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e0b222c..dd6e47b 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Harry -Harry est un bot Discord utilisé par le serveur Discord étudiant du BUT informatique à l'IUT de Reims. Pour l'instant, Harry n'est pas très utile, il ne permet que de configurer son identité sur le serveur. Harry sera sans doute plus utile dans un futur proche. Harry est actuellement développé par [Robin Bourachot](https://github.com/Ciborn), et certaines parties de son code ont été repris du bot [Aldebaran](https://github.com/Nightorn/Aldebaran). Harry est maintenu en vie par le [BDE de l'IUT](http://404cm.com/). +Harry est un bot Discord utilisé par le serveur Discord étudiant du BUT informatique à l'IUT de Reims. Pour l'instant, Harry n'est pas très utile, il ne permet que de configurer son identité sur le serveur. Harry sera sans doute plus utile dans un futur proche. Harry est actuellement développé par [Robin Bourachot](https://github.com/Ciborn), et a été réécrit en 🚀 Rust 🚀 par [Simon Ledoux](https://github.com/simon511000). Certaines parties du code ont été repris du bot [Aldebaran](https://github.com/Nightorn/Aldebaran). Harry est maintenu en vie par le [BDE de l'IUT](http://404cm.com/). ## Utilisation d'Harry Harry peut être démarré avec docker en utilisant ce `compose.yml` : From 58e4ca0f6f4348ba4f9e71e9c9bc3e111404e012 Mon Sep 17 00:00:00 2001 From: Simon Ledoux Date: Sun, 3 Sep 2023 11:52:21 +0200 Subject: [PATCH 3/9] Add cache to docker builds --- Dockerfile | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6ee4cca..f2fa81e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,17 +3,22 @@ FROM rust:1-alpine3.17 as builder RUN apk add musl-dev -WORKDIR /usr/src/harry +RUN cargo new /app/harry +COPY ./Cargo.toml ./Cargo.lock /app/harry/ + +WORKDIR /app/harry + +RUN --mount=type=cache,target=/usr/local/cargo/registry cargo build --release COPY . . -RUN cargo install --path . +RUN --mount=type=cache,target=/usr/local/cargo/registry cargo build --release # ========= Stage 2: Production ========= # FROM alpine as production WORKDIR /app -COPY --from=builder /usr/local/cargo/bin/harry /app/harry +COPY --from=builder /app/harry/target/release/harry /app/harry CMD ./harry \ No newline at end of file From de953b06c21353a547f79c80ac03b4ed41eca751 Mon Sep 17 00:00:00 2001 From: Simon Ledoux Date: Sun, 3 Sep 2023 17:48:08 +0200 Subject: [PATCH 4/9] add /etudients --- src/commands/mod.rs | 1 + src/commands/students.rs | 55 ++++++++++++++++++++++++++++++++++++++++ src/main.rs | 1 + 3 files changed, 57 insertions(+) create mode 100644 src/commands/students.rs diff --git a/src/commands/mod.rs b/src/commands/mod.rs index 4627cef..015c4f0 100644 --- a/src/commands/mod.rs +++ b/src/commands/mod.rs @@ -1,2 +1,3 @@ pub mod signup; +pub mod students; pub mod switch_class; diff --git a/src/commands/students.rs b/src/commands/students.rs new file mode 100644 index 0000000..ad278b9 --- /dev/null +++ b/src/commands/students.rs @@ -0,0 +1,55 @@ +use std::collections::HashMap; + +use poise::serenity_prelude::{Colour, Member, UserId}; + +use crate::{config::Group, Context, Error}; + +/// Lister les membres d'une classe ou catégorie +#[poise::command(slash_command)] +pub async fn etudients( + ctx: Context<'_>, + #[description = "Classe (ou catégorie)"] groupe: Group, +) -> Result<(), Error> { + // Tous les membres qui ont tous les roles du groupe sélectionné + let members: HashMap = ctx + .guild() + .unwrap() + .members + .into_iter() + .filter(|member| { + groupe + .to_roleids() + .iter() + .all(|role_id| member.1.roles.contains(role_id)) + }) + .collect(); + + if members.is_empty() { + ctx.send(|reply| { + reply + .ephemeral(true) + .content(format!("Il n'y a aucun membre dans {}.", groupe.name)) + }) + .await?; + + Ok(()) + } else { + ctx.send(|reply| { + reply.ephemeral(true).embed(|embed| { + embed + .color(Colour::BLUE) + .title(format!("Liste des {} :", groupe.name)) + .description( + members + .values() + .map(|member| format!("- <@{}>", member.user.id)) + .collect::>() + .join("\n"), + ) + }) + }) + .await?; + + Ok(()) + } +} diff --git a/src/main.rs b/src/main.rs index 9c564b7..da4a2e4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -40,6 +40,7 @@ async fn main() { commands: vec![ commands::signup::inscription(), commands::switch_class::changer_classe(), + commands::students::etudients(), ], ..Default::default() }) From 4b7f78d86f671fe60bd6767df679fa47fcb8d3fa Mon Sep 17 00:00:00 2001 From: Simon Ledoux Date: Sun, 3 Sep 2023 17:55:22 +0200 Subject: [PATCH 5/9] fix typo --- src/commands/students.rs | 2 +- src/main.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/commands/students.rs b/src/commands/students.rs index ad278b9..ccb4db7 100644 --- a/src/commands/students.rs +++ b/src/commands/students.rs @@ -6,7 +6,7 @@ use crate::{config::Group, Context, Error}; /// Lister les membres d'une classe ou catégorie #[poise::command(slash_command)] -pub async fn etudients( +pub async fn etudiants( ctx: Context<'_>, #[description = "Classe (ou catégorie)"] groupe: Group, ) -> Result<(), Error> { diff --git a/src/main.rs b/src/main.rs index da4a2e4..f05eb3a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -40,7 +40,7 @@ async fn main() { commands: vec![ commands::signup::inscription(), commands::switch_class::changer_classe(), - commands::students::etudients(), + commands::students::etudiants(), ], ..Default::default() }) From d5c86d1cb46758c4bd0570ec56b3c2fe9dd55a3f Mon Sep 17 00:00:00 2001 From: simon511000 Date: Sun, 3 Sep 2023 19:30:23 +0200 Subject: [PATCH 6/9] Update config.example.yml Co-authored-by: Robin Bourachot --- config.example.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.example.yml b/config.example.yml index 3061530..9932b79 100644 --- a/config.example.yml +++ b/config.example.yml @@ -39,7 +39,7 @@ groups: - *role_student - 1132600095410495552 - id: s3-td3 - name: S3/S4 - TD3 (Dév. C++) + name: S3/S4 - TD3 (Dév. C#) roles: - *role_student - 1132600214063173753 From 5f4d389a722fe879d959b42741f51673f40d3754 Mon Sep 17 00:00:00 2001 From: simon511000 Date: Sun, 3 Sep 2023 19:31:27 +0200 Subject: [PATCH 7/9] fix gatewayintents Co-authored-by: Robin Bourachot --- src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index f05eb3a..221d217 100644 --- a/src/main.rs +++ b/src/main.rs @@ -54,7 +54,7 @@ async fn main() { Ok(()) }) }) - .intents(serenity::GatewayIntents::privileged() | serenity::GatewayIntents::GUILDS) + .intents(serenity::GatewayIntents::GUILDS | serenity::GatewayIntents::GUILD_MEMBERS | serenity::GatewayIntents::GUILD_PRESENCES) .run() .await .unwrap(); From 14966d9350ef09ad03062579501e7b5e23148620 Mon Sep 17 00:00:00 2001 From: simon511000 Date: Sun, 3 Sep 2023 19:31:39 +0200 Subject: [PATCH 8/9] fix yaml -> yml Co-authored-by: Robin Bourachot --- compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compose.yml b/compose.yml index 25e8938..d2c7012 100644 --- a/compose.yml +++ b/compose.yml @@ -4,4 +4,4 @@ services: context: . target: production volumes: - - ./config.yaml:/app/config.yaml \ No newline at end of file + - ./config.yml:/app/config.yaml \ No newline at end of file From 1068f36126daef9355afef64b45562e5bc34c638 Mon Sep 17 00:00:00 2001 From: Simon Ledoux Date: Sun, 3 Sep 2023 19:41:26 +0200 Subject: [PATCH 9/9] Capitalize first letter of firstname and lastname --- src/commands/signup.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/commands/signup.rs b/src/commands/signup.rs index 60be955..52a0e7f 100644 --- a/src/commands/signup.rs +++ b/src/commands/signup.rs @@ -28,7 +28,11 @@ pub async fn inscription( member .edit(ctx.http(), |edit| { - edit.nickname(format!("{} {}", prenom, nom)) + edit.nickname(format!( + "{} {}", + capitalize_first_letter(prenom.as_str()), + capitalize_first_letter(nom.as_str()) + )) }) .await? .add_roles(ctx.http(), groupe.to_roleids().as_slice()) @@ -43,3 +47,7 @@ pub async fn inscription( Ok(()) } + +fn capitalize_first_letter(s: &str) -> String { + s[0..1].to_uppercase() + &s[1..] +}