From 5d93db63655a6f6cd237340a5882c4121f35262c Mon Sep 17 00:00:00 2001 From: Anthony Berg Date: Sat, 18 Nov 2023 22:01:33 +0000 Subject: [PATCH] refactor: run prettier --- .eslintrc.json | 60 +++--- .github/ISSUE_TEMPLATE/bug_report.md | 18 +- .github/ISSUE_TEMPLATE/feature_request.md | 1 - .github/renovate.json | 4 +- .github/workflows/codeql-analysis.yml | 61 +++--- .github/workflows/eslint.yml | 6 +- .github/workflows/prettier.yml | 4 +- README.md | 5 +- docker-compose.yml | 4 +- docs/CODE_OF_CONDUCT.md | 22 +- docs/COMMANDS.md | 5 +- docs/CONTRIBUTING.md | 47 ++-- docs/commands/GENERAL.md | 8 +- docs/commands/MOD.md | 20 +- docs/commands/VERIFIER.md | 11 +- src/commands/coordinators/access.ts | 71 ++++--- src/commands/coordinators/anonymous.ts | 23 +- src/commands/coordinators/clear.ts | 26 +-- src/commands/coordinators/private.ts | 98 ++++++--- src/commands/economy/balance.ts | 13 +- src/commands/economy/daily.ts | 31 +-- src/commands/economy/pay.ts | 70 +++--- src/commands/fun/1984.ts | 10 +- src/commands/fun/cringe.ts | 2 +- src/commands/fun/happy.ts | 4 +- src/commands/fun/hug.ts | 26 ++- src/commands/fun/kill.ts | 26 ++- src/commands/fun/poke.ts | 26 ++- src/commands/fun/sad.ts | 4 +- src/commands/fun/shrug.ts | 4 +- src/commands/mod/ban/ban.ts | 73 ++++--- src/commands/mod/ban/tempBan.ts | 95 +++++---- src/commands/mod/ban/unban.ts | 40 ++-- src/commands/mod/diversity.ts | 57 +++-- src/commands/mod/moveall.ts | 36 ++-- src/commands/mod/rename.ts | 33 +-- src/commands/mod/restriction/restrict.ts | 90 ++++---- src/commands/mod/restriction/restrictLogs.ts | 34 +-- .../mod/restriction/restrictTolerance.ts | 25 ++- src/commands/mod/restriction/restrictTools.ts | 80 ++++--- src/commands/mod/restriction/unrestrict.ts | 77 ++++--- src/commands/mod/slowmode.ts | 20 +- src/commands/mod/softMute.ts | 21 +- src/commands/mod/sus.ts | 166 +++++++++------ src/commands/mod/vcMute.ts | 27 ++- src/commands/mod/warn.ts | 21 +- src/commands/outreach/outreach.ts | 200 +++++++++++++----- src/commands/roles/bookClub.ts | 23 +- src/commands/roles/debateHost.ts | 23 +- src/commands/roles/gameNightHost.ts | 23 +- src/commands/roles/guest.ts | 23 +- src/commands/roles/staff/mentor.ts | 23 +- src/commands/roles/staff/mod.ts | 23 +- src/commands/roles/staff/restrictedAccess.ts | 23 +- src/commands/roles/staff/stagehost.ts | 23 +- src/commands/roles/staff/trialMod.ts | 23 +- src/commands/roles/staff/trialVerifier.ts | 23 +- src/commands/roles/staff/verifier.ts | 23 +- src/commands/roles/verification/activist.ts | 55 +++-- src/commands/roles/verification/aravegan.ts | 38 ++-- src/commands/roles/verification/convinced.ts | 27 ++- src/commands/roles/verification/plus.ts | 23 +- src/commands/roles/verification/trusted.ts | 27 ++- src/commands/roles/verification/vegan.ts | 41 ++-- src/commands/roles/verification/vegcurious.ts | 32 ++- src/commands/utils/apply.ts | 9 +- src/commands/utils/count.ts | 18 +- src/commands/utils/help.ts | 12 +- src/commands/utils/info.ts | 82 ++++--- src/commands/utils/ping.ts | 20 +- src/commands/verification/verify.ts | 87 +++++--- .../verification/verifyTimeoutRemove.ts | 23 +- src/commands/xp/rank.ts | 26 ++- src/interaction-handlers/nonVeganAccess.ts | 20 +- src/interaction-handlers/welcome.ts | 27 ++- src/listeners/ban/ban.ts | 30 ++- src/listeners/ban/banJoin.ts | 10 +- src/listeners/ban/unban.ts | 28 ++- src/listeners/botAppreciation.ts | 10 +- src/listeners/commandDenied.ts | 5 +- src/listeners/counting.ts | 14 +- src/listeners/dbLeaveServer.ts | 16 +- src/listeners/deniedPermission.ts | 5 +- src/listeners/modMail.ts | 24 ++- src/listeners/nonVeganAccess.ts | 35 ++- src/listeners/rolesJoinServer.ts | 58 +++-- src/listeners/suggestions.ts | 43 ++-- src/listeners/vcMute.ts | 12 +- src/listeners/verification/joinVC.ts | 174 +++++++++------ src/listeners/verification/leaveVC.ts | 67 ++++-- src/listeners/verification/start.ts | 18 +- src/listeners/verification/welcome.ts | 37 ++-- src/listeners/xp.ts | 2 +- src/preconditions/CoordinatorOnly.ts | 4 +- src/preconditions/DevCoordinatorOnly.ts | 4 +- src/preconditions/DiversityCoordinatorOnly.ts | 8 +- src/preconditions/EventCoordinatorOnly.ts | 8 +- src/preconditions/MentorCoordinatorOnly.ts | 8 +- src/preconditions/MentorOnly.ts | 4 +- src/preconditions/ModCoordinatorOnly.ts | 4 +- src/preconditions/ModOnly.ts | 8 +- src/preconditions/PatreonOnly.ts | 7 +- src/preconditions/RestrictedAccessOnly.ts | 4 +- src/preconditions/VerifierCoordinatorOnly.ts | 8 +- src/preconditions/VerifierOnly.ts | 4 +- src/scheduled-tasks/messages/diversityMon.ts | 32 +-- src/scheduled-tasks/messages/diversityWed.ts | 33 +-- .../messages/restrictedMessage.ts | 21 +- src/scheduled-tasks/messages/standup.ts | 9 +- .../messages/verifyReminder.ts | 17 +- src/scheduled-tasks/tempBan.ts | 49 +++-- src/scheduled-tasks/verifyTimeout.ts | 17 +- src/scheduled-tasks/verifyUnblock.ts | 10 +- src/utils/checker.ts | 6 +- src/utils/database/dbExistingUser.ts | 6 +- src/utils/database/outreach.ts | 24 ++- src/utils/database/restriction.ts | 9 +- src/utils/database/sus.ts | 13 +- src/utils/database/vcMute.ts | 6 +- src/utils/database/verification.ts | 57 ++--- src/utils/database/warnings.ts | 6 +- src/utils/database/xp.ts | 2 +- src/utils/logging/role.ts | 2 +- src/utils/verification.ts | 179 ++++++++++------ src/utils/verificationConfig.ts | 87 +++----- tsconfig.json | 22 +- 126 files changed, 2392 insertions(+), 1499 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 530fd4c..de68ad5 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,39 +1,29 @@ { - "env": { - "browser": true, - "es2021": true + "env": { + "browser": true, + "es2021": true + }, + "extends": ["airbnb-base", "airbnb-typescript/base", "prettier"], + "parser": "@typescript-eslint/parser", + "parserOptions": { + "ecmaVersion": "latest", + "sourceType": "module", + "project": "tsconfig.json" + }, + "plugins": ["@typescript-eslint", "import"], + "rules": { + "import/no-unresolved": "error", + "import/prefer-default-export": "off", + "class-methods-use-this": "off" + }, + "settings": { + "import/parsers": { + "@typescript-eslint/parser": [".ts", ".tsx"] }, - "extends": [ - "airbnb-base", - "airbnb-typescript/base", - "prettier" - ], - "parser": "@typescript-eslint/parser", - "parserOptions": { - "ecmaVersion": "latest", - "sourceType": "module", - "project": "tsconfig.json" - }, - "plugins": [ - "@typescript-eslint", - "import" - ], - "rules": { - "import/no-unresolved": "error", - "import/prefer-default-export": "off", - "class-methods-use-this": "off" - }, - "settings": { - "import/parsers": { - "@typescript-eslint/parser": [ - ".ts", - ".tsx" - ] - }, - "import/resolver": { - "typescript": { - "alwaysTryTypes": true - } - } + "import/resolver": { + "typescript": { + "alwaysTryTypes": true + } } + } } diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index f3d5c41..5ad9814 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -4,7 +4,6 @@ about: Create a report to help us improve title: '' labels: bug assignees: '' - --- **Describe the bug** @@ -12,6 +11,7 @@ A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior: + 1. Go to '...' 2. Click on '....' 3. Scroll down to '....' @@ -24,15 +24,17 @@ A clear and concise description of what you expected to happen. If applicable, add screenshots to help explain your problem. **Desktop (please complete the following information):** - - OS: [e.g. iOS] - - Browser [e.g. chrome, safari] - - Version [e.g. 22] + +- OS: [e.g. iOS] +- Browser [e.g. chrome, safari] +- Version [e.g. 22] **Smartphone (please complete the following information):** - - Device: [e.g. iPhone6] - - OS: [e.g. iOS8.1] - - Browser [e.g. stock browser, safari] - - Version [e.g. 22] + +- Device: [e.g. iPhone6] +- OS: [e.g. iOS8.1] +- Browser [e.g. stock browser, safari] +- Version [e.g. 22] **Additional context** Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 11fc491..5f0a04c 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -4,7 +4,6 @@ about: Suggest an idea for this project title: '' labels: enhancement assignees: '' - --- **Is your feature request related to a problem? Please describe.** diff --git a/.github/renovate.json b/.github/renovate.json index d9fdedf..af027bf 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -1,7 +1,5 @@ { "$schema": "https://docs.renovatebot.com/renovate-schema.json", - "extends": [ - "config:base" - ], + "extends": ["config:base"], "schedule": ["after 12pm and before 6pm on Saturday"] } diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 4f59002..20b871b 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -9,14 +9,14 @@ # the `language` matrix defined below to confirm you have the correct set of # supported CodeQL languages. # -name: "CodeQL" +name: 'CodeQL' on: push: - branches: [ "main" ] + branches: ['main'] pull_request: # The branches below must be a subset of the branches above - branches: [ "main" ] + branches: ['main'] schedule: - cron: '37 11 * * 2' @@ -32,41 +32,40 @@ jobs: strategy: fail-fast: false matrix: - language: [ 'javascript' ] + language: ['javascript'] # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support steps: - - name: Checkout repository - uses: actions/checkout@v4 + - name: Checkout repository + uses: actions/checkout@v4 - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - - # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs - # queries: security-extended,security-and-quality + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. - - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v2 + # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality - # โ„น๏ธ Command-line programs to run using the OS shell. - # ๐Ÿ“š See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v2 - # If the Autobuild fails above, remove it and uncomment the following three lines. - # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. + # โ„น๏ธ Command-line programs to run using the OS shell. + # ๐Ÿ“š See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun - # - run: | - # echo "Run, Build Application using script" - # ./location_of_script_within_repo/buildscript.sh + # If the Autobuild fails above, remove it and uncomment the following three lines. + # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + # - run: | + # echo "Run, Build Application using script" + # ./location_of_script_within_repo/buildscript.sh + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/eslint.yml b/.github/workflows/eslint.yml index 8ade254..39f7520 100644 --- a/.github/workflows/eslint.yml +++ b/.github/workflows/eslint.yml @@ -11,10 +11,10 @@ name: ESLint on: push: - branches: [ "main" ] + branches: ['main'] pull_request: # The branches below must be a subset of the branches above - branches: [ "main" ] + branches: ['main'] schedule: - cron: '27 13 * * 1' @@ -38,7 +38,7 @@ jobs: run: npx eslint . --config .eslintrc.json --ext .js,.jsx,.ts,.tsx - --format @microsoft/eslint-formatter-sarif + --format @microsoft/eslint-formatter-sarif --output-file eslint-results.sarif continue-on-error: true diff --git a/.github/workflows/prettier.yml b/.github/workflows/prettier.yml index 994d4f1..2b18ca0 100644 --- a/.github/workflows/prettier.yml +++ b/.github/workflows/prettier.yml @@ -2,10 +2,10 @@ name: Prettier on: push: - branches: [ "main" ] + branches: ['main'] pull_request: # The branches below must be a subset of the branches above - branches: [ "main" ] + branches: ['main'] schedule: - cron: '27 13 * * 1' diff --git a/README.md b/README.md index 1c39786..42d1b45 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,6 @@ Make sure to create the .env file, which you can use the [.env.example](.env.exa There are 2 options for running this bot, one using docker-compose and the other, less desirable npm. - ### Docker Running the bot Dockerised makes everything easier. To run the bot, run: @@ -28,11 +27,13 @@ docker-compose up -d Make sure to run `npm install` if you just cloned the repo. Then make sure to compile the TypeScript files using + ```shell npm run build ``` If you are running the code for the first time with a new database, make sure to run `npm run start:migrate`, otherwise run: + ```shell npm start ``` @@ -66,4 +67,4 @@ For support, feel free to send an email to anthony@aramovement.org or reach out This bot is free and open source. It licensed using [GPL v3](LICENSE). -Well done on making it to the bottom of the README file :) +Well done on making it to the bottom of the README file :) diff --git a/docker-compose.yml b/docker-compose.yml index 6d0e7db..1b2b811 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,4 @@ -version: "3.7" +version: '3.7' services: postgres: image: postgres:15 @@ -43,4 +43,4 @@ volumes: name: arabot-redis networks: - arabot: \ No newline at end of file + arabot: diff --git a/docs/CODE_OF_CONDUCT.md b/docs/CODE_OF_CONDUCT.md index 029febe..54ffa8b 100644 --- a/docs/CODE_OF_CONDUCT.md +++ b/docs/CODE_OF_CONDUCT.md @@ -17,23 +17,23 @@ diverse, inclusive, and healthy community. Examples of behavior that contributes to a positive environment for our community include: -* Demonstrating empathy and kindness toward other people -* Being respectful of differing opinions, viewpoints, and experiences -* Giving and gracefully accepting constructive feedback -* Accepting responsibility and apologizing to those affected by our mistakes, +- Demonstrating empathy and kindness toward other people +- Being respectful of differing opinions, viewpoints, and experiences +- Giving and gracefully accepting constructive feedback +- Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience -* Focusing on what is best not just for us as individuals, but for the +- Focusing on what is best not just for us as individuals, but for the overall community Examples of unacceptable behavior include: -* The use of sexualized language or imagery, and sexual attention or +- The use of sexualized language or imagery, and sexual attention or advances of any kind -* Trolling, insulting or derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or email +- Trolling, insulting or derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or email address, without their explicit permission -* Other conduct which could reasonably be considered inappropriate in a +- Other conduct which could reasonably be considered inappropriate in a professional setting ## Enforcement Responsibilities @@ -106,7 +106,7 @@ Violating these terms may lead to a permanent ban. ### 4. Permanent Ban **Community Impact**: Demonstrating a pattern of violation of community -standards, including sustained inappropriate behavior, harassment of an +standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. **Consequence**: A permanent ban from any sort of public interaction within diff --git a/docs/COMMANDS.md b/docs/COMMANDS.md index e203a5b..e2a463c 100644 --- a/docs/COMMANDS.md +++ b/docs/COMMANDS.md @@ -1,11 +1,12 @@ # Commands for the bot -These are all the commands that you can use for the bot. Some of these are for staff only, but everyone can use the +These are all the commands that you can use for the bot. Some of these are for staff only, but everyone can use the general commands ## Contents + - [General](commands/GENERAL.md) - [Moderator](commands/MOD.md) - [Verifier](commands/VERIFIER.md) - [Mentor](commands/MENTOR.md) -- [Coordinator](commands/COORDINATOR.md) \ No newline at end of file +- [Coordinator](commands/COORDINATOR.md) diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index e4baee4..9725214 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -1,13 +1,12 @@ -# Commit Message Format +# Commit Message Format -*This specification is a modified version of the [AngularJS commit message format](https://github.com/angular/angular/blob/main/CONTRIBUTING.md#-commit-message-format).* +_This specification is a modified version of the [AngularJS commit message format](https://github.com/angular/angular/blob/main/CONTRIBUTING.md#-commit-message-format)._ We have very precise rules over how our Git commit messages must be formatted. This format leads to **easier to read commit history**. Each commit message consists of a **header**, a **body**, and a **footer**. - ```
@@ -23,7 +22,6 @@ When the body is present it must be at least 20 characters long and must conform The `footer` is optional. The [Commit Message Footer](#commit-footer) format describes what the footer is used for and the structure it must have. - #### Commit Message Header ``` @@ -38,42 +36,39 @@ The `footer` is optional. The [Commit Message Footer](#commit-footer) format des The `` and `` fields are mandatory, the `()` field is optional. - ##### Type Must be one of the following: -* **build**: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm) -* **ci**: Changes to our CI configuration files and scripts -* **docs**: Documentation only changes -* **feat**: A new feature -* **fix**: A bug fix -* **perf**: A code change that improves performance -* **refactor**: A code change that neither fixes a bug nor adds a feature -* **test**: Adding missing tests or correcting existing tests - +- **build**: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm) +- **ci**: Changes to our CI configuration files and scripts +- **docs**: Documentation only changes +- **feat**: A new feature +- **fix**: A bug fix +- **perf**: A code change that improves performance +- **refactor**: A code change that neither fixes a bug nor adds a feature +- **test**: Adding missing tests or correcting existing tests ##### Scope + The scope should be the name of the npm package affected (as perceived by the person reading the changelog generated from commit messages). The following is the list of supported scopes: -* `arabot` -* `config` -* `compiler` -* `database` -* `docs` -* `upgrade` - +- `arabot` +- `config` +- `compiler` +- `database` +- `docs` +- `upgrade` ##### Summary Use the summary field to provide a succinct description of the change: -* use the imperative, present tense: "change" not "changed" nor "changes" -* don't capitalize the first letter -* no dot (.) at the end - +- use the imperative, present tense: "change" not "changed" nor "changes" +- don't capitalize the first letter +- no dot (.) at the end #### Commit Message Body @@ -82,7 +77,6 @@ Just as in the summary, use the imperative, present tense: "fix" not "fixed" nor Explain the motivation for the change in the commit message body. This commit message should explain _why_ you are making the change. You can include a comparison of the previous behavior with the new behavior in order to illustrate the impact of the change. - #### Commit Message Footer The footer can contain information about breaking changes and deprecations and is also the place to reference GitHub issues, Jira tickets, and other PRs that this commit closes or is related to. @@ -112,7 +106,6 @@ Breaking Change section should start with the phrase "BREAKING CHANGE: " followe Similarly, a Deprecation section should start with "DEPRECATED: " followed by a short description of what is deprecated, a blank line, and a detailed description of the deprecation that also mentions the recommended update path. - ### Revert commits If the commit reverts a previous commit, it should begin with `revert: `, followed by the header of the reverted commit. diff --git a/docs/commands/GENERAL.md b/docs/commands/GENERAL.md index eb1a1cc..746c5bc 100644 --- a/docs/commands/GENERAL.md +++ b/docs/commands/GENERAL.md @@ -5,8 +5,8 @@ - `/ping`/`?ping` - Checks if the bot is alive and the ping of the bot. - `/apply`/`?apply` - Gives you the link to where you can apply to be a Moderator or Verifier. - `/count`/`?count` - Tells you how many vegans and non-vegans there are on the server. -- `/info ` - Gives you information based on what you pick in ``. If you make `visible` -true, it will make the information visible to everyone. +- `/info ` - Gives you information based on what you pick in ``. If you make `visible` + true, it will make the information visible to everyone. - `/help`/`?help` - Gives a link (here) to all the commands. ## Economy @@ -18,7 +18,7 @@ true, it will make the information visible to everyone. ## XP - `/rank `/`?rank ` - Shows your rank based on the amount of XP you have. If you provide -a user, it will display that user's rank instead. + a user, it will display that user's rank instead. ## Fun Commands @@ -29,4 +29,4 @@ a user, it will display that user's rank instead. - `/poke` - `/sad` - `/shrug` -- `/cringe` \ No newline at end of file +- `/cringe` diff --git a/docs/commands/MOD.md b/docs/commands/MOD.md index da4c40f..b7de855 100644 --- a/docs/commands/MOD.md +++ b/docs/commands/MOD.md @@ -4,12 +4,12 @@ - `/rename `/`?ru ` - Renames that user to the specified nickname, if nickname is left blank it will reset the nickname to their original username. -- `/slowmode `/`?slowmode ` - changes the slowmode for a chat. Duration uses a time which can be set by providing a number -followed by s/d/m/y or just writing `off`. These can be combined. -For example to set the slowmode for 1 minute and 30 seconds, you would write: `1m 30s`. +- `/slowmode `/`?slowmode ` - changes the slowmode for a chat. Duration uses a time which can be set by providing a number + followed by s/d/m/y or just writing `off`. These can be combined. + For example to set the slowmode for 1 minute and 30 seconds, you would write: `1m 30s`. - `/softmute `/`?sm/softmute ` - Prevents the user from reacting to messages. -- `/vcmute `/`?vcmute ` - Adds a persistent VC mute if the user has left the VC or leaves the server to -circumvent VC mutes. +- `/vcmute `/`?vcmute ` - Adds a persistent VC mute if the user has left the VC or leaves the server to + circumvent VC mutes. - `?warn ` - Gives a warning to the user. ## Roles @@ -36,15 +36,15 @@ These are used for users that have broken rules severe enough that takes away th - `/restrict `/`?r/restrict ` - Restricts the user to the restricted section - `/unrestrict `/`?ur ` - Unrestricts the user -- `/restrictlogs ` - Shows the logs of when the user has been restricted. The need to provide the user -is optional depending on if the command is run in the ModMail category. +- `/restrictlogs ` - Shows the logs of when the user has been restricted. The need to provide the user + is optional depending on if the command is run in the ModMail category. - `/restricttools channel delete ` - Deletes the vegan restricted channel for the user. Providing a user -is only optional if the command is run in the channel that is to be deleted. + is only optional if the command is run in the channel that is to be deleted. ## Bans - `/tempban `/`?tempban ` - Bans the user for a specific amount of -time. Duration uses a time which can be set by providing a number followed by s/d/m/y. These can be combined. -For example to ban someone for 1 week and 3 days, you would write: `1w 3d`. + time. Duration uses a time which can be set by providing a number followed by s/d/m/y. These can be combined. + For example to ban someone for 1 week and 3 days, you would write: `1w 3d`. - `/ban `/`?ban ` - Permanently bans that user. - `/unban `/`?unban ` - Unbans that user. diff --git a/docs/commands/VERIFIER.md b/docs/commands/VERIFIER.md index d8342a1..57990ed 100644 --- a/docs/commands/VERIFIER.md +++ b/docs/commands/VERIFIER.md @@ -2,9 +2,10 @@ ## Verification -- `/verify `/`?ver ` - This is a manual verification to give roles to a user. This should -not be used if you are verifying the user in the voice channel. Roles available (you can write multiple in one command -such as `v a t`): +- `/verify `/`?ver ` - This is a manual verification to give roles to a user. This should + not be used if you are verifying the user in the voice channel. Roles available (you can write multiple in one command + such as `v a t`): + - `v` - Vegan - `a` - Activist - `t` - Trusted @@ -13,8 +14,8 @@ such as `v a t`): - `conv` - Convinced - `veg` - Veg Curious -- `/verifytimeoutremove ` - Removes a verification timeout if the user has been timed out as a verifier was not -available. This cannot be used for users that have been verified. +- `/verifytimeoutremove ` - Removes a verification timeout if the user has been timed out as a verifier was not + available. This cannot be used for users that have been verified. ## Roles diff --git a/src/commands/coordinators/access.ts b/src/commands/coordinators/access.ts index e0e8e03..6855dcd 100644 --- a/src/commands/coordinators/access.ts +++ b/src/commands/coordinators/access.ts @@ -26,7 +26,8 @@ export class AccessCommand extends Command { super(context, { ...options, name: 'access', - description: 'Manages channel permissions for ModMails, Private channels, and restricted channels', + description: + 'Manages channel permissions for ModMails, Private channels, and restricted channels', preconditions: ['CoordinatorOnly'], }); } @@ -34,25 +35,38 @@ export class AccessCommand extends Command { // Registers that this is a slash command public override registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand( - (builder) => builder - .setName(this.name) - .setDescription(this.description) - .addStringOption((option) => option.setName('permission') - .setDescription('Select permissions for the user/role') - .setRequired(true) - .addChoices( - { name: 'Add', value: 'add' }, - { name: 'Read', value: 'read' }, - { name: 'Remove', value: 'remove' }, - { name: 'Reset', value: 'reset' }, - )) - .addChannelOption((option) => option.setName('channel') - .setDescription('Channel to change these permissions on') - .setRequired(true)) - .addUserOption((option) => option.setName('user') - .setDescription('User to set these permissions for')) - .addRoleOption((option) => option.setName('role') - .setDescription('Role to set these permissions for')), + (builder) => + builder + .setName(this.name) + .setDescription(this.description) + .addStringOption((option) => + option + .setName('permission') + .setDescription('Select permissions for the user/role') + .setRequired(true) + .addChoices( + { name: 'Add', value: 'add' }, + { name: 'Read', value: 'read' }, + { name: 'Remove', value: 'remove' }, + { name: 'Reset', value: 'reset' }, + ), + ) + .addChannelOption((option) => + option + .setName('channel') + .setDescription('Channel to change these permissions on') + .setRequired(true), + ) + .addUserOption((option) => + option + .setName('user') + .setDescription('User to set these permissions for'), + ) + .addRoleOption((option) => + option + .setName('role') + .setDescription('Role to set these permissions for'), + ), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite, }, @@ -88,15 +102,18 @@ export class AccessCommand extends Command { // If user and role is provided, the return an error if (user !== null && role !== null) { await interaction.reply({ - content: 'You have entered a user and a role at the same time! Please only enter one at a time.', + content: + 'You have entered a user and a role at the same time! Please only enter one at a time.', ephemeral: true, }); return; } // Checks that the channel is a GuildText or GuildVoice, otherwise, return error - if (channel.type !== ChannelType.GuildText - && channel.type !== ChannelType.GuildVoice) { + if ( + channel.type !== ChannelType.GuildText && + channel.type !== ChannelType.GuildVoice + ) { await interaction.reply({ content: 'Please only select a text or voice channel!', ephemeral: true, @@ -105,9 +122,11 @@ export class AccessCommand extends Command { } // If the channel is not in the categories ModMail, Private, Restricted, the return error - if (channel.parentId !== IDs.categories.modMail - && channel.parentId !== IDs.categories.private - && channel.parentId !== IDs.categories.restricted) { + if ( + channel.parentId !== IDs.categories.modMail && + channel.parentId !== IDs.categories.private && + channel.parentId !== IDs.categories.restricted + ) { await interaction.reply({ content: 'Channel is not in ModMail/Private/Restricted category!', ephemeral: true, diff --git a/src/commands/coordinators/anonymous.ts b/src/commands/coordinators/anonymous.ts index 9cae7da..6a4e0b8 100644 --- a/src/commands/coordinators/anonymous.ts +++ b/src/commands/coordinators/anonymous.ts @@ -35,14 +35,21 @@ export class AnonymousCommand extends Command { // Registers that this is a slash command public override registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand( - (builder) => builder - .setName(this.name) - .setDescription(this.description) - .addStringOption((option) => option.setName('message') - .setDescription('The message the bot will send') - .setRequired(true)) - .addChannelOption((option) => option.setName('channel') - .setDescription('The channel the bot will send the message')), + (builder) => + builder + .setName(this.name) + .setDescription(this.description) + .addStringOption((option) => + option + .setName('message') + .setDescription('The message the bot will send') + .setRequired(true), + ) + .addChannelOption((option) => + option + .setName('channel') + .setDescription('The channel the bot will send the message'), + ), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite, }, diff --git a/src/commands/coordinators/clear.ts b/src/commands/coordinators/clear.ts index a8abd06..d0a67f7 100644 --- a/src/commands/coordinators/clear.ts +++ b/src/commands/coordinators/clear.ts @@ -33,14 +33,18 @@ export class ClearCommand extends Command { // Registers that this is a slash command public override registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand( - (builder) => builder - .setName(this.name) - .setDescription(this.description) - .addIntegerOption((option) => option.setName('messages') - .setDescription('Number of messages to clear') - .setRequired(true) - .setMinValue(1) - .setMaxValue(100)), + (builder) => + builder + .setName(this.name) + .setDescription(this.description) + .addIntegerOption((option) => + option + .setName('messages') + .setDescription('Number of messages to clear') + .setRequired(true) + .setMinValue(1) + .setMaxValue(100), + ), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite, }, @@ -53,8 +57,7 @@ export class ClearCommand extends Command { const messages = interaction.options.getInteger('messages', true); const { channel } = interaction; - if (channel === null - || channel.isDMBased()) { + if (channel === null || channel.isDMBased()) { await interaction.reply({ content: 'Could not fetch channel!', ephemeral: true, @@ -89,8 +92,7 @@ export class ClearCommand extends Command { const { channel } = message; - if (!channel.isTextBased() - || channel.isDMBased()) { + if (!channel.isTextBased() || channel.isDMBased()) { await message.react('โŒ'); await message.reply('Unsupported channel type!'); return; diff --git a/src/commands/coordinators/private.ts b/src/commands/coordinators/private.ts index fed68ec..8b5cda1 100644 --- a/src/commands/coordinators/private.ts +++ b/src/commands/coordinators/private.ts @@ -53,18 +53,31 @@ export class PrivateCommand extends Subcommand { // Registers that this is a slash command public override registerApplicationCommands(registry: Subcommand.Registry) { registry.registerChatInputCommand( - (builder) => builder - .setName(this.name) - .setDescription(this.description) - .addSubcommand((command) => command.setName('create') - .setDescription('Create a private channel') - .addUserOption((option) => option.setName('user') - .setDescription('User to create a private channel with') - .setRequired(true))) - .addSubcommand((command) => command.setName('delete') - .setDescription('Delete a private channel') - .addUserOption((option) => option.setName('user') - .setDescription('User to delete a private channel from'))), + (builder) => + builder + .setName(this.name) + .setDescription(this.description) + .addSubcommand((command) => + command + .setName('create') + .setDescription('Create a private channel') + .addUserOption((option) => + option + .setName('user') + .setDescription('User to create a private channel with') + .setRequired(true), + ), + ) + .addSubcommand((command) => + command + .setName('delete') + .setDescription('Delete a private channel') + .addUserOption((option) => + option + .setName('user') + .setDescription('User to delete a private channel from'), + ), + ), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite, }, @@ -122,10 +135,12 @@ export class PrivateCommand extends Subcommand { }, { id: coordinator, - allow: [PermissionsBitField.Flags.SendMessages, + allow: [ + PermissionsBitField.Flags.SendMessages, PermissionsBitField.Flags.ViewChannel, PermissionsBitField.Flags.Connect, - PermissionsBitField.Flags.MuteMembers], + PermissionsBitField.Flags.MuteMembers, + ], }, ], }); @@ -150,8 +165,10 @@ export class PrivateCommand extends Subcommand { }, { id: coordinator, - allow: [PermissionsBitField.Flags.SendMessages, - PermissionsBitField.Flags.ViewChannel], + allow: [ + PermissionsBitField.Flags.SendMessages, + PermissionsBitField.Flags.ViewChannel, + ], }, ], }); @@ -173,8 +190,10 @@ export class PrivateCommand extends Subcommand { }, { id: coordinator, - allow: [PermissionsBitField.Flags.SendMessages, - PermissionsBitField.Flags.ViewChannel], + allow: [ + PermissionsBitField.Flags.SendMessages, + PermissionsBitField.Flags.ViewChannel, + ], }, ], }); @@ -240,21 +259,23 @@ export class PrivateCommand extends Subcommand { if (user === null) { if (channel.type !== ChannelType.GuildText) { await interaction.editReply({ - content: 'Please make sure you ran this command in the original private text channel!', + content: + 'Please make sure you ran this command in the original private text channel!', }); return; } if (channel.parentId !== IDs.categories.private) { await interaction.editReply({ - content: 'Please make sure you ran this command in the original private text channel!', + content: + 'Please make sure you ran this command in the original private text channel!', }); return; } if (channel.topic === null) { await interaction.editReply({ - content: 'There was an error with this channel\'s topic!', + content: "There was an error with this channel's topic!", }); return; } @@ -265,15 +286,18 @@ export class PrivateCommand extends Subcommand { const vcId = topic[topic.indexOf(coordinator) + 1]; const voiceChannel = guild.channels.cache.get(vcId); - if (voiceChannel !== undefined - && voiceChannel.parentId === IDs.categories.private) { + if ( + voiceChannel !== undefined && + voiceChannel.parentId === IDs.categories.private + ) { await voiceChannel.delete(); } return; } - const category = guild.channels.cache - .get(IDs.categories.private) as CategoryChannel | undefined; + const category = guild.channels.cache.get(IDs.categories.private) as + | CategoryChannel + | undefined; if (category === undefined) { await interaction.editReply({ @@ -282,7 +306,9 @@ export class PrivateCommand extends Subcommand { return; } - const textChannels = category.children.cache.filter((c) => c.type === ChannelType.GuildText); + const textChannels = category.children.cache.filter( + (c) => c.type === ChannelType.GuildText, + ); textChannels.forEach((c) => { const textChannel = c as TextChannel; // Checks if the channel topic has the user's snowflake @@ -291,8 +317,10 @@ export class PrivateCommand extends Subcommand { const vcId = topic[topic.indexOf(coordinator) + 1]; const voiceChannel = guild.channels.cache.get(vcId); - if (voiceChannel !== undefined - && voiceChannel.parentId === IDs.categories.private) { + if ( + voiceChannel !== undefined && + voiceChannel.parentId === IDs.categories.private + ) { voiceChannel.delete(); } textChannel.delete(); @@ -333,19 +361,25 @@ export class PrivateCommand extends Subcommand { } private checkPrivate(user: Snowflake, coordinator: string, guild: Guild) { - const category = guild.channels.cache - .get(IDs.categories.private) as CategoryChannel | undefined; + const category = guild.channels.cache.get(IDs.categories.private) as + | CategoryChannel + | undefined; if (category === undefined) { return true; } - const textChannels = category.children.cache.filter((c) => c.type === ChannelType.GuildText); + const textChannels = category.children.cache.filter( + (c) => c.type === ChannelType.GuildText, + ); let exists = false; textChannels.forEach((c) => { const textChannel = c as TextChannel; // Checks if the channel topic has the user's snowflake - if (textChannel.topic?.includes(user) && textChannel.topic?.includes(coordinator)) { + if ( + textChannel.topic?.includes(user) && + textChannel.topic?.includes(coordinator) + ) { exists = true; } }); diff --git a/src/commands/economy/balance.ts b/src/commands/economy/balance.ts index 9cec2e3..8d7d98e 100644 --- a/src/commands/economy/balance.ts +++ b/src/commands/economy/balance.ts @@ -36,9 +36,7 @@ export class BalanceCommand extends Command { // Registers that this is a slash command public override registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand( - (builder) => builder - .setName(this.name) - .setDescription(this.description), + (builder) => builder.setName(this.name).setDescription(this.description), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite, }, @@ -114,10 +112,11 @@ export class BalanceCommand extends Command { const embed = new EmbedBuilder() .setColor('#00ff7d') - .setAuthor({ name: `${member.displayName}'s Account`, iconURL: `${user.displayAvatarURL()}` }) - .addFields( - { name: 'Balance', value: `${balance.balance} ARA` }, - ); + .setAuthor({ + name: `${member.displayName}'s Account`, + iconURL: `${user.displayAvatarURL()}`, + }) + .addFields({ name: 'Balance', value: `${balance.balance} ARA` }); info.success = true; info.embeds.push(embed); diff --git a/src/commands/economy/daily.ts b/src/commands/economy/daily.ts index 7c13071..4efdfc7 100644 --- a/src/commands/economy/daily.ts +++ b/src/commands/economy/daily.ts @@ -19,12 +19,7 @@ import { Command, RegisterBehavior } from '@sapphire/framework'; import { Time } from '@sapphire/time-utilities'; -import type { - User, - Guild, - GuildMember, - Message, -} from 'discord.js'; +import type { User, Guild, GuildMember, Message } from 'discord.js'; import { updateUser } from '#utils/database/dbExistingUser'; import { daily, getLastDaily } from '#utils/database/economy'; import { EmbedBuilder } from 'discord.js'; @@ -42,9 +37,7 @@ export class DailyCommand extends Command { // Registers that this is a slash command public override registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand( - (builder) => builder - .setName(this.name) - .setDescription(this.description), + (builder) => builder.setName(this.name).setDescription(this.description), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite, }, @@ -112,9 +105,12 @@ export class DailyCommand extends Command { const lastDaily = await getLastDaily(user.id); - if (lastDaily !== null - && (new Date().getTime() - lastDaily.time.getTime()) < time) { - info.message = 'You have already claimed your daily, come back later to claim it!'; + if ( + lastDaily !== null && + new Date().getTime() - lastDaily.time.getTime() < time + ) { + info.message = + 'You have already claimed your daily, come back later to claim it!'; return info; } @@ -136,8 +132,15 @@ export class DailyCommand extends Command { const embed = new EmbedBuilder() .setColor('#00ff7d') - .setAuthor({ name: 'Daily Reward', iconURL: `${user.displayAvatarURL()}` }) - .addFields({ name: 'Collected', value: `${amount} ARA`, inline: bonus > 0 }); + .setAuthor({ + name: 'Daily Reward', + iconURL: `${user.displayAvatarURL()}`, + }) + .addFields({ + name: 'Collected', + value: `${amount} ARA`, + inline: bonus > 0, + }); if (bonus > 0) { embed.addFields( diff --git a/src/commands/economy/pay.ts b/src/commands/economy/pay.ts index 2aa623f..ae4850d 100644 --- a/src/commands/economy/pay.ts +++ b/src/commands/economy/pay.ts @@ -36,19 +36,29 @@ export class BalanceCommand extends Command { // Registers that this is a slash command public override registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand( - (builder) => builder - .setName(this.name) - .setDescription(this.description) - .addUserOption((option) => option.setName('user') - .setDescription('The user to give the money to') - .setRequired(true)) - .addIntegerOption((option) => option.setName('amount') - .setDescription('The amount to give to the user') - .setMinValue(1) - .setRequired(true)) - .addStringOption((option) => option.setName('reason') - .setDescription('The reason/reference for the transaction') - .setRequired(true)), + (builder) => + builder + .setName(this.name) + .setDescription(this.description) + .addUserOption((option) => + option + .setName('user') + .setDescription('The user to give the money to') + .setRequired(true), + ) + .addIntegerOption((option) => + option + .setName('amount') + .setDescription('The amount to give to the user') + .setMinValue(1) + .setRequired(true), + ) + .addStringOption((option) => + option + .setName('reason') + .setDescription('The reason/reference for the transaction') + .setRequired(true), + ), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite, }, @@ -133,7 +143,13 @@ export class BalanceCommand extends Command { } } - private async pay(user: User, recipient: User, amount: number, reason: string, guild: Guild) { + private async pay( + user: User, + recipient: User, + amount: number, + reason: string, + guild: Guild, + ) { const info = { message: '', embeds: [] as EmbedBuilder[], @@ -142,8 +158,9 @@ export class BalanceCommand extends Command { // Check the amount to be paid is greater than 0 if (amount < 1) { - info.message = 'You need to actually give money, you can\'t send nothing or try to break the ' - + 'economy ๐Ÿ˜ญ'; + info.message = + "You need to actually give money, you can't send nothing or try to break the " + + 'economy ๐Ÿ˜ญ'; return info; } @@ -166,7 +183,7 @@ export class BalanceCommand extends Command { const balance = await getBalance(user.id); if (balance.balance < amount) { - info.message = 'You don\'t have enough money to send!'; + info.message = "You don't have enough money to send!"; return info; } @@ -174,7 +191,10 @@ export class BalanceCommand extends Command { const embed = new EmbedBuilder() .setColor('#00ff7d') - .setAuthor({ name: `Transfer to ${recipientMember.displayName}`, iconURL: `${recipientMember.displayAvatarURL()}` }) + .setAuthor({ + name: `Transfer to ${recipientMember.displayName}`, + iconURL: `${recipientMember.displayAvatarURL()}`, + }) .addFields( { name: 'From', value: `${user}`, inline: true }, { name: 'To', value: `${recipient}`, inline: true }, @@ -186,12 +206,14 @@ export class BalanceCommand extends Command { info.embeds.push(embed); // Log the payment in the server - let logChannel = guild.channels.cache - .get(IDs.channels.logs.economy) as TextChannel | undefined; + let logChannel = guild.channels.cache.get(IDs.channels.logs.economy) as + | TextChannel + | undefined; if (logChannel === undefined) { - logChannel = await guild.channels - .fetch(IDs.channels.logs.economy) as TextChannel | undefined; + logChannel = (await guild.channels.fetch(IDs.channels.logs.economy)) as + | TextChannel + | undefined; if (logChannel === undefined) { this.container.logger.error('Pay Error: Could not fetch log channel'); return info; @@ -199,9 +221,7 @@ export class BalanceCommand extends Command { } const logEmbed = new EmbedBuilder(embed.data); - logEmbed - .setTimestamp() - .setFooter({ text: `ID: ${user.id}` }); + logEmbed.setTimestamp().setFooter({ text: `ID: ${user.id}` }); await logChannel.send({ embeds: [logEmbed] }); return info; } diff --git a/src/commands/fun/1984.ts b/src/commands/fun/1984.ts index b78571d..5818895 100644 --- a/src/commands/fun/1984.ts +++ b/src/commands/fun/1984.ts @@ -35,9 +35,7 @@ export class N1984Command extends Command { // Registers that this is a slash command public override registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand( - (builder) => builder - .setName(this.name) - .setDescription(this.description), + (builder) => builder.setName(this.name).setDescription(this.description), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite, }, @@ -54,8 +52,10 @@ export class N1984Command extends Command { // Creates the embed for the 1984 reaction // Add a 1 in 1000 chance of Dantas literally making ARA 1984 - const random1984 = Math.random() < 0.001 ? 'https://c.tenor.com/0BwU0BjWYX4AAAAC/arthuria-dantas.gif' - : N1984[Math.floor(Math.random() * N1984.length)]; + const random1984 = + Math.random() < 0.001 + ? 'https://c.tenor.com/0BwU0BjWYX4AAAAC/arthuria-dantas.gif' + : N1984[Math.floor(Math.random() * N1984.length)]; const n1984Embed = new EmbedBuilder() .setColor('#ffffff') .setTitle(`${user.username} is happy!`) diff --git a/src/commands/fun/cringe.ts b/src/commands/fun/cringe.ts index aae26dc..0709191 100644 --- a/src/commands/fun/cringe.ts +++ b/src/commands/fun/cringe.ts @@ -37,7 +37,7 @@ export class CringeCommand extends Command { (builder) => builder.setName(this.name).setDescription(this.description), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite, - } + }, ); } diff --git a/src/commands/fun/happy.ts b/src/commands/fun/happy.ts index e750ede..c608962 100644 --- a/src/commands/fun/happy.ts +++ b/src/commands/fun/happy.ts @@ -34,9 +34,7 @@ export class HappyCommand extends Command { // Registers that this is a slash command public override registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand( - (builder) => builder - .setName(this.name) - .setDescription(this.description), + (builder) => builder.setName(this.name).setDescription(this.description), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite, }, diff --git a/src/commands/fun/hug.ts b/src/commands/fun/hug.ts index e6b6a5b..ff74e0f 100644 --- a/src/commands/fun/hug.ts +++ b/src/commands/fun/hug.ts @@ -34,12 +34,16 @@ export class HugCommand extends Command { // Registers that this is a slash command public override registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand( - (builder) => builder - .setName(this.name) - .setDescription(this.description) - .addUserOption((option) => option.setName('user') - .setDescription('User you want to hug') - .setRequired(true)), + (builder) => + builder + .setName(this.name) + .setDescription(this.description) + .addUserOption((option) => + option + .setName('user') + .setDescription('User you want to hug') + .setRequired(true), + ), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite, }, @@ -61,9 +65,15 @@ export class HugCommand extends Command { .setColor('#0099ff') .setTitle(`Hug from ${hugger.username}`) .setImage(randomHug) - .setFooter({ text: `Amount of hugs given from ${hugger.username} to you: ${count}` }); + .setFooter({ + text: `Amount of hugs given from ${hugger.username} to you: ${count}`, + }); // Send the hug - await interaction.reply({ content: `${user}`, embeds: [hugEmbed], fetchReply: true }); + await interaction.reply({ + content: `${user}`, + embeds: [hugEmbed], + fetchReply: true, + }); } } diff --git a/src/commands/fun/kill.ts b/src/commands/fun/kill.ts index 413217d..ffa536f 100644 --- a/src/commands/fun/kill.ts +++ b/src/commands/fun/kill.ts @@ -34,12 +34,16 @@ export class KillCommand extends Command { // Registers that this is a slash command public override registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand( - (builder) => builder - .setName(this.name) - .setDescription(this.description) - .addUserOption((option) => option.setName('user') - .setDescription('User you want to kill') - .setRequired(true)), + (builder) => + builder + .setName(this.name) + .setDescription(this.description) + .addUserOption((option) => + option + .setName('user') + .setDescription('User you want to kill') + .setRequired(true), + ), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite, }, @@ -66,9 +70,15 @@ export class KillCommand extends Command { .setColor('#ff0000') .setTitle(`Kill from ${sender.username}`) .setImage(randomKill) - .setFooter({ text: `Amount of kills from ${sender.username} to you: ${count}` }); + .setFooter({ + text: `Amount of kills from ${sender.username} to you: ${count}`, + }); // Send the kill - await interaction.reply({ content: `${user}`, embeds: [killEmbed], fetchReply: true }); + await interaction.reply({ + content: `${user}`, + embeds: [killEmbed], + fetchReply: true, + }); } } diff --git a/src/commands/fun/poke.ts b/src/commands/fun/poke.ts index fe735f1..8974836 100644 --- a/src/commands/fun/poke.ts +++ b/src/commands/fun/poke.ts @@ -34,12 +34,16 @@ export class PokeCommand extends Command { // Registers that this is a slash command public override registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand( - (builder) => builder - .setName(this.name) - .setDescription(this.description) - .addUserOption((option) => option.setName('user') - .setDescription('User you want to poke') - .setRequired(true)), + (builder) => + builder + .setName(this.name) + .setDescription(this.description) + .addUserOption((option) => + option + .setName('user') + .setDescription('User you want to poke') + .setRequired(true), + ), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite, }, @@ -61,9 +65,15 @@ export class PokeCommand extends Command { .setColor('#0099ff') .setTitle(`Poke from ${sender.username}`) .setImage(randomPoke) - .setFooter({ text: `Amount of pokes from ${sender.username} to you: ${count}` }); + .setFooter({ + text: `Amount of pokes from ${sender.username} to you: ${count}`, + }); // Send the poke - await interaction.reply({ content: `${user}`, embeds: [pokeEmbed], fetchReply: true }); + await interaction.reply({ + content: `${user}`, + embeds: [pokeEmbed], + fetchReply: true, + }); } } diff --git a/src/commands/fun/sad.ts b/src/commands/fun/sad.ts index cc8bad4..44b48ae 100644 --- a/src/commands/fun/sad.ts +++ b/src/commands/fun/sad.ts @@ -34,9 +34,7 @@ export class SadCommand extends Command { // Registers that this is a slash command public override registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand( - (builder) => builder - .setName(this.name) - .setDescription(this.description), + (builder) => builder.setName(this.name).setDescription(this.description), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite, }, diff --git a/src/commands/fun/shrug.ts b/src/commands/fun/shrug.ts index 74fa524..abae7a3 100644 --- a/src/commands/fun/shrug.ts +++ b/src/commands/fun/shrug.ts @@ -34,9 +34,7 @@ export class ShrugCommand extends Command { // Registers that this is a slash command public override registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand( - (builder) => builder - .setName(this.name) - .setDescription(this.description), + (builder) => builder.setName(this.name).setDescription(this.description), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite, }, diff --git a/src/commands/mod/ban/ban.ts b/src/commands/mod/ban/ban.ts index f85bb9a..9979f17 100644 --- a/src/commands/mod/ban/ban.ts +++ b/src/commands/mod/ban/ban.ts @@ -18,13 +18,7 @@ */ import { Args, Command, RegisterBehavior } from '@sapphire/framework'; -import type { - User, - Message, - Snowflake, - TextChannel, - Guild, -} from 'discord.js'; +import type { User, Message, Snowflake, TextChannel, Guild } from 'discord.js'; import { EmbedBuilder } from 'discord.js'; import IDs from '#utils/ids'; import { addBan, checkBan } from '#utils/database/ban'; @@ -44,15 +38,22 @@ export class BanCommand extends Command { // Registers that this is a slash command public override registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand( - (builder) => builder - .setName(this.name) - .setDescription(this.description) - .addUserOption((option) => option.setName('user') - .setDescription('User to ban') - .setRequired(true)) - .addStringOption((option) => option.setName('reason') - .setDescription('Note about the user') - .setRequired(true)), + (builder) => + builder + .setName(this.name) + .setDescription(this.description) + .addUserOption((option) => + option + .setName('user') + .setDescription('User to ban') + .setRequired(true), + ) + .addStringOption((option) => + option + .setName('reason') + .setDescription('Note about the user') + .setRequired(true), + ), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite, }, @@ -114,8 +115,10 @@ export class BanCommand extends Command { if (message.channel.id !== IDs.channels.restricted.moderators) { await message.react('โŒ'); - await message.reply(`You can only run this command in <#${IDs.channels.restricted.moderators}> ` - + 'or alternatively use the slash command!'); + await message.reply( + `You can only run this command in <#${IDs.channels.restricted.moderators}> ` + + 'or alternatively use the slash command!', + ); return; } @@ -125,7 +128,12 @@ export class BanCommand extends Command { await message.react(ban.success ? 'โœ…' : 'โŒ'); } - private async ban(userId: Snowflake, modId: Snowflake, reason: string, guild: Guild) { + private async ban( + userId: Snowflake, + modId: Snowflake, + reason: string, + guild: Guild, + ) { const info = { message: '', success: false, @@ -134,7 +142,7 @@ export class BanCommand extends Command { let user = guild.client.users.cache.get(userId); if (user === undefined) { - user = await guild.client.users.fetch(userId) as User; + user = (await guild.client.users.fetch(userId)) as User; } // Gets mod's GuildMember @@ -158,8 +166,7 @@ export class BanCommand extends Command { let member = guild.members.cache.get(userId); if (member === undefined) { - member = await guild.members.fetch(userId) - .catch(() => undefined); + member = await guild.members.fetch(userId).catch(() => undefined); } if (member !== undefined) { @@ -172,8 +179,11 @@ export class BanCommand extends Command { await updateUser(member); // Send DM for reason of ban - await member.send(`You have been banned from ARA for: ${reason}` - + '\n\nhttps://vbcamp.org/ARA') + await member + .send( + `You have been banned from ARA for: ${reason}` + + '\n\nhttps://vbcamp.org/ARA', + ) .catch(() => {}); // Ban the user @@ -193,12 +203,14 @@ export class BanCommand extends Command { info.success = true; // Log the ban - let logChannel = guild.channels.cache - .get(IDs.channels.logs.restricted) as TextChannel | undefined; + let logChannel = guild.channels.cache.get(IDs.channels.logs.restricted) as + | TextChannel + | undefined; if (logChannel === undefined) { - logChannel = await guild.channels - .fetch(IDs.channels.logs.restricted) as TextChannel | undefined; + logChannel = (await guild.channels.fetch( + IDs.channels.logs.restricted, + )) as TextChannel | undefined; if (logChannel === undefined) { this.container.logger.error('Ban Error: Could not fetch log channel'); info.message = `${user} has been banned. This hasn't been logged in a text channel as log channel could not be found`; @@ -208,7 +220,10 @@ export class BanCommand extends Command { const log = new EmbedBuilder() .setColor('#FF0000') - .setAuthor({ name: `Banned ${user.tag}`, iconURL: `${user.displayAvatarURL()}` }) + .setAuthor({ + name: `Banned ${user.tag}`, + iconURL: `${user.displayAvatarURL()}`, + }) .addFields( { name: 'User', value: `${user}`, inline: true }, { name: 'Moderator', value: `${mod}`, inline: true }, diff --git a/src/commands/mod/ban/tempBan.ts b/src/commands/mod/ban/tempBan.ts index 15cae08..fb7aec0 100644 --- a/src/commands/mod/ban/tempBan.ts +++ b/src/commands/mod/ban/tempBan.ts @@ -19,12 +19,7 @@ import { Args, Command, RegisterBehavior } from '@sapphire/framework'; import { Duration, DurationFormatter } from '@sapphire/time-utilities'; -import type { - User, - Snowflake, - TextChannel, - Guild, -} from 'discord.js'; +import type { User, Snowflake, TextChannel, Guild } from 'discord.js'; import { EmbedBuilder, Message } from 'discord.js'; import IDs from '#utils/ids'; import { addTempBan, checkTempBan } from '#utils/database/tempBan'; @@ -43,18 +38,28 @@ export class TempBanCommand extends Command { // Registers that this is a slash command public override registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand( - (builder) => builder - .setName(this.name) - .setDescription(this.description) - .addUserOption((option) => option.setName('user') - .setDescription('User to ban') - .setRequired(true)) - .addStringOption((option) => option.setName('duration') - .setDescription('How long to ban the user for') - .setRequired(true)) - .addStringOption((option) => option.setName('reason') - .setDescription('Note about the user') - .setRequired(true)), + (builder) => + builder + .setName(this.name) + .setDescription(this.description) + .addUserOption((option) => + option + .setName('user') + .setDescription('User to ban') + .setRequired(true), + ) + .addStringOption((option) => + option + .setName('duration') + .setDescription('How long to ban the user for') + .setRequired(true), + ) + .addStringOption((option) => + option + .setName('reason') + .setDescription('Note about the user') + .setRequired(true), + ), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite, }, @@ -140,8 +145,10 @@ export class TempBanCommand extends Command { if (message.channel.id !== IDs.channels.restricted.moderators) { await message.react('โŒ'); - await message.reply(`You can only run this command in <#${IDs.channels.restricted.moderators}> ` - + 'or alternatively use the slash command!'); + await message.reply( + `You can only run this command in <#${IDs.channels.restricted.moderators}> ` + + 'or alternatively use the slash command!', + ); return; } @@ -197,7 +204,7 @@ export class TempBanCommand extends Command { let user = guild.client.users.cache.get(userId); if (user === undefined) { - user = await guild.client.users.fetch(userId) as User; + user = (await guild.client.users.fetch(userId)) as User; } // Gets mod's GuildMember @@ -221,8 +228,7 @@ export class TempBanCommand extends Command { let member = guild.members.cache.get(userId); if (member === undefined) { - member = await guild.members.fetch(userId) - .catch(() => undefined); + member = await guild.members.fetch(userId).catch(() => undefined); } if (member !== undefined) { @@ -235,8 +241,11 @@ export class TempBanCommand extends Command { await updateUser(member); // Send DM for reason of ban - await member.send(`You have been temporarily banned from ARA for ${banLength}. Reason: ${reason}` - + '\n\nhttps://vbcamp.org/ARA') + await member + .send( + `You have been temporarily banned from ARA for ${banLength}. Reason: ${reason}` + + '\n\nhttps://vbcamp.org/ARA', + ) .catch(() => {}); // Ban the user @@ -249,32 +258,44 @@ export class TempBanCommand extends Command { await addTempBan(userId, modId, time.fromNow, reason); // Create scheduled task to unban - this.container.tasks.create('tempBan', { - userId: user.id, - guildId: guild.id, - }, time.offset); + this.container.tasks.create( + 'tempBan', + { + userId: user.id, + guildId: guild.id, + }, + time.offset, + ); info.message = `${user} has been temporarily banned for ${banLength}.`; info.success = true; // Log the ban - let logChannel = guild.channels.cache - .get(IDs.channels.logs.restricted) as TextChannel | undefined; + let logChannel = guild.channels.cache.get(IDs.channels.logs.restricted) as + | TextChannel + | undefined; if (logChannel === undefined) { - logChannel = await guild.channels - .fetch(IDs.channels.logs.restricted) as TextChannel | undefined; + logChannel = (await guild.channels.fetch( + IDs.channels.logs.restricted, + )) as TextChannel | undefined; if (logChannel === undefined) { - this.container.logger.error('Temp Ban Error: Could not fetch log channel'); - info.message = `${user} has been temporarily banned for ${banLength}. ` - + 'This hasn\'t been logged in a text channel as log channel could not be found'; + this.container.logger.error( + 'Temp Ban Error: Could not fetch log channel', + ); + info.message = + `${user} has been temporarily banned for ${banLength}. ` + + "This hasn't been logged in a text channel as log channel could not be found"; return info; } } const log = new EmbedBuilder() .setColor('#FF0000') - .setAuthor({ name: `Temp Banned ${user.tag}`, iconURL: `${user.displayAvatarURL()}` }) + .setAuthor({ + name: `Temp Banned ${user.tag}`, + iconURL: `${user.displayAvatarURL()}`, + }) .addFields( { name: 'User', value: `${user}`, inline: true }, { name: 'Moderator', value: `${mod}`, inline: true }, diff --git a/src/commands/mod/ban/unban.ts b/src/commands/mod/ban/unban.ts index 14a2a8d..60b76ef 100644 --- a/src/commands/mod/ban/unban.ts +++ b/src/commands/mod/ban/unban.ts @@ -45,12 +45,16 @@ export class UnbanCommand extends Command { // Registers that this is a slash command public override registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand( - (builder) => builder - .setName(this.name) - .setDescription(this.description) - .addUserOption((option) => option.setName('user') - .setDescription('User to unban') - .setRequired(true)), + (builder) => + builder + .setName(this.name) + .setDescription(this.description) + .addUserOption((option) => + option + .setName('user') + .setDescription('User to unban') + .setRequired(true), + ), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite, }, @@ -162,13 +166,16 @@ export class UnbanCommand extends Command { await addEmptyUser(user.id); // Add missing ban - await addBan(userId, modId, `(Mod who banned is not accurate) - ${reason}`); + await addBan( + userId, + modId, + `(Mod who banned is not accurate) - ${reason}`, + ); dbBan = true; } // Unban the user - await guild.members.unban(user) - .catch(() => {}); + await guild.members.unban(user).catch(() => {}); if (dbBan) { // Add unban to database @@ -181,12 +188,14 @@ export class UnbanCommand extends Command { info.success = true; // Log unban - let logChannel = guild.channels.cache - .get(IDs.channels.logs.restricted) as TextChannel | undefined; + let logChannel = guild.channels.cache.get(IDs.channels.logs.restricted) as + | TextChannel + | undefined; if (logChannel === undefined) { - logChannel = await guild.channels - .fetch(IDs.channels.logs.restricted) as TextChannel | undefined; + logChannel = (await guild.channels.fetch( + IDs.channels.logs.restricted, + )) as TextChannel | undefined; if (logChannel === undefined) { this.container.logger.error('Ban Error: Could not fetch log channel'); info.message = `${user} has been banned. This hasn't been logged in a text channel as log channel could not be found`; @@ -196,7 +205,10 @@ export class UnbanCommand extends Command { const log = new EmbedBuilder() .setColor('#28A745') - .setAuthor({ name: `Unbanned ${user.tag}`, iconURL: `${user.displayAvatarURL()}` }) + .setAuthor({ + name: `Unbanned ${user.tag}`, + iconURL: `${user.displayAvatarURL()}`, + }) .addFields( { name: 'User', value: `${user}`, inline: true }, { name: 'Moderator', value: `${mod}`, inline: true }, diff --git a/src/commands/mod/diversity.ts b/src/commands/mod/diversity.ts index c8e02b1..293eb9d 100644 --- a/src/commands/mod/diversity.ts +++ b/src/commands/mod/diversity.ts @@ -56,16 +56,28 @@ export class DiversityCommand extends Subcommand { // Registers that this is a slash command public override registerApplicationCommands(registry: Subcommand.Registry) { registry.registerChatInputCommand( - (builder) => builder - .setName(this.name) - .setDescription(this.description) - .addSubcommand((command) => command.setName('role') - .setDescription('Gives/removes the diversity role') - .addUserOption((option) => option.setName('user') - .setDescription('User to give/remove diversity to') - .setRequired(true))) - .addSubcommand((command) => command.setName('toggleopen') - .setDescription('Toggles read-only for vegans in diversity section')), + (builder) => + builder + .setName(this.name) + .setDescription(this.description) + .addSubcommand((command) => + command + .setName('role') + .setDescription('Gives/removes the diversity role') + .addUserOption((option) => + option + .setName('user') + .setDescription('User to give/remove diversity to') + .setRequired(true), + ), + ) + .addSubcommand((command) => + command + .setName('toggleopen') + .setDescription( + 'Toggles read-only for vegans in diversity section', + ), + ), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite, }, @@ -120,11 +132,14 @@ export class DiversityCommand extends Subcommand { } // Checks if the channel is open - const open = channel.permissionsFor(IDs.roles.vegan.vegan)! + const open = channel + .permissionsFor(IDs.roles.vegan.vegan)! .has([PermissionsBitField.Flags.SendMessages]); // Toggle send message in channel - await channelText.permissionOverwrites.edit(IDs.roles.vegan.vegan, { SendMessages: !open }); + await channelText.permissionOverwrites.edit(IDs.roles.vegan.vegan, { + SendMessages: !open, + }); await interaction.reply({ content: `${!open ? 'Opened' : 'Closed'} this channel.`, @@ -132,7 +147,9 @@ export class DiversityCommand extends Subcommand { }); } - public async roleCommand(interaction: Subcommand.ChatInputCommandInteraction) { + public async roleCommand( + interaction: Subcommand.ChatInputCommandInteraction, + ) { // TODO add database updates // Get the arguments const user = interaction.options.getUser('user'); @@ -181,7 +198,8 @@ export class DiversityCommand extends Subcommand { content: `Gave ${user} the ${diversity.name} role!`, fetchReply: true, }); - await user.send(`You have been given the ${diversity.name} role by ${mod}!`) + await user + .send(`You have been given the ${diversity.name} role by ${mod}!`) .catch(() => {}); } @@ -200,7 +218,9 @@ export class DiversityCommand extends Subcommand { if (mod === null) { await message.react('โŒ'); - await message.reply('Diversity coordinator not found! Try again or contact a developer!'); + await message.reply( + 'Diversity coordinator not found! Try again or contact a developer!', + ); return; } @@ -235,7 +255,8 @@ export class DiversityCommand extends Subcommand { await message.reply({ content: `Gave ${user} the ${diversity.name} role!`, }); - await user.send(`You have been given the ${diversity.name} role by ${mod}!`) + await user + .send(`You have been given the ${diversity.name} role by ${mod}!`) .catch(() => {}); } @@ -243,7 +264,9 @@ export class DiversityCommand extends Subcommand { } private async threadManager(member: Snowflake, add: boolean) { - const thread = await container.client.channels.fetch(IDs.channels.diversity.diversity); + const thread = await container.client.channels.fetch( + IDs.channels.diversity.diversity, + ); if (thread === null) { return; } diff --git a/src/commands/mod/moveall.ts b/src/commands/mod/moveall.ts index a475ed1..000a66f 100644 --- a/src/commands/mod/moveall.ts +++ b/src/commands/mod/moveall.ts @@ -38,12 +38,16 @@ export class MoveAllCommand extends Command { // Registers that this is a slash command public override registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand( - (builder) => builder - .setName(this.name) - .setDescription(this.description) - .addChannelOption((option) => option.setName('channel') - .setDescription('The channel to move everyone to') - .setRequired(true)), + (builder) => + builder + .setName(this.name) + .setDescription(this.description) + .addChannelOption((option) => + option + .setName('channel') + .setDescription('The channel to move everyone to') + .setRequired(true), + ), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite, }, @@ -59,8 +63,10 @@ export class MoveAllCommand extends Command { await interaction.deferReply({ ephemeral: true }); - if (channel.type !== ChannelType.GuildVoice - && channel.type !== ChannelType.GuildStageVoice) { + if ( + channel.type !== ChannelType.GuildVoice && + channel.type !== ChannelType.GuildStageVoice + ) { await interaction.editReply({ content: 'The channel you provided is not a voice channel!', }); @@ -100,8 +106,7 @@ export class MoveAllCommand extends Command { const voice = guild.channels.cache.get(mod.voice.channelId); - if (voice === undefined - || !voice.isVoiceBased()) { + if (voice === undefined || !voice.isVoiceBased()) { await interaction.editReply({ content: 'Error fetching your current voice channel!', }); @@ -138,7 +143,9 @@ export class MoveAllCommand extends Command { if (mod.voice.channelId === null) { await message.react('โŒ'); - await message.reply('You need to be in a voice channel to run this command!'); + await message.reply( + 'You need to be in a voice channel to run this command!', + ); return; } @@ -150,8 +157,7 @@ export class MoveAllCommand extends Command { const voice = guild.channels.cache.get(mod.voice.channelId); - if (voice === undefined - || !voice.isVoiceBased()) { + if (voice === undefined || !voice.isVoiceBased()) { await message.react('โŒ'); await message.reply('Could not fetch current voice channel!'); return; @@ -161,7 +167,9 @@ export class MoveAllCommand extends Command { member.voice.setChannel(channel.id); }); - await message.reply(`Successfully moved ${voice.members.size} members to <#${channel.id}>!`); + await message.reply( + `Successfully moved ${voice.members.size} members to <#${channel.id}>!`, + ); await message.react('โœ…'); } diff --git a/src/commands/mod/rename.ts b/src/commands/mod/rename.ts index 2f7eb8d..8b72b9a 100644 --- a/src/commands/mod/rename.ts +++ b/src/commands/mod/rename.ts @@ -34,15 +34,22 @@ export class RenameUserCommand extends Command { // Registers that this is a slash command public override registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand( - (builder) => builder - .setName(this.name) - .setDescription(this.description) - .addUserOption((option) => option.setName('user') - .setDescription('User to change nickname') - .setRequired(true)) - .addStringOption((option) => option.setName('nickname') - .setDescription('The nickname to give the user') - .setMaxLength(32)), + (builder) => + builder + .setName(this.name) + .setDescription(this.description) + .addUserOption((option) => + option + .setName('user') + .setDescription('User to change nickname') + .setRequired(true), + ) + .addStringOption((option) => + option + .setName('nickname') + .setDescription('The nickname to give the user') + .setMaxLength(32), + ), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite, }, @@ -85,7 +92,7 @@ export class RenameUserCommand extends Command { await member.setNickname(nickname); } catch { await interaction.reply({ - content: 'Bot doesn\'t have permission to change the user\'s name!', + content: "Bot doesn't have permission to change the user's name!", ephemeral: true, fetchReply: true, }); @@ -111,7 +118,7 @@ export class RenameUserCommand extends Command { const nickname = args.finished ? null : await args.rest('string'); - if ((nickname != null) && nickname.length > 32) { + if (nickname != null && nickname.length > 32) { await message.react('โŒ'); await message.reply('Nickname is too long!'); return; @@ -121,7 +128,9 @@ export class RenameUserCommand extends Command { await member.setNickname(nickname); } catch { await message.react('โŒ'); - await message.reply('Bot doesn\'t have permission to change the user\'s name!'); + await message.reply( + "Bot doesn't have permission to change the user's name!", + ); return; } diff --git a/src/commands/mod/restriction/restrict.ts b/src/commands/mod/restriction/restrict.ts index 75a7429..96fa351 100644 --- a/src/commands/mod/restriction/restrict.ts +++ b/src/commands/mod/restriction/restrict.ts @@ -29,15 +29,13 @@ import { PermissionsBitField, time, } from 'discord.js'; -import type { - User, - Message, - TextChannel, - Guild, - Snowflake, -} from 'discord.js'; +import type { User, Message, TextChannel, Guild, Snowflake } from 'discord.js'; import IDs from '#utils/ids'; -import { addEmptyUser, updateUser, fetchRoles } from '#utils/database/dbExistingUser'; +import { + addEmptyUser, + updateUser, + fetchRoles, +} from '#utils/database/dbExistingUser'; import { restrict, checkActive } from '#utils/database/restriction'; import { randint } from '#utils/maths'; import { blockedRolesAfterRestricted } from '#utils/blockedRoles'; @@ -85,8 +83,7 @@ export async function restrictRun( let member = guild.members.cache.get(userId); if (member === undefined) { - member = await guild.members.fetch(userId) - .catch(() => undefined); + member = await guild.members.fetch(userId).catch(() => undefined); } const restrictRoles = IDs.roles.restrictions.restricted; @@ -125,10 +122,12 @@ export async function restrictRun( }, { id: IDs.roles.staff.restricted, - allow: [PermissionsBitField.Flags.SendMessages, + allow: [ + PermissionsBitField.Flags.SendMessages, PermissionsBitField.Flags.ViewChannel, PermissionsBitField.Flags.Connect, - PermissionsBitField.Flags.MuteMembers], + PermissionsBitField.Flags.MuteMembers, + ], }, ], }); @@ -153,8 +152,10 @@ export async function restrictRun( }, { id: IDs.roles.staff.restricted, - allow: [PermissionsBitField.Flags.SendMessages, - PermissionsBitField.Flags.ViewChannel], + allow: [ + PermissionsBitField.Flags.SendMessages, + PermissionsBitField.Flags.ViewChannel, + ], }, ], }); @@ -176,8 +177,10 @@ export async function restrictRun( }, { id: IDs.roles.staff.restricted, - allow: [PermissionsBitField.Flags.SendMessages, - PermissionsBitField.Flags.ViewChannel], + allow: [ + PermissionsBitField.Flags.SendMessages, + PermissionsBitField.Flags.ViewChannel, + ], }, ], }); @@ -215,8 +218,7 @@ export async function restrictRun( } } - if (member !== undefined - && member.voice.channelId !== null) { + if (member !== undefined && member.voice.channelId !== null) { await member.voice.disconnect(); } @@ -230,22 +232,24 @@ export async function restrictRun( const dmEmbed = new EmbedBuilder() .setColor('#FF6700') - .setAuthor({ name: 'You\'ve been restricted!', iconURL: `${user.displayAvatarURL()}` }) - .addFields( - { name: 'Reason', value: reason }, - ) + .setAuthor({ + name: "You've been restricted!", + iconURL: `${user.displayAvatarURL()}`, + }) + .addFields({ name: 'Reason', value: reason }) .setTimestamp(); - await user.send({ embeds: [dmEmbed] }) - .catch(() => {}); + await user.send({ embeds: [dmEmbed] }).catch(() => {}); // Log the ban - let logChannel = guild.channels.cache - .get(IDs.channels.logs.restricted) as TextChannel | undefined; + let logChannel = guild.channels.cache.get(IDs.channels.logs.restricted) as + | TextChannel + | undefined; if (logChannel === undefined) { - logChannel = await guild.channels - .fetch(IDs.channels.logs.restricted) as TextChannel | undefined; + logChannel = (await guild.channels.fetch(IDs.channels.logs.restricted)) as + | TextChannel + | undefined; if (logChannel === undefined) { container.logger.error('Restrict Error: Could not fetch log channel'); info.message = `Restricted ${user} but could not find the log channel. This has been logged to the database.`; @@ -255,7 +259,10 @@ export async function restrictRun( const message = new EmbedBuilder() .setColor('#FF6700') - .setAuthor({ name: `Restricted ${user.tag}`, iconURL: `${user.displayAvatarURL()}` }) + .setAuthor({ + name: `Restricted ${user.tag}`, + iconURL: `${user.displayAvatarURL()}`, + }) .addFields( { name: 'User', value: `${user}`, inline: true }, { name: 'Moderator', value: `${mod}`, inline: true }, @@ -283,15 +290,22 @@ export class RestrictCommand extends Command { // Registers that this is a slash command public override registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand( - (builder) => builder - .setName(this.name) - .setDescription(this.description) - .addUserOption((option) => option.setName('user') - .setDescription('User to restrict') - .setRequired(true)) - .addStringOption((option) => option.setName('reason') - .setDescription('Reason for restricting the user') - .setRequired(true)), + (builder) => + builder + .setName(this.name) + .setDescription(this.description) + .addUserOption((option) => + option + .setName('user') + .setDescription('User to restrict') + .setRequired(true), + ) + .addStringOption((option) => + option + .setName('reason') + .setDescription('Reason for restricting the user') + .setRequired(true), + ), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite, }, diff --git a/src/commands/mod/restriction/restrictLogs.ts b/src/commands/mod/restriction/restrictLogs.ts index 48c4a8a..4502614 100644 --- a/src/commands/mod/restriction/restrictLogs.ts +++ b/src/commands/mod/restriction/restrictLogs.ts @@ -19,12 +19,7 @@ import { Args, Command, RegisterBehavior } from '@sapphire/framework'; import { ChannelType, EmbedBuilder } from 'discord.js'; -import type { - Message, - TextChannel, - Guild, - Snowflake, -} from 'discord.js'; +import type { Message, TextChannel, Guild, Snowflake } from 'discord.js'; import IDs from '#utils/ids'; import { getRestrictions } from '#utils/database/restriction'; import { checkStaff } from '#utils/checker'; @@ -42,11 +37,15 @@ export class RestrictLogsCommand extends Command { // Registers that this is a slash command public override registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand( - (builder) => builder - .setName(this.name) - .setDescription(this.description) - .addUserOption((option) => option.setName('user') - .setDescription('User to check restriction logs for')), + (builder) => + builder + .setName(this.name) + .setDescription(this.description) + .addUserOption((option) => + option + .setName('user') + .setDescription('User to check restriction logs for'), + ), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite, }, @@ -72,8 +71,7 @@ export class RestrictLogsCommand extends Command { let userId: Snowflake | null = null; - if (user !== undefined - && user !== null) { + if (user !== undefined && user !== null) { userId = user.id; } @@ -201,9 +199,11 @@ export class RestrictLogsCommand extends Command { .setFooter({ text: `ID: ${userId}` }); // Add up to 10 of the latest restrictions to the embed - for (let i = restrictions.length > 10 ? restrictions.length - 10 : 0; + for ( + let i = restrictions.length > 10 ? restrictions.length - 10 : 0; i < restrictions.length; - i += 1) { + i += 1 + ) { // Get mod names let restMod = restrictions[i].modId; const restModMember = guild.members.cache.get(restMod); @@ -226,7 +226,9 @@ export class RestrictLogsCommand extends Command { restTitle += 'Currently Restricted | '; } - restTitle += `Date: `; + restTitle += `Date: `; embed.addFields({ name: restTitle, diff --git a/src/commands/mod/restriction/restrictTolerance.ts b/src/commands/mod/restriction/restrictTolerance.ts index c514f3a..9988e1a 100644 --- a/src/commands/mod/restriction/restrictTolerance.ts +++ b/src/commands/mod/restriction/restrictTolerance.ts @@ -35,15 +35,22 @@ export class RestrictToleranceCommand extends Command { // Registers that this is a slash command public override registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand( - (builder) => builder - .setName(this.name) - .setDescription(this.description) - .addUserOption((option) => option.setName('user') - .setDescription('User to restrict') - .setRequired(true)) - .addStringOption((option) => option.setName('reason') - .setDescription('Reason for restricting the user') - .setRequired(true)), + (builder) => + builder + .setName(this.name) + .setDescription(this.description) + .addUserOption((option) => + option + .setName('user') + .setDescription('User to restrict') + .setRequired(true), + ) + .addStringOption((option) => + option + .setName('reason') + .setDescription('Reason for restricting the user') + .setRequired(true), + ), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite, }, diff --git a/src/commands/mod/restriction/restrictTools.ts b/src/commands/mod/restriction/restrictTools.ts index 341af13..29c2888 100644 --- a/src/commands/mod/restriction/restrictTools.ts +++ b/src/commands/mod/restriction/restrictTools.ts @@ -20,10 +20,7 @@ import { RegisterBehavior } from '@sapphire/framework'; import { Subcommand } from '@sapphire/plugin-subcommands'; import type { TextChannel } from 'discord.js'; -import { - CategoryChannel, - ChannelType, -} from 'discord.js'; +import { CategoryChannel, ChannelType } from 'discord.js'; import IDs from '#utils/ids'; export class RestrictToolsCommand extends Subcommand { @@ -35,9 +32,7 @@ export class RestrictToolsCommand extends Subcommand { { name: 'channel', type: 'group', - entries: [ - { name: 'delete', chatInputRun: 'deleteChannel' }, - ], + entries: [{ name: 'delete', chatInputRun: 'deleteChannel' }], }, ], description: 'Tools for managing restrictions', @@ -48,22 +43,34 @@ export class RestrictToolsCommand extends Subcommand { // Registers that this is a slash command public override registerApplicationCommands(registry: Subcommand.Registry) { registry.registerChatInputCommand( - (builder) => builder - .setName(this.name) - .setDescription(this.description) - .addSubcommandGroup((group) => group.setName('channel') - .setDescription('Manages restricted channels') - .addSubcommand((command) => command.setName('delete') - .setDescription('Deletes a restricted channel') - .addUserOption((option) => option.setName('user') - .setDescription('The user\'s channel to delete')))), + (builder) => + builder + .setName(this.name) + .setDescription(this.description) + .addSubcommandGroup((group) => + group + .setName('channel') + .setDescription('Manages restricted channels') + .addSubcommand((command) => + command + .setName('delete') + .setDescription('Deletes a restricted channel') + .addUserOption((option) => + option + .setName('user') + .setDescription("The user's channel to delete"), + ), + ), + ), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite, }, ); } - public async deleteChannel(interaction: Subcommand.ChatInputCommandInteraction) { + public async deleteChannel( + interaction: Subcommand.ChatInputCommandInteraction, + ) { // Get the arguments const user = interaction.options.getUser('user'); const { guild, channel } = interaction; @@ -83,33 +90,35 @@ export class RestrictToolsCommand extends Subcommand { if (user === null) { if (channel.type !== ChannelType.GuildText) { await interaction.editReply({ - content: 'Please make sure you ran this command in the original restricted text channel!', + content: + 'Please make sure you ran this command in the original restricted text channel!', }); return; } if (channel.parentId !== IDs.categories.restricted) { await interaction.editReply({ - content: 'Please make sure you ran this command in the original restricted text channel!', + content: + 'Please make sure you ran this command in the original restricted text channel!', }); return; } if ( - channel.id === IDs.channels.restricted.welcome - || channel.id === IDs.channels.restricted.moderators - || channel.id === IDs.channels.restricted.restricted - || channel.id === IDs.channels.restricted.tolerance + channel.id === IDs.channels.restricted.welcome || + channel.id === IDs.channels.restricted.moderators || + channel.id === IDs.channels.restricted.restricted || + channel.id === IDs.channels.restricted.tolerance ) { await interaction.editReply({ - content: 'You can\'t run this command these channels!', + content: "You can't run this command these channels!", }); return; } if (channel.topic === null) { await interaction.editReply({ - content: 'There was an error with this channel\'s topic!', + content: "There was an error with this channel's topic!", }); return; } @@ -120,16 +129,19 @@ export class RestrictToolsCommand extends Subcommand { const vcId = topic[3]; const voiceChannel = guild.channels.cache.get(vcId); - if (voiceChannel !== undefined - && voiceChannel.parentId === IDs.categories.restricted) { + if ( + voiceChannel !== undefined && + voiceChannel.parentId === IDs.categories.restricted + ) { await voiceChannel.delete(); } return; } - const category = guild.channels.cache - .get(IDs.categories.restricted) as CategoryChannel | undefined; + const category = guild.channels.cache.get(IDs.categories.restricted) as + | CategoryChannel + | undefined; if (category === undefined) { await interaction.editReply({ @@ -138,7 +150,9 @@ export class RestrictToolsCommand extends Subcommand { return; } - const textChannels = category.children.cache.filter((c) => c.type === ChannelType.GuildText); + const textChannels = category.children.cache.filter( + (c) => c.type === ChannelType.GuildText, + ); textChannels.forEach((c) => { const textChannel = c as TextChannel; // Checks if the channel topic has the user's snowflake @@ -147,8 +161,10 @@ export class RestrictToolsCommand extends Subcommand { const vcId = topic[topic.indexOf(user?.id) + 1]; const voiceChannel = guild.channels.cache.get(vcId); - if (voiceChannel !== undefined - && voiceChannel.parentId === IDs.categories.restricted) { + if ( + voiceChannel !== undefined && + voiceChannel.parentId === IDs.categories.restricted + ) { voiceChannel.delete(); } textChannel.delete(); diff --git a/src/commands/mod/restriction/unrestrict.ts b/src/commands/mod/restriction/unrestrict.ts index 53287e9..9ee28cc 100644 --- a/src/commands/mod/restriction/unrestrict.ts +++ b/src/commands/mod/restriction/unrestrict.ts @@ -19,16 +19,14 @@ import { Args, Command, RegisterBehavior } from '@sapphire/framework'; import { CategoryChannel, ChannelType, EmbedBuilder } from 'discord.js'; -import type { - User, - Message, - TextChannel, - Guild, - Snowflake, -} from 'discord.js'; +import type { User, Message, TextChannel, Guild, Snowflake } from 'discord.js'; import IDs from '#utils/ids'; import { fetchRoles, addExistingUser } from '#utils/database/dbExistingUser'; -import { unRestrict, checkActive, unRestrictLegacy } from '#utils/database/restriction'; +import { + unRestrict, + checkActive, + unRestrictLegacy, +} from '#utils/database/restriction'; export class UnRestrictCommand extends Command { public constructor(context: Command.Context, options: Command.Options) { @@ -44,12 +42,16 @@ export class UnRestrictCommand extends Command { // Registers that this is a slash command public override registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand( - (builder) => builder - .setName(this.name) - .setDescription(this.description) - .addUserOption((option) => option.setName('user') - .setDescription('User to unrestrict') - .setRequired(true)), + (builder) => + builder + .setName(this.name) + .setDescription(this.description) + .addUserOption((option) => + option + .setName('user') + .setDescription('User to unrestrict') + .setRequired(true), + ), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite, }, @@ -105,7 +107,12 @@ export class UnRestrictCommand extends Command { const channelRun = message.channel; - const info = await this.unRestrictRun(user?.id, mod.id, guild, channelRun.id); + const info = await this.unRestrictRun( + user?.id, + mod.id, + guild, + channelRun.id, + ); if (!info.runInVeganRestrict) { await message.reply(info.message); @@ -151,12 +158,11 @@ export class UnRestrictCommand extends Command { let member = guild.members.cache.get(userId); if (member === undefined) { - member = await guild.members.fetch(userId) - .catch(() => undefined); + member = await guild.members.fetch(userId).catch(() => undefined); } if (member === undefined) { - info.message = 'Can\'t unrestrict the user as they are not on this server'; + info.message = "Can't unrestrict the user as they are not on this server"; return info; } @@ -192,14 +198,16 @@ export class UnRestrictCommand extends Command { // Remove vegan restrict channels if (member.roles.cache.has(IDs.roles.vegan.vegan)) { - const category = guild.channels.cache - .get(IDs.categories.restricted) as CategoryChannel | undefined; + const category = guild.channels.cache.get(IDs.categories.restricted) as + | CategoryChannel + | undefined; let topic: string[]; if (category !== undefined) { - const textChannels = category.children.cache - .filter((c) => c.type === ChannelType.GuildText); + const textChannels = category.children.cache.filter( + (c) => c.type === ChannelType.GuildText, + ); textChannels.forEach((c) => { const textChannel = c as TextChannel; // Checks if the channel topic has the user's snowflake @@ -211,8 +219,10 @@ export class UnRestrictCommand extends Command { const vcId = topic[topic.indexOf(userId) + 1]; const voiceChannel = guild.channels.cache.get(vcId); - if (voiceChannel !== undefined - && voiceChannel.parentId === IDs.categories.restricted) { + if ( + voiceChannel !== undefined && + voiceChannel.parentId === IDs.categories.restricted + ) { voiceChannel.delete(); } textChannel.delete(); @@ -224,14 +234,18 @@ export class UnRestrictCommand extends Command { info.success = true; // Log the ban - let logChannel = guild.channels.cache - .get(IDs.channels.logs.restricted) as TextChannel | undefined; + let logChannel = guild.channels.cache.get(IDs.channels.logs.restricted) as + | TextChannel + | undefined; if (logChannel === undefined) { - logChannel = await guild.channels - .fetch(IDs.channels.logs.restricted) as TextChannel | undefined; + logChannel = (await guild.channels.fetch( + IDs.channels.logs.restricted, + )) as TextChannel | undefined; if (logChannel === undefined) { - this.container.logger.error('Restrict Error: Could not fetch log channel'); + this.container.logger.error( + 'Restrict Error: Could not fetch log channel', + ); info.message = `Unrestricted ${user} but could not find the log channel. This has been logged to the database.`; return info; } @@ -239,7 +253,10 @@ export class UnRestrictCommand extends Command { const message = new EmbedBuilder() .setColor('#28A745') - .setAuthor({ name: `Unrestricted ${user.tag}`, iconURL: `${user.displayAvatarURL()}` }) + .setAuthor({ + name: `Unrestricted ${user.tag}`, + iconURL: `${user.displayAvatarURL()}`, + }) .addFields( { name: 'User', value: `${user}`, inline: true }, { name: 'Moderator', value: `${mod}`, inline: true }, diff --git a/src/commands/mod/slowmode.ts b/src/commands/mod/slowmode.ts index 074ed5a..08b6b1d 100644 --- a/src/commands/mod/slowmode.ts +++ b/src/commands/mod/slowmode.ts @@ -36,12 +36,16 @@ export class SlowmodeCommand extends Command { // Registers that this is a slash command public override registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand( - (builder) => builder - .setName(this.name) - .setDescription(this.description) - .addStringOption((option) => option.setName('duration') - .setDescription('Set the slowmode time') - .setRequired(true)), + (builder) => + builder + .setName(this.name) + .setDescription(this.description) + .addStringOption((option) => + option + .setName('duration') + .setDescription('Set the slowmode time') + .setRequired(true), + ), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite, }, @@ -123,7 +127,9 @@ export class SlowmodeCommand extends Command { return info; } - info.message = `${channel} has now been set to a post every ${new DurationFormatter().format(time)}.`; + info.message = `${channel} has now been set to a post every ${new DurationFormatter().format( + time, + )}.`; return info; } } diff --git a/src/commands/mod/softMute.ts b/src/commands/mod/softMute.ts index 5d8caa5..3bf18a4 100644 --- a/src/commands/mod/softMute.ts +++ b/src/commands/mod/softMute.ts @@ -27,8 +27,9 @@ export class SoftMuteCommand extends Command { ...options, name: 'softmute', aliases: ['sm'], - description: 'Prevent a user from reacting to a message by giving ' - + 'the soft mute role', + description: + 'Prevent a user from reacting to a message by giving ' + + 'the soft mute role', preconditions: ['ModOnly'], }); } @@ -36,12 +37,16 @@ export class SoftMuteCommand extends Command { // Registers that this is a slash command public override registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand( - (builder) => builder - .setName(this.name) - .setDescription(this.description) - .addUserOption((option) => option.setName('user') - .setDescription('User to soft mute') - .setRequired(true)), + (builder) => + builder + .setName(this.name) + .setDescription(this.description) + .addUserOption((option) => + option + .setName('user') + .setDescription('User to soft mute') + .setRequired(true), + ), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite, }, diff --git a/src/commands/mod/sus.ts b/src/commands/mod/sus.ts index 3af8f90..6d2f061 100644 --- a/src/commands/mod/sus.ts +++ b/src/commands/mod/sus.ts @@ -75,36 +75,64 @@ export class SusCommand extends Subcommand { // Registers that this is a slash command public override registerApplicationCommands(registry: Subcommand.Registry) { registry.registerChatInputCommand( - (builder) => builder - .setName(this.name) - .setDescription(this.description) - // Subcommand to add a sus note - .addSubcommand((command) => command.setName('add') - .setDescription('Add a sus note about a user') - .addUserOption((option) => option.setName('user') - .setDescription('User to add the note') - .setRequired(true)) - .addStringOption((option) => option.setName('note') - .setDescription('Note about the user') - .setRequired(true))) - // Subcommand to list sus notes - .addSubcommand((command) => command.setName('view') - .setDescription('View a sus note for a user') - .addUserOption((option) => option.setName('user') - .setDescription('User to view the note of') - .setRequired(true))) - // Subcommand to remove a specific sus note - .addSubcommand((command) => command.setName('remove') - .setDescription('Remove a specific sus note') - .addIntegerOption((option) => option.setName('id') - .setDescription('Sus note ID') - .setRequired(true))) - // Subcommand to remove all sus notes - .addSubcommand((command) => command.setName('purge') - .setDescription('Remove all sus notes from a user') - .addUserOption((option) => option.setName('user') - .setDescription('User to remove the note from') - .setRequired(true))), + (builder) => + builder + .setName(this.name) + .setDescription(this.description) + // Subcommand to add a sus note + .addSubcommand((command) => + command + .setName('add') + .setDescription('Add a sus note about a user') + .addUserOption((option) => + option + .setName('user') + .setDescription('User to add the note') + .setRequired(true), + ) + .addStringOption((option) => + option + .setName('note') + .setDescription('Note about the user') + .setRequired(true), + ), + ) + // Subcommand to list sus notes + .addSubcommand((command) => + command + .setName('view') + .setDescription('View a sus note for a user') + .addUserOption((option) => + option + .setName('user') + .setDescription('User to view the note of') + .setRequired(true), + ), + ) + // Subcommand to remove a specific sus note + .addSubcommand((command) => + command + .setName('remove') + .setDescription('Remove a specific sus note') + .addIntegerOption((option) => + option + .setName('id') + .setDescription('Sus note ID') + .setRequired(true), + ), + ) + // Subcommand to remove all sus notes + .addSubcommand((command) => + command + .setName('purge') + .setDescription('Remove all sus notes from a user') + .addUserOption((option) => + option + .setName('user') + .setDescription('User to remove the note from') + .setRequired(true), + ), + ), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite, }, @@ -202,7 +230,11 @@ export class SusCommand extends Subcommand { .setThumbnail(user.displayAvatarURL()); // Add up to 10 of the latest sus notes to the embed - for (let i = notes.length > 10 ? notes.length - 10 : 0; i < notes.length; i += 1) { + for ( + let i = notes.length > 10 ? notes.length - 10 : 0; + i < notes.length; + i += 1 + ) { // Get mod name let mod = notes[i].modId; const modMember = guild.members.cache.get(mod); @@ -212,7 +244,11 @@ export class SusCommand extends Subcommand { // Add sus note to embed noteEmbed.addFields({ - name: `Sus ID: ${notes[i].id} | Moderator: ${mod} | Date: `, + name: `Sus ID: ${ + notes[i].id + } | Moderator: ${mod} | Date: `, value: notes[i].note, }); } @@ -285,22 +321,23 @@ export class SusCommand extends Subcommand { .setTitle(`Sus note for ${userName}`) .setThumbnail(member.displayAvatarURL()) .addFields({ - name: `ID: ${noteId} | Moderator: ${modName} | Date: `, + name: `ID: ${noteId} | Moderator: ${modName} | Date: `, value: note.note, }); // Create buttons to delete or cancel the deletion - const buttons = new ActionRowBuilder() - .addComponents( - new ButtonBuilder() - .setCustomId(`delete${noteId}`) - .setLabel('Delete') - .setStyle(ButtonStyle.Danger), - new ButtonBuilder() - .setCustomId(`cancel${noteId}`) - .setLabel('Cancel') - .setStyle(ButtonStyle.Secondary), - ); + const buttons = new ActionRowBuilder().addComponents( + new ButtonBuilder() + .setCustomId(`delete${noteId}`) + .setLabel('Delete') + .setStyle(ButtonStyle.Danger), + new ButtonBuilder() + .setCustomId(`cancel${noteId}`) + .setLabel('Cancel') + .setStyle(ButtonStyle.Secondary), + ); // Sends the note to verify this note is to be deleted const message = await interaction.reply({ @@ -350,7 +387,9 @@ export class SusCommand extends Subcommand { }); } - public async removeAllNotes(interaction: Subcommand.ChatInputCommandInteraction) { + public async removeAllNotes( + interaction: Subcommand.ChatInputCommandInteraction, + ) { // Get the arguments const user = interaction.options.getUser('user', true); const { guild, channel } = interaction; @@ -398,7 +437,11 @@ export class SusCommand extends Subcommand { .setThumbnail(user.displayAvatarURL()); // Add up to 10 of the latest sus notes to the embed - for (let i = notes.length > 10 ? notes.length - 10 : 0; i < notes.length; i += 1) { + for ( + let i = notes.length > 10 ? notes.length - 10 : 0; + i < notes.length; + i += 1 + ) { // Get mod name let mod = notes[i].modId; const modGuildMember = guild.members.cache.get(mod); @@ -407,23 +450,26 @@ export class SusCommand extends Subcommand { } // Add sus note to embed noteEmbed.addFields({ - name: `Sus ID: ${notes[i].id} | Moderator: ${mod} | Date: `, + name: `Sus ID: ${ + notes[i].id + } | Moderator: ${mod} | Date: `, value: notes[i].note, }); } // Create buttons to delete or cancel the deletion - const buttons = new ActionRowBuilder() - .addComponents( - new ButtonBuilder() - .setCustomId(`delete${user.id}`) - .setLabel('Delete') - .setStyle(ButtonStyle.Danger), - new ButtonBuilder() - .setCustomId(`cancel${user.id}`) - .setLabel('Cancel') - .setStyle(ButtonStyle.Secondary), - ); + const buttons = new ActionRowBuilder().addComponents( + new ButtonBuilder() + .setCustomId(`delete${user.id}`) + .setLabel('Delete') + .setStyle(ButtonStyle.Danger), + new ButtonBuilder() + .setCustomId(`cancel${user.id}`) + .setLabel('Cancel') + .setStyle(ButtonStyle.Secondary), + ); // Sends the note to verify this note is to be deleted const message = await interaction.reply({ @@ -491,7 +537,9 @@ export class SusCommand extends Subcommand { if (mod === null) { await message.react('โŒ'); - await message.reply('Moderator not found! Try again or contact a developer!'); + await message.reply( + 'Moderator not found! Try again or contact a developer!', + ); return; } diff --git a/src/commands/mod/vcMute.ts b/src/commands/mod/vcMute.ts index c671be9..8a0316e 100644 --- a/src/commands/mod/vcMute.ts +++ b/src/commands/mod/vcMute.ts @@ -36,14 +36,21 @@ export class VCMuteCommand extends Command { // Registers that this is a slash command public override registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand( - (builder) => builder - .setName(this.name) - .setDescription(this.description) - .addUserOption((option) => option.setName('user') - .setDescription('User to persistently mute') - .setRequired(true)) - .addStringOption((option) => option.setName('reason') - .setDescription('Reason for persistently muting the user')), + (builder) => + builder + .setName(this.name) + .setDescription(this.description) + .addUserOption((option) => + option + .setName('user') + .setDescription('User to persistently mute') + .setRequired(true), + ) + .addStringOption((option) => + option + .setName('reason') + .setDescription('Reason for persistently muting the user'), + ), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite, }, @@ -128,7 +135,9 @@ export class VCMuteCommand extends Command { if (mod === null) { await message.react('โŒ'); - await message.reply('Moderator not found! Try again or contact a developer!'); + await message.reply( + 'Moderator not found! Try again or contact a developer!', + ); return; } diff --git a/src/commands/mod/warn.ts b/src/commands/mod/warn.ts index e90bbfc..16dd630 100644 --- a/src/commands/mod/warn.ts +++ b/src/commands/mod/warn.ts @@ -18,12 +18,7 @@ */ import { Args, Command } from '@sapphire/framework'; -import type { - User, - Message, - Snowflake, - Guild, -} from 'discord.js'; +import type { User, Message, Snowflake, Guild } from 'discord.js'; import { addExistingUser, updateUser } from '#utils/database/dbExistingUser'; import { addWarn } from '#utils/database/warnings'; @@ -63,7 +58,9 @@ export class WarnCommand extends Command { if (mod === null) { await message.react('โŒ'); - await message.reply('Moderator not found! Try again or contact a developer!'); + await message.reply( + 'Moderator not found! Try again or contact a developer!', + ); return; } @@ -84,7 +81,12 @@ export class WarnCommand extends Command { // await message.react('โœ…'); } - private async warn(userId: Snowflake, modId: Snowflake, reason: string, guild: Guild) { + private async warn( + userId: Snowflake, + modId: Snowflake, + reason: string, + guild: Guild, + ) { const info = { message: '', success: false, @@ -106,8 +108,7 @@ export class WarnCommand extends Command { let member = guild.members.cache.get(userId); if (member === undefined) { - member = await guild.members.fetch(userId) - .catch(() => undefined); + member = await guild.members.fetch(userId).catch(() => undefined); } if (member === undefined) { diff --git a/src/commands/outreach/outreach.ts b/src/commands/outreach/outreach.ts index e816f0b..e2af50a 100644 --- a/src/commands/outreach/outreach.ts +++ b/src/commands/outreach/outreach.ts @@ -25,7 +25,8 @@ import { addStatUser, checkActiveEvent, createEvent, - createStat, endEvent, + createStat, + endEvent, getCurrentEvent, getStatFromLeader, getStatFromRole, @@ -69,14 +70,20 @@ export class OutreachCommand extends Subcommand { // Registers that this is a slash command public override registerApplicationCommands(registry: Subcommand.Registry) { registry.registerChatInputCommand( - (builder) => builder - .setName(this.name) - .setDescription(this.description) - .addSubcommandGroup((group) => group.setName('event') - .setDescription('Commands to do with outreach events') - .addSubcommand((command) => command.setName('create') - .setDescription('Start an outreach event')) - /* + (builder) => + builder + .setName(this.name) + .setDescription(this.description) + .addSubcommandGroup((group) => + group + .setName('event') + .setDescription('Commands to do with outreach events') + .addSubcommand((command) => + command + .setName('create') + .setDescription('Start an outreach event'), + ) + /* TODO add this back at a later date .addBooleanOption((option) => option.setName('start') @@ -84,43 +91,96 @@ export class OutreachCommand extends Subcommand { .addSubcommand((command) => command.setName('start') .setDescription('Start an outreach event')) */ - .addSubcommand((command) => command.setName('end') - .setDescription('End an outreach event'))) - .addSubcommandGroup((group) => group.setName('group') - .setDescription('Commands to do with groups') - .addSubcommand((command) => command.setName('create') - .setDescription('Create a group for people doing activism') - .addUserOption((option) => option.setName('leader') - .setDescription('This is the person leading the group') - .setRequired(true))) - .addSubcommand((command) => command.setName('add') - .setDescription('Add a person to the group') - .addUserOption((option) => option.setName('user') - .setDescription('User to add to the group') - .setRequired(true)) - .addRoleOption((option) => option.setName('group') - .setDescription('Group to add the user to'))) - .addSubcommand((command) => command.setName('update') - .setDescription('Update the statistics for the group') - .addIntegerOption((option) => option.setName('vegan') - .setDescription('How many said would go vegan?')) - .addIntegerOption((option) => option.setName('considered') - .setDescription('How many seriously considered being vegan?')) - .addIntegerOption((option) => option.setName('anti-vegan') - .setDescription('How many people had anti-vegan viewpoints?')) - .addIntegerOption((option) => option.setName('thanked') - .setDescription('How many thanked you for the conversation?')) - .addIntegerOption((option) => option.setName('documentary') - .setDescription('How many said they would watch a vegan documentary?')) - .addIntegerOption((option) => option.setName('educated') - .setDescription('How many got educated on veganism or the animal industry?')))), + .addSubcommand((command) => + command.setName('end').setDescription('End an outreach event'), + ), + ) + .addSubcommandGroup((group) => + group + .setName('group') + .setDescription('Commands to do with groups') + .addSubcommand((command) => + command + .setName('create') + .setDescription('Create a group for people doing activism') + .addUserOption((option) => + option + .setName('leader') + .setDescription('This is the person leading the group') + .setRequired(true), + ), + ) + .addSubcommand((command) => + command + .setName('add') + .setDescription('Add a person to the group') + .addUserOption((option) => + option + .setName('user') + .setDescription('User to add to the group') + .setRequired(true), + ) + .addRoleOption((option) => + option + .setName('group') + .setDescription('Group to add the user to'), + ), + ) + .addSubcommand((command) => + command + .setName('update') + .setDescription('Update the statistics for the group') + .addIntegerOption((option) => + option + .setName('vegan') + .setDescription('How many said would go vegan?'), + ) + .addIntegerOption((option) => + option + .setName('considered') + .setDescription( + 'How many seriously considered being vegan?', + ), + ) + .addIntegerOption((option) => + option + .setName('anti-vegan') + .setDescription( + 'How many people had anti-vegan viewpoints?', + ), + ) + .addIntegerOption((option) => + option + .setName('thanked') + .setDescription( + 'How many thanked you for the conversation?', + ), + ) + .addIntegerOption((option) => + option + .setName('documentary') + .setDescription( + 'How many said they would watch a vegan documentary?', + ), + ) + .addIntegerOption((option) => + option + .setName('educated') + .setDescription( + 'How many got educated on veganism or the animal industry?', + ), + ), + ), + ), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite, }, ); } - public async eventCreate(interaction: Subcommand.ChatInputCommandInteraction) { + public async eventCreate( + interaction: Subcommand.ChatInputCommandInteraction, + ) { // const start = interaction.options.getBoolean('start'); const modUser = interaction.user; const { guild } = interaction; @@ -238,9 +298,10 @@ export class OutreachCommand extends Subcommand { const activist = guild.channels.cache.get(IDs.channels.activism.activism); - if (activist === undefined - || !activist.isTextBased()) { - await interaction.editReply('Event has now ended, but could not post statistics!'); + if (activist === undefined || !activist.isTextBased()) { + await interaction.editReply( + 'Event has now ended, but could not post statistics!', + ); return; } @@ -249,11 +310,26 @@ export class OutreachCommand extends Subcommand { .setAuthor({ name: 'Stats for Discord Outreach' }) .addFields( { name: 'How many said would go vegan?', value: `${vegan}` }, - { name: 'How many seriously considered being vegan?', value: `${considered}` }, - { name: 'How many people had anti-vegan viewpoints?', value: `${antiVegan}` }, - { name: 'How many thanked you for the conversation?', value: `${thanked}` }, - { name: 'How many said they would watch a vegan documentary?', value: `${documentary}` }, - { name: 'How many got educated on veganism or the animal industry?', value: `${educated}` }, + { + name: 'How many seriously considered being vegan?', + value: `${considered}`, + }, + { + name: 'How many people had anti-vegan viewpoints?', + value: `${antiVegan}`, + }, + { + name: 'How many thanked you for the conversation?', + value: `${thanked}`, + }, + { + name: 'How many said they would watch a vegan documentary?', + value: `${documentary}`, + }, + { + name: 'How many got educated on veganism or the animal industry?', + value: `${educated}`, + }, ) .setTimestamp() .setFooter({ text: `Outreach Event: ${event.id}` }); @@ -263,7 +339,9 @@ export class OutreachCommand extends Subcommand { await interaction.editReply('Event has now ended!'); } - public async groupCreate(interaction: Subcommand.ChatInputCommandInteraction) { + public async groupCreate( + interaction: Subcommand.ChatInputCommandInteraction, + ) { const leader = interaction.options.getUser('leader', true); const { guild } = interaction; @@ -277,8 +355,10 @@ export class OutreachCommand extends Subcommand { await interaction.deferReply({ ephemeral: true }); - if (await getStatFromLeader(leader.id) !== null) { - await interaction.editReply(`${leader} is already a leader for another group!`); + if ((await getStatFromLeader(leader.id)) !== null) { + await interaction.editReply( + `${leader} is already a leader for another group!`, + ); return; } @@ -305,7 +385,9 @@ export class OutreachCommand extends Subcommand { await updateUser(leaderMember); - const role = await guild.roles.create({ name: `Outreach Group ${groupNo}` }); + const role = await guild.roles.create({ + name: `Outreach Group ${groupNo}`, + }); await createStat(event.id, leader.id, role.id); @@ -355,8 +437,10 @@ export class OutreachCommand extends Subcommand { return; } - if (leader.id !== stat.stat.leaderId - && !leaderMember.roles.cache.has(IDs.roles.staff.outreachCoordinator)) { + if ( + leader.id !== stat.stat.leaderId && + !leaderMember.roles.cache.has(IDs.roles.staff.outreachCoordinator) + ) { await interaction.editReply({ content: `You are not the leader for ${group}`, }); @@ -371,7 +455,7 @@ export class OutreachCommand extends Subcommand { if (stat === null) { await interaction.editReply({ - content: 'You\'re not a group leader!', + content: "You're not a group leader!", }); return; } @@ -409,7 +493,9 @@ export class OutreachCommand extends Subcommand { }); } - public async groupUpdate(interaction: Subcommand.ChatInputCommandInteraction) { + public async groupUpdate( + interaction: Subcommand.ChatInputCommandInteraction, + ) { const vegan = interaction.options.getInteger('vegan'); const considered = interaction.options.getInteger('considered'); const antiVegan = interaction.options.getInteger('anti-vegan'); @@ -441,7 +527,7 @@ export class OutreachCommand extends Subcommand { if (stat === null) { await interaction.editReply({ - content: 'You\'re not the leader of a group!', + content: "You're not the leader of a group!", }); return; } diff --git a/src/commands/roles/bookClub.ts b/src/commands/roles/bookClub.ts index 9ec7a79..b46d4e2 100644 --- a/src/commands/roles/bookClub.ts +++ b/src/commands/roles/bookClub.ts @@ -35,12 +35,16 @@ export class BookClubCommand extends Command { // Registers that this is a slash command public override registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand( - (builder) => builder - .setName(this.name) - .setDescription(this.description) - .addUserOption((option) => option.setName('user') - .setDescription('User to give Book Club to') - .setRequired(true)), + (builder) => + builder + .setName(this.name) + .setDescription(this.description) + .addUserOption((option) => + option + .setName('user') + .setDescription('User to give Book Club to') + .setRequired(true), + ), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite, }, @@ -86,7 +90,9 @@ export class BookClubCommand extends Command { if (mod === null) { await message.react('โŒ'); - await message.reply('Event coordinator not found! Try again or contact a developer!'); + await message.reply( + 'Event coordinator not found! Try again or contact a developer!', + ); return; } @@ -137,7 +143,8 @@ export class BookClubCommand extends Command { await roleAddLog(user.id, mod.id, bookClub); info.message = `Gave ${user} the ${bookClub.name} role!`; - await user.send(`You have been given the ${bookClub.name} role by ${mod}!`) + await user + .send(`You have been given the ${bookClub.name} role by ${mod}!`) .catch(() => {}); info.success = true; return info; diff --git a/src/commands/roles/debateHost.ts b/src/commands/roles/debateHost.ts index 85e03e3..a42e138 100644 --- a/src/commands/roles/debateHost.ts +++ b/src/commands/roles/debateHost.ts @@ -35,12 +35,16 @@ export class DebateHostCommand extends Command { // Registers that this is a slash command public override registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand( - (builder) => builder - .setName(this.name) - .setDescription(this.description) - .addUserOption((option) => option.setName('user') - .setDescription('User to give Debate Host role to') - .setRequired(true)), + (builder) => + builder + .setName(this.name) + .setDescription(this.description) + .addUserOption((option) => + option + .setName('user') + .setDescription('User to give Debate Host role to') + .setRequired(true), + ), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite, }, @@ -87,7 +91,9 @@ export class DebateHostCommand extends Command { if (mod === null) { await message.react('โŒ'); - await message.reply('Event coordinator not found! Try again or contact a developer!'); + await message.reply( + 'Event coordinator not found! Try again or contact a developer!', + ); return; } @@ -138,7 +144,8 @@ export class DebateHostCommand extends Command { await roleAddLog(user.id, mod.id, debateHost); info.message = `Gave ${user} the ${debateHost.name} role!`; - await user.send(`You have been given the ${debateHost.name} role by ${mod}!`) + await user + .send(`You have been given the ${debateHost.name} role by ${mod}!`) .catch(() => {}); info.success = true; return info; diff --git a/src/commands/roles/gameNightHost.ts b/src/commands/roles/gameNightHost.ts index 60979b7..a06c6c9 100644 --- a/src/commands/roles/gameNightHost.ts +++ b/src/commands/roles/gameNightHost.ts @@ -35,12 +35,16 @@ export class GameNightHostCommand extends Command { // Registers that this is a slash command public override registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand( - (builder) => builder - .setName(this.name) - .setDescription(this.description) - .addUserOption((option) => option.setName('user') - .setDescription('User to give Game Night Host role to') - .setRequired(true)), + (builder) => + builder + .setName(this.name) + .setDescription(this.description) + .addUserOption((option) => + option + .setName('user') + .setDescription('User to give Game Night Host role to') + .setRequired(true), + ), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite, }, @@ -86,7 +90,9 @@ export class GameNightHostCommand extends Command { if (mod === null) { await message.react('โŒ'); - await message.reply('Event coordinator not found! Try again or contact a developer!'); + await message.reply( + 'Event coordinator not found! Try again or contact a developer!', + ); return; } @@ -137,7 +143,8 @@ export class GameNightHostCommand extends Command { await roleAddLog(user.id, mod.id, gameNightHost); info.message = `Gave ${user} the ${gameNightHost.name} role!`; - await user.send(`You have been given the ${gameNightHost.name} role by ${mod}!`) + await user + .send(`You have been given the ${gameNightHost.name} role by ${mod}!`) .catch(() => {}); info.success = true; return info; diff --git a/src/commands/roles/guest.ts b/src/commands/roles/guest.ts index 185c9f6..8941c2b 100644 --- a/src/commands/roles/guest.ts +++ b/src/commands/roles/guest.ts @@ -35,12 +35,16 @@ export class GuestCommand extends Command { // Registers that this is a slash command public override registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand( - (builder) => builder - .setName(this.name) - .setDescription(this.description) - .addUserOption((option) => option.setName('user') - .setDescription('User to give Guest role to') - .setRequired(true)), + (builder) => + builder + .setName(this.name) + .setDescription(this.description) + .addUserOption((option) => + option + .setName('user') + .setDescription('User to give Guest role to') + .setRequired(true), + ), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite, }, @@ -86,7 +90,9 @@ export class GuestCommand extends Command { if (mod === null) { await message.react('โŒ'); - await message.reply('Event coordinator not found! Try again or contact a developer!'); + await message.reply( + 'Event coordinator not found! Try again or contact a developer!', + ); return; } @@ -137,7 +143,8 @@ export class GuestCommand extends Command { await roleAddLog(user.id, mod.id, guest); info.message = `Gave ${user} the ${guest.name} role!`; - await user.send(`You have been given the ${guest.name} role by ${mod}!`) + await user + .send(`You have been given the ${guest.name} role by ${mod}!`) .catch(() => {}); info.success = true; return info; diff --git a/src/commands/roles/staff/mentor.ts b/src/commands/roles/staff/mentor.ts index 0cf5a76..294abea 100644 --- a/src/commands/roles/staff/mentor.ts +++ b/src/commands/roles/staff/mentor.ts @@ -36,12 +36,16 @@ export class MentorCommand extends Command { // Registers that this is a slash command public override registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand( - (builder) => builder - .setName(this.name) - .setDescription(this.description) - .addUserOption((option) => option.setName('user') - .setDescription('User to give/remove mentor role') - .setRequired(true)), + (builder) => + builder + .setName(this.name) + .setDescription(this.description) + .addUserOption((option) => + option + .setName('user') + .setDescription('User to give/remove mentor role') + .setRequired(true), + ), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite, }, @@ -87,7 +91,9 @@ export class MentorCommand extends Command { if (mod === null) { await message.react('โŒ'); - await message.reply('Mentor coordinator not found! Try again or contact a developer!'); + await message.reply( + 'Mentor coordinator not found! Try again or contact a developer!', + ); return; } @@ -138,7 +144,8 @@ export class MentorCommand extends Command { await roleAddLog(user.id, mod.id, mentor, true); info.message = `Gave ${user} the ${mentor.name} role!`; - await user.send(`You have been given the ${mentor.name} role by ${mod}!`) + await user + .send(`You have been given the ${mentor.name} role by ${mod}!`) .catch(() => {}); info.success = true; return info; diff --git a/src/commands/roles/staff/mod.ts b/src/commands/roles/staff/mod.ts index ecec059..950bce2 100644 --- a/src/commands/roles/staff/mod.ts +++ b/src/commands/roles/staff/mod.ts @@ -35,12 +35,16 @@ export class ModCommand extends Command { // Registers that this is a slash command public override registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand( - (builder) => builder - .setName(this.name) - .setDescription(this.description) - .addUserOption((option) => option.setName('user') - .setDescription('User to give/remove mod role') - .setRequired(true)), + (builder) => + builder + .setName(this.name) + .setDescription(this.description) + .addUserOption((option) => + option + .setName('user') + .setDescription('User to give/remove mod role') + .setRequired(true), + ), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite, }, @@ -86,7 +90,9 @@ export class ModCommand extends Command { if (mod === null) { await message.react('โŒ'); - await message.reply('Mod coordinator not found! Try again or contact a developer!'); + await message.reply( + 'Mod coordinator not found! Try again or contact a developer!', + ); return; } @@ -137,7 +143,8 @@ export class ModCommand extends Command { await roleAddLog(user.id, mod.id, moderator, true); info.message = `Gave ${user} the ${moderator.name} role!`; - await user.send(`You have been given the ${moderator.name} role by ${mod}!`) + await user + .send(`You have been given the ${moderator.name} role by ${mod}!`) .catch(() => {}); info.success = true; return info; diff --git a/src/commands/roles/staff/restrictedAccess.ts b/src/commands/roles/staff/restrictedAccess.ts index e78342d..aa5dee9 100644 --- a/src/commands/roles/staff/restrictedAccess.ts +++ b/src/commands/roles/staff/restrictedAccess.ts @@ -36,12 +36,16 @@ export class RestrictedAccessCommand extends Command { // Registers that this is a slash command public override registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand( - (builder) => builder - .setName(this.name) - .setDescription(this.description) - .addUserOption((option) => option.setName('user') - .setDescription('User to give/remove restricted access role') - .setRequired(true)), + (builder) => + builder + .setName(this.name) + .setDescription(this.description) + .addUserOption((option) => + option + .setName('user') + .setDescription('User to give/remove restricted access role') + .setRequired(true), + ), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite, }, @@ -87,7 +91,9 @@ export class RestrictedAccessCommand extends Command { if (mod === null) { await message.react('โŒ'); - await message.reply('Mod coordinator not found! Try again or contact a developer!'); + await message.reply( + 'Mod coordinator not found! Try again or contact a developer!', + ); return; } @@ -138,7 +144,8 @@ export class RestrictedAccessCommand extends Command { await roleAddLog(user.id, mod.id, restricted, true); info.message = `Gave ${user} the ${restricted.name} role!`; - await user.send(`You have been given the ${restricted.name} role by ${mod}!`) + await user + .send(`You have been given the ${restricted.name} role by ${mod}!`) .catch(() => {}); info.success = true; return info; diff --git a/src/commands/roles/staff/stagehost.ts b/src/commands/roles/staff/stagehost.ts index eefacaf..b1d486e 100644 --- a/src/commands/roles/staff/stagehost.ts +++ b/src/commands/roles/staff/stagehost.ts @@ -35,12 +35,16 @@ export class StageHostCommand extends Command { // Registers that this is a slash command public override registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand( - (builder) => builder - .setName(this.name) - .setDescription(this.description) - .addUserOption((option) => option.setName('user') - .setDescription('User to give Stage Host to') - .setRequired(true)), + (builder) => + builder + .setName(this.name) + .setDescription(this.description) + .addUserOption((option) => + option + .setName('user') + .setDescription('User to give Stage Host to') + .setRequired(true), + ), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite, }, @@ -86,7 +90,9 @@ export class StageHostCommand extends Command { if (mod === null) { await message.react('โŒ'); - await message.reply('Event coordinator not found! Try again or contact a developer!'); + await message.reply( + 'Event coordinator not found! Try again or contact a developer!', + ); return; } @@ -137,7 +143,8 @@ export class StageHostCommand extends Command { await roleAddLog(user.id, mod.id, stageHost, true); info.message = `Gave ${user} the ${stageHost.name} role!`; - await user.send(`You have been given the ${stageHost.name} role by ${mod}!`) + await user + .send(`You have been given the ${stageHost.name} role by ${mod}!`) .catch(() => {}); info.success = true; return info; diff --git a/src/commands/roles/staff/trialMod.ts b/src/commands/roles/staff/trialMod.ts index 8f3583d..f152c39 100644 --- a/src/commands/roles/staff/trialMod.ts +++ b/src/commands/roles/staff/trialMod.ts @@ -36,12 +36,16 @@ export class TrialModCommand extends Command { // Registers that this is a slash command public override registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand( - (builder) => builder - .setName(this.name) - .setDescription(this.description) - .addUserOption((option) => option.setName('user') - .setDescription('User to give/remove trial mod role') - .setRequired(true)), + (builder) => + builder + .setName(this.name) + .setDescription(this.description) + .addUserOption((option) => + option + .setName('user') + .setDescription('User to give/remove trial mod role') + .setRequired(true), + ), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite, }, @@ -87,7 +91,9 @@ export class TrialModCommand extends Command { if (mod === null) { await message.react('โŒ'); - await message.reply('Mod coordinator not found! Try again or contact a developer!'); + await message.reply( + 'Mod coordinator not found! Try again or contact a developer!', + ); return; } @@ -138,7 +144,8 @@ export class TrialModCommand extends Command { await roleAddLog(user.id, mod.id, moderator, true); info.message = `Gave ${user} the ${moderator.name} role!`; - await user.send(`You have been given the ${moderator.name} role by ${mod}!`) + await user + .send(`You have been given the ${moderator.name} role by ${mod}!`) .catch(() => {}); info.success = true; return info; diff --git a/src/commands/roles/staff/trialVerifier.ts b/src/commands/roles/staff/trialVerifier.ts index 2edb493..42ab6db 100644 --- a/src/commands/roles/staff/trialVerifier.ts +++ b/src/commands/roles/staff/trialVerifier.ts @@ -35,12 +35,16 @@ export class TrialVerifierCommand extends Command { // Registers that this is a slash command public override registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand( - (builder) => builder - .setName(this.name) - .setDescription(this.description) - .addUserOption((option) => option.setName('user') - .setDescription('User to give/remove trial verifier role') - .setRequired(true)), + (builder) => + builder + .setName(this.name) + .setDescription(this.description) + .addUserOption((option) => + option + .setName('user') + .setDescription('User to give/remove trial verifier role') + .setRequired(true), + ), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite, }, @@ -86,7 +90,9 @@ export class TrialVerifierCommand extends Command { if (mod === null) { await message.react('โŒ'); - await message.reply('Verifier coordinator not found! Try again or contact a developer!'); + await message.reply( + 'Verifier coordinator not found! Try again or contact a developer!', + ); return; } @@ -137,7 +143,8 @@ export class TrialVerifierCommand extends Command { await roleAddLog(user.id, mod.id, trialVerifier, true); info.message = `Gave ${user} the ${trialVerifier.name} role!`; - await user.send(`You have been given the ${trialVerifier.name} role by ${mod}!`) + await user + .send(`You have been given the ${trialVerifier.name} role by ${mod}!`) .catch(() => {}); info.success = true; return info; diff --git a/src/commands/roles/staff/verifier.ts b/src/commands/roles/staff/verifier.ts index 9b0298e..c5c1b01 100644 --- a/src/commands/roles/staff/verifier.ts +++ b/src/commands/roles/staff/verifier.ts @@ -35,12 +35,16 @@ export class VerifierCommand extends Command { // Registers that this is a slash command public override registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand( - (builder) => builder - .setName(this.name) - .setDescription(this.description) - .addUserOption((option) => option.setName('user') - .setDescription('User to give/remove verifier role') - .setRequired(true)), + (builder) => + builder + .setName(this.name) + .setDescription(this.description) + .addUserOption((option) => + option + .setName('user') + .setDescription('User to give/remove verifier role') + .setRequired(true), + ), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite, }, @@ -86,7 +90,9 @@ export class VerifierCommand extends Command { if (mod === null) { await message.react('โŒ'); - await message.reply('Verifier coordinator not found! Try again or contact a developer!'); + await message.reply( + 'Verifier coordinator not found! Try again or contact a developer!', + ); return; } @@ -137,7 +143,8 @@ export class VerifierCommand extends Command { await roleAddLog(user.id, mod.id, verifier, true); info.message = `Gave ${user} the ${verifier.name} role!`; - await user.send(`You have been given the ${verifier.name} role by ${mod}!`) + await user + .send(`You have been given the ${verifier.name} role by ${mod}!`) .catch(() => {}); info.success = true; return info; diff --git a/src/commands/roles/verification/activist.ts b/src/commands/roles/verification/activist.ts index f5ba55d..9db156d 100644 --- a/src/commands/roles/verification/activist.ts +++ b/src/commands/roles/verification/activist.ts @@ -29,19 +29,25 @@ export class ActivistCommand extends Command { name: 'activist', aliases: ['a'], description: 'Gives the activist role', - preconditions: [['ModCoordinatorOnly', 'VerifierCoordinatorOnly', 'VerifierOnly']], + preconditions: [ + ['ModCoordinatorOnly', 'VerifierCoordinatorOnly', 'VerifierOnly'], + ], }); } // Registers that this is a slash command public override registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand( - (builder) => builder - .setName(this.name) - .setDescription(this.description) - .addUserOption((option) => option.setName('user') - .setDescription('User to give activist role to') - .setRequired(true)), + (builder) => + builder + .setName(this.name) + .setDescription(this.description) + .addUserOption((option) => + option + .setName('user') + .setDescription('User to give activist role to') + .setRequired(true), + ), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite, }, @@ -121,7 +127,7 @@ export class ActivistCommand extends Command { } if (modMember === undefined) { - info.message = 'Error fetching the staff\'s guild member!'; + info.message = "Error fetching the staff's guild member!"; return info; } @@ -132,11 +138,14 @@ export class ActivistCommand extends Command { // Checks if the user is Activist and to give them or remove them based on if they have it if (member.roles.cache.has(IDs.roles.vegan.activist)) { - if (!modMember.roles.cache.hasAny( - IDs.roles.staff.verifierCoordinator, - IDs.roles.staff.modCoordinator, - )) { - info.message = 'You need to be a verifier coordinator to remove this role!'; + if ( + !modMember.roles.cache.hasAny( + IDs.roles.staff.verifierCoordinator, + IDs.roles.staff.modCoordinator, + ) + ) { + info.message = + 'You need to be a verifier coordinator to remove this role!'; return info; } @@ -153,15 +162,17 @@ export class ActivistCommand extends Command { await roleAddLog(user.id, mod.id, activist); info.message = `Gave ${user} the ${activist.name} role!`; - await user.send( - `${user} you have been given the ${activist.name} role by ${mod}! ` - + `This means that if you'd wish to engage with non-vegans in <#${IDs.channels.nonVegan.general}>, you should follow these rules:\n\n` - + '1. Try to move conversations with non-vegans towards veganism/animal ethics\n' - + '2. Don\'t discuss social topics while activism is happening\n' - + '3. Have evidence for claims you make. "I don\'t know" is an acceptable answer. Chances are someone here knows or you can take time to find out\n' - + '4. Don\'t advocate for baby steps towards veganism. Participation in exploitation can stop today\n' - + '5. Differences in opinion between activists should be resolved in vegan spaces, not in the chat with non-vegans', - ).catch(() => {}); + await user + .send( + `${user} you have been given the ${activist.name} role by ${mod}! ` + + `This means that if you'd wish to engage with non-vegans in <#${IDs.channels.nonVegan.general}>, you should follow these rules:\n\n` + + '1. Try to move conversations with non-vegans towards veganism/animal ethics\n' + + "2. Don't discuss social topics while activism is happening\n" + + '3. Have evidence for claims you make. "I don\'t know" is an acceptable answer. Chances are someone here knows or you can take time to find out\n' + + "4. Don't advocate for baby steps towards veganism. Participation in exploitation can stop today\n" + + '5. Differences in opinion between activists should be resolved in vegan spaces, not in the chat with non-vegans', + ) + .catch(() => {}); info.success = true; return info; } diff --git a/src/commands/roles/verification/aravegan.ts b/src/commands/roles/verification/aravegan.ts index ab8c256..480e485 100644 --- a/src/commands/roles/verification/aravegan.ts +++ b/src/commands/roles/verification/aravegan.ts @@ -28,19 +28,25 @@ export class ARAVeganCommand extends Command { ...options, name: 'aravegan', description: 'Gives the ara vegan role', - preconditions: [['ModCoordinatorOnly', 'VerifierCoordinatorOnly', 'VerifierOnly']], + preconditions: [ + ['ModCoordinatorOnly', 'VerifierCoordinatorOnly', 'VerifierOnly'], + ], }); } // Registers that this is a slash command public override registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand( - (builder) => builder - .setName(this.name) - .setDescription(this.description) - .addUserOption((option) => option.setName('user') - .setDescription('User to give vegan role to') - .setRequired(true)), + (builder) => + builder + .setName(this.name) + .setDescription(this.description) + .addUserOption((option) => + option + .setName('user') + .setDescription('User to give vegan role to') + .setRequired(true), + ), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite, }, @@ -120,7 +126,7 @@ export class ARAVeganCommand extends Command { } if (modMember === undefined) { - info.message = 'Error fetching the staff\'s guild member!'; + info.message = "Error fetching the staff's guild member!"; return info; } @@ -131,11 +137,14 @@ export class ARAVeganCommand extends Command { // Checks if the user is an ARA Vegan and to give them or remove them based on if they have it if (member.roles.cache.has(IDs.roles.vegan.araVegan)) { - if (!modMember.roles.cache.hasAny( - IDs.roles.staff.verifierCoordinator, - IDs.roles.staff.modCoordinator, - )) { - info.message = 'You need to be a verifier coordinator to remove these roles!'; + if ( + !modMember.roles.cache.hasAny( + IDs.roles.staff.verifierCoordinator, + IDs.roles.staff.modCoordinator, + ) + ) { + info.message = + 'You need to be a verifier coordinator to remove these roles!'; return info; } @@ -158,7 +167,8 @@ export class ARAVeganCommand extends Command { await roleAddLog(user.id, mod.id, vegan); info.message = `Gave ${user} the ${vegan.name} role!`; - await user.send(`You have been given the ${vegan.name} role by ${mod}!`) + await user + .send(`You have been given the ${vegan.name} role by ${mod}!`) .catch(() => {}); info.success = true; return info; diff --git a/src/commands/roles/verification/convinced.ts b/src/commands/roles/verification/convinced.ts index 7fb041b..602f428 100644 --- a/src/commands/roles/verification/convinced.ts +++ b/src/commands/roles/verification/convinced.ts @@ -36,12 +36,16 @@ export class ConvincedCommand extends Command { // Registers that this is a slash command public override registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand( - (builder) => builder - .setName(this.name) - .setDescription(this.description) - .addUserOption((option) => option.setName('user') - .setDescription('User to give convinced to') - .setRequired(true)), + (builder) => + builder + .setName(this.name) + .setDescription(this.description) + .addUserOption((option) => + option + .setName('user') + .setDescription('User to give convinced to') + .setRequired(true), + ), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite, }, @@ -143,10 +147,13 @@ export class ConvincedCommand extends Command { await roleAddLog(user.id, mod.id, convinced); info.message = `Gave ${user} the ${convinced.name} role!`; - await user.send(`You have been given the ${convinced.name} role by ${mod}!` - + '\n\nThis role allows you to get access to the Diet Support section in this server that can help you go vegan ' - + 'and other parts of the server! :)' - + '\n\nThank you for caring about the animals ๐Ÿ’š') + await user + .send( + `You have been given the ${convinced.name} role by ${mod}!` + + '\n\nThis role allows you to get access to the Diet Support section in this server that can help you go vegan ' + + 'and other parts of the server! :)' + + '\n\nThank you for caring about the animals ๐Ÿ’š', + ) .catch(() => {}); info.success = true; diff --git a/src/commands/roles/verification/plus.ts b/src/commands/roles/verification/plus.ts index 31378df..3568ce8 100644 --- a/src/commands/roles/verification/plus.ts +++ b/src/commands/roles/verification/plus.ts @@ -36,12 +36,16 @@ export class PlusCommand extends Command { // Registers that this is a slash command public override registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand( - (builder) => builder - .setName(this.name) - .setDescription(this.description) - .addUserOption((option) => option.setName('user') - .setDescription('User to give/remove plus to') - .setRequired(true)), + (builder) => + builder + .setName(this.name) + .setDescription(this.description) + .addUserOption((option) => + option + .setName('user') + .setDescription('User to give/remove plus to') + .setRequired(true), + ), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite, }, @@ -86,7 +90,9 @@ export class PlusCommand extends Command { if (mod === null) { await message.react('โŒ'); - await message.reply('Coordinator not found! Try again or contact a developer!'); + await message.reply( + 'Coordinator not found! Try again or contact a developer!', + ); return; } @@ -137,7 +143,8 @@ export class PlusCommand extends Command { await roleAddLog(user.id, mod.id, plus); info.message = `Gave ${user} the ${plus.name} role!`; - await user.send(`You have been given the ${plus.name} role by ${mod}!`) + await user + .send(`You have been given the ${plus.name} role by ${mod}!`) .catch(() => {}); info.success = true; return info; diff --git a/src/commands/roles/verification/trusted.ts b/src/commands/roles/verification/trusted.ts index a84afbf..2caa994 100644 --- a/src/commands/roles/verification/trusted.ts +++ b/src/commands/roles/verification/trusted.ts @@ -36,12 +36,16 @@ export class TrustedCommand extends Command { // Registers that this is a slash command public override registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand( - (builder) => builder - .setName(this.name) - .setDescription(this.description) - .addUserOption((option) => option.setName('user') - .setDescription('User to give/remove trusted to') - .setRequired(true)), + (builder) => + builder + .setName(this.name) + .setDescription(this.description) + .addUserOption((option) => + option + .setName('user') + .setDescription('User to give/remove trusted to') + .setRequired(true), + ), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite, }, @@ -138,10 +142,13 @@ export class TrustedCommand extends Command { await roleAddLog(user.id, mod.id, trusted); info.message = `Gave ${user} the ${trusted.name} role!`; - await user.send(`You have been given the ${trusted.name} role by ${mod}!` - + '\n\nThis role allows you to post attachments to the server and stream in VCs.' - + '\nMake sure that you follow the rules, and don\'t post anything NSFW, anything objectifying animals and follow Discord\'s ToS.' - + `\nNot following these rules can result in the removal of the ${trusted.name} role.`) + await user + .send( + `You have been given the ${trusted.name} role by ${mod}!` + + '\n\nThis role allows you to post attachments to the server and stream in VCs.' + + "\nMake sure that you follow the rules, and don't post anything NSFW, anything objectifying animals and follow Discord's ToS." + + `\nNot following these rules can result in the removal of the ${trusted.name} role.`, + ) .catch(() => {}); info.success = true; return info; diff --git a/src/commands/roles/verification/vegan.ts b/src/commands/roles/verification/vegan.ts index b28268e..b665aaa 100644 --- a/src/commands/roles/verification/vegan.ts +++ b/src/commands/roles/verification/vegan.ts @@ -29,19 +29,25 @@ export class VeganCommand extends Command { name: 'vegan', aliases: ['v'], description: 'Gives the vegan role', - preconditions: [['ModCoordinatorOnly', 'VerifierCoordinatorOnly', 'VerifierOnly']], + preconditions: [ + ['ModCoordinatorOnly', 'VerifierCoordinatorOnly', 'VerifierOnly'], + ], }); } // Registers that this is a slash command public override registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand( - (builder) => builder - .setName(this.name) - .setDescription(this.description) - .addUserOption((option) => option.setName('user') - .setDescription('User to give vegan role to') - .setRequired(true)), + (builder) => + builder + .setName(this.name) + .setDescription(this.description) + .addUserOption((option) => + option + .setName('user') + .setDescription('User to give vegan role to') + .setRequired(true), + ), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite, }, @@ -121,7 +127,7 @@ export class VeganCommand extends Command { } if (modMember === undefined) { - info.message = 'Error fetching the staff\'s guild member!'; + info.message = "Error fetching the staff's guild member!"; return info; } @@ -132,11 +138,14 @@ export class VeganCommand extends Command { // Checks if the user is Vegan and to give them or remove them based on if they have it if (member.roles.cache.has(IDs.roles.vegan.vegan)) { - if (!modMember.roles.cache.hasAny( - IDs.roles.staff.verifierCoordinator, - IDs.roles.staff.modCoordinator, - )) { - info.message = 'You need to be a verifier coordinator to remove these roles!'; + if ( + !modMember.roles.cache.hasAny( + IDs.roles.staff.verifierCoordinator, + IDs.roles.staff.modCoordinator, + ) + ) { + info.message = + 'You need to be a verifier coordinator to remove these roles!'; return info; } @@ -154,8 +163,7 @@ export class VeganCommand extends Command { } // Add Vegan role to the user - await member.roles.add([vegan, - IDs.roles.vegan.nvAccess]); + await member.roles.add([vegan, IDs.roles.vegan.nvAccess]); await member.roles.remove([ IDs.roles.nonvegan.nonvegan, IDs.roles.nonvegan.convinced, @@ -164,7 +172,8 @@ export class VeganCommand extends Command { await roleAddLog(user.id, mod.id, vegan); info.message = `Gave ${user} the ${vegan.name} role!`; - await user.send(`You have been given the ${vegan.name} role by ${mod}!`) + await user + .send(`You have been given the ${vegan.name} role by ${mod}!`) .catch(() => {}); info.success = true; return info; diff --git a/src/commands/roles/verification/vegcurious.ts b/src/commands/roles/verification/vegcurious.ts index 13c06c1..3bf8cf1 100644 --- a/src/commands/roles/verification/vegcurious.ts +++ b/src/commands/roles/verification/vegcurious.ts @@ -36,12 +36,16 @@ export class VegCuriousCommand extends Command { // Registers that this is a slash command public override registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand( - (builder) => builder - .setName(this.name) - .setDescription(this.description) - .addUserOption((option) => option.setName('user') - .setDescription('User to give veg curious to') - .setRequired(true)), + (builder) => + builder + .setName(this.name) + .setDescription(this.description) + .addUserOption((option) => + option + .setName('user') + .setDescription('User to give veg curious to') + .setRequired(true), + ), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite, }, @@ -121,7 +125,7 @@ export class VegCuriousCommand extends Command { } if (modMember === undefined) { - info.message = 'Error fetching the staff\'s guild member!'; + info.message = "Error fetching the staff's guild member!"; return info; } @@ -134,13 +138,15 @@ export class VegCuriousCommand extends Command { if (!modMember.roles.cache.has(IDs.roles.staff.mentorCoordinator)) { // Only Mentor Coordinators can remove Veg Curious role if (member.roles.cache.has(IDs.roles.nonvegan.vegCurious)) { - info.message = 'You need to be a mentor coordinator to remove this role!'; + info.message = + 'You need to be a mentor coordinator to remove this role!'; return info; } // Only Mentor Coordinators can give vegans Veg Curious role if (member.roles.cache.has(IDs.roles.vegan.vegan)) { - info.message = 'You need to be a mentor coordinator to give vegans this role!'; + info.message = + 'You need to be a mentor coordinator to give vegans this role!'; return info; } } @@ -160,8 +166,12 @@ export class VegCuriousCommand extends Command { await roleAddLog(user.id, mod.id, vegCurious); info.message = `Gave ${user} the ${vegCurious.name} role!`; - await user.send(`You have been given the ${vegCurious.name} role by ${mod} ` - + 'which gives you access to the diet support section').catch(() => {}); + await user + .send( + `You have been given the ${vegCurious.name} role by ${mod} ` + + 'which gives you access to the diet support section', + ) + .catch(() => {}); info.success = true; return info; } diff --git a/src/commands/utils/apply.ts b/src/commands/utils/apply.ts index 7dd5cd8..8d3d41e 100644 --- a/src/commands/utils/apply.ts +++ b/src/commands/utils/apply.ts @@ -29,15 +29,14 @@ export class ApplyCommand extends Command { }); } - message = 'If you want to help out in ARA and support animals at the same time, ' - + 'apply here: https://forms.gle/kgBHbB7LHFUJXhui6 and we\'ll try to get back as soon as possible!'; + message = + 'If you want to help out in ARA and support animals at the same time, ' + + "apply here: https://forms.gle/kgBHbB7LHFUJXhui6 and we'll try to get back as soon as possible!"; // Registers that this is a slash command public override registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand( - (builder) => builder - .setName(this.name) - .setDescription(this.description), + (builder) => builder.setName(this.name).setDescription(this.description), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite, }, diff --git a/src/commands/utils/count.ts b/src/commands/utils/count.ts index d0d0c5e..025fb14 100644 --- a/src/commands/utils/count.ts +++ b/src/commands/utils/count.ts @@ -33,9 +33,7 @@ export class RenameUserCommand extends Command { // Registers that this is a slash command public override registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand( - (builder) => builder - .setName(this.name) - .setDescription(this.description), + (builder) => builder.setName(this.name).setDescription(this.description), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite, }, @@ -70,8 +68,9 @@ export class RenameUserCommand extends Command { } await interaction.reply({ - content: `${vegan.name}s: \`${vegan.members.size}\`` - + `\n${notVegan.name}s: \`${notVegan.members.size}\``, + content: + `${vegan.name}s: \`${vegan.members.size}\`` + + `\n${notVegan.name}s: \`${notVegan.members.size}\``, fetchReply: true, }); } @@ -81,7 +80,9 @@ export class RenameUserCommand extends Command { if (guild === null) { await message.react('โŒ'); - await message.reply('Guild not found, please try again or contact a developer!'); + await message.reply( + 'Guild not found, please try again or contact a developer!', + ); return; } @@ -99,8 +100,9 @@ export class RenameUserCommand extends Command { } await message.reply({ - content: `${vegan.name}s: \`${vegan.members.size}\`` - + `\n${notVegan.name}s: \`${notVegan.members.size}\``, + content: + `${vegan.name}s: \`${vegan.members.size}\`` + + `\n${notVegan.name}s: \`${notVegan.members.size}\``, }); await message.react('โœ…'); diff --git a/src/commands/utils/help.ts b/src/commands/utils/help.ts index 5031bd6..9e6c2e8 100644 --- a/src/commands/utils/help.ts +++ b/src/commands/utils/help.ts @@ -29,14 +29,16 @@ export class HelpCommand extends Command { // Registers that this is a slash command public override registerApplicationCommands(registry: Command.Registry) { - registry.registerChatInputCommand((builder) => builder - .setName(this.name) - .setDescription(this.description)); + registry.registerChatInputCommand((builder) => + builder.setName(this.name).setDescription(this.description), + ); } embed = new EmbedBuilder() - .setColor(0x0099FF) - .setDescription('For a list of all the commands, click [here](https://github.com/veganhacktivists/arabot/blob/main/docs/COMMANDS.md)'); + .setColor(0x0099ff) + .setDescription( + 'For a list of all the commands, click [here](https://github.com/veganhacktivists/arabot/blob/main/docs/COMMANDS.md)', + ); // Command run public async chatInputRun(interaction: Command.ChatInputCommandInteraction) { diff --git a/src/commands/utils/info.ts b/src/commands/utils/info.ts index 31efe9f..6a9e619 100644 --- a/src/commands/utils/info.ts +++ b/src/commands/utils/info.ts @@ -31,20 +31,29 @@ export class InfoCommand extends Command { // Registers that this is a slash command public override registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand( - (builder) => builder - .setName(this.name) - .setDescription(this.description) - .addStringOption((option) => option.setName('info') - .setDescription('Information you want') - .setRequired(true) - .addChoices( - { name: 'Trusted', value: 'trusted' }, - { name: 'Veg Curious', value: 'vegCurious' }, - { name: 'Verification', value: 'verification' }, - { name: 'ModMail', value: 'modMail' }, - )) - .addBooleanOption((option) => option.setName('visible') - .setDescription('If you want this this information visible to everyone')), + (builder) => + builder + .setName(this.name) + .setDescription(this.description) + .addStringOption((option) => + option + .setName('info') + .setDescription('Information you want') + .setRequired(true) + .addChoices( + { name: 'Trusted', value: 'trusted' }, + { name: 'Veg Curious', value: 'vegCurious' }, + { name: 'Verification', value: 'verification' }, + { name: 'ModMail', value: 'modMail' }, + ), + ) + .addBooleanOption((option) => + option + .setName('visible') + .setDescription( + 'If you want this this information visible to everyone', + ), + ), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite, }, @@ -66,34 +75,39 @@ export class InfoCommand extends Command { switch (option) { case 'trusted': - message = 'The trusted role (โœ…) gives you permissions to send images and share your screen and use the ' - + 'camera (unless you\'re a minor) on voice chats.\n\n' - + 'If you want the trusted role, please contact a moderator the moderators will determine whether ' - + 'you can have the role. This depends on your behaviour on the server.'; + message = + 'The trusted role (โœ…) gives you permissions to send images and share your screen and use the ' + + "camera (unless you're a minor) on voice chats.\n\n" + + 'If you want the trusted role, please contact a moderator the moderators will determine whether ' + + 'you can have the role. This depends on your behaviour on the server.'; break; case 'vegCurious': - message = 'Would you like the Veg Curious role? It will allow you access to our diet support section where our ' - + 'mentors can assist you. Mentors can provide product or substitution suggestions as well as other advice. ' - + 'They also host a stage that highlights new recipes weekly, which you will get pinged for.\n\n' - + 'If you\'re interested in the role, ask a member of staff or DM ModMail for the role. This role is ' - + 'available for non-vegans and vegans that are genuinely interested in learning more about plant-based ' - + 'diets!'; + message = + 'Would you like the Veg Curious role? It will allow you access to our diet support section where our ' + + 'mentors can assist you. Mentors can provide product or substitution suggestions as well as other advice. ' + + 'They also host a stage that highlights new recipes weekly, which you will get pinged for.\n\n' + + "If you're interested in the role, ask a member of staff or DM ModMail for the role. This role is " + + 'available for non-vegans and vegans that are genuinely interested in learning more about plant-based ' + + 'diets!'; break; case 'verification': - message = 'If you want to have the vegan or activist role, you\'ll need to do a voice verification. ' - + 'To do this, hop into the \'Verification\' voice channel.' - + '\n\nIf there aren\'t any verifiers available, you\'ll be disconnected, and you can rejoin later.'; + message = + "If you want to have the vegan or activist role, you'll need to do a voice verification. " + + "To do this, hop into the 'Verification' voice channel." + + "\n\nIf there aren't any verifiers available, you'll be disconnected, and you can rejoin later."; break; case 'modMail': - message = 'If you would like to contact the Moderators privately, the best way to do so would be to send a ' - + 'ModMail.\n\n' - + 'To do so, you will have to DM <@575252669443211264> then send it a message and it will prompt you to ' - + 'set up ModMail. Once you have set up ModMail, you can send a message and you will have to select this ' - + 'server to send it to. You will get a message from ModMail saying \'Message Sent\' when we have received ' - + 'your message!'; + message = + 'If you would like to contact the Moderators privately, the best way to do so would be to send a ' + + 'ModMail.\n\n' + + 'To do so, you will have to DM <@575252669443211264> then send it a message and it will prompt you to ' + + 'set up ModMail. Once you have set up ModMail, you can send a message and you will have to select this ' + + "server to send it to. You will get a message from ModMail saying 'Message Sent' when we have received " + + 'your message!'; break; default: - message = 'You\'re not supposed to find this, here\'s a virtual vegan cookie! :D'; + message = + "You're not supposed to find this, here's a virtual vegan cookie! :D"; } await interaction.reply({ diff --git a/src/commands/utils/ping.ts b/src/commands/utils/ping.ts index 2c3e8e3..eedb476 100644 --- a/src/commands/utils/ping.ts +++ b/src/commands/utils/ping.ts @@ -32,19 +32,25 @@ export class PingCommand extends Command { // Registers that this is a slash command public override registerApplicationCommands(registry: Command.Registry) { - registry.registerChatInputCommand((builder) => builder - .setName(this.name) - .setDescription(this.description)); + registry.registerChatInputCommand((builder) => + builder.setName(this.name).setDescription(this.description), + ); } // Command run public async chatInputRun(interaction: Command.ChatInputCommandInteraction) { - const msg = await interaction.reply({ content: 'Ping?', ephemeral: true, fetchReply: true }); + const msg = await interaction.reply({ + content: 'Ping?', + ephemeral: true, + fetchReply: true, + }); if (isMessageInstance(msg)) { const diff = msg.createdTimestamp - interaction.createdTimestamp; const ping = Math.round(this.container.client.ws.ping); - return interaction.editReply(`Pong ๐Ÿ“! (Round trip took: ${diff}ms. Heartbeat: ${ping}ms.)`); + return interaction.editReply( + `Pong ๐Ÿ“! (Round trip took: ${diff}ms. Heartbeat: ${ping}ms.)`, + ); } return interaction.editReply('Failed to retrieve ping :('); @@ -56,6 +62,8 @@ export class PingCommand extends Command { const diff = msg.createdTimestamp - message.createdTimestamp; const ping = Math.round(this.container.client.ws.ping); - return msg.edit(`Pong ๐Ÿ“! (Round trip took: ${diff}ms. Heartbeat: ${ping}ms.)`); + return msg.edit( + `Pong ๐Ÿ“! (Round trip took: ${diff}ms. Heartbeat: ${ping}ms.)`, + ); } } diff --git a/src/commands/verification/verify.ts b/src/commands/verification/verify.ts index 1e2ea8e..86c546f 100644 --- a/src/commands/verification/verify.ts +++ b/src/commands/verification/verify.ts @@ -18,14 +18,12 @@ */ import { Args, Command, RegisterBehavior } from '@sapphire/framework'; -import type { - Message, - User, - Guild, - Snowflake, -} from 'discord.js'; +import type { Message, User, Guild, Snowflake } from 'discord.js'; import IDs from '#utils/ids'; -import { finishVerifyMessages, giveVerificationRoles } from '#utils/verification'; +import { + finishVerifyMessages, + giveVerificationRoles, +} from '#utils/verification'; import { manualVerification } from '#utils/database/verification'; export class VerifyCommand extends Command { @@ -35,22 +33,31 @@ export class VerifyCommand extends Command { name: 'verify', aliases: ['ver'], description: 'Gives roles to the user', - preconditions: [['ModCoordinatorOnly', 'VerifierCoordinatorOnly', 'VerifierOnly']], + preconditions: [ + ['ModCoordinatorOnly', 'VerifierCoordinatorOnly', 'VerifierOnly'], + ], }); } // Registers that this is a slash command public override registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand( - (builder) => builder - .setName(this.name) - .setDescription(this.description) - .addUserOption((option) => option.setName('user') - .setDescription('User to give the roles to') - .setRequired(true)) - .addStringOption((option) => option.setName('roles') - .setDescription('Roles to give to the user') - .setRequired(true)), + (builder) => + builder + .setName(this.name) + .setDescription(this.description) + .addUserOption((option) => + option + .setName('user') + .setDescription('User to give the roles to') + .setRequired(true), + ) + .addStringOption((option) => + option + .setName('roles') + .setDescription('Roles to give to the user') + .setRequired(true), + ), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite, }, @@ -76,7 +83,13 @@ export class VerifyCommand extends Command { return; } - const verify = await this.verify(user, verifier.id, roles, messageId, guild); + const verify = await this.verify( + user, + verifier.id, + roles, + messageId, + guild, + ); await interaction.reply({ content: verify.message, @@ -113,7 +126,13 @@ export class VerifyCommand extends Command { return; } - const verify = await this.verify(user, verifier.id, roles, message.id, guild); + const verify = await this.verify( + user, + verifier.id, + roles, + message.id, + guild, + ); await message.reply(verify.message); await message.react(verify.success ? 'โœ…' : 'โŒ'); @@ -144,8 +163,7 @@ export class VerifyCommand extends Command { // Checks if member is null if (member === undefined) { - member = await guild.members.fetch(user.id) - .catch(() => undefined); + member = await guild.members.fetch(user.id).catch(() => undefined); if (member === undefined) { info.message = 'Failed to fetch member'; return info; @@ -153,7 +171,7 @@ export class VerifyCommand extends Command { } if (member.roles.cache.hasAny(...IDs.roles.restrictions.restricted)) { - info.message = 'Can\'t verify a restricted user!'; + info.message = "Can't verify a restricted user!"; return info; } @@ -161,8 +179,7 @@ export class VerifyCommand extends Command { // Checks if verifier is null if (verifier === undefined) { - verifier = await guild.members.fetch(user.id) - .catch(() => undefined); + verifier = await guild.members.fetch(user.id).catch(() => undefined); if (verifier === undefined) { info.message = 'Failed to fetch verifier'; return info; @@ -203,15 +220,19 @@ export class VerifyCommand extends Command { return info; } - if ((roles.vegan || member.roles.cache.has(IDs.roles.vegan.vegan)) - && (roleArgs.includes('nv') || roles.vegCurious || roles.convinced)) { - info.message = 'Can\'t give non-vegan roles to a vegan'; + if ( + (roles.vegan || member.roles.cache.has(IDs.roles.vegan.vegan)) && + (roleArgs.includes('nv') || roles.vegCurious || roles.convinced) + ) { + info.message = "Can't give non-vegan roles to a vegan"; return info; } - if (roleArgs.includes('nv') - && (roles.vegan || roles.activist || roles.araVegan)) { - info.message = 'Can\'t give vegan roles to a non-vegan'; + if ( + roleArgs.includes('nv') && + (roles.vegan || roles.activist || roles.araVegan) + ) { + info.message = "Can't give vegan roles to a non-vegan"; return info; } @@ -221,8 +242,10 @@ export class VerifyCommand extends Command { await manualVerification(messageId, member, verifier, roles); - if (member.roles.cache.has(IDs.roles.nonvegan.nonvegan) - && (roles.vegan || roles.activist || roles.araVegan)) { + if ( + member.roles.cache.has(IDs.roles.nonvegan.nonvegan) && + (roles.vegan || roles.activist || roles.araVegan) + ) { await member.roles.remove([ IDs.roles.nonvegan.nonvegan, IDs.roles.nonvegan.vegCurious, diff --git a/src/commands/verification/verifyTimeoutRemove.ts b/src/commands/verification/verifyTimeoutRemove.ts index b24785a..038d06c 100644 --- a/src/commands/verification/verifyTimeoutRemove.ts +++ b/src/commands/verification/verifyTimeoutRemove.ts @@ -34,12 +34,16 @@ export class VerifyTimeoutRemoveCommand extends Command { // Registers that this is a slash command public override registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand( - (builder) => builder - .setName(this.name) - .setDescription(this.description) - .addUserOption((option) => option.setName('user') - .setDescription('User to remove timeout from') - .setRequired(true)), + (builder) => + builder + .setName(this.name) + .setDescription(this.description) + .addUserOption((option) => + option + .setName('user') + .setDescription('User to remove timeout from') + .setRequired(true), + ), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite, }, @@ -67,8 +71,7 @@ export class VerifyTimeoutRemoveCommand extends Command { let member = guild.members.cache.get(user.id); if (member === undefined) { - member = await guild.members.fetch(user.id) - .catch(undefined); + member = await guild.members.fetch(user.id).catch(undefined); if (member === undefined) { await interaction.editReply(`${user} is not on this server!`); return; @@ -81,7 +84,9 @@ export class VerifyTimeoutRemoveCommand extends Command { } if (await checkVerificationFinish(user.id)) { - await interaction.editReply(`Can't remove ${user}'s role as they failed their last verification`); + await interaction.editReply( + `Can't remove ${user}'s role as they failed their last verification`, + ); return; } diff --git a/src/commands/xp/rank.ts b/src/commands/xp/rank.ts index 7bfa27e..5d9a224 100644 --- a/src/commands/xp/rank.ts +++ b/src/commands/xp/rank.ts @@ -34,11 +34,13 @@ export class RankCommand extends Command { // Registers that this is a slash command public override registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand( - (builder) => builder - .setName(this.name) - .setDescription(this.description) - .addUserOption((option) => option.setName('user') - .setDescription('User to show rank for')), + (builder) => + builder + .setName(this.name) + .setDescription(this.description) + .addUserOption((option) => + option.setName('user').setDescription('User to show rank for'), + ), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite, }, @@ -109,8 +111,7 @@ export class RankCommand extends Command { let member = guild.members.cache.get(user.id); if (member === undefined) { - member = await guild.members.fetch(user.id) - .catch(() => undefined); + member = await guild.members.fetch(user.id).catch(() => undefined); if (member === undefined) { info.message = 'The user is not on this server!'; return info; @@ -123,10 +124,17 @@ export class RankCommand extends Command { const embed = new EmbedBuilder() .setColor('#00ff7d') - .setAuthor({ name: `${member.displayName}'s Rank`, iconURL: `${user.displayAvatarURL()}` }) + .setAuthor({ + name: `${member.displayName}'s Rank`, + iconURL: `${user.displayAvatarURL()}`, + }) .addFields( { name: 'Rank', value: `${rank.rank}` }, - { name: 'Level', value: `${rank.level} (${rank.xpNextLevel}/${xpNextLevel} XP)`, inline: true }, + { + name: 'Level', + value: `${rank.level} (${rank.xpNextLevel}/${xpNextLevel} XP)`, + inline: true, + }, { name: 'Total XP', value: `${rank.xp}`, inline: true }, { name: 'Total messages', value: `${rank.messages}` }, ); diff --git a/src/interaction-handlers/nonVeganAccess.ts b/src/interaction-handlers/nonVeganAccess.ts index 41bee38..8bb42eb 100644 --- a/src/interaction-handlers/nonVeganAccess.ts +++ b/src/interaction-handlers/nonVeganAccess.ts @@ -17,7 +17,10 @@ along with this program. If not, see . */ -import { InteractionHandler, InteractionHandlerTypes } from '@sapphire/framework'; +import { + InteractionHandler, + InteractionHandlerTypes, +} from '@sapphire/framework'; import type { PieceContext } from '@sapphire/framework'; import type { ButtonInteraction, GuildMember } from 'discord.js'; import IDs from '#utils/ids'; @@ -39,8 +42,9 @@ export class NonVeganAccessButtonHandler extends InteractionHandler { public async run(interaction: ButtonInteraction) { let { member } = interaction; - const errorMessage = 'There was an error giving you the role, please try again later or contact ModMail/the developer ' - + 'to sort out this problem.'; + const errorMessage = + 'There was an error giving you the role, please try again later or contact ModMail/the developer ' + + 'to sort out this problem.'; if (member === null) { await interaction.reply({ @@ -64,8 +68,9 @@ export class NonVeganAccessButtonHandler extends InteractionHandler { if (member.roles.cache.has(IDs.roles.vegan.nvAccess)) { await member.roles.remove(IDs.roles.vegan.nvAccess); await interaction.reply({ - content: 'Your access from the non vegan section has been removed. ' - + 'If you want to gain access again, click this button again.', + content: + 'Your access from the non vegan section has been removed. ' + + 'If you want to gain access again, click this button again.', ephemeral: true, }); return; @@ -73,8 +78,9 @@ export class NonVeganAccessButtonHandler extends InteractionHandler { await member.roles.add(IDs.roles.vegan.nvAccess); await interaction.reply({ - content: 'Your access to the non vegan section has been given back. ' - + 'If you want to remove access again, click this button again.', + content: + 'Your access to the non vegan section has been given back. ' + + 'If you want to remove access again, click this button again.', ephemeral: true, }); } catch (error) { diff --git a/src/interaction-handlers/welcome.ts b/src/interaction-handlers/welcome.ts index 4459ac5..499f895 100644 --- a/src/interaction-handlers/welcome.ts +++ b/src/interaction-handlers/welcome.ts @@ -17,7 +17,10 @@ along with this program. If not, see . */ -import { InteractionHandler, InteractionHandlerTypes } from '@sapphire/framework'; +import { + InteractionHandler, + InteractionHandlerTypes, +} from '@sapphire/framework'; import type { PieceContext } from '@sapphire/framework'; import type { ButtonInteraction, GuildMember, TextChannel } from 'discord.js'; import IDs from '#utils/ids'; @@ -38,15 +41,17 @@ export class WelcomeButtonHandler extends InteractionHandler { public async run(interaction: ButtonInteraction) { let { member } = interaction; - const general = this.container.client.channels.cache - .get(IDs.channels.nonVegan.general) as TextChannel | undefined; + const general = this.container.client.channels.cache.get( + IDs.channels.nonVegan.general, + ) as TextChannel | undefined; if (general === undefined) { return; } if (member === null) { await interaction.reply({ - content: 'There was an error giving you the role, please try again later or contact ModMail to be let into this server.', + content: + 'There was an error giving you the role, please try again later or contact ModMail to be let into this server.', ephemeral: true, }); return; @@ -59,19 +64,23 @@ export class WelcomeButtonHandler extends InteractionHandler { if (!member.voice.channel) { await member.roles.add(IDs.roles.nonvegan.nonvegan); - await general.send(`${member} Welcome to ARA! :D Please check <#${IDs.channels.information.roles}> ` - + `and remember to follow the <#${IDs.channels.information.conduct}> and to respect ongoing discussion and debates.` - + '\n\nIf you would like to be verified as a vegan, join the \'Verification\' voice channel.'); + await general.send( + `${member} Welcome to ARA! :D Please check <#${IDs.channels.information.roles}> ` + + `and remember to follow the <#${IDs.channels.information.conduct}> and to respect ongoing discussion and debates.` + + "\n\nIf you would like to be verified as a vegan, join the 'Verification' voice channel.", + ); return; } await interaction.reply({ - content: 'You\'re currently in a verification, you\'ll have to leave the verification or get verified before being able to access the server again.', + content: + "You're currently in a verification, you'll have to leave the verification or get verified before being able to access the server again.", ephemeral: true, }); } catch (error) { await interaction.reply({ - content: 'There was an error giving you the role, please try again later or contact ModMail to be let into this server.', + content: + 'There was an error giving you the role, please try again later or contact ModMail to be let into this server.', ephemeral: true, }); } diff --git a/src/listeners/ban/ban.ts b/src/listeners/ban/ban.ts index c2af357..7b8de0d 100644 --- a/src/listeners/ban/ban.ts +++ b/src/listeners/ban/ban.ts @@ -69,7 +69,9 @@ export class BanListener extends Listener { // Check if the bot banned the user if (executor.id === this.container.client.user.id) { - this.container.logger.error('BanListener: got past the checkActive and bot banned this user.'); + this.container.logger.error( + 'BanListener: got past the checkActive and bot banned this user.', + ); return; } @@ -81,10 +83,11 @@ export class BanListener extends Listener { // Checks if GuildMember is null if (mod === undefined) { - mod = await guild.members.fetch(executor.id) - .catch(() => undefined); + mod = await guild.members.fetch(executor.id).catch(() => undefined); if (mod === undefined) { - this.container.logger.error('UnbanListener: Could not fetch moderator.'); + this.container.logger.error( + 'UnbanListener: Could not fetch moderator.', + ); return; } } @@ -93,7 +96,9 @@ export class BanListener extends Listener { await addExistingUser(mod); if (await checkBan(user.id)) { - this.container.logger.error('BanListener: got past the checkActive at the start.'); + this.container.logger.error( + 'BanListener: got past the checkActive at the start.', + ); return; } @@ -110,12 +115,14 @@ export class BanListener extends Listener { await addBan(user.id, mod.id, `${reason}`); // Log the ban - let logChannel = guild.channels.cache - .get(IDs.channels.logs.restricted) as TextChannel | undefined; + let logChannel = guild.channels.cache.get(IDs.channels.logs.restricted) as + | TextChannel + | undefined; if (logChannel === undefined) { - logChannel = await guild.channels - .fetch(IDs.channels.logs.restricted) as TextChannel | undefined; + logChannel = (await guild.channels.fetch( + IDs.channels.logs.restricted, + )) as TextChannel | undefined; if (logChannel === undefined) { this.container.logger.error('BanListener: Could not fetch log channel'); return; @@ -124,7 +131,10 @@ export class BanListener extends Listener { const log = new EmbedBuilder() .setColor('#FF0000') - .setAuthor({ name: `Banned ${user.tag} (not done via bot)`, iconURL: `${user.displayAvatarURL()}` }) + .setAuthor({ + name: `Banned ${user.tag} (not done via bot)`, + iconURL: `${user.displayAvatarURL()}`, + }) .addFields( { name: 'User', value: `${user}`, inline: true }, { name: 'Moderator', value: `${mod}`, inline: true }, diff --git a/src/listeners/ban/banJoin.ts b/src/listeners/ban/banJoin.ts index c8182d0..50ce9d3 100644 --- a/src/listeners/ban/banJoin.ts +++ b/src/listeners/ban/banJoin.ts @@ -32,8 +32,7 @@ export class BanJoinListener extends Listener { public async run(user: GuildMember) { // Check if the user is banned - if (!await checkBan(user.id) - && !await checkTempBan(user.id)) { + if (!(await checkBan(user.id)) && !(await checkTempBan(user.id))) { return; } @@ -41,8 +40,11 @@ export class BanJoinListener extends Listener { const reason = await getBanReason(user.id); // Send DM for ban reason - await user.send(`You have been banned from ARA for: ${reason}` - + '\n\nhttps://vbcamp.org/ARA') + await user + .send( + `You have been banned from ARA for: ${reason}` + + '\n\nhttps://vbcamp.org/ARA', + ) .catch(() => {}); // Ban the user diff --git a/src/listeners/ban/unban.ts b/src/listeners/ban/unban.ts index 7e27c5b..1a31526 100644 --- a/src/listeners/ban/unban.ts +++ b/src/listeners/ban/unban.ts @@ -72,10 +72,11 @@ export class UnbanListener extends Listener { // Checks if GuildMember is null if (mod === undefined) { - mod = await guild.members.fetch(executor.id) - .catch(() => undefined); + mod = await guild.members.fetch(executor.id).catch(() => undefined); if (mod === undefined) { - this.container.logger.error('UnbanListener: Could not fetch moderator.'); + this.container.logger.error( + 'UnbanListener: Could not fetch moderator.', + ); return; } } @@ -84,7 +85,7 @@ export class UnbanListener extends Listener { await addExistingUser(mod); // Check for missing ban on database - if (!await checkBan(user.id)) { + if (!(await checkBan(user.id))) { // Check if user and mod are on the database await addEmptyUser(user.id); @@ -96,21 +97,28 @@ export class UnbanListener extends Listener { await removeBan(user.id, mod.id); // Log the ban - let logChannel = guild.channels.cache - .get(IDs.channels.logs.restricted) as TextChannel | undefined; + let logChannel = guild.channels.cache.get(IDs.channels.logs.restricted) as + | TextChannel + | undefined; if (logChannel === undefined) { - logChannel = await guild.channels - .fetch(IDs.channels.logs.restricted) as TextChannel | undefined; + logChannel = (await guild.channels.fetch( + IDs.channels.logs.restricted, + )) as TextChannel | undefined; if (logChannel === undefined) { - this.container.logger.error('UnbanListener: Could not fetch log channel'); + this.container.logger.error( + 'UnbanListener: Could not fetch log channel', + ); return; } } const log = new EmbedBuilder() .setColor('#28A745') - .setAuthor({ name: `Unbanned ${user.tag} (not done via bot)`, iconURL: `${user.displayAvatarURL()}` }) + .setAuthor({ + name: `Unbanned ${user.tag} (not done via bot)`, + iconURL: `${user.displayAvatarURL()}`, + }) .addFields( { name: 'User', value: `${user}`, inline: true }, { name: 'Moderator', value: `${mod}`, inline: true }, diff --git a/src/listeners/botAppreciation.ts b/src/listeners/botAppreciation.ts index 06d75f5..4f1e7e2 100644 --- a/src/listeners/botAppreciation.ts +++ b/src/listeners/botAppreciation.ts @@ -30,10 +30,12 @@ export class BotAppreciationListener extends Listener { public async run(message: Message) { const content = message.content.toLowerCase(); - if (!content.includes('thanks arabot') - && !content.includes('thanks ara bot') - && !content.includes('thank you arabot') - && !content.includes('thank you ara bot')) { + if ( + !content.includes('thanks arabot') && + !content.includes('thanks ara bot') && + !content.includes('thank you arabot') && + !content.includes('thank you ara bot') + ) { return; } diff --git a/src/listeners/commandDenied.ts b/src/listeners/commandDenied.ts index c5ee69a..6d88afc 100644 --- a/src/listeners/commandDenied.ts +++ b/src/listeners/commandDenied.ts @@ -17,7 +17,10 @@ along with this program. If not, see . */ -import type { UserError, MessageCommandDeniedPayload } from '@sapphire/framework'; +import type { + UserError, + MessageCommandDeniedPayload, +} from '@sapphire/framework'; import { Listener } from '@sapphire/framework'; export class OldCommandDeniedListener extends Listener { diff --git a/src/listeners/counting.ts b/src/listeners/counting.ts index 8d33a03..2b4a386 100644 --- a/src/listeners/counting.ts +++ b/src/listeners/counting.ts @@ -46,7 +46,9 @@ export class XpListener extends Listener { // If no counts exist on the database, then create the first count from the bot if (lastCount === null) { if (this.container.client.id === null) { - message.channel.send('An unexpected error occurred trying to set up the counting channel, please contact a developer!'); + message.channel.send( + 'An unexpected error occurred trying to set up the counting channel, please contact a developer!', + ); return; } @@ -58,7 +60,9 @@ export class XpListener extends Listener { lastCount = await getLastCount(); if (lastCount === null) { - message.channel.send('An unexpected error occurred, please contact a developer!'); + message.channel.send( + 'An unexpected error occurred, please contact a developer!', + ); return; } } @@ -80,7 +84,9 @@ export class XpListener extends Listener { // If the count was not correct, restart it await addCount(message.author.id, 0); await message.react('โŒ'); - await message.reply(`${message.author} counted incorrectly! The count got up to ${lastCount.number}! ` - + 'The count has been reset and the next number is 1'); + await message.reply( + `${message.author} counted incorrectly! The count got up to ${lastCount.number}! ` + + 'The count has been reset and the next number is 1', + ); } } diff --git a/src/listeners/dbLeaveServer.ts b/src/listeners/dbLeaveServer.ts index 07a631c..5a77ece 100644 --- a/src/listeners/dbLeaveServer.ts +++ b/src/listeners/dbLeaveServer.ts @@ -20,7 +20,11 @@ import { Listener } from '@sapphire/framework'; import type { GuildMember } from 'discord.js'; import IDs from '#utils/ids'; -import { addEmptyUser, logLeaving, updateUser } from '#utils/database/dbExistingUser'; +import { + addEmptyUser, + logLeaving, + updateUser, +} from '#utils/database/dbExistingUser'; export class DbLeaveServerListener extends Listener { public constructor(context: Listener.Context, options: Listener.Options) { @@ -31,10 +35,12 @@ export class DbLeaveServerListener extends Listener { } public async run(member: GuildMember) { - if (member.roles.cache.hasAny( - IDs.roles.vegan.vegan, - IDs.roles.nonvegan.nonvegan, - )) { + if ( + member.roles.cache.hasAny( + IDs.roles.vegan.vegan, + IDs.roles.nonvegan.nonvegan, + ) + ) { await updateUser(member); } else { await addEmptyUser(member.id); diff --git a/src/listeners/deniedPermission.ts b/src/listeners/deniedPermission.ts index 62c6740..fba3467 100644 --- a/src/listeners/deniedPermission.ts +++ b/src/listeners/deniedPermission.ts @@ -17,7 +17,10 @@ along with this program. If not, see . */ -import type { UserError, ChatInputCommandDeniedPayload } from '@sapphire/framework'; +import type { + UserError, + ChatInputCommandDeniedPayload, +} from '@sapphire/framework'; import { Listener } from '@sapphire/framework'; export class CommandDeniedListener extends Listener { diff --git a/src/listeners/modMail.ts b/src/listeners/modMail.ts index c83f366..136399c 100644 --- a/src/listeners/modMail.ts +++ b/src/listeners/modMail.ts @@ -52,7 +52,7 @@ export class ModMailCreateListener extends Listener { const userId = topic[2]; // Check if the user is currently restricted on the database - if (!await checkActive(userId)) return; + if (!(await checkActive(userId))) return; // Get the restriction logs const restrictions = await getRestrictions(userId); @@ -66,9 +66,11 @@ export class ModMailCreateListener extends Listener { .setFooter({ text: `ID: ${userId}` }); // Add up to 10 of the latest restrictions to the embed - for (let i = restrictions.length > 10 ? restrictions.length - 10 : 0; + for ( + let i = restrictions.length > 10 ? restrictions.length - 10 : 0; i < restrictions.length; - i += 1) { + i += 1 + ) { // Get mod names let restMod = restrictions[i].modId; const restModMember = guild.members.cache.get(restMod); @@ -91,7 +93,9 @@ export class ModMailCreateListener extends Listener { restTitle += 'Currently Restricted | '; } - restTitle += `Date: `; + restTitle += `Date: `; restrictEmbed.addFields({ name: restTitle, @@ -107,7 +111,11 @@ export class ModMailCreateListener extends Listener { .setTitle(`${notes.length} sus notes`); // Add up to 10 of the latest sus notes to the embed - for (let i = notes.length > 10 ? notes.length - 10 : 0; i < notes.length; i += 1) { + for ( + let i = notes.length > 10 ? notes.length - 10 : 0; + i < notes.length; + i += 1 + ) { // Get mod name const modGuildMember = guild.members.cache.get(notes[i].modId); let mod = notes[i].modId; @@ -116,7 +124,11 @@ export class ModMailCreateListener extends Listener { } // Add sus note to embed susEmbed.addFields({ - name: `Sus ID: ${notes[i].id} | Moderator: ${mod} | Date: `, + name: `Sus ID: ${ + notes[i].id + } | Moderator: ${mod} | Date: `, value: notes[i].note, }); } diff --git a/src/listeners/nonVeganAccess.ts b/src/listeners/nonVeganAccess.ts index f005e1f..989ea17 100644 --- a/src/listeners/nonVeganAccess.ts +++ b/src/listeners/nonVeganAccess.ts @@ -20,10 +20,7 @@ import { Listener } from '@sapphire/framework'; import { ButtonStyle, ActionRowBuilder, ButtonBuilder } from 'discord.js'; -import type { - Client, - TextChannel, -} from 'discord.js'; +import type { Client, TextChannel } from 'discord.js'; import IDs from '#utils/ids'; export class NonVeganAccessReady extends Listener { @@ -36,11 +33,13 @@ export class NonVeganAccessReady extends Listener { } public async run(client: Client) { - let roles = client.channels.cache - .get(IDs.channels.information.roles) as TextChannel | undefined; + let roles = client.channels.cache.get(IDs.channels.information.roles) as + | TextChannel + | undefined; if (roles === undefined) { - roles = await client.channels - .fetch(IDs.channels.information.roles) as TextChannel | undefined; + roles = (await client.channels.fetch(IDs.channels.information.roles)) as + | TextChannel + | undefined; if (roles === undefined) { this.container.logger.error('nonVeganAccess: Roles not found'); return; @@ -51,17 +50,17 @@ export class NonVeganAccessReady extends Listener { const messages = await roles.messages.fetch(); const message = messages.first(); - const content = '**Change access to non-vegan section of the server:**\n\n' - + 'If you\'re vegan and want your access removed/added back to the non vegan sections, ' - + 'press the button bellow to remove/gain access to the non vegan sections.'; + const content = + '**Change access to non-vegan section of the server:**\n\n' + + "If you're vegan and want your access removed/added back to the non vegan sections, " + + 'press the button bellow to remove/gain access to the non vegan sections.'; - const button = new ActionRowBuilder() - .addComponents( - new ButtonBuilder() - .setCustomId('nvAccess') - .setLabel('Non Vegan Access') - .setStyle(ButtonStyle.Primary), - ); + const button = new ActionRowBuilder().addComponents( + new ButtonBuilder() + .setCustomId('nvAccess') + .setLabel('Non Vegan Access') + .setStyle(ButtonStyle.Primary), + ); if (message?.author.id !== botId) { await roles.send({ diff --git a/src/listeners/rolesJoinServer.ts b/src/listeners/rolesJoinServer.ts index 23ce65f..481c559 100644 --- a/src/listeners/rolesJoinServer.ts +++ b/src/listeners/rolesJoinServer.ts @@ -71,9 +71,13 @@ export class RolesJoinServerListener extends Listener { // Add user to the restricted vegan channel if (section === 5) { - const restrictedCategory = member.guild.channels.cache.get(IDs.categories.restricted); - if (restrictedCategory !== undefined - && restrictedCategory.type === ChannelType.GuildCategory) { + const restrictedCategory = member.guild.channels.cache.get( + IDs.categories.restricted, + ); + if ( + restrictedCategory !== undefined && + restrictedCategory.type === ChannelType.GuildCategory + ) { await this.restrictRun(member.id, restrictedCategory, member.guild); } } @@ -93,19 +97,28 @@ export class RolesJoinServerListener extends Listener { await member.roles.add(roles); } - const privateCategory = member.guild.channels.cache.get(IDs.categories.private); + const privateCategory = member.guild.channels.cache.get( + IDs.categories.private, + ); - if (privateCategory !== undefined - && privateCategory.type === ChannelType.GuildCategory) { + if ( + privateCategory !== undefined && + privateCategory.type === ChannelType.GuildCategory + ) { await this.privateRun(member.id, privateCategory, member.guild); } // TODO add access back to diversity team } - private async restrictRun(userId: Snowflake, category: CategoryChannel, guild: Guild) { - const textChannels = category.children.cache - .filter((c) => c.type === ChannelType.GuildText); + private async restrictRun( + userId: Snowflake, + category: CategoryChannel, + guild: Guild, + ) { + const textChannels = category.children.cache.filter( + (c) => c.type === ChannelType.GuildText, + ); textChannels.forEach((c) => { const textChannel = c as TextChannel; // Checks if the channel topic has the user's snowflake @@ -114,9 +127,11 @@ export class RolesJoinServerListener extends Listener { const vcId = topic[topic.indexOf(userId) + 1]; const voiceChannel = guild.channels.cache.get(vcId); - if (voiceChannel !== undefined - && voiceChannel.parentId === IDs.categories.restricted - && voiceChannel.isVoiceBased()) { + if ( + voiceChannel !== undefined && + voiceChannel.parentId === IDs.categories.restricted && + voiceChannel.isVoiceBased() + ) { voiceChannel.permissionOverwrites.edit(userId, { ViewChannel: true }); } textChannel.permissionOverwrites.edit(userId, { ViewChannel: true }); @@ -124,9 +139,14 @@ export class RolesJoinServerListener extends Listener { }); } - private async privateRun(userId: Snowflake, category: CategoryChannel, guild: Guild) { - const textChannels = category.children.cache - .filter((c) => c.type === ChannelType.GuildText); + private async privateRun( + userId: Snowflake, + category: CategoryChannel, + guild: Guild, + ) { + const textChannels = category.children.cache.filter( + (c) => c.type === ChannelType.GuildText, + ); textChannels.forEach((c) => { const textChannel = c as TextChannel; // Checks if the channel topic has the user's snowflake @@ -135,9 +155,11 @@ export class RolesJoinServerListener extends Listener { const vcId = topic[topic.indexOf(userId) + 2]; const voiceChannel = guild.channels.cache.get(vcId); - if (voiceChannel !== undefined - && voiceChannel.parentId === IDs.categories.private - && voiceChannel.isVoiceBased()) { + if ( + voiceChannel !== undefined && + voiceChannel.parentId === IDs.categories.private && + voiceChannel.isVoiceBased() + ) { voiceChannel.permissionOverwrites.edit(userId, { ViewChannel: true }); } textChannel.permissionOverwrites.edit(userId, { ViewChannel: true }); diff --git a/src/listeners/suggestions.ts b/src/listeners/suggestions.ts index 0901641..eda1491 100644 --- a/src/listeners/suggestions.ts +++ b/src/listeners/suggestions.ts @@ -35,12 +35,14 @@ export class Suggestions extends Listener { return; } - const mailbox = await this.container.client.channels.cache - .get(IDs.channels.staff.mailbox); + const mailbox = await this.container.client.channels.cache.get( + IDs.channels.staff.mailbox, + ); - if (mailbox === undefined - || !mailbox.isTextBased()) { - this.container.logger.error('Mailbox is not a TextBased channel or is undefined'); + if (mailbox === undefined || !mailbox.isTextBased()) { + this.container.logger.error( + 'Mailbox is not a TextBased channel or is undefined', + ); return; } @@ -54,7 +56,10 @@ export class Suggestions extends Listener { const suggestion = new EmbedBuilder() .setColor('#FFFFFF') - .setAuthor({ name: `Suggestion from ${message.author.tag}:`, iconURL: `${message.author.displayAvatarURL()}` }) + .setAuthor({ + name: `Suggestion from ${message.author.tag}:`, + iconURL: `${message.author.displayAvatarURL()}`, + }) .setTimestamp(); if (message.content.length > 0) { @@ -66,9 +71,12 @@ export class Suggestions extends Listener { suggestion.setFields({ name: 'Attachments', value: attachmentsString }); } else { await message.delete(); - await message.author.send({ - content: 'There was an error sending your suggestion, please try again later or contact the devs!', - }).catch(() => {}); + await message.author + .send({ + content: + 'There was an error sending your suggestion, please try again later or contact the devs!', + }) + .catch(() => {}); return; } @@ -81,13 +89,16 @@ export class Suggestions extends Listener { await sent.react('๐Ÿ‘'); await sent.react('๐Ÿ‘Ž'); - await sent.react('<:catshrug:917505035196313671>') - .catch(() => { sent.react('๐Ÿคท'); }); + await sent.react('<:catshrug:917505035196313671>').catch(() => { + sent.react('๐Ÿคท'); + }); - await message.author.send({ - content: 'Your suggestion has been sent!', - embeds: [suggestion], - files: attachments, - }).catch(() => {}); + await message.author + .send({ + content: 'Your suggestion has been sent!', + embeds: [suggestion], + files: attachments, + }) + .catch(() => {}); } } diff --git a/src/listeners/vcMute.ts b/src/listeners/vcMute.ts index f6ce33d..a1e75d3 100644 --- a/src/listeners/vcMute.ts +++ b/src/listeners/vcMute.ts @@ -35,7 +35,9 @@ export class VCMuteListener extends Listener { const { member } = newState; if (member === null) { - this.container.logger.error('VCMute Listener - GuildMember not found when joining'); + this.container.logger.error( + 'VCMute Listener - GuildMember not found when joining', + ); return; } @@ -45,7 +47,7 @@ export class VCMuteListener extends Listener { } // Check if user is muted on the database - if (!await checkActive(member.id)) { + if (!(await checkActive(member.id))) { return; } @@ -59,12 +61,14 @@ export class VCMuteListener extends Listener { const { member } = newState; if (member === null) { - this.container.logger.error('VCMute Listener - GuildMember not found when unmuting'); + this.container.logger.error( + 'VCMute Listener - GuildMember not found when unmuting', + ); return; } // Check if user is muted on the database - if (!await checkActive(member.id)) { + if (!(await checkActive(member.id))) { return; } diff --git a/src/listeners/verification/joinVC.ts b/src/listeners/verification/joinVC.ts index 04ae9da..3cd4e5c 100644 --- a/src/listeners/verification/joinVC.ts +++ b/src/listeners/verification/joinVC.ts @@ -45,7 +45,11 @@ import { finishVerifyMessages, } from '#utils/verification'; import { maxVCs, questionInfo, serverFind } from '#utils/verificationConfig'; -import { joinVerification, startVerification, finishVerification } from '#utils/database/verification'; +import { + joinVerification, + startVerification, + finishVerification, +} from '#utils/database/verification'; import { findNotes } from '#utils/database/sus'; import { addExistingUser } from '#utils/database/dbExistingUser'; import { rolesToString } from '#utils/formatter'; @@ -61,8 +65,9 @@ export class VerificationJoinVCListener extends Listener { public async run(oldState: VoiceState, newState: VoiceState) { // If the event was not a user joining the channel - if (oldState.channel?.parent?.id === IDs.categories.verification - || newState.channel?.parent?.id !== IDs.categories.verification + if ( + oldState.channel?.parent?.id === IDs.categories.verification || + newState.channel?.parent?.id !== IDs.categories.verification ) { return; } @@ -116,19 +121,22 @@ export class VerificationJoinVCListener extends Listener { } // Checks if there is more than one person who has joined or if the channel has members - if (channel.members.size !== 1 - || !channel.members.has(member.id)) { + if (channel.members.size !== 1 || !channel.members.has(member.id)) { return; } // Check if the user has the verifiers role - if (member.roles.cache.has(IDs.roles.staff.verifier) - || member.roles.cache.has(IDs.roles.staff.trialVerifier)) { + if ( + member.roles.cache.has(IDs.roles.staff.verifier) || + member.roles.cache.has(IDs.roles.staff.trialVerifier) + ) { await channel.setName('Verifier Meeting'); verifier = true; } else { - await currentChannel.send(`Hiya ${member.user}, please be patient as a verifier has been called out to verify you.\n\n` - + 'If you leave this voice channel, you will automatically be given the non-vegan role where you gain access to this server and if you\'d like to verify as a vegan again, you\'d have to contact a Mod, which could be done via ModMail.'); + await currentChannel.send( + `Hiya ${member.user}, please be patient as a verifier has been called out to verify you.\n\n` + + "If you leave this voice channel, you will automatically be given the non-vegan role where you gain access to this server and if you'd like to verify as a vegan again, you'd have to contact a Mod, which could be done via ModMail.", + ); // Adds to the database that the user joined verification await joinVerification(channel.id, member); @@ -143,22 +151,31 @@ export class VerificationJoinVCListener extends Listener { ]); // Start 15-minute timer if verifier does not join - this.container.tasks.create('verifyTimeout', { - channelId: channel.id, - userId: member.id, - }, 900_000); // 15 minutes + this.container.tasks.create( + 'verifyTimeout', + { + channelId: channel.id, + userId: member.id, + }, + 900_000, + ); // 15 minutes } // Check how many voice channels there are - const listVoiceChannels = category.children.cache - .filter((c) => c.type === ChannelType.GuildVoice); + const listVoiceChannels = category.children.cache.filter( + (c) => c.type === ChannelType.GuildVoice, + ); // Create a text channel for verifiers only if (!verifier) { let verificationText: TextChannel; let bannedName = false; try { - verificationText = await createVerificationText(member, channel, category); + verificationText = await createVerificationText( + member, + channel, + category, + ); } catch { bannedName = true; verificationText = await createVerificationText( @@ -184,7 +201,12 @@ export class VerificationJoinVCListener extends Listener { embeds: [userInfoEmbed, susNotes], }); - await this.verificationProcess(verificationText, channel.id, member, guild); + await this.verificationProcess( + verificationText, + channel.id, + member, + guild, + ); } // Create a new channel for others to join @@ -200,29 +222,37 @@ export class VerificationJoinVCListener extends Listener { await currentChannel.permissionOverwrites.set([ { id: guild.roles.everyone, - deny: [PermissionsBitField.Flags.SendMessages, + deny: [ + PermissionsBitField.Flags.SendMessages, PermissionsBitField.Flags.ViewChannel, - PermissionsBitField.Flags.Stream], + PermissionsBitField.Flags.Stream, + ], }, { id: IDs.roles.verifyBlock, - deny: [PermissionsBitField.Flags.ViewChannel, + deny: [ + PermissionsBitField.Flags.ViewChannel, PermissionsBitField.Flags.Connect, - PermissionsBitField.Flags.SendMessages], + PermissionsBitField.Flags.SendMessages, + ], }, { id: IDs.roles.staff.verifier, - allow: [PermissionsBitField.Flags.SendMessages, + allow: [ + PermissionsBitField.Flags.SendMessages, PermissionsBitField.Flags.ViewChannel, PermissionsBitField.Flags.Connect, - PermissionsBitField.Flags.MuteMembers], + PermissionsBitField.Flags.MuteMembers, + ], }, { id: IDs.roles.staff.trialVerifier, - allow: [PermissionsBitField.Flags.SendMessages, + allow: [ + PermissionsBitField.Flags.SendMessages, PermissionsBitField.Flags.ViewChannel, PermissionsBitField.Flags.Connect, - PermissionsBitField.Flags.MuteMembers], + PermissionsBitField.Flags.MuteMembers, + ], }, { id: member.id, @@ -259,7 +289,11 @@ export class VerificationJoinVCListener extends Listener { .setTitle(`${notes.length} sus notes for ${user.user.username}`); // Add up to 10 of the latest sus notes to the embed - for (let i = notes.length > 10 ? notes.length - 10 : 0; i < notes.length; i += 1) { + for ( + let i = notes.length > 10 ? notes.length - 10 : 0; + i < notes.length; + i += 1 + ) { // Get mod name const modGuildMember = guild.members.cache.get(notes[i].modId); let mod = notes[i].modId; @@ -268,7 +302,11 @@ export class VerificationJoinVCListener extends Listener { } // Add sus note to embed embed.addFields({ - name: `Sus ID: ${notes[i].id} | Moderator: ${mod} | Date: `, + name: `Sus ID: ${ + notes[i].id + } | Moderator: ${mod} | Date: `, value: notes[i].note, }); } @@ -335,7 +373,10 @@ export class VerificationJoinVCListener extends Listener { case 0: { info.find.reason = buttonChoice; if (buttonChoice !== 0 && info.find.reason === 0) { - embed = await this.createEmbed(serverFind[info.page].question, embedColor); + embed = await this.createEmbed( + serverFind[info.page].question, + embedColor, + ); buttons = await this.createButtons(serverFind[info.page].buttons); await message.edit({ embeds: [embed], @@ -405,7 +446,10 @@ export class VerificationJoinVCListener extends Listener { info.page += 1; // Checks if finished all the questions if (info.page < questionLength) { - embed = await this.createEmbed(questionInfo[info.page].question, embedColor); + embed = await this.createEmbed( + questionInfo[info.page].question, + embedColor, + ); buttons = await this.createButtons(questionInfo[info.page].buttons); await message.edit({ embeds: [embed], @@ -419,13 +463,14 @@ export class VerificationJoinVCListener extends Listener { .setColor(embedColor) .setTitle(`Give these roles to ${user.displayName}?`) .setThumbnail(user.avatarURL()!) - .addFields( - { name: 'Roles:', value: this.getTextRoles(info.roles) }, - ); + .addFields({ + name: 'Roles:', + value: this.getTextRoles(info.roles), + }); // Create buttons for input - buttons = [new ActionRowBuilder() - .addComponents( + buttons = [ + new ActionRowBuilder().addComponents( new ButtonBuilder() .setCustomId('confirm') .setLabel('Yes') @@ -434,7 +479,8 @@ export class VerificationJoinVCListener extends Listener { .setCustomId('cancel') .setLabel('No') .setStyle(ButtonStyle.Danger), - )]; + ), + ]; await message.edit({ embeds: [embed], components: buttons, @@ -444,7 +490,9 @@ export class VerificationJoinVCListener extends Listener { // Confirming and finishing the verification if (button.customId === 'confirm' && info.page >= questionLength) { // Check verifier is on the database - const verifierGuildMember = await guild.members.cache.get(button.user.id); + const verifierGuildMember = await guild.members.cache.get( + button.user.id, + ); if (verifierGuildMember === undefined) { await message.edit({ content: 'Verifier not found!' }); return; @@ -459,19 +507,21 @@ export class VerificationJoinVCListener extends Listener { // Add timeout if they do not have activist role if (!info.roles.activist) { // @ts-ignore - this.container.tasks.create('verifyUnblock', { - userId: user.id, - guildId: guild.id, - }, (info.roles.vegan || info.roles.convinced) ? 604800000 : 1814400000); + this.container.tasks.create( + 'verifyUnblock', + { + userId: user.id, + guildId: guild.id, + }, + info.roles.vegan || info.roles.convinced ? 604800000 : 1814400000, + ); } // Add embed saying verification completed embed = new EmbedBuilder() .setColor('#34c000') .setTitle(`Successfully verified ${user.displayName}!`) .setThumbnail(user.user.displayAvatarURL()) - .addFields( - { name: 'Roles:', value: this.getTextRoles(info.roles) }, - ); + .addFields({ name: 'Roles:', value: this.getTextRoles(info.roles) }); await message.edit({ embeds: [embed], components: [], @@ -486,7 +536,10 @@ export class VerificationJoinVCListener extends Listener { info.roles.trusted = false; info.roles.vegCurious = false; info.roles.convinced = false; - embed = await this.createEmbed(questionInfo[info.page].question, embedColor); + embed = await this.createEmbed( + questionInfo[info.page].question, + embedColor, + ); buttons = await this.createButtons(questionInfo[info.page].buttons); await message.edit({ embeds: [embed], @@ -498,9 +551,7 @@ export class VerificationJoinVCListener extends Listener { } private async createEmbed(title: string, color: ColorResolvable) { - return new EmbedBuilder() - .setColor(color) - .setTitle(title); + return new EmbedBuilder().setColor(color).setTitle(title); } private async createButtons(buttons: string[]) { @@ -511,13 +562,12 @@ export class VerificationJoinVCListener extends Listener { if (i % 5 === 0) { buttonActions.push(new ActionRowBuilder()); } - buttonActions[Math.floor(i / 5)] - .addComponents( - new ButtonBuilder() - .setCustomId(`button${i}`) - .setLabel(buttons[i]) - .setStyle(ButtonStyle.Secondary), - ); + buttonActions[Math.floor(i / 5)].addComponents( + new ButtonBuilder() + .setCustomId(`button${i}`) + .setLabel(buttons[i]) + .setStyle(ButtonStyle.Secondary), + ); } return buttonActions; @@ -532,15 +582,13 @@ export class VerificationJoinVCListener extends Listener { return parseInt(buttonChoice, 10); } - private getTextRoles( - roles: { - vegan: boolean, - activist: boolean, - trusted: boolean, - vegCurious: boolean, - convinced: boolean - }, - ) { + private getTextRoles(roles: { + vegan: boolean; + activist: boolean; + trusted: boolean; + vegCurious: boolean; + convinced: boolean; + }) { let rolesText = ''; if (roles.convinced) { rolesText += `<@&${IDs.roles.nonvegan.convinced}>`; diff --git a/src/listeners/verification/leaveVC.ts b/src/listeners/verification/leaveVC.ts index ea33c8f..b37c43e 100644 --- a/src/listeners/verification/leaveVC.ts +++ b/src/listeners/verification/leaveVC.ts @@ -19,12 +19,19 @@ import { Listener } from '@sapphire/framework'; import type { - VoiceState, CategoryChannel, VoiceChannel, TextChannel, + VoiceState, + CategoryChannel, + VoiceChannel, + TextChannel, } from 'discord.js'; import { time, ChannelType } from 'discord.js'; import { createVerificationVoice } from '#utils/verification'; import { maxVCs, leaveBan } from '#utils/verificationConfig'; -import { getUser, checkFinish, countIncomplete } from '#utils/database/verification'; +import { + getUser, + checkFinish, + countIncomplete, +} from '#utils/database/verification'; import { fetchRoles } from '#utils/database/dbExistingUser'; import { fibonacci } from '#utils/maths'; import IDs from '#utils/ids'; @@ -39,9 +46,10 @@ export class VerificationLeaveVCListener extends Listener { public async run(oldState: VoiceState, newState: VoiceState) { // If the event was not a user joining the channel - if (oldState.channel?.parent?.id !== IDs.categories.verification - || newState.channel?.parent?.id === IDs.categories.verification - || oldState.channel.members.size > 0 + if ( + oldState.channel?.parent?.id !== IDs.categories.verification || + newState.channel?.parent?.id === IDs.categories.verification || + oldState.channel.members.size > 0 ) { return; } @@ -77,32 +85,48 @@ export class VerificationLeaveVCListener extends Listener { const user = guild.members.cache.get(userSnowflake!); // Remove verify as vegan and give non vegan role - if (!await checkFinish(channel.id) && user !== undefined) { + if (!(await checkFinish(channel.id)) && user !== undefined) { // Get roles to give back to the user const roles = await fetchRoles(user.id); roles.push(IDs.roles.verifyBlock); - await user.roles.add(roles) - .catch(() => this.container.logger.error('Verification: User left but bot still tried to add roles')); + await user.roles + .add(roles) + .catch(() => + this.container.logger.error( + 'Verification: User left but bot still tried to add roles', + ), + ); // Create timeout block for user // Counts the recent times they have incomplete verifications - const incompleteCount = await countIncomplete(user.id) % (leaveBan + 1); + const incompleteCount = + (await countIncomplete(user.id)) % (leaveBan + 1); // Creates the length of the time for the ban const banLength = fibonacci(incompleteCount) * 3600_000; - this.container.tasks.create('verifyUnblock', { - userId: user.id, - guildId: guild.id, - }, banLength); + this.container.tasks.create( + 'verifyUnblock', + { + userId: user.id, + guildId: guild.id, + }, + banLength, + ); - await user.user.send('You have been timed out as a verifier had not joined for 15 minutes or you disconnected from verification.\n\n' - + `You can verify again at: ${time(Math.round(Date.now() / 1000) + (banLength / 1000))}`) + await user.user + .send( + 'You have been timed out as a verifier had not joined for 15 minutes or you disconnected from verification.\n\n' + + `You can verify again at: ${time( + Math.round(Date.now() / 1000) + banLength / 1000, + )}`, + ) .catch(() => this.container.logger.error('Verification: Closed DMs')); } } // Check how many voice channels there are - const listVoiceChannels = category.children.cache - .filter((c) => c.type === ChannelType.GuildVoice); + const listVoiceChannels = category.children.cache.filter( + (c) => c.type === ChannelType.GuildVoice, + ); // Check that it is not deleting the 'Verification' channel (in case bot crashes) if (channel.name !== 'Verification') { @@ -113,8 +137,9 @@ export class VerificationLeaveVCListener extends Listener { // Delete text channel if (!verifier) { // Gets a list of all the text channels in the verification category - const listTextChannels = category.children.cache - .filter((c) => c.type === ChannelType.GuildText); + const listTextChannels = category.children.cache.filter( + (c) => c.type === ChannelType.GuildText, + ); listTextChannels.forEach((c) => { const textChannel = c as TextChannel; // Checks if the channel topic has the user's snowflake @@ -138,7 +163,9 @@ export class VerificationLeaveVCListener extends Listener { const verification = listVoiceChannels.last() as VoiceChannel | undefined; if (verification === undefined) { - this.container.logger.error('Verification: Verification channel not found.'); + this.container.logger.error( + 'Verification: Verification channel not found.', + ); return; } diff --git a/src/listeners/verification/start.ts b/src/listeners/verification/start.ts index afe081f..9549c6b 100644 --- a/src/listeners/verification/start.ts +++ b/src/listeners/verification/start.ts @@ -39,11 +39,13 @@ export class VerificationReady extends Listener { public async run(client: Client) { // Get verification category - let category = client.channels.cache - .get(IDs.categories.verification) as CategoryChannel | undefined; + let category = client.channels.cache.get(IDs.categories.verification) as + | CategoryChannel + | undefined; if (category === undefined) { - category = await client.channels - .fetch(IDs.categories.verification) as CategoryChannel | undefined; + category = (await client.channels.fetch(IDs.categories.verification)) as + | CategoryChannel + | undefined; if (category === undefined) { this.container.logger.error('verifyStart: Channel not found'); return; @@ -51,7 +53,9 @@ export class VerificationReady extends Listener { } // Check how many voice channels there are - const voiceChannels = category.children.cache.filter((c) => c.type === ChannelType.GuildVoice); + const voiceChannels = category.children.cache.filter( + (c) => c.type === ChannelType.GuildVoice, + ); const currentVCs: VoiceChannel[] = []; const emptyVC: string[] = []; // Delete voice channels @@ -66,7 +70,9 @@ export class VerificationReady extends Listener { }); // Delete text channels - const textChannels = category.children.cache.filter((c) => c.type === ChannelType.GuildText); + const textChannels = category.children.cache.filter( + (c) => c.type === ChannelType.GuildText, + ); textChannels.forEach((c) => { const textChannel = c as TextChannel; // Checks if the channel topic has the user's snowflake diff --git a/src/listeners/verification/welcome.ts b/src/listeners/verification/welcome.ts index 3413b7a..709c8c8 100644 --- a/src/listeners/verification/welcome.ts +++ b/src/listeners/verification/welcome.ts @@ -20,10 +20,7 @@ import { Listener } from '@sapphire/framework'; import { ButtonStyle, ActionRowBuilder, ButtonBuilder } from 'discord.js'; -import type { - Client, - TextChannel, -} from 'discord.js'; +import type { Client, TextChannel } from 'discord.js'; import IDs from '#utils/ids'; export class VerificationReady extends Listener { @@ -37,9 +34,13 @@ export class VerificationReady extends Listener { public async run(client: Client) { // Get verification category - let welcome = client.channels.cache.get(IDs.channels.welcome) as TextChannel | undefined; + let welcome = client.channels.cache.get(IDs.channels.welcome) as + | TextChannel + | undefined; if (welcome === undefined) { - welcome = await client.channels.fetch(IDs.channels.welcome) as TextChannel | undefined; + welcome = (await client.channels.fetch(IDs.channels.welcome)) as + | TextChannel + | undefined; if (welcome === undefined) { this.container.logger.error('verifyStart: Welcome not found'); return; @@ -50,19 +51,19 @@ export class VerificationReady extends Listener { const messages = await welcome.messages.fetch(); const message = messages.first(); - const content = '**To continue and unlock more channels, please click \'Join\':**' - + '\n\n**Important:** If you want to get the vegan role, you will need to pass voice verification. ' - + 'You can do this by joining the \'Verification\' voice channel after clicking the button below. ' - + 'You\'ll chat with one of our verifiers who will just ask you a few questions before approving your Vegan role. ' - + 'Vegans have access to more channels. Voice discussions may be recorded.'; + const content = + "**To continue and unlock more channels, please click 'Join':**" + + '\n\n**Important:** If you want to get the vegan role, you will need to pass voice verification. ' + + "You can do this by joining the 'Verification' voice channel after clicking the button below. " + + "You'll chat with one of our verifiers who will just ask you a few questions before approving your Vegan role. " + + 'Vegans have access to more channels. Voice discussions may be recorded.'; - const button = new ActionRowBuilder() - .addComponents( - new ButtonBuilder() - .setCustomId('welcomeJoin') - .setLabel('Join') - .setStyle(ButtonStyle.Success), - ); + const button = new ActionRowBuilder().addComponents( + new ButtonBuilder() + .setCustomId('welcomeJoin') + .setLabel('Join') + .setStyle(ButtonStyle.Success), + ); if (message?.author.id !== botId) { await welcome.send({ diff --git a/src/listeners/xp.ts b/src/listeners/xp.ts index 87463b1..b38ecd6 100644 --- a/src/listeners/xp.ts +++ b/src/listeners/xp.ts @@ -37,7 +37,7 @@ export class XpListener extends Listener { return; } - if (!await checkCanAddXp(user.id)) { + if (!(await checkCanAddXp(user.id))) { return; } diff --git a/src/preconditions/CoordinatorOnly.ts b/src/preconditions/CoordinatorOnly.ts index dff9bde..31b37bb 100644 --- a/src/preconditions/CoordinatorOnly.ts +++ b/src/preconditions/CoordinatorOnly.ts @@ -37,7 +37,9 @@ export class CoordinatorOnlyPrecondition extends AllFlowsPrecondition { return this.checkCoordinator(interaction.member! as GuildMember); } - public override async contextMenuRun(interaction: ContextMenuCommandInteraction) { + public override async contextMenuRun( + interaction: ContextMenuCommandInteraction, + ) { // for context menu command return this.checkCoordinator(interaction.member! as GuildMember); } diff --git a/src/preconditions/DevCoordinatorOnly.ts b/src/preconditions/DevCoordinatorOnly.ts index 25138b8..0997c65 100644 --- a/src/preconditions/DevCoordinatorOnly.ts +++ b/src/preconditions/DevCoordinatorOnly.ts @@ -37,7 +37,9 @@ export class DevCoordinatorOnlyPrecondition extends AllFlowsPrecondition { return this.checkDevCoordinator(interaction.member! as GuildMember); } - public override async contextMenuRun(interaction: ContextMenuCommandInteraction) { + public override async contextMenuRun( + interaction: ContextMenuCommandInteraction, + ) { // for context menu command return this.checkDevCoordinator(interaction.member! as GuildMember); } diff --git a/src/preconditions/DiversityCoordinatorOnly.ts b/src/preconditions/DiversityCoordinatorOnly.ts index 5c319f4..31aee2f 100644 --- a/src/preconditions/DiversityCoordinatorOnly.ts +++ b/src/preconditions/DiversityCoordinatorOnly.ts @@ -37,7 +37,9 @@ export class DiversityCoordinatorOnlyPrecondition extends AllFlowsPrecondition { return this.checkDiversityCoordinator(interaction.member! as GuildMember); } - public override async contextMenuRun(interaction: ContextMenuCommandInteraction) { + public override async contextMenuRun( + interaction: ContextMenuCommandInteraction, + ) { // for context menu command return this.checkDiversityCoordinator(interaction.member! as GuildMember); } @@ -45,7 +47,9 @@ export class DiversityCoordinatorOnlyPrecondition extends AllFlowsPrecondition { private async checkDiversityCoordinator(user: GuildMember) { return user.roles.cache.has(IDs.roles.staff.diversityCoordinator) ? this.ok() - : this.error({ message: 'Only diversity coordinators can run this command!' }); + : this.error({ + message: 'Only diversity coordinators can run this command!', + }); } } diff --git a/src/preconditions/EventCoordinatorOnly.ts b/src/preconditions/EventCoordinatorOnly.ts index 7e9914b..2e1df9d 100644 --- a/src/preconditions/EventCoordinatorOnly.ts +++ b/src/preconditions/EventCoordinatorOnly.ts @@ -37,7 +37,9 @@ export class EventCoordinatorOnlyPrecondition extends AllFlowsPrecondition { return this.checkEventCoordinator(interaction.member! as GuildMember); } - public override async contextMenuRun(interaction: ContextMenuCommandInteraction) { + public override async contextMenuRun( + interaction: ContextMenuCommandInteraction, + ) { // for context menu command return this.checkEventCoordinator(interaction.member! as GuildMember); } @@ -45,7 +47,9 @@ export class EventCoordinatorOnlyPrecondition extends AllFlowsPrecondition { private async checkEventCoordinator(user: GuildMember) { return user.roles.cache.has(IDs.roles.staff.eventCoordinator) ? this.ok() - : this.error({ message: 'Only event coordinators can run this command!' }); + : this.error({ + message: 'Only event coordinators can run this command!', + }); } } diff --git a/src/preconditions/MentorCoordinatorOnly.ts b/src/preconditions/MentorCoordinatorOnly.ts index 7e0eafd..18767c4 100644 --- a/src/preconditions/MentorCoordinatorOnly.ts +++ b/src/preconditions/MentorCoordinatorOnly.ts @@ -37,7 +37,9 @@ export class MentorCoordinatorOnlyPrecondition extends AllFlowsPrecondition { return this.checkMentorCoordinator(interaction.member! as GuildMember); } - public override async contextMenuRun(interaction: ContextMenuCommandInteraction) { + public override async contextMenuRun( + interaction: ContextMenuCommandInteraction, + ) { // for context menu command return this.checkMentorCoordinator(interaction.member! as GuildMember); } @@ -45,7 +47,9 @@ export class MentorCoordinatorOnlyPrecondition extends AllFlowsPrecondition { private async checkMentorCoordinator(user: GuildMember) { return user.roles.cache.has(IDs.roles.staff.mentorCoordinator) ? this.ok() - : this.error({ message: 'Only mentor coordinators can run this command!' }); + : this.error({ + message: 'Only mentor coordinators can run this command!', + }); } } diff --git a/src/preconditions/MentorOnly.ts b/src/preconditions/MentorOnly.ts index a439f3e..79f830a 100644 --- a/src/preconditions/MentorOnly.ts +++ b/src/preconditions/MentorOnly.ts @@ -37,7 +37,9 @@ export class MentorOnlyPrecondition extends AllFlowsPrecondition { return this.checkMentor(interaction.member! as GuildMember); } - public override async contextMenuRun(interaction: ContextMenuCommandInteraction) { + public override async contextMenuRun( + interaction: ContextMenuCommandInteraction, + ) { // for context menu command return this.checkMentor(interaction.member! as GuildMember); } diff --git a/src/preconditions/ModCoordinatorOnly.ts b/src/preconditions/ModCoordinatorOnly.ts index f7ac4dd..c17c8dd 100644 --- a/src/preconditions/ModCoordinatorOnly.ts +++ b/src/preconditions/ModCoordinatorOnly.ts @@ -37,7 +37,9 @@ export class ModCoordinatorOnlyPrecondition extends AllFlowsPrecondition { return this.checkModCoordinator(interaction.member! as GuildMember); } - public override async contextMenuRun(interaction: ContextMenuCommandInteraction) { + public override async contextMenuRun( + interaction: ContextMenuCommandInteraction, + ) { // for context menu command return this.checkModCoordinator(interaction.member! as GuildMember); } diff --git a/src/preconditions/ModOnly.ts b/src/preconditions/ModOnly.ts index 4ed0e7a..e952cc5 100644 --- a/src/preconditions/ModOnly.ts +++ b/src/preconditions/ModOnly.ts @@ -37,14 +37,16 @@ export class ModOnlyPrecondition extends AllFlowsPrecondition { return this.checkMod(interaction.member! as GuildMember); } - public override async contextMenuRun(interaction: ContextMenuCommandInteraction) { + public override async contextMenuRun( + interaction: ContextMenuCommandInteraction, + ) { // for context menu command return this.checkMod(interaction.member! as GuildMember); } private async checkMod(user: GuildMember) { - return user.roles.cache.has(IDs.roles.staff.moderator) - || user.roles.cache.has(IDs.roles.staff.trialModerator) + return user.roles.cache.has(IDs.roles.staff.moderator) || + user.roles.cache.has(IDs.roles.staff.trialModerator) ? this.ok() : this.error({ message: 'Only moderators can run this command!' }); } diff --git a/src/preconditions/PatreonOnly.ts b/src/preconditions/PatreonOnly.ts index 0e57a8d..892a771 100644 --- a/src/preconditions/PatreonOnly.ts +++ b/src/preconditions/PatreonOnly.ts @@ -37,13 +37,16 @@ export class PatreonOnlyPrecondition extends AllFlowsPrecondition { return this.checkPatreon(interaction.member! as GuildMember); } - public override async contextMenuRun(interaction: ContextMenuCommandInteraction) { + public override async contextMenuRun( + interaction: ContextMenuCommandInteraction, + ) { // for context menu command return this.checkPatreon(interaction.member! as GuildMember); } private async checkPatreon(user: GuildMember) { - return user.roles.cache.has(IDs.roles.patron) || user.roles.cache.has(IDs.roles.patreon) + return user.roles.cache.has(IDs.roles.patron) || + user.roles.cache.has(IDs.roles.patreon) ? this.ok() : this.error({ message: 'Only Patreon members can run this command!' }); } diff --git a/src/preconditions/RestrictedAccessOnly.ts b/src/preconditions/RestrictedAccessOnly.ts index 0fbfb32..40cf956 100644 --- a/src/preconditions/RestrictedAccessOnly.ts +++ b/src/preconditions/RestrictedAccessOnly.ts @@ -37,7 +37,9 @@ export class RestrictedAccessOnlyPrecondition extends AllFlowsPrecondition { return this.checkRestrictedAccess(interaction.member! as GuildMember); } - public override async contextMenuRun(interaction: ContextMenuCommandInteraction) { + public override async contextMenuRun( + interaction: ContextMenuCommandInteraction, + ) { // for context menu command return this.checkRestrictedAccess(interaction.member! as GuildMember); } diff --git a/src/preconditions/VerifierCoordinatorOnly.ts b/src/preconditions/VerifierCoordinatorOnly.ts index bf628bf..6618162 100644 --- a/src/preconditions/VerifierCoordinatorOnly.ts +++ b/src/preconditions/VerifierCoordinatorOnly.ts @@ -37,7 +37,9 @@ export class VerifierCoordinatorOnlyPrecondition extends AllFlowsPrecondition { return this.checkVerifierCoordinator(interaction.member! as GuildMember); } - public override async contextMenuRun(interaction: ContextMenuCommandInteraction) { + public override async contextMenuRun( + interaction: ContextMenuCommandInteraction, + ) { // for context menu command return this.checkVerifierCoordinator(interaction.member! as GuildMember); } @@ -45,7 +47,9 @@ export class VerifierCoordinatorOnlyPrecondition extends AllFlowsPrecondition { private async checkVerifierCoordinator(user: GuildMember) { return user.roles.cache.has(IDs.roles.staff.verifierCoordinator) ? this.ok() - : this.error({ message: 'Only verifier coordinators can run this command!' }); + : this.error({ + message: 'Only verifier coordinators can run this command!', + }); } } diff --git a/src/preconditions/VerifierOnly.ts b/src/preconditions/VerifierOnly.ts index b2fef0f..b7957c0 100644 --- a/src/preconditions/VerifierOnly.ts +++ b/src/preconditions/VerifierOnly.ts @@ -37,7 +37,9 @@ export class VerifierOnlyPrecondition extends AllFlowsPrecondition { return this.checkVerifier(interaction.member! as GuildMember); } - public override async contextMenuRun(interaction: ContextMenuCommandInteraction) { + public override async contextMenuRun( + interaction: ContextMenuCommandInteraction, + ) { // for context menu command return this.checkVerifier(interaction.member! as GuildMember); } diff --git a/src/scheduled-tasks/messages/diversityMon.ts b/src/scheduled-tasks/messages/diversityMon.ts index 53e0c8b..6709eff 100644 --- a/src/scheduled-tasks/messages/diversityMon.ts +++ b/src/scheduled-tasks/messages/diversityMon.ts @@ -23,7 +23,10 @@ import type { TextChannel } from 'discord.js'; import IDs from '#utils/ids'; export class DiversityMonMessageTask extends ScheduledTask { - public constructor(context: ScheduledTask.Context, options: ScheduledTask.Options) { + public constructor( + context: ScheduledTask.Context, + options: ScheduledTask.Options, + ) { super(context, { ...options, pattern: '0 15 * * 1', @@ -33,18 +36,23 @@ export class DiversityMonMessageTask extends ScheduledTask { public async run() { const { client } = container; - const message = '**๐Ÿ“Œ Diversity Section Code of Conduct**\n\n' - + 'โค๏ธ Be *Kind*\n' - + '๐Ÿงก Make sure your communication invites others for discourse, not debate.\n' - + '๐Ÿ’› Avoid slurs which otherize individuals or groups - safe space vibes please! <:blobheart:820513749893906543>\n' - + '๐Ÿ’š When engaging in discourse, acknowledge others participating and actively ask questions in a charitable manner and avoid assumptions about what someone is saying about the topic.\n' - + '๐Ÿ’™ Avoid spreading misinformation.\n' - + '๐Ÿ’œ Be sincere when interacting with others, socially and in serious discourse.\n' - + 'โค๏ธ Respect the creativity of others.\n' - + '๐Ÿงก Actively seek to include others, especially moderators, in heated discourse for the purpose of de-escalation.'; + const message = + '**๐Ÿ“Œ Diversity Section Code of Conduct**\n\n' + + 'โค๏ธ Be *Kind*\n' + + '๐Ÿงก Make sure your communication invites others for discourse, not debate.\n' + + '๐Ÿ’› Avoid slurs which otherize individuals or groups - safe space vibes please! <:blobheart:820513749893906543>\n' + + '๐Ÿ’š When engaging in discourse, acknowledge others participating and actively ask questions in a charitable manner and avoid assumptions about what someone is saying about the topic.\n' + + '๐Ÿ’™ Avoid spreading misinformation.\n' + + '๐Ÿ’œ Be sincere when interacting with others, socially and in serious discourse.\n' + + 'โค๏ธ Respect the creativity of others.\n' + + '๐Ÿงก Actively seek to include others, especially moderators, in heated discourse for the purpose of de-escalation.'; - const lgbtqia = client.channels.cache.get(IDs.channels.diversity.lgbtqia) as TextChannel; - const potgm = client.channels.cache.get(IDs.channels.diversity.potgm) as TextChannel; + const lgbtqia = client.channels.cache.get( + IDs.channels.diversity.lgbtqia, + ) as TextChannel; + const potgm = client.channels.cache.get( + IDs.channels.diversity.potgm, + ) as TextChannel; await lgbtqia.send(message); await potgm.send(message); diff --git a/src/scheduled-tasks/messages/diversityWed.ts b/src/scheduled-tasks/messages/diversityWed.ts index f40ee0b..fe7f7c2 100644 --- a/src/scheduled-tasks/messages/diversityWed.ts +++ b/src/scheduled-tasks/messages/diversityWed.ts @@ -23,7 +23,10 @@ import type { TextChannel } from 'discord.js'; import IDs from '#utils/ids'; export class DiversityWedMessageTask extends ScheduledTask { - public constructor(context: ScheduledTask.Context, options: ScheduledTask.Options) { + public constructor( + context: ScheduledTask.Context, + options: ScheduledTask.Options, + ) { super(context, { ...options, pattern: '0 15 * * 3', @@ -33,19 +36,23 @@ export class DiversityWedMessageTask extends ScheduledTask { public async run() { const { client } = container; - const message = '**๐Ÿ“Œ Diversity Section Code of Conduct**\n\n' - + 'โค๏ธ Be *Kind*\n' - + '๐Ÿงก Make sure your communication invites others for discourse, not debate.\n' - + '๐Ÿ’› Avoid slurs which otherize individuals or groups - safe space vibes please! <:blobheart:820513749893906543>\n' - + '๐Ÿ’š When engaging in discourse, acknowledge others participating and actively ask questions in a charitable manner and avoid assumptions about what someone is saying about the topic.\n' - + '๐Ÿ’™ Avoid spreading misinformation.\n' - + '๐Ÿ’œ Be sincere when interacting with others, socially and in serious discourse.\n' - + 'โค๏ธ Respect the creativity of others.\n' - + '๐Ÿงก Actively seek to include others, especially moderators, in heated discourse for the purpose of de-escalation.'; + const message = + '**๐Ÿ“Œ Diversity Section Code of Conduct**\n\n' + + 'โค๏ธ Be *Kind*\n' + + '๐Ÿงก Make sure your communication invites others for discourse, not debate.\n' + + '๐Ÿ’› Avoid slurs which otherize individuals or groups - safe space vibes please! <:blobheart:820513749893906543>\n' + + '๐Ÿ’š When engaging in discourse, acknowledge others participating and actively ask questions in a charitable manner and avoid assumptions about what someone is saying about the topic.\n' + + '๐Ÿ’™ Avoid spreading misinformation.\n' + + '๐Ÿ’œ Be sincere when interacting with others, socially and in serious discourse.\n' + + 'โค๏ธ Respect the creativity of others.\n' + + '๐Ÿงก Actively seek to include others, especially moderators, in heated discourse for the purpose of de-escalation.'; - const women = client.channels.cache.get(IDs.channels.diversity.women) as TextChannel; - const disabilities = client.channels.cache - .get(IDs.channels.diversity.disabilities) as TextChannel; + const women = client.channels.cache.get( + IDs.channels.diversity.women, + ) as TextChannel; + const disabilities = client.channels.cache.get( + IDs.channels.diversity.disabilities, + ) as TextChannel; await women.send(message); await disabilities.send(message); diff --git a/src/scheduled-tasks/messages/restrictedMessage.ts b/src/scheduled-tasks/messages/restrictedMessage.ts index d24f1a0..a7c8c6c 100644 --- a/src/scheduled-tasks/messages/restrictedMessage.ts +++ b/src/scheduled-tasks/messages/restrictedMessage.ts @@ -23,7 +23,10 @@ import type { TextChannel } from 'discord.js'; import IDs from '#utils/ids'; export class RestrictedMessageTask extends ScheduledTask { - public constructor(context: ScheduledTask.Context, options: ScheduledTask.Options) { + public constructor( + context: ScheduledTask.Context, + options: ScheduledTask.Options, + ) { super(context, { ...options, pattern: '0 17 * * *', @@ -33,17 +36,23 @@ export class RestrictedMessageTask extends ScheduledTask { public async run() { const { client } = container; - const restricted = client.channels.cache.get(IDs.channels.restricted.restricted) as TextChannel; - const tolerance = client.channels.cache.get(IDs.channels.restricted.tolerance) as TextChannel; + const restricted = client.channels.cache.get( + IDs.channels.restricted.restricted, + ) as TextChannel; + const tolerance = client.channels.cache.get( + IDs.channels.restricted.tolerance, + ) as TextChannel; await restricted.send(this.message(IDs.roles.restrictions.restricted1)); await tolerance.send(this.message(IDs.roles.restrictions.restricted3)); } private message(id: string) { - return `Hi <@&${id}>, just a friendly reminder that you can reach out to <@575252669443211264> ` - + 'to attempt to clear up the issue that lead to your restriction and rejoin the server.' - + '\n\nJust let us know what got you restricted and why youโ€™d like to avoid repeating that behaviour and weโ€™ll try to sort it out.'; + return ( + `Hi <@&${id}>, just a friendly reminder that you can reach out to <@575252669443211264> ` + + 'to attempt to clear up the issue that lead to your restriction and rejoin the server.' + + '\n\nJust let us know what got you restricted and why youโ€™d like to avoid repeating that behaviour and weโ€™ll try to sort it out.' + ); } } diff --git a/src/scheduled-tasks/messages/standup.ts b/src/scheduled-tasks/messages/standup.ts index 6731464..a577c38 100644 --- a/src/scheduled-tasks/messages/standup.ts +++ b/src/scheduled-tasks/messages/standup.ts @@ -23,7 +23,10 @@ import type { TextChannel } from 'discord.js'; import IDs from '#utils/ids'; export class StandupTask extends ScheduledTask { - public constructor(context: ScheduledTask.Context, options: ScheduledTask.Options) { + public constructor( + context: ScheduledTask.Context, + options: ScheduledTask.Options, + ) { super(context, { ...options, pattern: '0 12 * * 1', @@ -33,7 +36,9 @@ export class StandupTask extends ScheduledTask { public async run() { const { client } = container; - const channel = client.channels.cache.get(IDs.channels.staff.coordinators) as TextChannel; + const channel = client.channels.cache.get( + IDs.channels.staff.coordinators, + ) as TextChannel; await channel.send(`Hiya <@&${IDs.roles.staff.coordinator}> it's time for your weekly standup! \nPlease submit it in <#${IDs.channels.staff.standup}> :)`); diff --git a/src/scheduled-tasks/messages/verifyReminder.ts b/src/scheduled-tasks/messages/verifyReminder.ts index 88a3cf7..4e2943a 100644 --- a/src/scheduled-tasks/messages/verifyReminder.ts +++ b/src/scheduled-tasks/messages/verifyReminder.ts @@ -23,7 +23,10 @@ import type { TextChannel } from 'discord.js'; import IDs from '#utils/ids'; export class VerifyReminder extends ScheduledTask { - public constructor(context: ScheduledTask.Context, options: ScheduledTask.Options) { + public constructor( + context: ScheduledTask.Context, + options: ScheduledTask.Options, + ) { super(context, { ...options, pattern: '0 */1 * * *', @@ -42,11 +45,15 @@ export class VerifyReminder extends ScheduledTask { if (!messageCount || +messageCount < 100) return; // Send verification reminder to non-vegan general - const channel = client.channels.cache.get(IDs.channels.nonVegan.general) as TextChannel; + const channel = client.channels.cache.get( + IDs.channels.nonVegan.general, + ) as TextChannel; - await channel.send('If you want to have the vegan or activist role, you\'ll need to do a voice verification. ' - + 'To do this, hop into the \'Verification\' voice channel.' - + '\n\nIf there aren\'t any verifiers available, you\'ll be disconnected, and you can rejoin later.'); + await channel.send( + "If you want to have the vegan or activist role, you'll need to do a voice verification. " + + "To do this, hop into the 'Verification' voice channel." + + "\n\nIf there aren't any verifiers available, you'll be disconnected, and you can rejoin later.", + ); // Reset the total message counter to 0 await this.container.redis.set(redisKey, 0); diff --git a/src/scheduled-tasks/tempBan.ts b/src/scheduled-tasks/tempBan.ts index 52927f2..709261b 100644 --- a/src/scheduled-tasks/tempBan.ts +++ b/src/scheduled-tasks/tempBan.ts @@ -19,19 +19,19 @@ import { ScheduledTask } from '@sapphire/plugin-scheduled-tasks'; import IDs from '#utils/ids'; -import { - TextChannel, - EmbedBuilder, -} from 'discord.js'; +import { TextChannel, EmbedBuilder } from 'discord.js'; import { checkBan } from '#utils/database/ban'; import { checkTempBan, removeTempBan } from '#utils/database/tempBan'; export class TempBan extends ScheduledTask { - public constructor(context: ScheduledTask.Context, options: ScheduledTask.Options) { + public constructor( + context: ScheduledTask.Context, + options: ScheduledTask.Options, + ) { super(context, options); } - public async run(payload: { userId: string, guildId: string }) { + public async run(payload: { userId: string; guildId: string }) { this.container.logger.debug('Temp Unban Task: Currently running unban'); // Get the guild where the user is in let guild = this.container.client.guilds.cache.get(payload.guildId); @@ -50,42 +50,49 @@ export class TempBan extends ScheduledTask { if (user === undefined) { user = await guild.client.users.fetch(userId); if (user === undefined) { - this.container.logger.error('Temp Unban Task: Could not fetch banned user!'); + this.container.logger.error( + 'Temp Unban Task: Could not fetch banned user!', + ); return; } } - if (await checkBan(userId) - || !await checkTempBan(userId)) { - this.container.logger.debug('Temp Unban Task: User is either permanently banned or no longer temporarily banned.'); + if ((await checkBan(userId)) || !(await checkTempBan(userId))) { + this.container.logger.debug( + 'Temp Unban Task: User is either permanently banned or no longer temporarily banned.', + ); return; } // Unban the user - await guild.members.unban(user) - .catch(() => {}); + await guild.members.unban(user).catch(() => {}); await removeTempBan(userId); // Log unban - let logChannel = guild.channels.cache - .get(IDs.channels.logs.restricted) as TextChannel | undefined; + let logChannel = guild.channels.cache.get(IDs.channels.logs.restricted) as + | TextChannel + | undefined; if (logChannel === undefined) { - logChannel = await guild.channels - .fetch(IDs.channels.logs.restricted) as TextChannel | undefined; + logChannel = (await guild.channels.fetch( + IDs.channels.logs.restricted, + )) as TextChannel | undefined; if (logChannel === undefined) { - this.container.logger.error(`Temp Ban Listener: Could not fetch log channel. User Snowflake: ${userId}`); + this.container.logger.error( + `Temp Ban Listener: Could not fetch log channel. User Snowflake: ${userId}`, + ); return; } } const log = new EmbedBuilder() .setColor('#28A745') - .setAuthor({ name: `Unbanned ${user.tag} (tempban)`, iconURL: `${user.displayAvatarURL()}` }) - .addFields( - { name: 'User', value: `${user}`, inline: true }, - ) + .setAuthor({ + name: `Unbanned ${user.tag} (tempban)`, + iconURL: `${user.displayAvatarURL()}`, + }) + .addFields({ name: 'User', value: `${user}`, inline: true }) .setTimestamp() .setFooter({ text: `ID: ${user.id}` }); diff --git a/src/scheduled-tasks/verifyTimeout.ts b/src/scheduled-tasks/verifyTimeout.ts index a0bd253..df3ea9d 100644 --- a/src/scheduled-tasks/verifyTimeout.ts +++ b/src/scheduled-tasks/verifyTimeout.ts @@ -21,17 +21,22 @@ import type { VoiceChannel } from 'discord.js'; import { ScheduledTask } from '@sapphire/plugin-scheduled-tasks'; export class VerifyTimeout extends ScheduledTask { - public constructor(context: ScheduledTask.Context, options: ScheduledTask.Options) { + public constructor( + context: ScheduledTask.Context, + options: ScheduledTask.Options, + ) { super(context, options); } - public async run(payload: { channelId: string, userId: string }) { + public async run(payload: { channelId: string; userId: string }) { // Get the guild where the user is in - let channel = this.container.client.channels.cache - .get(payload.channelId) as VoiceChannel | undefined; + let channel = this.container.client.channels.cache.get( + payload.channelId, + ) as VoiceChannel | undefined; if (channel === undefined) { - channel = await this.container.client.channels - .fetch(payload.channelId) as VoiceChannel | undefined; + channel = (await this.container.client.channels.fetch( + payload.channelId, + )) as VoiceChannel | undefined; if (channel === undefined) { this.container.logger.error('verifyTimeout: Channel not found!'); return; diff --git a/src/scheduled-tasks/verifyUnblock.ts b/src/scheduled-tasks/verifyUnblock.ts index 9730a45..92a118d 100644 --- a/src/scheduled-tasks/verifyUnblock.ts +++ b/src/scheduled-tasks/verifyUnblock.ts @@ -21,11 +21,14 @@ import { ScheduledTask } from '@sapphire/plugin-scheduled-tasks'; import IDs from '#utils/ids'; export class VerifyUnblock extends ScheduledTask { - public constructor(context: ScheduledTask.Context, options: ScheduledTask.Options) { + public constructor( + context: ScheduledTask.Context, + options: ScheduledTask.Options, + ) { super(context, options); } - public async run(payload: { userId: string, guildId: string }) { + public async run(payload: { userId: string; guildId: string }) { // Get the guild where the user is in let guild = this.container.client.guilds.cache.get(payload.guildId); if (guild === undefined) { @@ -39,8 +42,7 @@ export class VerifyUnblock extends ScheduledTask { // Find GuildMember for the user let user = guild.members.cache.get(payload.userId); if (user === undefined) { - user = await guild.members.fetch(payload.userId) - .catch(undefined); + user = await guild.members.fetch(payload.userId).catch(undefined); if (user === undefined) { this.container.logger.error('verifyUnblock: GuildMember not found!'); return; diff --git a/src/utils/checker.ts b/src/utils/checker.ts index 0ea8045..e0e1dc2 100644 --- a/src/utils/checker.ts +++ b/src/utils/checker.ts @@ -32,6 +32,8 @@ export function checkStaff(channel: TextChannel) { return false; } - return channel.parent.id === IDs.categories.staff - || channel.parent.id === IDs.categories.modMail; + return ( + channel.parent.id === IDs.categories.staff || + channel.parent.id === IDs.categories.modMail + ); } diff --git a/src/utils/database/dbExistingUser.ts b/src/utils/database/dbExistingUser.ts index 36e2627..1c22298 100644 --- a/src/utils/database/dbExistingUser.ts +++ b/src/utils/database/dbExistingUser.ts @@ -17,7 +17,11 @@ along with this program. If not, see . */ -import type { GuildMember, GuildMemberRoleManager, Snowflake } from 'discord.js'; +import type { + GuildMember, + GuildMemberRoleManager, + Snowflake, +} from 'discord.js'; import { container } from '@sapphire/framework'; import IDs from '#utils/ids'; diff --git a/src/utils/database/outreach.ts b/src/utils/database/outreach.ts index 376c589..4708dc8 100644 --- a/src/utils/database/outreach.ts +++ b/src/utils/database/outreach.ts @@ -81,7 +81,11 @@ export async function addStatUser(statId: number, userId: Snowflake) { }); } -export async function createStat(eventId: number, leaderId: Snowflake, roleId: Snowflake) { +export async function createStat( + eventId: number, + leaderId: Snowflake, + roleId: Snowflake, +) { await container.database.stat.create({ data: { event: { @@ -115,12 +119,12 @@ export async function createStat(eventId: number, leaderId: Snowflake, roleId: S export async function updateStats( statId: number, stats: { - vegan: number, - considered: number, - antiVegan: number, - thanked: number, - documentary: number, - educated: number, + vegan: number; + considered: number; + antiVegan: number; + thanked: number; + documentary: number; + educated: number; }, ) { await container.database.stat.update({ @@ -221,11 +225,9 @@ export async function createTypes() { } export async function setupTypes() { - const types = [ - 'Discord Outreach', - ]; + const types = ['Discord Outreach']; - if (types.length === await countTypes()) { + if (types.length === (await countTypes())) { return; } diff --git a/src/utils/database/restriction.ts b/src/utils/database/restriction.ts index b50aeea..837641b 100644 --- a/src/utils/database/restriction.ts +++ b/src/utils/database/restriction.ts @@ -112,7 +112,11 @@ export async function getSection(userId: Snowflake) { } // This is only for restrictions created with the old bot -export async function unRestrictLegacy(userId: Snowflake, modId: Snowflake, section: number) { +export async function unRestrictLegacy( + userId: Snowflake, + modId: Snowflake, + section: number, +) { await container.database.restrict.create({ data: { user: { @@ -130,7 +134,8 @@ export async function unRestrictLegacy(userId: Snowflake, modId: Snowflake, sect id: modId, }, }, - reason: 'This user was restricted with the old bot. Restrict reason, time and mod unknown, check old bot logs.', + reason: + 'This user was restricted with the old bot. Restrict reason, time and mod unknown, check old bot logs.', section, endTime: new Date(), }, diff --git a/src/utils/database/sus.ts b/src/utils/database/sus.ts index c6d3e92..528d6a0 100644 --- a/src/utils/database/sus.ts +++ b/src/utils/database/sus.ts @@ -1,6 +1,10 @@ import { container } from '@sapphire/framework'; -export async function addToDatabase(userId: string, modId: string, message: string) { +export async function addToDatabase( + userId: string, + modId: string, + message: string, +) { // Add the user to the database await container.database.sus.create({ data: { @@ -27,10 +31,9 @@ export async function findNotes(userId: string, active: boolean) { userId, active, }, - orderBy: - { - id: 'asc', - }, + orderBy: { + id: 'asc', + }, }); return note; diff --git a/src/utils/database/vcMute.ts b/src/utils/database/vcMute.ts index e57e63b..a6d62a4 100644 --- a/src/utils/database/vcMute.ts +++ b/src/utils/database/vcMute.ts @@ -1,7 +1,11 @@ import { container } from '@sapphire/framework'; import type { Snowflake } from 'discord.js'; -export async function addMute(userId: Snowflake, modId: Snowflake, reason: string | null) { +export async function addMute( + userId: Snowflake, + modId: Snowflake, + reason: string | null, +) { // Add the user to the database await container.database.vCMute.create({ data: { diff --git a/src/utils/database/verification.ts b/src/utils/database/verification.ts index 61d7dfc..72bb9df 100644 --- a/src/utils/database/verification.ts +++ b/src/utils/database/verification.ts @@ -28,12 +28,12 @@ export async function manualVerification( member: GuildMember, verifier: GuildMember, roles: { - vegan: boolean, - activist: boolean, - araVegan: boolean, - trusted: boolean, - vegCurious: boolean, - convinced: boolean + vegan: boolean; + activist: boolean; + araVegan: boolean; + trusted: boolean; + vegCurious: boolean; + convinced: boolean; }, ) { await updateUser(member); @@ -64,7 +64,10 @@ export async function manualVerification( }); } -export async function joinVerification(channelId: Snowflake, member: GuildMember) { +export async function joinVerification( + channelId: Snowflake, + member: GuildMember, +) { // Update the user on the database with the current roles they have await updateUser(member); @@ -115,23 +118,24 @@ export async function finishVerification( channelId: Snowflake, verifierId: Snowflake, info: { - page: number, + page: number; find: { - reason: number, - where: number - }, - length: number, - reasoning: number, - life: number, - food: number, + reason: number; + where: number; + }; + length: number; + reasoning: number; + life: number; + food: number; roles: { - vegan: boolean, - activist: boolean, - araVegan: boolean, - trusted: boolean, - vegCurious: boolean, - convinced: boolean - } }, + vegan: boolean; + activist: boolean; + araVegan: boolean; + trusted: boolean; + vegCurious: boolean; + convinced: boolean; + }; + }, ) { // TODO potentially add an incomplete tracker? await container.database.verify.update({ @@ -220,14 +224,17 @@ export async function blockTime(userId: Snowflake) { return 0; } const timeOff = new Date().getTime() - verification.finishTime.getTime(); - return ((verification.vegan || verification.convinced) ? 604800000 : 1814400000) - timeOff; + return ( + (verification.vegan || verification.convinced ? 604800000 : 1814400000) - + timeOff + ); } // Timeouts - const count = await countIncomplete(verification.userId) % (leaveBan + 1); + const count = (await countIncomplete(verification.userId)) % (leaveBan + 1); const timeOff = new Date().getTime() - verification.joinTime.getTime(); // Creates the length of the time for the ban - return (fibonacci(count) * 3600_000) - timeOff; + return fibonacci(count) * 3600_000 - timeOff; } // Checks if the last verification was completed diff --git a/src/utils/database/warnings.ts b/src/utils/database/warnings.ts index ee2b1b0..ca13e47 100644 --- a/src/utils/database/warnings.ts +++ b/src/utils/database/warnings.ts @@ -1,7 +1,11 @@ import { container } from '@sapphire/framework'; import type { Snowflake } from 'discord.js'; -export async function addWarn(userId: Snowflake, modId: Snowflake, message: string) { +export async function addWarn( + userId: Snowflake, + modId: Snowflake, + message: string, +) { await container.database.warning.create({ data: { user: { diff --git a/src/utils/database/xp.ts b/src/utils/database/xp.ts index 5310f48..45fcf0e 100644 --- a/src/utils/database/xp.ts +++ b/src/utils/database/xp.ts @@ -3,7 +3,7 @@ import { Time } from '@sapphire/time-utilities'; import type { Snowflake } from 'discord.js'; export function xpToNextLevel(level: number, xp: number) { - return 5 * (level * level) + (50 * level) + 100 - xp; + return 5 * (level * level) + 50 * level + 100 - xp; } export async function getUser(userId: Snowflake) { diff --git a/src/utils/logging/role.ts b/src/utils/logging/role.ts index b102e2b..b4353a4 100644 --- a/src/utils/logging/role.ts +++ b/src/utils/logging/role.ts @@ -5,7 +5,7 @@ export async function roleLog( userId: Snowflake, modId: Snowflake, role: Role, - staffRole : boolean, + staffRole: boolean, add: boolean, ) { await container.database.roleLog.create({ diff --git a/src/utils/verification.ts b/src/utils/verification.ts index 818c23a..faa2a34 100644 --- a/src/utils/verification.ts +++ b/src/utils/verification.ts @@ -47,23 +47,31 @@ export async function createVerificationText( permissionOverwrites: [ { id: guild.roles.everyone, - deny: [PermissionsBitField.Flags.SendMessages, - PermissionsBitField.Flags.ViewChannel], + deny: [ + PermissionsBitField.Flags.SendMessages, + PermissionsBitField.Flags.ViewChannel, + ], }, { id: IDs.roles.verifyBlock, - deny: [PermissionsBitField.Flags.SendMessages, - PermissionsBitField.Flags.ViewChannel], + deny: [ + PermissionsBitField.Flags.SendMessages, + PermissionsBitField.Flags.ViewChannel, + ], }, { id: IDs.roles.staff.verifier, - allow: [PermissionsBitField.Flags.SendMessages, - PermissionsBitField.Flags.ViewChannel], + allow: [ + PermissionsBitField.Flags.SendMessages, + PermissionsBitField.Flags.ViewChannel, + ], }, { id: IDs.roles.staff.trialVerifier, - allow: [PermissionsBitField.Flags.SendMessages, - PermissionsBitField.Flags.ViewChannel], + allow: [ + PermissionsBitField.Flags.SendMessages, + PermissionsBitField.Flags.ViewChannel, + ], }, ], }); @@ -84,15 +92,19 @@ export async function createVerificationVoice( permissionOverwrites: [ { id: guild.roles.everyone, - deny: [PermissionsBitField.Flags.SendMessages, + deny: [ + PermissionsBitField.Flags.SendMessages, PermissionsBitField.Flags.ViewChannel, - PermissionsBitField.Flags.Stream], + PermissionsBitField.Flags.Stream, + ], }, { id: IDs.roles.verifyBlock, - deny: [PermissionsBitField.Flags.ViewChannel, + deny: [ + PermissionsBitField.Flags.ViewChannel, PermissionsBitField.Flags.Connect, - PermissionsBitField.Flags.SendMessages], + PermissionsBitField.Flags.SendMessages, + ], }, { id: IDs.roles.nonvegan.nonvegan, @@ -104,41 +116,51 @@ export async function createVerificationVoice( }, { id: IDs.roles.vegan.activist, - deny: [PermissionsBitField.Flags.ViewChannel, - PermissionsBitField.Flags.Connect], + deny: [ + PermissionsBitField.Flags.ViewChannel, + PermissionsBitField.Flags.Connect, + ], }, { id: IDs.roles.staff.verifier, - allow: [PermissionsBitField.Flags.SendMessages, + allow: [ + PermissionsBitField.Flags.SendMessages, PermissionsBitField.Flags.ViewChannel, PermissionsBitField.Flags.Connect, - PermissionsBitField.Flags.MuteMembers], + PermissionsBitField.Flags.MuteMembers, + ], }, { id: IDs.roles.staff.trialVerifier, - allow: [PermissionsBitField.Flags.SendMessages, + allow: [ + PermissionsBitField.Flags.SendMessages, PermissionsBitField.Flags.ViewChannel, PermissionsBitField.Flags.Connect, - PermissionsBitField.Flags.MuteMembers], + PermissionsBitField.Flags.MuteMembers, + ], }, ], }); if (full) { - await channel.permissionOverwrites.edit(IDs.roles.nonvegan.nonvegan, { Connect: false }); - await channel.permissionOverwrites.edit(IDs.roles.vegan.vegan, { Connect: false }); + await channel.permissionOverwrites.edit(IDs.roles.nonvegan.nonvegan, { + Connect: false, + }); + await channel.permissionOverwrites.edit(IDs.roles.vegan.vegan, { + Connect: false, + }); } } export async function giveVerificationRoles( member: GuildMember, roles: { - vegan: boolean, - activist: boolean, - araVegan: boolean - trusted: boolean, - vegCurious: boolean, - convinced: boolean + vegan: boolean; + activist: boolean; + araVegan: boolean; + trusted: boolean; + vegCurious: boolean; + convinced: boolean; }, manual: boolean = false, ) { @@ -170,27 +192,39 @@ export async function giveVerificationRoles( } // Messages after verifying the user -export async function finishDM(user: User, roles: { - vegan: boolean, - activist: boolean, - araVegan: boolean, - trusted: boolean, - vegCurious: boolean, - convinced: boolean -}) { +export async function finishDM( + user: User, + roles: { + vegan: boolean; + activist: boolean; + araVegan: boolean; + trusted: boolean; + vegCurious: boolean; + convinced: boolean; + }, +) { if (!roles.vegan && !roles.convinced) { - const message = 'You\'ve been verified as non-vegan!' - + `\n\nYou can next verify on ${time(Math.round(Date.now() / 1000) + 1814400)}`; + const message = + "You've been verified as non-vegan!" + + `\n\nYou can next verify on ${time( + Math.round(Date.now() / 1000) + 1814400, + )}`; await user.send(message); } else if (roles.convinced) { - const message = 'You\'ve been verified as convinced!' - + `\n\nYou can next verify on ${time(Math.round(Date.now() / 1000) + 604800)}`; + const message = + "You've been verified as convinced!" + + `\n\nYou can next verify on ${time( + Math.round(Date.now() / 1000) + 604800, + )}`; await user.send(message); } else if (roles.vegan && !roles.activist) { - const message = 'You\'ve been verified as a vegan!' - + `\n\nYou can next get verified on ${time(Math.round(Date.now() / 1000) + 604800)} if you would wish to have the activist role.`; + const message = + "You've been verified as a vegan!" + + `\n\nYou can next get verified on ${time( + Math.round(Date.now() / 1000) + 604800, + )} if you would wish to have the activist role.`; await user.send(message); } @@ -200,30 +234,33 @@ export async function finishDM(user: User, roles: { export async function finishVerifyMessages( user: User, roles: { - vegan: boolean, - activist: boolean, - araVegan: boolean - trusted: boolean, - vegCurious: boolean, - convinced: boolean + vegan: boolean; + activist: boolean; + araVegan: boolean; + trusted: boolean; + vegCurious: boolean; + convinced: boolean; }, manual: boolean = false, ) { // Send a DM with when their verification is finished if (!manual) { - await finishDM(user, roles) - .catch(() => container.logger.error('Verification: Closed DMs')); + await finishDM(user, roles).catch(() => + container.logger.error('Verification: Closed DMs'), + ); } // Not vegan if (!roles.vegan) { - const general = container.client.channels.cache - .get(IDs.channels.nonVegan.general) as TextChannel | undefined; + const general = container.client.channels.cache.get( + IDs.channels.nonVegan.general, + ) as TextChannel | undefined; if (general === undefined) { return; } - let msg = `${user}, you have been verified! Please check <#${IDs.channels.information.roles}> ` - + `and remember to follow the <#${IDs.channels.information.conduct}> and to respect ongoing discussion and debates.`; + let msg = + `${user}, you have been verified! Please check <#${IDs.channels.information.roles}> ` + + `and remember to follow the <#${IDs.channels.information.conduct}> and to respect ongoing discussion and debates.`; // Add extra info if the user got veg curious or convinced. if (roles.vegCurious || roles.convinced) { msg += `\n\nYou also have access to <#${IDs.channels.dietSupport.main}> for help on going vegan.`; @@ -233,8 +270,9 @@ export async function finishVerifyMessages( } // Vegan - const general = container.client.channels.cache - .get(IDs.channels.vegan.general) as TextChannel | undefined; + const general = container.client.channels.cache.get( + IDs.channels.vegan.general, + ) as TextChannel | undefined; if (general === undefined) { return; } @@ -243,21 +281,22 @@ export async function finishVerifyMessages( // Activist role if (roles.activist) { - const activistMsg = `${user} you have been given the activist role! This means that if you'd wish to engage with non-vegans in ` - + `<#${IDs.channels.nonVegan.general}>, you should follow these rules:\n\n` - + '1. Try to move conversations with non-vegans towards veganism/animal ethics\n' - + '2. Don\'t discuss social topics while activism is happening\n' - + '3. Have evidence for claims you make. "I don\'t know" is an acceptable answer. Chances are someone here knows or you can take time to find out\n' - + '4. Don\'t advocate for baby steps towards veganism. Participation in exploitation can stop today\n' - + '5. Differences in opinion between activists should be resolved in vegan spaces, not in the chat with non-vegans'; - await user.send(activistMsg) - .catch(() => { - const activist = container.client.channels.cache - .get(IDs.channels.activism.activism) as TextChannel | undefined; - if (activist === undefined) { - return; - } - activist.send(activistMsg); - }); + const activistMsg = + `${user} you have been given the activist role! This means that if you'd wish to engage with non-vegans in ` + + `<#${IDs.channels.nonVegan.general}>, you should follow these rules:\n\n` + + '1. Try to move conversations with non-vegans towards veganism/animal ethics\n' + + "2. Don't discuss social topics while activism is happening\n" + + '3. Have evidence for claims you make. "I don\'t know" is an acceptable answer. Chances are someone here knows or you can take time to find out\n' + + "4. Don't advocate for baby steps towards veganism. Participation in exploitation can stop today\n" + + '5. Differences in opinion between activists should be resolved in vegan spaces, not in the chat with non-vegans'; + await user.send(activistMsg).catch(() => { + const activist = container.client.channels.cache.get( + IDs.channels.activism.activism, + ) as TextChannel | undefined; + if (activist === undefined) { + return; + } + activist.send(activistMsg); + }); } } diff --git a/src/utils/verificationConfig.ts b/src/utils/verificationConfig.ts index 3d6daaf..b6d2eee 100644 --- a/src/utils/verificationConfig.ts +++ b/src/utils/verificationConfig.ts @@ -25,14 +25,9 @@ export const leaveBan = 8; export const questionInfo = [ { - question: 'Welcome to Animal Rights Advocates! How did you find the server?', - buttons: [ - 'Search', - 'Friend', - 'YouTube', - 'Another Server', - 'Vegan Org', - ], + question: + 'Welcome to Animal Rights Advocates! How did you find the server?', + buttons: ['Search', 'Friend', 'YouTube', 'Another Server', 'Vegan Org'], }, { question: 'How long have you been vegan?', @@ -46,24 +41,19 @@ export const questionInfo = [ ], }, { - question: 'Ask the user why they went vegan and to define veganism.\n' - + 'Do they cite ethical concerns and abstinence from at least meat, dairy, eggs, leather, and fur?', - buttons: [ - 'Yes', - 'Yes with prompting', - 'No', - ], + question: + 'Ask the user why they went vegan and to define veganism.\n' + + 'Do they cite ethical concerns and abstinence from at least meat, dairy, eggs, leather, and fur?', + buttons: ['Yes', 'Yes with prompting', 'No'], }, { - question: 'Ask the user about their life as a vegan, including things like watching documentaries or social media content and interactions with family and friends. What are their stories like?', - buttons: [ - 'Believable', - 'Unbelievable', - 'Short', - ], + question: + 'Ask the user about their life as a vegan, including things like watching documentaries or social media content and interactions with family and friends. What are their stories like?', + buttons: ['Believable', 'Unbelievable', 'Short'], }, { - question: 'Ask the user about food and nutrition. Do they seem to know how to live as a vegan?', + question: + 'Ask the user about food and nutrition. Do they seem to know how to live as a vegan?', buttons: [ 'Dietitian / Chef', 'Acceptable', @@ -73,33 +63,23 @@ export const questionInfo = [ ], }, { - question: 'Do you think this user is definitely vegan? (This is for the trusted role)', - buttons: [ - 'Yes', - 'No', - ], + question: + 'Do you think this user is definitely vegan? (This is for the trusted role)', + buttons: ['Yes', 'No'], }, { - question: 'Offer to ask questions for Activist. Do you think they should get it?', - buttons: [ - 'Yes', - 'No', - ], + question: + 'Offer to ask questions for Activist. Do you think they should get it?', + buttons: ['Yes', 'No'], }, { - question: 'Do some activism, asking Activist questions. Now which role should they get?', - buttons: [ - 'Vegan', - 'Convinced', - 'Non-vegan', - ], + question: + 'Do some activism, asking Activist questions. Now which role should they get?', + buttons: ['Vegan', 'Convinced', 'Non-vegan'], }, { question: 'Should this user get Veg Curious?', - buttons: [ - 'Yes', - 'No', - ], + buttons: ['Yes', 'No'], }, ]; @@ -107,36 +87,21 @@ export const serverFind = [ // From a friend { question: 'Ask for username and indicate', - buttons: [ - 'Vegan', - 'Non-Vegan', - 'Unknown', - ], + buttons: ['Vegan', 'Non-Vegan', 'Unknown'], }, // From a video { question: 'Ask what video', - buttons: [ - 'Troll video', - 'Our content', - 'Other', - ], + buttons: ['Troll video', 'Our content', 'Other'], }, // From another server { question: 'Ask which server', - buttons: [ - 'Vegan', - 'Debate', - 'Other', - ], + buttons: ['Vegan', 'Debate', 'Other'], }, // From a vegan organisation { question: 'Ask which one', - buttons: [ - 'Vegan Hacktivists', - 'Other', - ], + buttons: ['Vegan Hacktivists', 'Other'], }, ]; diff --git a/tsconfig.json b/tsconfig.json index b5a1dec..bfa63f0 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -6,13 +6,13 @@ /* Projects */ // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ - "tsBuildInfoFile": "dist/.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ + "tsBuildInfoFile": "dist/.tsbuildinfo" /* Specify the path to .tsbuildinfo incremental compilation file. */, // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ /* Language and Environment */ - "target": "ES2022", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + "target": "ES2022" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */, // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ // "jsx": "preserve", /* Specify what JSX code is generated. */ // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ @@ -26,13 +26,13 @@ // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ /* Modules */ - "module": "Node16", /* Specify what module code is generated. */ - "rootDir": "src", /* Specify the root folder within your source files. */ + "module": "Node16" /* Specify what module code is generated. */, + "rootDir": "src" /* Specify the root folder within your source files. */, // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ - "baseUrl": "src", /* Specify the base directory to resolve non-relative module names. */ + "baseUrl": "src" /* Specify the base directory to resolve non-relative module names. */, "paths": { "#utils/*": ["./utils/*"] - }, /* Specify a set of entries that re-map imports to additional lookup locations. */ + } /* Specify a set of entries that re-map imports to additional lookup locations. */, // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ // "types": [], /* Specify type package names to be included without being referenced in a source file. */ @@ -52,7 +52,7 @@ // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ - "outDir": "dist", /* Specify an output folder for all emitted files. */ + "outDir": "dist" /* Specify an output folder for all emitted files. */, // "removeComments": true, /* Disable emitting comments. */ // "noEmit": true, /* Disable emitting files from a compilation. */ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ @@ -74,12 +74,12 @@ /* Interop Constraints */ // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ - "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ + "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */, // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ - "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */, /* Type Checking */ - "strict": true, /* Enable all strict type-checking options. */ + "strict": true /* Enable all strict type-checking options. */ // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ @@ -104,4 +104,4 @@ // "skipLibCheck": true /* Skip type checking all .d.ts files. */ }, "include": ["src"] -} \ No newline at end of file +}