diff --git a/.editorconfig b/.editorconfig
index 89bbf68e2..0609db6ce 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -2,9 +2,11 @@
indent_size = 4
indent_style = space
end_of_line = lf
+insert_final_newline = true
+charset = utf-8
[*.yml, *.yaml]
indent_size = 2
[*.md, *.mdx]
-trim_trailing_whitespace = false
\ No newline at end of file
+trim_trailing_whitespace = false
diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
index 35d3f328e..8e8c8d4db 100644
--- a/.github/FUNDING.yml
+++ b/.github/FUNDING.yml
@@ -1,13 +1,3 @@
-# These are supported funding model platforms
-
-github: onesoft-sudo
-patreon:
+#github: onesoft-sudo
# open_collective: sudobot
-ko_fi: # Replace with a single Ko-fi username
-tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
-community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
-liberapay: # Replace with a single Liberapay username
-issuehunt: # Replace with a single IssueHunt username
-otechie: # Replace with a single Otechie username
-lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
custom: https://www.sudobot.online/donate
diff --git a/.github/cra-metadata.json b/.github/cra-metadata.json
index 594eba572..95e4bf883 100644
--- a/.github/cra-metadata.json
+++ b/.github/cra-metadata.json
@@ -1,3 +1,3 @@
{
- "lastReadCommit": "488865f642bcd30ffe8feea45c92db7e46a9dde5"
+ "lastReadCommit": "04f849ee5e093072e7b3186ef3de36c41a7f8ecc"
}
diff --git a/.license-notice b/.license-notice
new file mode 100644
index 000000000..8797fbb04
--- /dev/null
+++ b/.license-notice
@@ -0,0 +1,18 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e4110fe8a..d43db4be6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,7 +1,179 @@
# Changelog
+### 20-09-2024 - [[Ar Rakin](mailto:rakinar2@onesoftnet.eu.org)]
+
+ * **fix:** eslint issues
+
+ **Signed-off-by:** Ar Rakin
+ * **fix:** type errors
+
+ **Signed-off-by:** Ar Rakin
+ * **feat:** auto configure guilds on guildCreate
+
+ **Signed-off-by:** Ar Rakin
+ * **chore(extensions):** build extensions [skip ci]
+
+ **Signed-off-by:** Ar Rakin
+
+
+### 19-09-2024 - [[Ar Rakin](mailto:rakinar2@onesoftnet.eu.org)]
+
+ * **chore(extensions):** build extensions [skip ci]
+
+ **Signed-off-by:** Ar Rakin
+
+
+### 18-09-2024 - [[Ar Rakin](mailto:rakinar2@onesoftnet.eu.org)]
+
+ * **test:** update tests
+
+ **Signed-off-by:** Ar Rakin
+
+ * **fix:** type errors
+
+ **Signed-off-by:** Ar Rakin
+
+ * **chore:** update eslint config
+
+ **Signed-off-by:** Ar Rakin
+
+ * **refactor:** fix eslint issues
+
+ **Signed-off-by:** Ar Rakin
+
+
+### 18-09-2024 - [[Conventional Release Action](mailto:rakinar2@onesoftnet.eu.org)]
+
+ * **release:** v10.14.5 [skip ci]
+
+ **Signed-off-by:** Conventional Release Action
+
+
+### 17-09-2024 - [[Ar Rakin](mailto:rakinar2@onesoftnet.eu.org)]
+
+ * **chore:** update eslint.config.mjs
+
+ **Signed-off-by:** Ar Rakin
+
+ * **chore:** update .editorconfig
+
+ **Signed-off-by:** Ar Rakin
+
+ * **chore:** add .license-notice file
+
+ **Signed-off-by:** Ar Rakin
+
+ * **chore:** add `addlicense` script from OSN commons
+
+ **Signed-off-by:** Ar Rakin
+
+ * **style:** update license comments
+
+ **Signed-off-by:** Ar Rakin
+
+ * **style:** add license comments
+
+ **Signed-off-by:** Ar Rakin
+
+ * **chore(extensions):** build extensions [skip ci]
+
+ **Signed-off-by:** Ar Rakin
+
+
+### 16-09-2024 - [[Ar Rakin](mailto:rakinar2@onesoftnet.eu.org)]
+
+ * **docs:** fix table of contents spacing on desktop
+
+ **Signed-off-by:** Ar Rakin
+ * **chore:** update VERSIONS.md
+
+ **Signed-off-by:** Ar Rakin
+ * **chore(extensions):** build extensions [skip ci]
+
+ **Signed-off-by:** Ar Rakin
+
+
+### 15-09-2024 - [[Ar Rakin](mailto:rakinar2@onesoftnet.eu.org)]
+
+ * **chore:** update FUNDING.yml
+
+ **Signed-off-by:** Ar Rakin
+ * **chore:** update VERSIONS.md
+
+ **Signed-off-by:** Ar Rakin
+ * **chore(extensions):** build extensions [skip ci]
+
+ **Signed-off-by:** Ar Rakin
+
+
+### 14-09-2024 - [[Ar Rakin](mailto:rakinar2@gmail.com)]
+
+ * **docs:** add max width to the navbar search icon
+
+### 14-09-2024 - [[nin](mailto:95270582+ninsaccplayzyt@users.noreply.github.com)]
+
+ * make it sound correct
+
+ **Signed-off-by:** nin <95270582+ninsaccplayzyt@users.noreply.github.com>
+
+### 14-09-2024 - [[Ar Rakin](mailto:rakinar2@onesoftnet.eu.org)]
+
+ * **chore(extensions):** build extensions [skip ci]
+
+ **Signed-off-by:** Ar Rakin
+
+
+### 13-09-2024 - [[Ar Rakin](mailto:rakinar2@onesoftnet.eu.org)]
+
+ * **chore:** update VERSIONS.md
+ * **fix(services:auditlog):** do not list `@everyone` as a role on `guildMemberRemove`
+
+ **Signed-off-by:** Ar Rakin
+ * **chore:** update VERSIONS.md
+
+ **Signed-off-by:** Ar Rakin
+ * **chore:** update VERSIONS.md
+
+ **Signed-off-by:** Ar Rakin
+ * **deps:** bump discord.js to 14.16.2
+
+ **Signed-off-by:** Ar Rakin
+ * **chore(extensions):** build extensions [skip ci]
+
+ **Signed-off-by:** Ar Rakin
+
+
+### 13-09-2024 - [[Conventional Release Action](mailto:rakinar2@onesoftnet.eu.org)]
+
+ * **release:** v10.14.4 [skip ci]
+
+ **Signed-off-by:** Conventional Release Action
+
+
### 12-09-2024 - [[Ar Rakin](mailto:rakinar2@onesoftnet.eu.org)]
+ * **chore:** update VERSIONS.md
+
+ **Signed-off-by:** Ar Rakin
+
+ * **chore:** create VERSIONS.md
+
+ **Signed-off-by:** Ar Rakin
+ * **chore:** update readme
+
+ **Signed-off-by:** Ar Rakin
+ * **docs:** update vcs guide
+
+ **Signed-off-by:** Ar Rakin
+ * **docs:** fix broken links
+
+ **Signed-off-by:** Ar Rakin
+ * **docs:** fix typo
+
+ **Signed-off-by:** Ar Rakin
+ * **docs:** update vcs guide
+
+ **Signed-off-by:** Ar Rakin
* **fix:** set default config for AI automod
**Signed-off-by:** Ar Rakin
@@ -11,6 +183,13 @@
**Signed-off-by:** Ar Rakin
+### 12-09-2024 - [[Conventional Release Action](mailto:rakinar2@onesoftnet.eu.org)]
+
+ * **release:** v10.14.3 [skip ci]
+
+ **Signed-off-by:** Conventional Release Action
+
+
### 11-09-2024 - [[Ar Rakin](mailto:rakinar2@onesoftnet.eu.org)]
* **docs:** fix pageinfo action
diff --git a/VERSIONS.md b/VERSIONS.md
index 3821f9641..5494e95e8 100644
--- a/VERSIONS.md
+++ b/VERSIONS.md
@@ -2,4 +2,22 @@
Here is a list of SudoBot's notable versions:
-[TODO]
+| Version | Description | Release Date | Supported Until | Status |
+|---------------------------------------------------------------------|---------------------------|--------------|-----------------|------------------|
+| [1.x](https://github.com/onesoft-sudo/sudobot/tree/1.x) | Initial release | 2022-03-26 | - | EOL |
+| [2.x](https://github.com/onesoft-sudo/sudobot/tree/2.x) | 2.x release | 2022-04-30 | - | EOL |
+| [3.x](https://github.com/onesoft-sudo/sudobot/tree/3.x) | 3.x release | 2022-07-16 | - | EOL |
+| [4.x](https://github.com/onesoft-sudo/sudobot/tree/4.x) | 4.x release | 2022-08-02 | - | EOL |
+| [5.x](https://github.com/onesoft-sudo/sudobot/tree/5.x) | 5.x release | 2022-08-24 | - | EOL |
+| [6.x](https://github.com/onesoft-sudo/sudobot/tree/6.x) | 6.x release | 2023-03-09 | - | EOL |
+| [7.x](https://github.com/onesoft-sudo/sudobot/tree/7.x) | 7.x release | 2023-08-01 | - | EOL |
+| [8.x](https://github.com/onesoft-sudo/sudobot/tree/8.x) | 8.x release [LTS] | 2024-02-03 | 2025-01-01 | LTS |
+| 9.x [< 9.26.7] | 9.x release | 2024-06-16 | 2024-08-31 | EOL |
+| [9.x](https://github.com/onesoft-sudo/sudobot/tree/9.x) [>= 9.26.7] | 9.x [Security Fix] | 2024-08-30 | 2024-09-30 | Maintenance only |
+| [10.x](https://github.com/onesoft-sudo/sudobot/tree/main) | 10.x release [Current] | 2024-08-31 | [No due date] | Stable |
+
+### Terminology
+
+- **EOL**: End of Life. No longer supported.
+- **LTS**: Long Term Support. Supported for a longer period of time.
+- **Maintenance only**: Only security fixes are provided.
diff --git a/docs/app/(docs)/getting-started/page.mdx b/docs/app/(docs)/getting-started/page.mdx
index 62c26e2fa..3234983ce 100644
--- a/docs/app/(docs)/getting-started/page.mdx
+++ b/docs/app/(docs)/getting-started/page.mdx
@@ -21,7 +21,7 @@ This guide will help you get started with SudoBot. You will learn how to build t
This guide assumes you have a Linux/Unix-based system where you'll install SudoBot. Windows users, please [scroll down](#windows-compatibility) to see how you can run SudoBot on Windows.
-Before you start, you need to have the following installed on your system:
+Before you start, you need to have the following:
- A Discord API Application token (bot token). Go to the [Discord Developer Portal](https://discord.com/developers/applications) to create a new application, and get the token.
- A [PostgreSQL](https://www.postgresql.org/) database server. You can use a local server or use a cloud service like [Supabase](https://supabase.com/).
diff --git a/docs/components/MDX/TableOfContents.tsx b/docs/components/MDX/TableOfContents.tsx
index 4b7af5b53..d47da8002 100644
--- a/docs/components/MDX/TableOfContents.tsx
+++ b/docs/components/MDX/TableOfContents.tsx
@@ -72,7 +72,7 @@ export default function TableOfContents({
On this page
-
+
{headings.map(heading => (
-
{
setToggled(true);
}}
diff --git a/eslint.config.mjs b/eslint.config.mjs
index cec3cbb32..de8d6a113 100644
--- a/eslint.config.mjs
+++ b/eslint.config.mjs
@@ -6,7 +6,7 @@ import tseslint from "typescript-eslint";
export default tseslint.config(
{
- extends: [eslint.configs.recommended, ...tseslint.configs.recommended],
+ extends: [eslint.configs.recommended, ...tseslint.configs.recommendedTypeChecked],
languageOptions: {
ecmaVersion: "latest",
sourceType: "module",
@@ -23,6 +23,8 @@ export default tseslint.config(
},
rules: {
indent: "off",
+ semi: ["warn", "always"],
+ "no-var": "off",
"linebreak-style": ["error", "unix"],
quotes: [
"warn",
@@ -31,7 +33,6 @@ export default tseslint.config(
avoidEscape: true
}
],
- semi: ["warn", "always"],
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/consistent-type-imports": [
"error",
@@ -47,7 +48,13 @@ export default tseslint.config(
"error",
{ accessibility: "explicit" }
],
- "@typescript-eslint/no-unused-vars": "off"
+ "@typescript-eslint/no-unused-vars": "off",
+ "@typescript-eslint/no-unsafe-member-access": "off",
+ "@typescript-eslint/no-unsafe-call": "off",
+ "@typescript-eslint/no-unsafe-assignment": "off",
+ "@typescript-eslint/no-unsafe-return": "off",
+ "@typescript-eslint/no-unsafe-argument": "off",
+ "@typescript-eslint/restrict-template-expressions": "off"
},
files: ["src/**/*.ts"],
ignores: [
diff --git a/extensions/.extbuilds/index.json b/extensions/.extbuilds/index.json
index bb2b6336d..e553b6a77 100644
--- a/extensions/.extbuilds/index.json
+++ b/extensions/.extbuilds/index.json
@@ -16,17 +16,25 @@
},
"license": "AGPL-3.0-or-later",
"licenseURL": "https://spdx.org/licenses/AGPL-3.0-or-later.html",
- "lastUpdated": "2024-09-12T01:02:14.682Z",
+ "lastUpdated": "2024-09-20T01:03:32.837Z",
"readmeFileName": "README.md",
"readmeFileURL": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/neko/README.md",
"tarballs": [
+ {
+ "url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/neko/neko-1.0.0-54.tar.gz",
+ "basename": "neko-1.0.0-54.tar.gz",
+ "version": "1.0.0-54",
+ "checksum": "52dc5f138ba8404253bb4f81de1e39f54c36175a6f287ef16596b1aaf6fd1f4833f27cee3f442b8d5a0fab42bfedb8337f36587edf802912dd7d5a9c72ace552",
+ "size": 1271,
+ "createdAt": "2024-09-20T01:02:25.592Z"
+ },
{
"url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/neko/neko-1.0.0-53.tar.gz",
"basename": "neko-1.0.0-53.tar.gz",
"version": "1.0.0-53",
"checksum": "adbb022e52fa19655bbd18b4e3bbe2ec265e7ad3324888dda32dedad568341cff081e900f92f87c699073085b6b4633a035c4158bb87d3fb0dbfba0045a45212",
"size": 1287,
- "createdAt": "2024-09-12T01:01:03.287Z"
+ "createdAt": "2024-09-20T01:02:25.592Z"
},
{
"url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/neko/neko-1.0.0-52.tar.gz",
@@ -34,7 +42,7 @@
"version": "1.0.0-52",
"checksum": "dda37dbd89e91f3bfa1499144547c32d9fb080bc6f9330890481c9e2a2f69b7cd5cf4a9dcb2adfc1dee6ef25f008ff7e5b2feb031b625000587b28d9164d7a11",
"size": 1471,
- "createdAt": "2024-09-12T01:01:03.287Z"
+ "createdAt": "2024-09-20T01:02:25.592Z"
},
{
"url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/neko/neko-1.0.0-51.tar.gz",
@@ -42,7 +50,7 @@
"version": "1.0.0-51",
"checksum": "335b49ebda018af883fcaed4ee53c3871f6b324d9146cbce0e86df41a04d020d68dbfc4d12b130f17a08341f65018102d2ebcdeba3c23e643fdbfb31c6883b25",
"size": 651,
- "createdAt": "2024-09-12T01:01:03.287Z"
+ "createdAt": "2024-09-20T01:02:25.592Z"
},
{
"url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/neko/neko-1.0.0-50.tar.gz",
@@ -50,7 +58,7 @@
"version": "1.0.0-50",
"checksum": "7d441add5e58c05058e29bc221a0accdefe0adcdda0da881683f51a0a835253d4981d2f10216e0e9432f5ab032dd76f61a2d52f26cb5642eb9d181cca62c940f",
"size": 1469,
- "createdAt": "2024-09-12T01:01:03.287Z"
+ "createdAt": "2024-09-20T01:02:25.592Z"
},
{
"url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/neko/neko-1.0.0-49.tar.gz",
@@ -58,7 +66,7 @@
"version": "1.0.0-49",
"checksum": "531a614b2df6508086929c987d0b6331d2eabe86584f45bf7ab8c9261b66bf85bda1f34b131bf0f1f0b335199d6154433b5679d9119e97d1180d3e6dc10ea2fd",
"size": 1404,
- "createdAt": "2024-09-12T01:01:03.287Z"
+ "createdAt": "2024-09-20T01:02:25.592Z"
},
{
"url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/neko/neko-1.0.0-48.tar.gz",
@@ -66,7 +74,7 @@
"version": "1.0.0-48",
"checksum": "ad944f96176dd2c93d9e689f9e24e18a980d4e5a0cb912ca6949785aab91fe592318fdf315c38d21b238547f9c7531d1adce08e565c2adde974b44c50fd1cbdd",
"size": 1403,
- "createdAt": "2024-09-12T01:01:03.287Z"
+ "createdAt": "2024-09-20T01:02:25.592Z"
},
{
"url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/neko/neko-1.0.0-47.tar.gz",
@@ -74,7 +82,7 @@
"version": "1.0.0-47",
"checksum": "9befe8fd42ef3921a3b6cda788e15d2d260fe716d30324801cf7c5f4cc2c674678246791c79cd76f6c74cd8a44d54185028a75657cd58981f8bee2e0bb95a78f",
"size": 1404,
- "createdAt": "2024-09-12T01:01:03.287Z"
+ "createdAt": "2024-09-20T01:02:25.592Z"
},
{
"url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/neko/neko-1.0.0-46.tar.gz",
@@ -82,7 +90,7 @@
"version": "1.0.0-46",
"checksum": "f9e15b2e58338a684586f636e02317a898820c29349edb09990103b9cb58b18ed0d76f07c3209a5ce6f50467aa9565525b4d0b4a9605c10aea8b66afda3017a6",
"size": 1406,
- "createdAt": "2024-09-12T01:01:03.287Z"
+ "createdAt": "2024-09-20T01:02:25.592Z"
},
{
"url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/neko/neko-1.0.0-45.tar.gz",
@@ -90,7 +98,7 @@
"version": "1.0.0-45",
"checksum": "da4d2d48b5011e696ca34051f41d832b1c64044a2e234006c344067203ce0186b22679f06e35701f41a9eaf8f9780b82e02397d079f83cfc73d726a3c21317e0",
"size": 1407,
- "createdAt": "2024-09-12T01:01:03.287Z"
+ "createdAt": "2024-09-20T01:02:25.592Z"
},
{
"url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/neko/neko-1.0.0-44.tar.gz",
@@ -98,7 +106,7 @@
"version": "1.0.0-44",
"checksum": "98b571887df1001eb1b40c0ef8c4ae1c82ce5dbbfe4af221d7a9debc9062187f5074f38e27d77ce9e128dc7e294b8dd11f07d19669ebf7e4c1dd12309eaa771f",
"size": 1406,
- "createdAt": "2024-09-12T01:01:03.287Z"
+ "createdAt": "2024-09-20T01:02:25.592Z"
},
{
"url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/neko/neko-1.0.0-43.tar.gz",
@@ -106,7 +114,7 @@
"version": "1.0.0-43",
"checksum": "6f48437d6601469744878a535486c730b5b81e985287ee9e73a82d5e399e0e2404320cb964124c6d9c13807731cbc2799f378aefc0d5ac650a8c6149e68cd003",
"size": 1404,
- "createdAt": "2024-09-12T01:01:03.287Z"
+ "createdAt": "2024-09-20T01:02:25.592Z"
},
{
"url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/neko/neko-1.0.0-42.tar.gz",
@@ -114,7 +122,7 @@
"version": "1.0.0-42",
"checksum": "717f3ce3b64cb30fc28005ed0d59caf903c9134a903ec24a33154be151ee80ead55550661e23a08ba2cf4f90773c11d05aae78c2bbda6751a15ebd89bfad2439",
"size": 1405,
- "createdAt": "2024-09-12T01:01:03.287Z"
+ "createdAt": "2024-09-20T01:02:25.592Z"
},
{
"url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/neko/neko-1.0.0-41.tar.gz",
@@ -122,7 +130,7 @@
"version": "1.0.0-41",
"checksum": "7bc7de9409a348c9a7b9f84feebd5e960b8ef85dd8c672bcfd72059c0da2e70b4fb3aa8da311cdc07edcb4d3a585fe49c7612138f12b2f403480b9b387225ac1",
"size": 1406,
- "createdAt": "2024-09-12T01:01:03.287Z"
+ "createdAt": "2024-09-20T01:02:25.592Z"
},
{
"url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/neko/neko-1.0.0-40.tar.gz",
@@ -130,7 +138,7 @@
"version": "1.0.0-40",
"checksum": "4bdddd3358886bbe40208fcaef8f2c2a04f3f27e9be1c5ed743b0d854792a8438842cb6278258563338e854f28326ebdf276d07abb3b63f23e9da28ea9d553aa",
"size": 1404,
- "createdAt": "2024-09-12T01:01:03.287Z"
+ "createdAt": "2024-09-20T01:02:25.592Z"
},
{
"url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/neko/neko-1.0.0-39.tar.gz",
@@ -138,7 +146,7 @@
"version": "1.0.0-39",
"checksum": "f98d525dc149630fcba7bfa37e7247a95d35e124567d472a57ae05a5ff9f265e3df85d0c774c3f36cb6935c75b7ef9ecf408e5fcc202a08b024e11d8bd2f48c7",
"size": 1406,
- "createdAt": "2024-09-12T01:01:03.287Z"
+ "createdAt": "2024-09-20T01:02:25.592Z"
},
{
"url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/neko/neko-1.0.0-38.tar.gz",
@@ -146,7 +154,7 @@
"version": "1.0.0-38",
"checksum": "a42724f262e24c65fd508fc773c01df3d62222e176cd7e32d1797c0c7731c858b1b45ce88ed7aa501565200cb5a867fb1960bdc4dfe4f1e19e9a4a9cc35af0b2",
"size": 1404,
- "createdAt": "2024-09-12T01:01:03.287Z"
+ "createdAt": "2024-09-20T01:02:25.592Z"
},
{
"url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/neko/neko-1.0.0-37.tar.gz",
@@ -154,7 +162,7 @@
"version": "1.0.0-37",
"checksum": "1b1d408e56dabba6edd2b72c955ed67db55d66608830de856cf46959c2502ee0db7e6b5026c78ed92d312520dc5cd4cefbe983a183dee92aaebb393800b5a46f",
"size": 1407,
- "createdAt": "2024-09-12T01:01:03.287Z"
+ "createdAt": "2024-09-20T01:02:25.592Z"
},
{
"url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/neko/neko-1.0.0-36.tar.gz",
@@ -162,7 +170,7 @@
"version": "1.0.0-36",
"checksum": "0766e971fb3c7064c90f32eafcee8203204993a5cc2b723e4282da3d9c718585e3d5b28ecfef03991b837cae2dbdbbaf5d9459058a71ed4f9ae0f92eca299443",
"size": 1404,
- "createdAt": "2024-09-12T01:01:03.287Z"
+ "createdAt": "2024-09-20T01:02:25.592Z"
},
{
"url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/neko/neko-1.0.0-35.tar.gz",
@@ -170,7 +178,7 @@
"version": "1.0.0-35",
"checksum": "cbbf5941a71dca9c0fb190770f29a0779fe6b3eaa7a1a7c49671f3e03d2a300af8fcc747e3271c2aef7750a152d45ca0a3faf63ae88c8416ae35a7874445455d",
"size": 1411,
- "createdAt": "2024-09-12T01:01:03.287Z"
+ "createdAt": "2024-09-20T01:02:25.592Z"
},
{
"url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/neko/neko-1.0.0-34.tar.gz",
@@ -178,7 +186,7 @@
"version": "1.0.0-34",
"checksum": "ceb43e1156e5d2151252c46ad4b7563eaf7051974503a2181bfc3e1194f3a40ecceae25a8cb8037537fa8e30269228f2a388bc39280e529c945c04fb2e32e95c",
"size": 1406,
- "createdAt": "2024-09-12T01:01:03.287Z"
+ "createdAt": "2024-09-20T01:02:25.592Z"
},
{
"url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/neko/neko-1.0.0-33.tar.gz",
@@ -186,7 +194,7 @@
"version": "1.0.0-33",
"checksum": "93863269efc53ed8ce93a2a9063f7a8925474322a51b20fb32a3b38529633f0ddb47ccd1a2f182b913bb6295dc83d2a3b361aa59df54ee1cc3e117bd294b9e93",
"size": 1410,
- "createdAt": "2024-09-12T01:01:03.287Z"
+ "createdAt": "2024-09-20T01:02:25.592Z"
},
{
"url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/neko/neko-1.0.0-32.tar.gz",
@@ -194,7 +202,7 @@
"version": "1.0.0-32",
"checksum": "8a70322884e0255991502c482e4bf22caa0e6ddd0f331c3569ac4336343c522f437921052198d44477f77748028d8a2c5c3a4bb2e066a04df81822aec118f268",
"size": 1403,
- "createdAt": "2024-09-12T01:01:03.287Z"
+ "createdAt": "2024-09-20T01:02:25.592Z"
},
{
"url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/neko/neko-1.0.0-31.tar.gz",
@@ -202,7 +210,7 @@
"version": "1.0.0-31",
"checksum": "b2326c5e6d5222605ce8450cd0a68db3d51002212f9c75a4793efab8afcae96d3abcfc80f22a62a56057daa535587113be0fd508a70ebf6b561af90148b398b4",
"size": 1410,
- "createdAt": "2024-09-12T01:01:03.287Z"
+ "createdAt": "2024-09-20T01:02:25.591Z"
},
{
"url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/neko/neko-1.0.0-30.tar.gz",
@@ -210,7 +218,7 @@
"version": "1.0.0-30",
"checksum": "6cf983a286178dd213578260806ceb7ec668bace1f494b5bf8a5f007da6fbb5be15360c2e0e02274b5ec1db5e137b0c845fa3afb76502f29e059a6be9be549cd",
"size": 1404,
- "createdAt": "2024-09-12T01:01:03.287Z"
+ "createdAt": "2024-09-20T01:02:25.591Z"
},
{
"url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/neko/neko-1.0.0-29.tar.gz",
@@ -218,7 +226,7 @@
"version": "1.0.0-29",
"checksum": "bb38dc8e93cec2a24478a97853611d246d4fd24fc3068e4f01abf917b7cd41f7ebc2286a67468d8e0a94773b5741d02210ddc41b4b74e668a9f17cb0554df963",
"size": 1412,
- "createdAt": "2024-09-12T01:01:03.287Z"
+ "createdAt": "2024-09-20T01:02:25.591Z"
},
{
"url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/neko/neko-1.0.0-28.tar.gz",
@@ -226,7 +234,7 @@
"version": "1.0.0-28",
"checksum": "d40e847ab0e11b5d9213e32ff9ac41b1067858b3c7c18b22c331230897f0cc20c4656d61d1a12745fbb01474f3c57402ace4b87136a403b5e3b994fff66fd2ed",
"size": 1403,
- "createdAt": "2024-09-12T01:01:03.287Z"
+ "createdAt": "2024-09-20T01:02:25.591Z"
},
{
"url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/neko/neko-1.0.0-27.tar.gz",
@@ -234,7 +242,7 @@
"version": "1.0.0-27",
"checksum": "048ed20b92d2179dae148e4a4e0dbf93230da0bb0ea112e490fc4f69dbdcb5e98eadfa0924a2f3b6f0909cbf989bc71098b6ca9cb08a94affa2fae36f1a4ae8b",
"size": 1411,
- "createdAt": "2024-09-12T01:01:03.287Z"
+ "createdAt": "2024-09-20T01:02:25.591Z"
},
{
"url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/neko/neko-1.0.0-26.tar.gz",
@@ -242,7 +250,7 @@
"version": "1.0.0-26",
"checksum": "203f98019b1c82ae33783cb2dd512bdaeeb39a7f58b8e3d3e49d97768d60b00531bbb03999d1e38fee6f59c25de490d223e94b78a9801d5323cf4d1b32d35356",
"size": 1406,
- "createdAt": "2024-09-12T01:01:03.287Z"
+ "createdAt": "2024-09-20T01:02:25.591Z"
},
{
"url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/neko/neko-1.0.0-25.tar.gz",
@@ -250,7 +258,7 @@
"version": "1.0.0-25",
"checksum": "6d17ad18f306107579c1259b0097ec14813b8bfa92f95e75ea1b1f3e9f217d9a16a8837a701d31d72db394efcb604cae64bcee4a73d859384d2f25d003a0c014",
"size": 1412,
- "createdAt": "2024-09-12T01:01:03.287Z"
+ "createdAt": "2024-09-20T01:02:25.591Z"
},
{
"url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/neko/neko-1.0.0-24.tar.gz",
@@ -258,7 +266,7 @@
"version": "1.0.0-24",
"checksum": "dc46ee3d3622a85e62ccb9e5e49c945d024f8032aeab08f53bfa847b675bb2bad56248425fa5b0e2521b306883d4b4fe2910e1a35cac87761835ec318b03f6fc",
"size": 1405,
- "createdAt": "2024-09-12T01:01:03.287Z"
+ "createdAt": "2024-09-20T01:02:25.591Z"
},
{
"url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/neko/neko-1.0.0-23.tar.gz",
@@ -266,7 +274,7 @@
"version": "1.0.0-23",
"checksum": "2b2bc83f710966a9ec0f47ee055327cd0594720e92026a60eb418acf79bdb3fc9a2ebc9450210e1954ad1ec848507250d568180abd3b11899ddfcbe19e791ed4",
"size": 1411,
- "createdAt": "2024-09-12T01:01:03.287Z"
+ "createdAt": "2024-09-20T01:02:25.591Z"
},
{
"url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/neko/neko-1.0.0-22.tar.gz",
@@ -274,7 +282,7 @@
"version": "1.0.0-22",
"checksum": "ea66b61650d5f4756b04040d28b82c73d3fcacc6107205e197b8104da578d482a1f8437204e3463c5568a51528db3d70de426c2d5d5735d4b403fd9fbbbeee92",
"size": 1385,
- "createdAt": "2024-09-12T01:01:03.287Z"
+ "createdAt": "2024-09-20T01:02:25.591Z"
},
{
"url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/neko/neko-1.0.0-21.tar.gz",
@@ -282,7 +290,7 @@
"version": "1.0.0-21",
"checksum": "cccc00894faaa52a81c62ddf1694cfb59c5a701c40923785ca242680668c0a90766470a58d0492cf62c036174f2f4e3f482ea9dcf0b7949d0bde4a0ed608ab19",
"size": 1379,
- "createdAt": "2024-09-12T01:01:03.287Z"
+ "createdAt": "2024-09-20T01:02:25.591Z"
},
{
"url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/neko/neko-1.0.0-20.tar.gz",
@@ -290,7 +298,7 @@
"version": "1.0.0-20",
"checksum": "e2f8c66e71e8683c61effd47688198dab46bf634fc2929e87a4629f83498c526a52a2591a1d9ad930f87e29e0554b85de6bee8ed0c23c3b77bfbd5077a0b28b1",
"size": 1387,
- "createdAt": "2024-09-12T01:01:03.287Z"
+ "createdAt": "2024-09-20T01:02:25.591Z"
},
{
"url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/neko/neko-1.0.0-19.tar.gz",
@@ -298,7 +306,7 @@
"version": "1.0.0-19",
"checksum": "b44dc15448803b053adc43ef220b6516293523f2b42337c586c158a3d6cc05895b6c4e465b2ed0a6d9c5f80873511ab6162a38caf2a1e3155ee65980acbefde3",
"size": 1379,
- "createdAt": "2024-09-12T01:01:03.287Z"
+ "createdAt": "2024-09-20T01:02:25.591Z"
},
{
"url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/neko/neko-1.0.0-18.tar.gz",
@@ -306,7 +314,7 @@
"version": "1.0.0-18",
"checksum": "63a5393681a8f5327839943bebbf3c0840484d5c0b01f08276033e8210e8871ef78c4908c12cc26ecc5c9dee2b026500d2e34656584ad298600bf4f9a3df0024",
"size": 1388,
- "createdAt": "2024-09-12T01:01:03.287Z"
+ "createdAt": "2024-09-20T01:02:25.591Z"
},
{
"url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/neko/neko-1.0.0-17.tar.gz",
@@ -314,7 +322,7 @@
"version": "1.0.0-17",
"checksum": "c5dcf4c954e37e5a7b2809400bd9eafdc4517c5118289c7906e0d6b59160bebd5093ef77abbe95395a1b696b3585d209c7e660517b96f36e034e72067cb1d58c",
"size": 1377,
- "createdAt": "2024-09-12T01:01:03.287Z"
+ "createdAt": "2024-09-20T01:02:25.591Z"
},
{
"url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/neko/neko-1.0.0-16.tar.gz",
@@ -322,7 +330,7 @@
"version": "1.0.0-16",
"checksum": "569c791a769e950ae13c9c6ac07e7bad6fa4834e2e6d80c025e8a6868610547558b5f76172d71d07b17a65cc0af145199574ad2e47704404f08c9b3c660e9aeb",
"size": 1385,
- "createdAt": "2024-09-12T01:01:03.287Z"
+ "createdAt": "2024-09-20T01:02:25.591Z"
},
{
"url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/neko/neko-1.0.0-15.tar.gz",
@@ -330,7 +338,7 @@
"version": "1.0.0-15",
"checksum": "c72ea5f5d6911541972cd0c461cdd64a9f1ee22e85bcd307f3169ba24ff7fca364a1cbf90caf68a12459b85556ddfb8bfa9ee0728efdbb6bedd18c3c335a5db4",
"size": 1379,
- "createdAt": "2024-09-12T01:01:03.287Z"
+ "createdAt": "2024-09-20T01:02:25.591Z"
},
{
"url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/neko/neko-1.0.0-14.tar.gz",
@@ -338,7 +346,7 @@
"version": "1.0.0-14",
"checksum": "164ab6b3a81209a4e6d38746f1b141fb0b4feb9f77905781a97416058fdc4e9135af8a60aa6c53fbb30fb0e7c6061c4152fc1664c912adadcdd230d2ba17cc2f",
"size": 1389,
- "createdAt": "2024-09-12T01:01:03.287Z"
+ "createdAt": "2024-09-20T01:02:25.591Z"
},
{
"url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/neko/neko-1.0.0-13.tar.gz",
@@ -346,7 +354,7 @@
"version": "1.0.0-13",
"checksum": "bb4945e18f36aab1dc4aaab4639834d573728e1feb7761d8c25b299062924c8f6da66d86d564ed9d47c736189aa30d05e249dcd4426f99d92f646dc4c0a98a28",
"size": 1376,
- "createdAt": "2024-09-12T01:01:03.287Z"
+ "createdAt": "2024-09-20T01:02:25.591Z"
},
{
"url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/neko/neko-1.0.0-12.tar.gz",
@@ -354,7 +362,7 @@
"version": "1.0.0-12",
"checksum": "9441ffc84ee0e3cf4528dded4cf6f93ed70d4c34d46461f6c2acdac3902158df9a51286d277f18df6edcc288ee24fc6b7e510ee2a09ab94e9aedeb8fa815e09f",
"size": 1387,
- "createdAt": "2024-09-12T01:01:03.287Z"
+ "createdAt": "2024-09-20T01:02:25.591Z"
},
{
"url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/neko/neko-1.0.0-11.tar.gz",
@@ -362,7 +370,7 @@
"version": "1.0.0-11",
"checksum": "e074e4a43b7afcab54a2eb454e257f05093ccc7c80bd9610962b2bd7a4560bbb371f8761db03fa3605c5b2f6b3a6efa9f0b97e5e68c2f6c9c6b071f62dd22316",
"size": 1377,
- "createdAt": "2024-09-12T01:01:03.287Z"
+ "createdAt": "2024-09-20T01:02:25.591Z"
},
{
"url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/neko/neko-1.0.0-10.tar.gz",
@@ -370,7 +378,7 @@
"version": "1.0.0-10",
"checksum": "9efb5adef9c283f2c6a1fa8dc062df7ca35684993edce3ba9d53d9a5937024d47372b0c140b79727d8f71677b474ece8bef027b9e63041b32e9875a95650eff2",
"size": 1386,
- "createdAt": "2024-09-12T01:01:03.287Z"
+ "createdAt": "2024-09-20T01:02:25.591Z"
},
{
"url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/neko/neko-1.0.0-9.tar.gz",
@@ -378,7 +386,7 @@
"version": "1.0.0-9",
"checksum": "d9059a241376ea1bbb718e8785cd3db1d3d87d07787cf555168b3da7387d2fc3302139dfb32db28454084f731f47502e8ef31614043462db2161b72532c71157",
"size": 1378,
- "createdAt": "2024-09-12T01:01:03.287Z"
+ "createdAt": "2024-09-20T01:02:25.592Z"
},
{
"url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/neko/neko-1.0.0-8.tar.gz",
@@ -386,7 +394,7 @@
"version": "1.0.0-8",
"checksum": "4fc544252e082caca3e94920d659116df61cfe73ce9e79f69b3cb936161772d4059aff6310cbde6060137a55095b274f9131c802dae4a060c6412d07018926d4",
"size": 1386,
- "createdAt": "2024-09-12T01:01:03.287Z"
+ "createdAt": "2024-09-20T01:02:25.592Z"
},
{
"url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/neko/neko-1.0.0-7.tar.gz",
@@ -394,7 +402,7 @@
"version": "1.0.0-7",
"checksum": "2d2c33293d74e8857e28e92de96780480cfaac9ace7ea7744f1e9739370495934b45cbb9888db381814b35fb054506a7a973141cd16d86595cbfd3a1ed8516ae",
"size": 1379,
- "createdAt": "2024-09-12T01:01:03.287Z"
+ "createdAt": "2024-09-20T01:02:25.592Z"
},
{
"url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/neko/neko-1.0.0-6.tar.gz",
@@ -402,7 +410,7 @@
"version": "1.0.0-6",
"checksum": "db8c10ecf735916141ec0b7986773318a77514cbcce37137d3311b8f282a2500a4657c78b805991cb4f5b0e372629ba73257a09cdbf9fe9e7b7769af3cc6607b",
"size": 1387,
- "createdAt": "2024-09-12T01:01:03.287Z"
+ "createdAt": "2024-09-20T01:02:25.592Z"
},
{
"url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/neko/neko-1.0.0-5.tar.gz",
@@ -410,7 +418,7 @@
"version": "1.0.0-5",
"checksum": "bf4c9a405048dcfa0a79f7a0c460407e613e333b2726fb1794f26b2ef6ddfab014fe73192fd15aa6b89e5d83315cbcf11bc444d00f292489b6caa73666de96ff",
"size": 1379,
- "createdAt": "2024-09-12T01:01:03.287Z"
+ "createdAt": "2024-09-20T01:02:25.592Z"
},
{
"url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/neko/neko-1.0.0-4.tar.gz",
@@ -418,7 +426,7 @@
"version": "1.0.0-4",
"checksum": "0a621fb60adab6bf34a7f0480b3dbbf51055df487fe0d63647bf6f0bfb45d158e6bdc4601448b95036ad7625f5b26949e1a73d81fb135c813da453f911f08180",
"size": 1385,
- "createdAt": "2024-09-12T01:01:03.287Z"
+ "createdAt": "2024-09-20T01:02:25.592Z"
},
{
"url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/neko/neko-1.0.0-3.tar.gz",
@@ -426,7 +434,7 @@
"version": "1.0.0-3",
"checksum": "bf2a586bc68ece5e17dd3233f1f3a4d55bfe177cb6db905f6ca361f5726cc70168b667a52c4597dae0c5e1e7270c3f386ede57378ae4bdbcb99f9b8c9b00fba5",
"size": 1378,
- "createdAt": "2024-09-12T01:01:03.287Z"
+ "createdAt": "2024-09-20T01:02:25.591Z"
},
{
"url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/neko/neko-1.0.0-2.tar.gz",
@@ -434,7 +442,7 @@
"version": "1.0.0-2",
"checksum": "e021d99669b163b006e1fda4d18a751853204985e0f0e69321cebc0e2e8e6affd833cfa5201889f403f1940eeb4a6dd091fcb3b55e1191dce11fdac27f9d3963",
"size": 1387,
- "createdAt": "2024-09-12T01:01:03.287Z"
+ "createdAt": "2024-09-20T01:02:25.591Z"
},
{
"url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/neko/neko-1.0.0-1.tar.gz",
@@ -442,7 +450,7 @@
"version": "1.0.0-1",
"checksum": "eb8e2ec09ab2746bb4681cc2b421388e88365bdf53b349f768a68185eb52901b75b58c4e49ec75c4dcddf09490f05d26fc081bc26de98df6830dc483e3edba7c",
"size": 1405,
- "createdAt": "2024-09-12T01:01:03.287Z"
+ "createdAt": "2024-09-20T01:02:25.591Z"
},
{
"url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/neko/neko-1.0.0.tar.gz",
@@ -450,7 +458,7 @@
"version": "1.0.0",
"checksum": "92b1ed74950a16d24d57b010c6b4574f4a742f501fed0b01393526a65b414840978045d6a3fdaee153c3b4759d173919640013e2205a2c2a40c61604b4cd70a3",
"size": 1406,
- "createdAt": "2024-09-12T01:01:03.287Z"
+ "createdAt": "2024-09-20T01:02:25.592Z"
}
]
},
@@ -471,17 +479,25 @@
},
"license": "AGPL-3.0-or-later",
"licenseURL": "https://spdx.org/licenses/AGPL-3.0-or-later.html",
- "lastUpdated": "2024-09-12T01:02:14.686Z",
+ "lastUpdated": "2024-09-20T01:03:32.841Z",
"readmeFileName": "README.md",
"readmeFileURL": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/waifu.pics/README.md",
"tarballs": [
+ {
+ "url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/waifu.pics/waifu.pics-1.0.0-1.tar.gz",
+ "basename": "waifu.pics-1.0.0-1.tar.gz",
+ "version": "1.0.0-1",
+ "checksum": "3863a51c34dfabd7ff7f9ff6708783b4262dcb80d81f6fd4730ca9160d2904cf182ec892b802bab6585cb84a9b70cc29099405ed0b667c35d0cb047df32148c5",
+ "size": 2038,
+ "createdAt": "2024-09-20T01:02:25.592Z"
+ },
{
"url": "https://raw.githubusercontent.com/onesoft-sudo/sudobot/main/extensions/.extbuilds/waifu.pics/waifu.pics-1.0.0.tar.gz",
"basename": "waifu.pics-1.0.0.tar.gz",
"version": "1.0.0",
"checksum": "55efd9e6137a08ec6117b50c9f91fec489a834c491206b3361ae127569273d3b7f2180228b9df1da9d3330b42c5dc1e75f5c5c47cb45e084b9368bc7ad8004e6",
"size": 2050,
- "createdAt": "2024-09-12T01:01:03.287Z"
+ "createdAt": "2024-09-20T01:02:25.592Z"
}
]
}
diff --git a/extensions/.extbuilds/neko/neko-1.0.0-54.tar.gz b/extensions/.extbuilds/neko/neko-1.0.0-54.tar.gz
new file mode 100644
index 000000000..7faeafdbd
Binary files /dev/null and b/extensions/.extbuilds/neko/neko-1.0.0-54.tar.gz differ
diff --git a/extensions/.extbuilds/waifu.pics/waifu.pics-1.0.0-1.tar.gz b/extensions/.extbuilds/waifu.pics/waifu.pics-1.0.0-1.tar.gz
new file mode 100644
index 000000000..e8d4ec290
Binary files /dev/null and b/extensions/.extbuilds/waifu.pics/waifu.pics-1.0.0-1.tar.gz differ
diff --git a/package.json b/package.json
index 65b84dc67..7ed48f48b 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "sudobot",
- "version": "10.14.3",
+ "version": "10.15.0",
"description": "A Discord bot for moderation purposes.",
"author": {
"name": "Ar Rakin",
@@ -78,7 +78,7 @@
"cors": "^2.8.5",
"date-fns": "^3.6.0",
"deepmerge": "^4.3.1",
- "discord.js": "^14.16.1",
+ "discord.js": "^14.16.2",
"dot-object": "^2.1.5",
"dotenv": "^16.4.5",
"drizzle-orm": "^0.32.1",
diff --git a/scripts/addlicense b/scripts/addlicense
new file mode 100755
index 000000000..be42efdea
--- /dev/null
+++ b/scripts/addlicense
@@ -0,0 +1,430 @@
+#!/bin/sh
+#
+# addlicense -- a script to insert license comments automatically
+#
+# This script is part of OSN Commons. Copyright (C) 2024 OSN Developers.
+#
+# OSN Commons is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# OSN Commons is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with OSN Commons. If not, see .
+#
+
+me=$0
+canonical_name=$(echo $me | rev | cut -d'/' -f1 | rev)
+
+if [ $(echo $me | cut -c1) = "/" ]; then
+ me=$canonical_name
+fi
+
+version="1.0.0"
+
+usage() {
+ echo "Usage: $me [options...] [[directory...] | [-]]"
+ echo "Automatically insert license comments to the project's "
+ echo "source files."
+ echo ""
+ echo "Options:"
+ echo " -e, --exclude Add an exclusion pattern"
+ echo " -i, --include Add an inclusion pattern"
+ echo " -E, --exclude-file Exclude a file path"
+ echo " -I, --include-file Include a file path"
+ echo " -h, --help Show this help and exit"
+ echo " -v, --version Show version info and exit"
+ echo " -f, --file Specify a file containing the license"
+ echo " notice to insert"
+ echo ""
+ echo "Bug reports and general questions should be sent to "
+ echo "."
+ exit 0
+}
+
+show_version() {
+ echo "$canonical_name (OSN Commons) v$version"
+ echo ""
+ echo "Copyright (C) 2024 OSN Developers."
+ echo "License GPLv3+: GNU GPL version 3 or later ."
+ echo "This is free software: you are free to change and redistribute it."
+ echo "There is NO WARRANTY, to the extent permitted by law."
+ echo ""
+ echo "Written by Ar Rakin."
+ exit 0
+}
+
+trim_string() {
+ echo "$1" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//'
+}
+
+targets=""
+exclpats=""
+inclpats=""
+exclfiles=""
+inclfiles=""
+license_notice_file=""
+license_notice="/*
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */"
+stdin_read=""
+
+while [ $# -gt 0 ]; do
+ case "$1" in
+ -h | --help)
+ usage
+ ;;
+
+ -v | --version)
+ show_version
+ ;;
+
+ -e | --exclude)
+ if [ -z "$2" ]; then
+ echo "$me: option requires an argument -- '$1'" >&2
+ echo "Try '$me --help' for more detailed information." >&2
+ exit 2
+ fi
+
+ if [ "$2" != "$(echo "$2" | tr -d ':')" ]; then
+ echo "$me: exclusion patterns must not contain colons (':')" >&2
+ exit 2
+ fi
+
+ if [ -z "$exclpats" ]; then
+ exclpats="$2"
+ else
+ exclpats="$exclpats:$2"
+ fi
+
+ shift
+ ;;
+
+ -i | --include)
+ if [ -z "$2" ]; then
+ echo "$me: option requires an argument -- '$1'" >&2
+ echo "Try '$me --help' for more detailed information." >&2
+ exit 2
+ fi
+
+ if [ "$2" != "$(echo "$2" | tr -d ':')" ]; then
+ echo "$me: inclusion patterns must not contain colons (':')" >&2
+ exit 2
+ fi
+
+ if [ -z "$inclpats" ]; then
+ inclpats="$2"
+ else
+ inclpats="$inclpats:$2"
+ fi
+
+ shift
+ ;;
+
+ -E | --exclude-file)
+ if [ -z "$2" ]; then
+ echo "$me: option requires an argument -- '$1'" >&2
+ echo "Try '$me --help' for more detailed information." >&2
+ exit 2
+ fi
+
+ if [ "$2" != "$(echo "$2" | tr -d ':')" ]; then
+ echo "$me: file paths must not contain colons (':')" >&2
+ exit 2
+ fi
+
+ if [ ! -e "$2" ]; then
+ echo "$me: $2: No such file or directory" >&2
+ exit 2
+ fi
+
+ file=$(readlink -f "$2")
+
+ if [ $? -ne 0 ]; then
+ echo "$me: $2: Ignoring" >&2
+ else
+ if [ -z "$exclfiles" ]; then
+ exclfiles="$file"
+ else
+ exclfiles="$exclfiles:$file"
+ fi
+ fi
+
+ shift
+ ;;
+
+ -I | --include-file)
+ if [ -z "$2" ]; then
+ echo "$me: option requires an argument -- '$1'" >&2
+ echo "Try '$me --help' for more detailed information." >&2
+ exit 2
+ fi
+
+ if [ "$2" != "$(echo "$2" | tr -d ':')" ]; then
+ echo "$me: file paths must not contain colons (':')" >&2
+ exit 2
+ fi
+
+ if [ ! -e "$2" ]; then
+ echo "$me: $2: No such file or directory" >&2
+ exit 2
+ fi
+
+ file=$(readlink -f "$2")
+
+ if [ $? -ne 0 ]; then
+ echo "$me: $2: Ignoring" >&2
+ else
+ if [ -z "$inclfiles" ]; then
+ inclfiles="$file"
+ else
+ inclfiles="$inclfiles:$file"
+ fi
+ fi
+
+ shift
+ ;;
+
+ -f | --file)
+ if [ -z "$2" ]; then
+ echo "$me: option requires an argument -- '$1'" >&2
+ echo "Try '$me --help' for more detailed information." >&2
+ exit 2
+ fi
+
+ if [ "$2" = "-" ]; then
+ if [ -t 0 ]; then
+ echo "$me: nothing to read from standard input" >&2
+ exit 2
+ fi
+
+ if [ ! -z "$stdin_read" ] && [ "$stdin_read" != "notice" ]; then
+ echo "$me: multiple options are being directed to standard input" >&2
+ exit 2
+ fi
+
+ license_notice="$(
+ cat
+ echo E
+ )"
+ stdin_read="notice"
+ else
+ if [ ! -f "$2" ]; then
+ echo "$me: $2: No such file or directory" >&2
+ exit 2
+ fi
+
+ license_notice_file="$2"
+ license_notice="$(
+ cat "$2"
+ echo E
+ )"
+ fi
+
+ license_notice=${license_notice%E}
+ shift
+ ;;
+
+ -)
+ if [ -t 0 ]; then
+ echo "$me: nothing to read from standard input" >&2
+ exit 2
+ fi
+
+ if [ ! -z "$stdin_read" ] && [ "$stdin_read" != "targets" ]; then
+ echo "$me: multiple options are being directed to standard input" >&2
+ exit 2
+ fi
+
+ while IFS='' read -r line; do
+ if [ "$line" != "$(echo "$line" | tr -d ':')" ] || [ -z "$line" ]; then
+ echo "$me: target paths must not contain colons (':')" >&2
+ exit 2
+ fi
+
+ if [ -z "$targets" ]; then
+ targets="$line"
+ else
+ targets="$targets:$line"
+ fi
+ done
+
+ stdin_read="targets"
+ ;;
+
+ -*)
+ echo "$me: Invalid option -- '$1'" >&2
+ echo "Try '$me --help' for more detailed information." >&2
+ exit 2
+ ;;
+
+ *)
+ if [ "$1" != "$(echo "$1" | tr -d ':')" ] || [ -z "$1" ]; then
+ echo "$me: target paths must not contain colons (':')" >&2
+ exit 2
+ fi
+
+ if [ -z "$targets" ]; then
+ targets="$1"
+ else
+ targets="$targets:$1"
+ fi
+ ;;
+ esac
+
+ shift
+done
+
+if [ -z "$targets" ]; then
+ echo "$me: No target operands specified" >&2
+ echo "Try '$me --help' for more detailed information" >&2
+ exit 2
+fi
+
+success=0
+
+insert_license() {
+ set -e
+ local file="$1"
+ local tmpfile="$(mktemp)"
+
+ echo "$license_notice" >$tmpfile
+ cat $file >>$tmpfile
+ mv $tmpfile $file
+ set +e
+}
+
+process_files() {
+ echo "$targets" | while IFS=':' read -r target; do
+ local stat_out=$(stat "$target" 2>&1)
+
+ if [ $? -ne 0 ]; then
+ echo "$me: $(echo $stat_out | cut -c 7-)" >&2
+ continue
+ fi
+
+ echo "$me: scanning: $target"
+ local find_cmd="find '$target' -type f ! -path \"*/*~\" \
+ ! -path \"*/.git/*\" ! -path \"*/.svn/*\" \
+ ! -path \"*/.hg/*\" ! -path \"*/CVS/*\" \
+ ! -path \"*/.bzr/*\" ! -path \"$me\""
+
+ if [ ! -z "$exclpats" ]; then
+ local ifs="$IFS"
+
+ IFS=":"
+
+ for exclpat in $exclpats; do
+ find_cmd="$find_cmd ! -path \"$exclpat\""
+ done
+
+ IFS="$ifs"
+ fi
+
+ if [ ! -z "$inclpats" ]; then
+ local ifs="$IFS"
+
+ IFS=":"
+
+ for inclpat in $inclpats; do
+ find_cmd="$find_cmd -path \"$inclpat\""
+ done
+
+ IFS="$ifs"
+ fi
+
+ local files=$(eval $find_cmd)
+
+ if [ -z "$files" ]; then
+ echo "$me: no files found" >&2
+ continue
+ fi
+
+ local r_license_notice_file
+
+ if [ ! -z "$license_notice_file" ]; then
+ r_license_notice_file=$(readlink -f "$license_notice_file")
+ fi
+
+ for file in $files; do
+ local rpath=$(readlink -f "$file")
+
+ if [ ! -z "$license_notice_file" ] && [ "$rpath" = "$r_license_notice_file" ]; then
+ continue
+ fi
+
+ if [ ! -z "$exclfiles" ]; then
+ local ifs="$IFS"
+
+ IFS=":"
+
+ for exclfile in $exclfiles; do
+ if [ "$rpath" = "$exclfile" ]; then
+ continue 2
+ fi
+ done
+
+ IFS="$ifs"
+ fi
+
+ if [ ! -z "$inclfiles" ]; then
+ local ifs="$IFS"
+
+ IFS=":"
+
+ for inclfile in $inclfiles; do
+ if [ "$rpath" = "$inclfile" ]; then
+ break
+ fi
+ done
+
+ if [ "$rpath" != "$inclfile" ]; then
+ continue
+ fi
+
+ IFS="$ifs"
+ fi
+
+ if file "$file" -b | grep -Eq 'binary|ELF|executable|data'; then
+ echo "$me: skipping binary/data file: $file"
+ continue
+ fi
+
+ local license_notice_size=$(echo "$license_notice" | wc -c)
+ local part=$(sed ':a; /^$/d; $!{N; ba}; s/^[[:space:]]*//' $file | head -c $license_notice_size)
+
+ if [ "$license_notice" = "$part" ]; then
+ echo "$me: license notice already present in: $file"
+ success=1
+ continue
+ fi
+
+ echo "$me: inserting license comment to: $file"
+ insert_license "$file"
+ done
+
+ success=1
+ done
+}
+
+process_files
+
+if [ $success -ne 1 ]; then
+ exit 1
+fi
diff --git a/src/framework/resources/.gitignore b/src/framework/resources/.gitignore
index d0c4753de..53e62f399 100644
--- a/src/framework/resources/.gitignore
+++ b/src/framework/resources/.gitignore
@@ -1 +1 @@
-.noresource
\ No newline at end of file
+.noresource
diff --git a/src/framework/typescript/api/APIServer.ts b/src/framework/typescript/api/APIServer.ts
index 4e9e11a9d..34efd73c7 100644
--- a/src/framework/typescript/api/APIServer.ts
+++ b/src/framework/typescript/api/APIServer.ts
@@ -1,7 +1,7 @@
-/**
+/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2023 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -32,7 +32,7 @@ import path from "path";
import { Logger } from "../log/Logger";
import { Name } from "../services/Name";
import { Service } from "../services/Service";
-import { RouteMetadata, RouteMetadataEntry } from "./RouteMetadata";
+import { RouteMetadata } from "./RouteMetadata";
import Controller from "./http/Controller";
import Response from "./http/Response";
@@ -70,7 +70,7 @@ export default class APIServer extends Service {
.systemConfig.api.enabled
) {
await this.setup();
- await this.start();
+ this.start();
}
}
@@ -115,9 +115,11 @@ export default class APIServer extends Service {
key: string,
alternativeKey: string
): T | null {
- return Symbol.metadata in controllerClass && controllerClass[Symbol.metadata]
- ? controllerClass[Symbol.metadata]?.[alternativeKey]
- : Reflect.getMetadata(key, controllerClass.prototype);
+ return (
+ Symbol.metadata in controllerClass && controllerClass[Symbol.metadata]
+ ? controllerClass[Symbol.metadata]?.[alternativeKey]
+ : Reflect.getMetadata(key, controllerClass.prototype)
+ ) as T | null;
}
public loadController(
@@ -153,9 +155,8 @@ export default class APIServer extends Service {
for (const callbackName in actions) {
for (const method in actions[callbackName]) {
- const data = actions[callbackName][
- method as keyof (typeof actions)[keyof typeof actions]
- ] as RouteMetadataEntry | null;
+ const data =
+ actions[callbackName][method as keyof (typeof actions)[keyof typeof actions]];
if (!data) {
continue;
@@ -226,7 +227,13 @@ export default class APIServer extends Service {
};
}
- private onError(err: unknown, _: ExpressRequest, res: ExpressResponse, next: NextFunction) {
+ private onError(
+ this: void,
+ err: unknown,
+ _: ExpressRequest,
+ res: ExpressResponse,
+ next: NextFunction
+ ) {
if (err instanceof SyntaxError && "status" in err && err.status === 400 && "body" in err) {
res.status(400).json({
error: "Invalid JSON payload"
@@ -238,7 +245,7 @@ export default class APIServer extends Service {
next();
}
- public async start() {
+ public start() {
this.expressServer = this.expressApp.listen(this.port, () =>
this.application.logger.info(`API server is listening at port ${this.port}`)
);
diff --git a/src/framework/typescript/api/RouteMetadata.ts b/src/framework/typescript/api/RouteMetadata.ts
index d224a2ff2..0f8e3d1b3 100644
--- a/src/framework/typescript/api/RouteMetadata.ts
+++ b/src/framework/typescript/api/RouteMetadata.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2023 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
diff --git a/src/framework/typescript/api/decorators/Action.ts b/src/framework/typescript/api/decorators/Action.ts
index 61494adc0..911306609 100644
--- a/src/framework/typescript/api/decorators/Action.ts
+++ b/src/framework/typescript/api/decorators/Action.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2023 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -40,10 +40,10 @@ export function Action(
descriptor?: PropertyDescriptor
) => {
if (typeof contextOrMethodName === "string") {
- const metadata: Record = Reflect.getMetadata(
+ const metadata: Record = (Reflect.getMetadata(
"action_methods",
originalMethodOrTarget as object
- ) ?? {
+ ) as Record | undefined) ?? {
[contextOrMethodName]: {
GET: null,
DELETE: null,
@@ -62,20 +62,20 @@ export function Action(
} as RouteMetadata;
const data = {
- handler: descriptor!.value,
+ handler: descriptor!.value as AnyFunction,
method,
path: uri,
middleware: middleware as AnyFunction[]
};
- metadata[contextOrMethodName]![method] ??= data;
- metadata[contextOrMethodName]![method]!.handler ??= data.handler;
- metadata[contextOrMethodName]![method]!.method ??= data.method;
+ metadata[contextOrMethodName][method] ??= data;
+ metadata[contextOrMethodName][method].handler ??= data.handler;
+ metadata[contextOrMethodName][method].method ??= data.method;
- if (metadata[contextOrMethodName]![method]!.middleware?.length) {
- metadata[contextOrMethodName]![method]!.middleware.push(...data.middleware);
+ if (metadata[contextOrMethodName][method].middleware?.length) {
+ metadata[contextOrMethodName][method].middleware.push(...data.middleware);
} else {
- metadata[contextOrMethodName]![method]!.middleware = data.middleware;
+ metadata[contextOrMethodName][method].middleware = data.middleware;
}
Reflect.defineMetadata("action_methods", metadata, originalMethodOrTarget as object);
@@ -107,14 +107,14 @@ export function Action(
middleware: middleware as AnyFunction[]
};
- metadata[key]![method] ??= data;
- metadata[key]![method]!.handler ??= data.handler;
- metadata[key]![method]!.method ??= data.method;
+ metadata[key][method] ??= data;
+ metadata[key][method].handler ??= data.handler;
+ metadata[key][method].method ??= data.method;
- if (metadata[key]![method]!.middleware?.length) {
- metadata[key]![method]!.middleware.push(...data.middleware);
+ if (metadata[key][method].middleware?.length) {
+ metadata[key][method].middleware.push(...data.middleware);
} else {
- metadata[key]![method]!.middleware = data.middleware;
+ metadata[key][method].middleware = data.middleware;
}
(contextOrMethodName.metadata as unknown) ??= {};
diff --git a/src/framework/typescript/api/decorators/EnableAdminAccessControl.ts b/src/framework/typescript/api/decorators/EnableAdminAccessControl.ts
index a22768def..3e2172bb3 100644
--- a/src/framework/typescript/api/decorators/EnableAdminAccessControl.ts
+++ b/src/framework/typescript/api/decorators/EnableAdminAccessControl.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2023 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -30,7 +30,9 @@ export function EnableAdminAccessControl() {
) => {
if (typeof contextOrMethodName === "string") {
const metadata =
- Reflect.getMetadata("aac_middleware", originalMethodOrTarget as object) ?? {};
+ (Reflect.getMetadata("aac_middleware", originalMethodOrTarget as object) as
+ | Record
+ | undefined) ?? {};
const middleware = (
application: Application,
req: Request,
diff --git a/src/framework/typescript/api/decorators/EnableGuildAccessControl.ts b/src/framework/typescript/api/decorators/EnableGuildAccessControl.ts
index 5e2afd591..e3221f469 100644
--- a/src/framework/typescript/api/decorators/EnableGuildAccessControl.ts
+++ b/src/framework/typescript/api/decorators/EnableGuildAccessControl.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2023 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -30,7 +30,9 @@ export function EnableGuildAccessControl() {
) => {
if (typeof contextOrMethodName === "string") {
const metadata =
- Reflect.getMetadata("gac_middleware", originalMethodOrTarget as object) ?? {};
+ (Reflect.getMetadata("gac_middleware", originalMethodOrTarget as object) as
+ | Record
+ | undefined) ?? {};
const middleware = (
application: Application,
req: Request,
diff --git a/src/framework/typescript/api/decorators/GatewayEventListener.ts b/src/framework/typescript/api/decorators/GatewayEventListener.ts
index 027a53acf..2f29093f3 100644
--- a/src/framework/typescript/api/decorators/GatewayEventListener.ts
+++ b/src/framework/typescript/api/decorators/GatewayEventListener.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2023 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -32,7 +32,9 @@ export function GatewayEventListener(event: keyof ClientEvents | "raw") {
) => {
if (typeof contextOrMethodName === "string") {
const metadata =
- Reflect.getMetadata("event_listeners", originalMethodOrTarget as object) ?? [];
+ (Reflect.getMetadata("event_listeners", originalMethodOrTarget as object) as
+ | Record[]
+ | undefined) ?? [];
metadata.push({
event,
diff --git a/src/framework/typescript/api/decorators/RequireAuth.ts b/src/framework/typescript/api/decorators/RequireAuth.ts
index c5dcb086f..44e430417 100644
--- a/src/framework/typescript/api/decorators/RequireAuth.ts
+++ b/src/framework/typescript/api/decorators/RequireAuth.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2023 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -30,7 +30,9 @@ export function RequireAuth(fetchUser = true) {
) => {
if (typeof contextOrMethodName === "string") {
const metadata =
- Reflect.getMetadata("auth_middleware", originalMethodOrTarget as object) ?? {};
+ (Reflect.getMetadata("auth_middleware", originalMethodOrTarget as object) as
+ | Record
+ | undefined) ?? {};
const middleware = (
application: Application,
req: Request,
diff --git a/src/framework/typescript/api/decorators/SuppressErrors.ts b/src/framework/typescript/api/decorators/SuppressErrors.ts
index c63b91039..0159cf898 100644
--- a/src/framework/typescript/api/decorators/SuppressErrors.ts
+++ b/src/framework/typescript/api/decorators/SuppressErrors.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2023 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
diff --git a/src/framework/typescript/api/decorators/Validate.ts b/src/framework/typescript/api/decorators/Validate.ts
index a28135519..28361eaf3 100644
--- a/src/framework/typescript/api/decorators/Validate.ts
+++ b/src/framework/typescript/api/decorators/Validate.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2023 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -30,8 +30,9 @@ export function Validate(schema: ZodSchema) {
) => {
if (typeof contextOrMethodName === "string") {
const metadata =
- Reflect.getMetadata("validation_middleware", originalMethodOrTarget as object) ??
- {};
+ (Reflect.getMetadata("validation_middleware", originalMethodOrTarget as object) as
+ | Record
+ | undefined) ?? {};
const middleware = (
_application: Application,
req: Request,
diff --git a/src/framework/typescript/api/http/Controller.ts b/src/framework/typescript/api/http/Controller.ts
index d7cce5f58..142bec74f 100644
--- a/src/framework/typescript/api/http/Controller.ts
+++ b/src/framework/typescript/api/http/Controller.ts
@@ -1,7 +1,7 @@
-/**
+/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2023 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
diff --git a/src/framework/typescript/api/http/Request.ts b/src/framework/typescript/api/http/Request.ts
index 527ada864..5741b8cd0 100644
--- a/src/framework/typescript/api/http/Request.ts
+++ b/src/framework/typescript/api/http/Request.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2023 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
diff --git a/src/framework/typescript/api/http/Response.ts b/src/framework/typescript/api/http/Response.ts
index 17ac1db07..8838ab8d5 100644
--- a/src/framework/typescript/api/http/Response.ts
+++ b/src/framework/typescript/api/http/Response.ts
@@ -1,7 +1,7 @@
-/**
+/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2023 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
diff --git a/src/framework/typescript/api/middleware/AdminAccessControl.ts b/src/framework/typescript/api/middleware/AdminAccessControl.ts
index 145849cf7..c909a9443 100644
--- a/src/framework/typescript/api/middleware/AdminAccessControl.ts
+++ b/src/framework/typescript/api/middleware/AdminAccessControl.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2023 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -23,7 +23,7 @@ import type Request from "../http/Request";
// FIXME
const ROOT_USER_ID = 1;
-export default async function AdminAccessControl(
+export default function AdminAccessControl(
request: Request,
response: Response,
next: NextFunction
diff --git a/src/framework/typescript/api/middleware/GuildAccessControl.ts b/src/framework/typescript/api/middleware/GuildAccessControl.ts
index b6f9fa8df..efdec763f 100644
--- a/src/framework/typescript/api/middleware/GuildAccessControl.ts
+++ b/src/framework/typescript/api/middleware/GuildAccessControl.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2023 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -21,7 +21,7 @@ import { APIErrorCode } from "@main/types/APIErrorCode";
import type { NextFunction, Response } from "express";
import type Request from "../http/Request";
-export default async function GuildAccessControl(
+export default function GuildAccessControl(
request: Request,
response: Response,
next: NextFunction
diff --git a/src/framework/typescript/api/middleware/RequireAuthMiddleware.ts b/src/framework/typescript/api/middleware/RequireAuthMiddleware.ts
index 74ed74176..a8bc0eae0 100644
--- a/src/framework/typescript/api/middleware/RequireAuthMiddleware.ts
+++ b/src/framework/typescript/api/middleware/RequireAuthMiddleware.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2023 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -53,7 +53,7 @@ export default async function RequireAuthMiddleware(
}
try {
- const info = jwt.verify(token, process.env.JWT_SECRET!, {
+ const info = jwt.verify(token, process.env.JWT_SECRET, {
issuer: process.env.JWT_ISSUER ?? "SudoBot",
complete: true
});
diff --git a/src/framework/typescript/api/middleware/ValidateMiddleware.ts b/src/framework/typescript/api/middleware/ValidateMiddleware.ts
index 4aafc522d..eda915351 100644
--- a/src/framework/typescript/api/middleware/ValidateMiddleware.ts
+++ b/src/framework/typescript/api/middleware/ValidateMiddleware.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2023 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -29,7 +29,7 @@ export default async function ValidateMiddleware(
next: NextFunction
) {
try {
- const parsedBody = await schema.parseAsync(request.body);
+ const parsedBody = (await schema.parseAsync(request.body)) as Record;
request.parsedBody = parsedBody;
next();
} catch (e) {
diff --git a/src/framework/typescript/app/Application.ts b/src/framework/typescript/app/Application.ts
index da1105c72..37606651a 100644
--- a/src/framework/typescript/app/Application.ts
+++ b/src/framework/typescript/app/Application.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -188,9 +188,7 @@ class Application {
return this.service(name, error);
}
- /**
- * An alias of Application#getServiceByName.
- */
+
public service(name: N, error = true): ServiceRecord[N] {
const service = this.serviceManager.getServiceByName(name);
diff --git a/src/framework/typescript/arguments/Argument.ts b/src/framework/typescript/arguments/Argument.ts
index 5c13a7d67..b4c71a95e 100644
--- a/src/framework/typescript/arguments/Argument.ts
+++ b/src/framework/typescript/arguments/Argument.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -69,12 +69,7 @@ export default abstract class Argument implements ArgumentInterface
return this;
}
- /**
- * This method is used to validate the argument string, before transformation.
- *
- * @returns {Awaitable} Whether the argument is valid.
- * @throws {InvalidArgumentError} If the argument is invalid.
- */
+
public validate(): Awaitable {
return true;
}
@@ -131,12 +126,7 @@ export default abstract class Argument implements ArgumentInterface
return this;
}
- /**
- * This method is used to validate the argument after transformation.
- *
- * @returns {Awaitable} Whether the argument is valid.
- * @throws {InvalidArgumentError} If the argument is invalid.
- */
+
public postTransformValidation(): Awaitable {
return true;
}
@@ -146,7 +136,7 @@ export default abstract class Argument implements ArgumentInterface
}
public getValue() {
- return this.transformedValue!;
+ return this.transformedValue;
}
protected error(
diff --git a/src/framework/typescript/arguments/ArgumentInterface.ts b/src/framework/typescript/arguments/ArgumentInterface.ts
index 366ca929d..5e3b41db4 100644
--- a/src/framework/typescript/arguments/ArgumentInterface.ts
+++ b/src/framework/typescript/arguments/ArgumentInterface.ts
@@ -1,21 +1,21 @@
/*
-* This file is part of SudoBot.
-*
-* Copyright (C) 2021-2024 OSN Developers.
-*
-* SudoBot is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Affero General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* SudoBot is distributed in the hope that it will be useful, but
-* WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU Affero General Public License for more details.
-*
-* You should have received a copy of the GNU Affero General Public License
-* along with SudoBot. If not, see .
-*/
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
export interface ArgumentInterface {
toString(): string;
diff --git a/src/framework/typescript/arguments/ArgumentParser.ts b/src/framework/typescript/arguments/ArgumentParser.ts
index 76a21d9d5..e740621eb 100644
--- a/src/framework/typescript/arguments/ArgumentParser.ts
+++ b/src/framework/typescript/arguments/ArgumentParser.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -16,6 +16,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with SudoBot. If not, see .
*/
+
import "reflect-metadata";
import Application from "@framework/app/Application";
@@ -267,7 +268,7 @@ class ArgumentParser {
if (context.isLegacy()) {
while (context.args[state.argIndex]?.startsWith("-")) {
- const { error, silent, errorType } = await this.parseOption({
+ const { error, silent, errorType } = this.parseOption({
context,
schema,
state
@@ -291,9 +292,12 @@ class ArgumentParser {
subcommandName = context.args[state.argIndex++];
}
- const onSubcommandNotFoundHandler =
- command.onSubcommandNotFound?.bind(command) ??
- Reflect.getMetadata("command:subcommand_not_found_error", command.constructor);
+ const onSubcommandNotFoundHandler = (command.onSubcommandNotFound?.bind(command) ??
+ Reflect.getMetadata("command:subcommand_not_found_error", command.constructor)) as (
+ context: ArgumentParserContext,
+ subcommandName: string | undefined,
+ type: "not_found" | "not_specified"
+ ) => Promise | void;
if (!subcommandName) {
if (typeof onSubcommandNotFoundHandler === "function") {
@@ -457,7 +461,7 @@ class ArgumentParser {
state: ParserGlobalState;
command: Command;
}>): Promise<
- CommonResult<{ name: string; value: null | unknown }> & {
+ CommonResult<{ name: string; value: unknown }> & {
abortParsingDefinitions?: boolean;
errorTypeForwarded?: ErrorType;
}
@@ -471,7 +475,7 @@ class ArgumentParser {
assert(definition.names.length > 0, "No names provided");
} else if (context.isLegacy() && context.args[state.argIndex]?.startsWith("-")) {
while (context.args[state.argIndex]?.startsWith("-")) {
- const { error, silent } = await this.parseOption({
+ const { error, silent } = this.parseOption({
context,
schema,
state
@@ -555,7 +559,7 @@ class ArgumentParser {
};
}
- public async parseOption({
+ public parseOption({
context,
schema,
state
@@ -563,7 +567,7 @@ class ArgumentParser {
state: ParserGlobalState;
}> & {
context: LegacyContext;
- }): Promise & { silent?: boolean }> {
+ }): CommonResult & { silent?: boolean } {
if (!schema.options) {
return {
error: "Options are not allowed",
@@ -741,7 +745,7 @@ class ArgumentParser {
};
} catch (error) {
return {
- error: error instanceof Error ? error.message : `${error}`
+ error: error instanceof Error ? error.message : `${error as string}`
};
}
}
diff --git a/src/framework/typescript/arguments/ArgumentTypes.ts b/src/framework/typescript/arguments/ArgumentTypes.ts
index a4cb542f3..61e410db6 100644
--- a/src/framework/typescript/arguments/ArgumentTypes.ts
+++ b/src/framework/typescript/arguments/ArgumentTypes.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
diff --git a/src/framework/typescript/arguments/ChannelArgument.ts b/src/framework/typescript/arguments/ChannelArgument.ts
index 2384a30c8..23c2f4f91 100644
--- a/src/framework/typescript/arguments/ChannelArgument.ts
+++ b/src/framework/typescript/arguments/ChannelArgument.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
diff --git a/src/framework/typescript/arguments/DurationArgument.ts b/src/framework/typescript/arguments/DurationArgument.ts
index d2b298aa4..557e4a5bb 100644
--- a/src/framework/typescript/arguments/DurationArgument.ts
+++ b/src/framework/typescript/arguments/DurationArgument.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -31,7 +31,7 @@ class DurationArgument extends Argument {
};
public override toString(): string {
- return this.stringValue!.toString();
+ return this.stringValue.toString();
}
public override validate(): boolean {
@@ -40,7 +40,7 @@ class DurationArgument extends Argument {
public override transform(): Duration {
try {
- return Duration.fromDurationStringExpression(this.stringValue!);
+ return Duration.fromDurationStringExpression(this.stringValue);
} catch (error) {
if (error instanceof DurationParseError) {
return this.error(error.message, ErrorType.InvalidType);
@@ -53,7 +53,7 @@ class DurationArgument extends Argument {
public override postTransformValidation(): boolean {
const durationValue =
typeof this.transformedValue === "number"
- ? this.transformedValue!
+ ? this.transformedValue
: this.transformedValue.toMilliseconds();
if (this.rules?.["range:min"] && durationValue < this.rules?.["range:min"]) {
@@ -76,7 +76,7 @@ class DurationArgument extends Argument {
return this.error(`${this.name} is required!`, ErrorType.Required);
}
try {
- return Duration.fromDurationStringExpression(value!);
+ return Duration.fromDurationStringExpression(value);
} catch (error) {
if (error instanceof DurationParseError) {
return this.error(error.message, ErrorType.InvalidType);
diff --git a/src/framework/typescript/arguments/DynamicArguments.ts b/src/framework/typescript/arguments/DynamicArguments.ts
index 61ade9510..983b953d3 100644
--- a/src/framework/typescript/arguments/DynamicArguments.ts
+++ b/src/framework/typescript/arguments/DynamicArguments.ts
@@ -1,21 +1,21 @@
/*
-* This file is part of SudoBot.
-*
-* Copyright (C) 2021-2024 OSN Developers.
-*
-* SudoBot is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Affero General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* SudoBot is distributed in the hope that it will be useful, but
-* WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU Affero General Public License for more details.
-*
-* You should have received a copy of the GNU Affero General Public License
-* along with SudoBot. If not, see .
-*/
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
export function DynamicArguments(target: object, _propertyKey?: unknown, _descriptor?: unknown) {
Reflect.defineMetadata("command:dynamic", true, target);
diff --git a/src/framework/typescript/arguments/EntityArgument.ts b/src/framework/typescript/arguments/EntityArgument.ts
index 65971f6b1..f217cc56b 100644
--- a/src/framework/typescript/arguments/EntityArgument.ts
+++ b/src/framework/typescript/arguments/EntityArgument.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -28,7 +28,7 @@ abstract class EntityArgument<
protected readonly mentionStart: string[] = [];
public override toString(): string {
- return this.stringValue!.toString();
+ return this.stringValue.toString();
}
public toSnowflake(): Snowflake {
@@ -41,7 +41,7 @@ abstract class EntityArgument<
}
}
- return snowflake as Snowflake;
+ return snowflake;
}
public override validate(): boolean {
diff --git a/src/framework/typescript/arguments/GuildMemberArgument.ts b/src/framework/typescript/arguments/GuildMemberArgument.ts
index ac641c3d7..e712ed97d 100644
--- a/src/framework/typescript/arguments/GuildMemberArgument.ts
+++ b/src/framework/typescript/arguments/GuildMemberArgument.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
diff --git a/src/framework/typescript/arguments/IntegerArgument.ts b/src/framework/typescript/arguments/IntegerArgument.ts
index 89ab9b49e..b27783d8e 100644
--- a/src/framework/typescript/arguments/IntegerArgument.ts
+++ b/src/framework/typescript/arguments/IntegerArgument.ts
@@ -1,21 +1,21 @@
/*
-* This file is part of SudoBot.
-*
-* Copyright (C) 2021-2024 OSN Developers.
-*
-* SudoBot is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Affero General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* SudoBot is distributed in the hope that it will be useful, but
-* WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU Affero General Public License for more details.
-*
-* You should have received a copy of the GNU Affero General Public License
-* along with SudoBot. If not, see .
-*/
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
import type { Awaitable, ChatInputCommandInteraction } from "discord.js";
import { ErrorType } from "./InvalidArgumentError";
diff --git a/src/framework/typescript/arguments/InvalidArgumentError.ts b/src/framework/typescript/arguments/InvalidArgumentError.ts
index cbe5eae6e..291fb2a44 100644
--- a/src/framework/typescript/arguments/InvalidArgumentError.ts
+++ b/src/framework/typescript/arguments/InvalidArgumentError.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
diff --git a/src/framework/typescript/arguments/NumberArgument.ts b/src/framework/typescript/arguments/NumberArgument.ts
index 732a2d86d..31e917c31 100644
--- a/src/framework/typescript/arguments/NumberArgument.ts
+++ b/src/framework/typescript/arguments/NumberArgument.ts
@@ -1,21 +1,21 @@
/*
-* This file is part of SudoBot.
-*
-* Copyright (C) 2021-2024 OSN Developers.
-*
-* SudoBot is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Affero General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* SudoBot is distributed in the hope that it will be useful, but
-* WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU Affero General Public License for more details.
-*
-* You should have received a copy of the GNU Affero General Public License
-* along with SudoBot. If not, see .
-*/
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
import type { Awaitable, ChatInputCommandInteraction } from "discord.js";
import Argument from "./Argument";
@@ -23,7 +23,7 @@ import { ErrorType } from "./InvalidArgumentError";
class NumberArgument extends Argument {
public override toString(): string {
- return this.stringValue!.toString();
+ return this.stringValue.toString();
}
public override validate(): boolean {
@@ -35,15 +35,15 @@ class NumberArgument extends Argument {
}
public override postTransformValidation(): boolean {
- if (isNaN(this.transformedValue!)) {
+ if (isNaN(this.transformedValue)) {
return this.error("Number must be a valid number", ErrorType.InvalidType);
}
- if (this.rules?.["range:min"] && this.transformedValue! < this.rules?.["range:min"]) {
+ if (this.rules?.["range:min"] && this.transformedValue < this.rules?.["range:min"]) {
return this.error("Number is too small", ErrorType.InvalidRange);
}
- if (this.rules?.["range:max"] && this.transformedValue! > this.rules?.["range:max"]) {
+ if (this.rules?.["range:max"] && this.transformedValue > this.rules?.["range:max"]) {
return this.error("Number is too large", ErrorType.InvalidRange);
}
diff --git a/src/framework/typescript/arguments/ParserConfigError.ts b/src/framework/typescript/arguments/ParserConfigError.ts
index 1c5ab4cb4..f113d4d16 100644
--- a/src/framework/typescript/arguments/ParserConfigError.ts
+++ b/src/framework/typescript/arguments/ParserConfigError.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
class ParserConfigError extends Error {
public constructor(message: string) {
super(message + "\nThis is a bug. If you're not a developer, you should report this.");
diff --git a/src/framework/typescript/arguments/RestStringArgument.ts b/src/framework/typescript/arguments/RestStringArgument.ts
index c72df2cec..a49478dd1 100644
--- a/src/framework/typescript/arguments/RestStringArgument.ts
+++ b/src/framework/typescript/arguments/RestStringArgument.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -52,14 +52,14 @@ class RestStringArgument extends Argument {
if (
this.rules?.["range:min"] &&
- this.transformedValue!.length < this.rules?.["range:min"]
+ this.transformedValue.length < this.rules?.["range:min"]
) {
return this.error("String is too short", ErrorType.InvalidRange);
}
if (
this.rules?.["range:max"] &&
- this.transformedValue!.length > this.rules?.["range:max"]
+ this.transformedValue.length > this.rules?.["range:max"]
) {
return this.error("String is too long", ErrorType.InvalidRange);
}
diff --git a/src/framework/typescript/arguments/RoleArgument.ts b/src/framework/typescript/arguments/RoleArgument.ts
index c8931c1ad..6daed63c4 100644
--- a/src/framework/typescript/arguments/RoleArgument.ts
+++ b/src/framework/typescript/arguments/RoleArgument.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
diff --git a/src/framework/typescript/arguments/StringArgument.ts b/src/framework/typescript/arguments/StringArgument.ts
index a76805492..bfd27516d 100644
--- a/src/framework/typescript/arguments/StringArgument.ts
+++ b/src/framework/typescript/arguments/StringArgument.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -27,7 +27,7 @@ class StringArgument extends Argument {
}
public override validate(): boolean {
- if (!this.stringValue!.length) {
+ if (!this.stringValue.length) {
return this.error("String cannot be empty", ErrorType.InvalidType);
}
@@ -41,14 +41,14 @@ class StringArgument extends Argument {
public override postTransformValidation(): Awaitable {
if (
this.rules?.["range:min"] &&
- this.transformedValue!.length < this.rules?.["range:min"]
+ this.transformedValue.length < this.rules?.["range:min"]
) {
return this.error("String is too short", ErrorType.InvalidRange);
}
if (
this.rules?.["range:max"] &&
- this.transformedValue!.length > this.rules?.["range:max"]
+ this.transformedValue.length > this.rules?.["range:max"]
) {
return this.error("String is too long", ErrorType.InvalidRange);
}
diff --git a/src/framework/typescript/arguments/SubcommandErrorMessage.ts b/src/framework/typescript/arguments/SubcommandErrorMessage.ts
index 036cfe955..4090866af 100644
--- a/src/framework/typescript/arguments/SubcommandErrorMessage.ts
+++ b/src/framework/typescript/arguments/SubcommandErrorMessage.ts
@@ -1,21 +1,21 @@
/*
-* This file is part of SudoBot.
-*
-* Copyright (C) 2021-2024 OSN Developers.
-*
-* SudoBot is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Affero General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* SudoBot is distributed in the hope that it will be useful, but
-* WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU Affero General Public License for more details.
-*
-* You should have received a copy of the GNU Affero General Public License
-* along with SudoBot. If not, see .
-*/
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
import type { Command } from "../commands/Command";
import type Context from "../commands/Context";
diff --git a/src/framework/typescript/arguments/UserArgument.ts b/src/framework/typescript/arguments/UserArgument.ts
index af2e0f524..b8f20a51c 100644
--- a/src/framework/typescript/arguments/UserArgument.ts
+++ b/src/framework/typescript/arguments/UserArgument.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
diff --git a/src/framework/typescript/cache/CacheUtil.ts b/src/framework/typescript/cache/CacheUtil.ts
index 1fb6db9c8..9d0031f5f 100644
--- a/src/framework/typescript/cache/CacheUtil.ts
+++ b/src/framework/typescript/cache/CacheUtil.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -39,7 +39,7 @@ export const cache = (
fn: F,
options?: CacheOptions
): ReturnValue => {
- const callback = ((...args: unknown[]) => {
+ const callback = ((...args: unknown[]): unknown => {
const finalId = [...args, id].join("_");
if (!data.has(finalId)) {
@@ -61,9 +61,11 @@ export const cache = (
}) as unknown as F;
if (options?.invoke) {
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
return callback() as ReturnValue;
}
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
return callback as ReturnValue;
};
@@ -78,9 +80,11 @@ export const memoize = (fn: F) => {
return (...args: Parameters): ReturnType => {
const key = args.join("_");
if (cache.has(key)) {
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
return cache.get(key)!;
}
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
return fn(...(args as unknown[]));
};
};
diff --git a/src/framework/typescript/cache/GlobalStore.ts b/src/framework/typescript/cache/GlobalStore.ts
index 3df43b50c..90ecf8e5d 100644
--- a/src/framework/typescript/cache/GlobalStore.ts
+++ b/src/framework/typescript/cache/GlobalStore.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -48,6 +48,7 @@ type Dependency = string | number | boolean | undefined | null | object;
const store = new Collection>();
+// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
export const get = (key: K): CacheValue | undefined => {
const data = store.get(key);
@@ -64,6 +65,7 @@ export const get = (key: K): CacheValue | undefined => {
export const set = async (
key: K,
+ // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
value: CacheValue | (() => Awaitable>),
options?: CacheOptions
): Promise => {
@@ -78,14 +80,16 @@ export const set = async (
change = true;
} else {
if (!options?.dependencyCheckDeep) {
- for (const index in options.dependencies) {
- if (existing.dependencies![index] !== options.dependencies[index]) {
+ options.dependencies.every((dep, index) => {
+ if (existing.dependencies?.[index] !== options.dependencies?.[index]) {
change = true;
- break;
+ return false;
}
- }
+
+ return true;
+ });
} else {
- change = !isDeepStrictEqual(existing.dependencies!, options.dependencies!);
+ change = !isDeepStrictEqual(existing.dependencies, options.dependencies);
}
}
} else {
diff --git a/src/framework/typescript/cache/GuildStore.ts b/src/framework/typescript/cache/GuildStore.ts
index 050924bb6..712b663d8 100644
--- a/src/framework/typescript/cache/GuildStore.ts
+++ b/src/framework/typescript/cache/GuildStore.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import type { Snowflake } from "discord.js";
import { Collection } from "discord.js";
import type { ReadonlyCollection } from "../collections/ReadonlyCollection";
diff --git a/src/framework/typescript/client/BaseClient.ts b/src/framework/typescript/client/BaseClient.ts
index a7d41bbb5..ef5c66c4d 100644
--- a/src/framework/typescript/client/BaseClient.ts
+++ b/src/framework/typescript/client/BaseClient.ts
@@ -1,7 +1,7 @@
-/**
+/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2023 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
diff --git a/src/framework/typescript/cluster/FeatureFlagManager.ts b/src/framework/typescript/cluster/FeatureFlagManager.ts
index 0b0722c5c..8b9c59c13 100644
--- a/src/framework/typescript/cluster/FeatureFlagManager.ts
+++ b/src/framework/typescript/cluster/FeatureFlagManager.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import type { Bootable } from "@framework/contracts/Bootable";
import { HasApplication } from "@framework/types/HasApplication";
import axios from "axios";
diff --git a/src/framework/typescript/collections/FluentIterator.ts b/src/framework/typescript/collections/FluentIterator.ts
index e5e26b6c3..7aeb095b2 100644
--- a/src/framework/typescript/collections/FluentIterator.ts
+++ b/src/framework/typescript/collections/FluentIterator.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
class FluentIterator {
public static slice(data: Iterable, offset: number, limit?: number): Array;
public static slice(data: Iterable, limit: number): Array;
diff --git a/src/framework/typescript/collections/FluentSet.ts b/src/framework/typescript/collections/FluentSet.ts
index 5bb990068..6294dbe98 100644
--- a/src/framework/typescript/collections/FluentSet.ts
+++ b/src/framework/typescript/collections/FluentSet.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
diff --git a/src/framework/typescript/collections/ReadonlyCollection.ts b/src/framework/typescript/collections/ReadonlyCollection.ts
index 250517b77..7e6e882de 100644
--- a/src/framework/typescript/collections/ReadonlyCollection.ts
+++ b/src/framework/typescript/collections/ReadonlyCollection.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import type { Collection } from "discord.js";
export type ReadonlyCollection = Omit, "set" | "delete" | "clear" | "sweep">;
diff --git a/src/framework/typescript/commands/AbstractRootCommand.ts b/src/framework/typescript/commands/AbstractRootCommand.ts
index c69f33a38..da19b8bf8 100644
--- a/src/framework/typescript/commands/AbstractRootCommand.ts
+++ b/src/framework/typescript/commands/AbstractRootCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { Command } from "@framework/commands/Command";
abstract class AbstractRootCommand extends Command {
diff --git a/src/framework/typescript/commands/Command.ts b/src/framework/typescript/commands/Command.ts
index e482eda42..7efb5d4fa 100644
--- a/src/framework/typescript/commands/Command.ts
+++ b/src/framework/typescript/commands/Command.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -28,7 +28,12 @@ import type {
Snowflake,
User
} from "discord.js";
-import { ApplicationCommandType, ContextMenuCommandBuilder, SlashCommandBuilder } from "discord.js";
+import {
+ ApplicationCommandType,
+ ContextMenuCommandBuilder,
+ InteractionContextType,
+ SlashCommandBuilder
+} from "discord.js";
import type Application from "../app/Application";
import type Argument from "../arguments/Argument";
import type ArgumentParser from "../arguments/ArgumentParser";
@@ -81,36 +86,17 @@ export type CommandGuardLike = GuardLike | typeof Guard;
export type CommandPermissionLike = PermissionLike | PermissionsString | typeof Permission;
export type PlainPermissionResolvable = PermissionsString | bigint;
-/**
- * Represents an abstract command.
- * @template T - The type of context the command supports.
- */
abstract class Command
implements Builder
{
- /**
- * The name of the command.
- */
public abstract readonly name: string;
- /**
- * The group of the command.
- */
public group!: string;
- /**
- * The description of the command.
- */
public abstract readonly description: string;
- /**
- * The detailed description of the command.
- */
public readonly detailedDescription?: string;
- /**
- * The aliases of the command.
- */
public readonly aliases: string[] = [];
/**
@@ -364,8 +350,13 @@ abstract class Command,
options?: Record
- ): Promise;
+ ): Awaitable;
/**
* Handles the case when a subcommand is not found.
@@ -620,7 +613,7 @@ abstract class Command.
-*/
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
import type Context from "./Context";
diff --git a/src/framework/typescript/commands/Context.ts b/src/framework/typescript/commands/Context.ts
index e022315eb..85e588a9c 100644
--- a/src/framework/typescript/commands/Context.ts
+++ b/src/framework/typescript/commands/Context.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -78,7 +78,7 @@ abstract class Context {
}
public get channelId(): Snowflake {
- return this.commandMessage.channelId!;
+ return this.commandMessage.channelId;
}
public get channel(): GuildTextBasedChannel {
diff --git a/src/framework/typescript/commands/ContextType.ts b/src/framework/typescript/commands/ContextType.ts
index f6ca4a888..5629c7492 100644
--- a/src/framework/typescript/commands/ContextType.ts
+++ b/src/framework/typescript/commands/ContextType.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
diff --git a/src/framework/typescript/commands/InteractionContext.ts b/src/framework/typescript/commands/InteractionContext.ts
index d2f4cb849..920a8c778 100644
--- a/src/framework/typescript/commands/InteractionContext.ts
+++ b/src/framework/typescript/commands/InteractionContext.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
diff --git a/src/framework/typescript/commands/LegacyContext.ts b/src/framework/typescript/commands/LegacyContext.ts
index 80e9f1231..71cbb4bc0 100644
--- a/src/framework/typescript/commands/LegacyContext.ts
+++ b/src/framework/typescript/commands/LegacyContext.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
diff --git a/src/framework/typescript/concurrent/Condition.ts b/src/framework/typescript/concurrent/Condition.ts
index 2cdb7c946..4bebf5ca0 100644
--- a/src/framework/typescript/concurrent/Condition.ts
+++ b/src/framework/typescript/concurrent/Condition.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { promiseWithResolvers } from "@framework/polyfills/Promise";
class Condition {
diff --git a/src/framework/typescript/concurrent/Mutex.ts b/src/framework/typescript/concurrent/Mutex.ts
index d10fd9e02..7f9d4e0d4 100644
--- a/src/framework/typescript/concurrent/Mutex.ts
+++ b/src/framework/typescript/concurrent/Mutex.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { EventEmitter } from "node:events";
import { promiseWithResolvers } from "../polyfills/Promise";
diff --git a/src/framework/typescript/concurrent/Semaphore.ts b/src/framework/typescript/concurrent/Semaphore.ts
index 6faf5b1dc..3de7d1485 100644
--- a/src/framework/typescript/concurrent/Semaphore.ts
+++ b/src/framework/typescript/concurrent/Semaphore.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import type Condition from "@framework/concurrent/Condition";
import { promiseWithResolvers } from "../polyfills/Promise";
diff --git a/src/framework/typescript/container/Bind.ts b/src/framework/typescript/container/Bind.ts
index 3e171d4b9..048dcb065 100644
--- a/src/framework/typescript/container/Bind.ts
+++ b/src/framework/typescript/container/Bind.ts
@@ -1,21 +1,21 @@
/*
-* This file is part of SudoBot.
-*
-* Copyright (C) 2021-2024 OSN Developers.
-*
-* SudoBot is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Affero General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* SudoBot is distributed in the hope that it will be useful, but
-* WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU Affero General Public License for more details.
-*
-* You should have received a copy of the GNU Affero General Public License
-* along with SudoBot. If not, see .
-*/
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
export default function Bind(name: string) {
return function (constructor: object) {
diff --git a/src/framework/typescript/container/BindToContainer.ts b/src/framework/typescript/container/BindToContainer.ts
index 23eebe0c6..72a44a95c 100644
--- a/src/framework/typescript/container/BindToContainer.ts
+++ b/src/framework/typescript/container/BindToContainer.ts
@@ -1,21 +1,21 @@
/*
-* This file is part of SudoBot.
-*
-* Copyright (C) 2021-2024 OSN Developers.
-*
-* SudoBot is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Affero General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* SudoBot is distributed in the hope that it will be useful, but
-* WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU Affero General Public License for more details.
-*
-* You should have received a copy of the GNU Affero General Public License
-* along with SudoBot. If not, see .
-*/
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
import CanBind from "./CanBind";
import type { AnyConstructor, ContainerBindOptions as DIBindOptions } from "./Container";
diff --git a/src/framework/typescript/container/CanBind.ts b/src/framework/typescript/container/CanBind.ts
index b73a1173f..967b34d51 100644
--- a/src/framework/typescript/container/CanBind.ts
+++ b/src/framework/typescript/container/CanBind.ts
@@ -1,21 +1,21 @@
/*
-* This file is part of SudoBot.
-*
-* Copyright (C) 2021-2024 OSN Developers.
-*
-* SudoBot is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Affero General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* SudoBot is distributed in the hope that it will be useful, but
-* WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU Affero General Public License for more details.
-*
-* You should have received a copy of the GNU Affero General Public License
-* along with SudoBot. If not, see .
-*/
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
export default function CanBind<
// eslint-disable-next-line @typescript-eslint/no-explicit-any
diff --git a/src/framework/typescript/container/Container.ts b/src/framework/typescript/container/Container.ts
index 2bb967057..41f13f67c 100644
--- a/src/framework/typescript/container/Container.ts
+++ b/src/framework/typescript/container/Container.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -40,12 +40,6 @@ export type ContainerBindOptions = {
export type Resolved = InstanceType;
-/**
- * A custom dependency injection container.
- * It allows you to bind classes to a key and resolve them later.
- *
- * @since 9.0.0
- */
class Container {
public static readonly Inject = Inject;
private static instance?: Container;
@@ -54,11 +48,6 @@ class Container {
private constructor() {}
- /**
- * Get the global container instance.
- *
- * @since 9.0.0
- */
public static getInstance() {
if (!Container.instance) {
Container.instance = new Container();
@@ -67,22 +56,10 @@ class Container {
return Container.instance;
}
- /**
- * Destroy the global container instance.
- *
- * @since 9.0.0
- */
public static destroyGlobalContainer() {
Container.instance = undefined;
}
- /**
- * Bind a class to a key.
- *
- * @param key The key to bind the class to.
- * @param value The class to bind.
- * @since 9.0.0
- */
public bind(value: T, options?: ContainerBindOptions) {
const key = options?.key ?? value.name;
const binding = {
@@ -92,18 +69,12 @@ class Container {
factory: options?.factory,
singleton: options?.singleton ?? false
};
- this.bindingsByName.set(key as string, binding as Binding);
+ this.bindingsByName.set(key, binding as Binding);
this.bindingsByConstructor.set(value, binding as Binding);
}
- /**
- * Resolve a class by its key.
- *
- * @param key The key to resolve.
- * @since 9.0.0
- */
public resolve(key: string): Resolved {
- const binding = this.bindingsByName.get(key as string);
+ const binding = this.bindingsByName.get(key);
if (!binding) {
throw new Error(`No binding found for key: ${key}`);
@@ -112,12 +83,6 @@ class Container {
return this.resolveBinding(binding) as Resolved;
}
- /**
- * Resolve a class by its constructor.
- *
- * @param value The constructor to resolve.
- * @since 9.0.0
- */
public resolveByClass(
value: T,
args?: ConstructorParameters,
@@ -181,13 +146,13 @@ class Container {
const constructorParamTypes = Reflect.getMetadata("design:paramtypes", value) as
| AnyConstructor[]
| undefined;
- const bindAs = Reflect.getMetadata("di:bind_as", value);
+ const bindAs = Reflect.getMetadata("di:bind_as", value) as string | undefined;
let instance: InstanceType;
if (!constructorParamTypes || args) {
instance = new (value as unknown as new (...args: unknown[]) => InstanceType)(
...(args ?? [])
- ) as InstanceType;
+ );
} else {
const resolvedParams = constructorParamTypes.map(paramType =>
this.resolveByClass(paramType)
@@ -195,7 +160,7 @@ class Container {
instance = new (value as unknown as new (...args: unknown[]) => InstanceType)(
...resolvedParams
- ) as InstanceType;
+ );
}
if (bindAs) {
@@ -241,7 +206,12 @@ class Container {
instance?: InstanceType
): InstanceType {
const finalInstance = instance ?? this.resolveByClass(value);
- const injections = Reflect.getMetadata("di:inject", value.prototype) || [];
+ const injections =
+ (Reflect.getMetadata("di:inject", value.prototype as object) as {
+ key: string;
+ name: string;
+ ref: T;
+ }[]) || [];
for (const injection of injections) {
if ((finalInstance as Record)[injection.key]) {
@@ -256,7 +226,7 @@ class Container {
injection.ref ??
Reflect.getMetadata(
"design:type",
- value.prototype,
+ value.prototype as object,
injection.key
),
"Cannot determine the type of property to inject"
diff --git a/src/framework/typescript/container/Inject.ts b/src/framework/typescript/container/Inject.ts
index 9d0933ebc..682e41c02 100644
--- a/src/framework/typescript/container/Inject.ts
+++ b/src/framework/typescript/container/Inject.ts
@@ -1,27 +1,32 @@
/*
-* This file is part of SudoBot.
-*
-* Copyright (C) 2021-2024 OSN Developers.
-*
-* SudoBot is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Affero General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* SudoBot is distributed in the hope that it will be useful, but
-* WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU Affero General Public License for more details.
-*
-* You should have received a copy of the GNU Affero General Public License
-* along with SudoBot. If not, see .
-*/
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
import type { AnyConstructor } from "./Container";
export function Inject(ref?: R | string) {
return (target: object, key: string | symbol, _descriptor?: PropertyDescriptor) => {
- const injections = Reflect.getMetadata("di:inject", target) || [];
+ const injections =
+ (Reflect.getMetadata("di:inject", target) as {
+ key: string | symbol;
+ name: string | null;
+ ref: R | null | undefined;
+ }[]) || [];
injections.push({
key,
diff --git a/src/framework/typescript/container/InjectOnCall.ts b/src/framework/typescript/container/InjectOnCall.ts
index 53096a4b8..67a335b56 100644
--- a/src/framework/typescript/container/InjectOnCall.ts
+++ b/src/framework/typescript/container/InjectOnCall.ts
@@ -1,21 +1,21 @@
/*
-* This file is part of SudoBot.
-*
-* Copyright (C) 2021-2024 OSN Developers.
-*
-* SudoBot is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Affero General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* SudoBot is distributed in the hope that it will be useful, but
-* WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU Affero General Public License for more details.
-*
-* You should have received a copy of the GNU Affero General Public License
-* along with SudoBot. If not, see .
-*/
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
export function InjectOnCall(
target: object,
diff --git a/src/framework/typescript/contracts/BehavesLikePrimitive.ts b/src/framework/typescript/contracts/BehavesLikePrimitive.ts
index 88cd2283d..f75ed5bc5 100644
--- a/src/framework/typescript/contracts/BehavesLikePrimitive.ts
+++ b/src/framework/typescript/contracts/BehavesLikePrimitive.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
export interface BehavesLikePrimitive {
[Symbol.toPrimitive]: (hint: "string" | "number" | "default") => string | number;
}
\ No newline at end of file
diff --git a/src/framework/typescript/contracts/Bootable.ts b/src/framework/typescript/contracts/Bootable.ts
index 2bec4c788..d4ff508b6 100644
--- a/src/framework/typescript/contracts/Bootable.ts
+++ b/src/framework/typescript/contracts/Bootable.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import type { Awaitable } from "discord.js";
export interface Bootable {
diff --git a/src/framework/typescript/contracts/CommandManagerServiceInterface.ts b/src/framework/typescript/contracts/CommandManagerServiceInterface.ts
index b68d565c0..706a9bf1e 100644
--- a/src/framework/typescript/contracts/CommandManagerServiceInterface.ts
+++ b/src/framework/typescript/contracts/CommandManagerServiceInterface.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import type ArgumentParser from "@framework/arguments/ArgumentParser";
import type { Command } from "@framework/commands/Command";
import type CommandRateLimiterContract from "@framework/contracts/CommandRateLimiterContract";
diff --git a/src/framework/typescript/contracts/CommandRateLimiterContract.ts b/src/framework/typescript/contracts/CommandRateLimiterContract.ts
index cd2643f07..730264a49 100644
--- a/src/framework/typescript/contracts/CommandRateLimiterContract.ts
+++ b/src/framework/typescript/contracts/CommandRateLimiterContract.ts
@@ -1,11 +1,30 @@
-import type { Snowflake } from "discord.js";
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
+import type { Awaitable, Snowflake } from "discord.js";
interface CommandRateLimiterContract {
isRateLimitedWithHit(
commandName: string,
guildId: Snowflake,
userId: Snowflake
- ): Promise;
+ ): Awaitable;
}
export default CommandRateLimiterContract;
diff --git a/src/framework/typescript/contracts/ConfigurationManagerServiceInterface.ts b/src/framework/typescript/contracts/ConfigurationManagerServiceInterface.ts
index 997dd8675..522d1f58b 100644
--- a/src/framework/typescript/contracts/ConfigurationManagerServiceInterface.ts
+++ b/src/framework/typescript/contracts/ConfigurationManagerServiceInterface.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
export interface ConfigurationManagerServiceInterface {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
config: Record | undefined>;
diff --git a/src/framework/typescript/contracts/JSONSerializable.ts b/src/framework/typescript/contracts/JSONSerializable.ts
index 88630019e..8c0f9b7ad 100644
--- a/src/framework/typescript/contracts/JSONSerializable.ts
+++ b/src/framework/typescript/contracts/JSONSerializable.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
export interface JSONSerializable {
toJSON(): T;
}
\ No newline at end of file
diff --git a/src/framework/typescript/contracts/PermissionManagerInterface.ts b/src/framework/typescript/contracts/PermissionManagerInterface.ts
index 93f375ae6..96c4e91ae 100644
--- a/src/framework/typescript/contracts/PermissionManagerInterface.ts
+++ b/src/framework/typescript/contracts/PermissionManagerInterface.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import type { Awaitable, GuildMember, PermissionsString } from "discord.js";
import type FluentSet from "../collections/FluentSet";
import type {
diff --git a/src/framework/typescript/contracts/PermissionManagerServiceInterface.ts b/src/framework/typescript/contracts/PermissionManagerServiceInterface.ts
index 072c178d7..8ca3db2f8 100644
--- a/src/framework/typescript/contracts/PermissionManagerServiceInterface.ts
+++ b/src/framework/typescript/contracts/PermissionManagerServiceInterface.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import type { Awaitable, Collection, GuildMember } from "discord.js";
import type {
SystemPermissionLikeString,
diff --git a/src/framework/typescript/core/DiscordKernelClassInterface.ts b/src/framework/typescript/core/DiscordKernelClassInterface.ts
index 47f1f5733..18447b116 100644
--- a/src/framework/typescript/core/DiscordKernelClassInterface.ts
+++ b/src/framework/typescript/core/DiscordKernelClassInterface.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
export interface DiscordKernelClassInterface {
services: string[];
aliases: Record;
diff --git a/src/framework/typescript/core/Kernel.ts b/src/framework/typescript/core/Kernel.ts
index 9368975ea..03d73cee2 100644
--- a/src/framework/typescript/core/Kernel.ts
+++ b/src/framework/typescript/core/Kernel.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
diff --git a/src/framework/typescript/core/KernelInterface.ts b/src/framework/typescript/core/KernelInterface.ts
index 179ffa46f..7077cfb2d 100644
--- a/src/framework/typescript/core/KernelInterface.ts
+++ b/src/framework/typescript/core/KernelInterface.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
diff --git a/src/framework/typescript/database/Enum.ts b/src/framework/typescript/database/Enum.ts
index 5231ab29b..00637ae43 100644
--- a/src/framework/typescript/database/Enum.ts
+++ b/src/framework/typescript/database/Enum.ts
@@ -1,7 +1,26 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { pgEnum as drizzlePgEnum } from "drizzle-orm/pg-core";
export function enumToPgEnum>(target: T) {
- return Object.values(target).map((value: unknown) => `${value}`) as [
+ return Object.values(target).map((value: unknown) => `${value as string}`) as [
T[keyof T],
...T[keyof T][]
];
diff --git a/src/framework/typescript/datetime/Duration.ts b/src/framework/typescript/datetime/Duration.ts
index 668b4d48d..da42dc9a3 100644
--- a/src/framework/typescript/datetime/Duration.ts
+++ b/src/framework/typescript/datetime/Duration.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { BehavesLikePrimitive } from "@framework/contracts/BehavesLikePrimitive";
import { JSONSerializable } from "@framework/contracts/JSONSerializable";
import DurationParseError from "@framework/datetime/DurationParseError";
@@ -277,11 +296,7 @@ class Duration implements BehavesLikePrimitive, JSONSerializable {
return Date.now() - this.toMilliseconds();
}
- /**
- * Formats the duration into a human-readable string.
- *
- * @returns The formatted duration.
- */
+
public format(): string {
let formatted = formatDuration(this);
@@ -292,19 +307,10 @@ class Duration implements BehavesLikePrimitive, JSONSerializable {
return formatted;
}
- /**
- * Formats the duration for Discord.
- *
- * @returns The formatted duration.
- */
+
public formatForDiscord(): ``;
- /**
- * Formats the duration for Discord with a style.
- *
- * @param style The style to format the duration with.
- * @returns The formatted duration.
- */
+
public formatForDiscord
(style: S): ``;
public formatForDiscord(style?: S) {
@@ -315,35 +321,19 @@ class Duration implements BehavesLikePrimitive, JSONSerializable {
return time(this.fromNow(), style);
}
- /**
- * Returns a string representation of the duration.
- *
- * @returns The formatted duration.
- */
+
@Override
public toString() {
return this.format();
}
- /**
- * Returns the JSON representation of the duration.
- *
- * @returns A number representing the duration in milliseconds.
- */
+
@Override
public toJSON(): number {
return this.toMilliseconds();
}
- /**
- * Converts the duration to a string or number.
- * Cannot use @Override annotation here because of a bug
- * in Bun interpreter.
- *
- * @param hint The hint to convert the duration to.
- * @returns The duration as a string or number.
- * @override
- */
+
public [Symbol.toPrimitive](hint: "string" | "number" | "default") {
if (hint === "number") {
return this.toMilliseconds();
diff --git a/src/framework/typescript/datetime/DurationParseError.ts b/src/framework/typescript/datetime/DurationParseError.ts
index dd3009f40..e8a429be4 100644
--- a/src/framework/typescript/datetime/DurationParseError.ts
+++ b/src/framework/typescript/datetime/DurationParseError.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
class DurationParseError extends Error {
public override readonly name = "DurationParseError";
}
diff --git a/src/framework/typescript/decorators/Override.ts b/src/framework/typescript/decorators/Override.ts
index c0460cc70..25fe0ba6b 100644
--- a/src/framework/typescript/decorators/Override.ts
+++ b/src/framework/typescript/decorators/Override.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
export function Override(
_target: object,
_propertyKey: string | symbol,
diff --git a/src/framework/typescript/directives/Directive.ts b/src/framework/typescript/directives/Directive.ts
index f078df8f2..d3a2109a3 100644
--- a/src/framework/typescript/directives/Directive.ts
+++ b/src/framework/typescript/directives/Directive.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import type DirectiveParser from "@framework/directives/DirectiveParser";
import type { Awaitable } from "discord.js";
diff --git a/src/framework/typescript/directives/DirectiveParseError.ts b/src/framework/typescript/directives/DirectiveParseError.ts
index 4bf7b810c..a9fc2499e 100644
--- a/src/framework/typescript/directives/DirectiveParseError.ts
+++ b/src/framework/typescript/directives/DirectiveParseError.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
class DirectiveParseError extends Error {}
export default DirectiveParseError;
diff --git a/src/framework/typescript/directives/DirectiveParser.ts b/src/framework/typescript/directives/DirectiveParser.ts
index 2f02219c2..c3ddfd24b 100644
--- a/src/framework/typescript/directives/DirectiveParser.ts
+++ b/src/framework/typescript/directives/DirectiveParser.ts
@@ -1,7 +1,26 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import type Directive from "@framework/directives/Directive";
+import DirectiveParseError from "@framework/directives/DirectiveParseError";
import type { Class } from "@framework/types/Utils";
import { isAlpha } from "@framework/utils/string";
-import DirectiveParseError from "@framework/directives/DirectiveParseError";
import JSON5 from "json5";
class DirectiveParser {
@@ -49,12 +68,15 @@ class DirectiveParser {
let length = 0;
try {
- const { json, length: computedLength, str } = this.getNextJSON5Literal(sliced, name);
+ const {
+ json,
+ length: computedLength,
+ str
+ } = this.getNextJSON5Literal(sliced, name);
arg = json;
length = computedLength;
state.currentArgument = str;
- }
- catch (error) {
+ } catch (error) {
if (!silent) {
throw error;
}
@@ -80,14 +102,11 @@ class DirectiveParser {
depth++;
} else if (input[end] === "}") {
depth--;
- }
- else if (input[end] === undefined) {
+ } else if (input[end] === undefined) {
throw new DirectiveParseError("Unexpected end of input");
- }
- else if (input[end] === "\"") {
- end = input.indexOf("\"", end + 1);
- }
- else if (input[end] === "'") {
+ } else if (input[end] === '"') {
+ end = input.indexOf('"', end + 1);
+ } else if (input[end] === "'") {
end = input.indexOf("'", end + 1);
}
@@ -102,15 +121,17 @@ class DirectiveParser {
try {
return {
- json: JSON5.parse(str),
+ json: JSON5.parse>(str),
length: str.length,
str
};
- }
- catch (error) {
- throw new DirectiveParseError("Failed to parse JSON5 literal in directive: " + directiveName, {
- cause: error
- });
+ } catch (error) {
+ throw new DirectiveParseError(
+ "Failed to parse JSON5 literal in directive: " + directiveName,
+ {
+ cause: error
+ }
+ );
}
}
}
diff --git a/src/framework/typescript/env/Environment.ts b/src/framework/typescript/env/Environment.ts
index 9d922838e..8547a6d83 100644
--- a/src/framework/typescript/env/Environment.ts
+++ b/src/framework/typescript/env/Environment.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import type { z, ZodSchema } from "zod";
class Environment {
@@ -21,14 +40,8 @@ class Environment {
return process.env;
}
- /**
- * Parse environment variables using a Zod schema.
- *
- * @param schema The Zod schema to use.
- * @returns The parsed environment variables.
- * @throws {z.ZodError} If the environment variables do not match the schema.
- */
public static parseVariables(schema: T): z.infer {
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
return schema.parse(this.variables());
}
}
diff --git a/src/framework/typescript/errors/APIErrors.ts b/src/framework/typescript/errors/APIErrors.ts
index ae6e3dc3a..4ecb8a497 100644
--- a/src/framework/typescript/errors/APIErrors.ts
+++ b/src/framework/typescript/errors/APIErrors.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { DiscordAPIErrorMessage } from "@framework/errors/DiscordAPIErrorMessage";
class APIErrors {
diff --git a/src/framework/typescript/errors/DiscordAPIErrorMessage.ts b/src/framework/typescript/errors/DiscordAPIErrorMessage.ts
index 53f923654..181cba273 100644
--- a/src/framework/typescript/errors/DiscordAPIErrorMessage.ts
+++ b/src/framework/typescript/errors/DiscordAPIErrorMessage.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
export const DiscordAPIErrorMessage = {
0: "Unknown error occurred",
10001: "Unknown account",
diff --git a/src/framework/typescript/events/EventListener.ts b/src/framework/typescript/events/EventListener.ts
index b7fee75ce..07dbcd7f4 100644
--- a/src/framework/typescript/events/EventListener.ts
+++ b/src/framework/typescript/events/EventListener.ts
@@ -1,7 +1,7 @@
-/**
+/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2023 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -24,7 +24,7 @@ import { ClientEvents } from "../types/ClientEvents";
@CanBind
export default abstract class EventListener<
- K extends keyof ClientEvents | string = keyof ClientEvents,
+ K extends keyof ClientEvents = keyof ClientEvents,
C extends BaseClient = BaseClient
> {
public abstract readonly name: K;
diff --git a/src/framework/typescript/events/GatewayEventListener.ts b/src/framework/typescript/events/GatewayEventListener.ts
index 56ff5948b..a726cfe51 100644
--- a/src/framework/typescript/events/GatewayEventListener.ts
+++ b/src/framework/typescript/events/GatewayEventListener.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2023 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -32,7 +32,10 @@ export function GatewayEventListener(event: keyof ClientEvents | "raw") {
) => {
if (typeof contextOrMethodName === "string") {
const metadata =
- Reflect.getMetadata("event_listeners", originalMethodOrTarget as object) ?? [];
+ (Reflect.getMetadata("event_listeners", originalMethodOrTarget as object) as Record<
+ string,
+ unknown
+ >[]) ?? [];
metadata.push({
event,
diff --git a/src/framework/typescript/functions/Callable.ts b/src/framework/typescript/functions/Callable.ts
index 2211b98cc..1dac9c331 100644
--- a/src/framework/typescript/functions/Callable.ts
+++ b/src/framework/typescript/functions/Callable.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
const CallableSymbol = Symbol("Callable");
abstract class Callable extends Function {
@@ -5,7 +24,7 @@ abstract class Callable extends Function {
public constructor() {
super("...args", "return this._invoke(...args)");
- this[CallableSymbol] = this.bind(this);
+ this[CallableSymbol] = this.bind(this) as this;
return this[CallableSymbol];
}
diff --git a/src/framework/typescript/guards/Guard.ts b/src/framework/typescript/guards/Guard.ts
index a0560ee70..d868905c3 100644
--- a/src/framework/typescript/guards/Guard.ts
+++ b/src/framework/typescript/guards/Guard.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
diff --git a/src/framework/typescript/guards/GuardLike.ts b/src/framework/typescript/guards/GuardLike.ts
index 8dd216a18..374004bdb 100644
--- a/src/framework/typescript/guards/GuardLike.ts
+++ b/src/framework/typescript/guards/GuardLike.ts
@@ -1,21 +1,21 @@
/*
-* This file is part of SudoBot.
-*
-* Copyright (C) 2021-2024 OSN Developers.
-*
-* SudoBot is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Affero General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* SudoBot is distributed in the hope that it will be useful, but
-* WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU Affero General Public License for more details.
-*
-* You should have received a copy of the GNU Affero General Public License
-* along with SudoBot. If not, see .
-*/
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
import type { Awaitable } from "discord.js";
import type { Command } from "../commands/Command";
diff --git a/src/framework/typescript/import/ClassLoader.ts b/src/framework/typescript/import/ClassLoader.ts
index c0d04a468..4e9efee74 100644
--- a/src/framework/typescript/import/ClassLoader.ts
+++ b/src/framework/typescript/import/ClassLoader.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2023 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -137,14 +137,6 @@ class ClassLoader {
return null;
}
- /**
- * Load a class from a file.
- *
- * @param resolvable The file to load the class from.
- * @returns {Promise>} The class object.
- * @throws {InvalidClassFileError} If the file is not a TypeScript or JavaScript file.
- * @throws {NoClassDefFoundError} If no class definition is found in the file.
- */
public async loadClass(resolvable: File | string): Promise> {
const classPath = typeof resolvable === "string" ? resolvable : resolvable.path;
@@ -152,7 +144,7 @@ class ClassLoader {
throw new InvalidClassFileError("Class file must be a TypeScript or JavaScript file");
}
- const { default: classObject }: DefaultExport> = await import(classPath);
+ const { default: classObject } = (await import(classPath)) as DefaultExport>;
if (!classObject) {
throw new NoClassDefFoundError("No class definition found in file");
@@ -161,14 +153,6 @@ class ClassLoader {
return classObject;
}
- /**
- * Load all classes from a directory.
- *
- * @param directory The directory to load classes from.
- * @returns {Promise>>} An array of class objects.
- * @throws {InvalidClassFileError} If a file is not a TypeScript or JavaScript file.
- * @throws {NoClassDefFoundError} If no class definition is found in a file.
- */
public async loadClassesFromDirectory(directory: string): Promise>> {
const classFiles = await this.iterateDirectoryRecursively(directory);
const results = [];
@@ -202,8 +186,9 @@ class ClassLoader {
}
public async loadController(filepath: string, router: Router) {
- const { default: ControllerClass }: DefaultExport> =
- await import(filepath);
+ const { default: ControllerClass } = (await import(filepath)) as DefaultExport<
+ Class
+ >;
const controller = Container.getInstance().resolveByClass(ControllerClass);
this.loadEventsFromMetadata(controller, true);
this.application.service("apiServer").loadController(controller, ControllerClass, router);
@@ -223,8 +208,9 @@ class ClassLoader {
}
public async loadEvent(filepath: string) {
- const { default: EventListenerClass }: DefaultExport> =
- await import(filepath);
+ const { default: EventListenerClass } = (await import(filepath)) as DefaultExport<
+ Class
+ >;
const listener = this.getContainer().resolveByClass(EventListenerClass);
await listener.onInitialize?.();
this.application
@@ -246,9 +232,9 @@ class ClassLoader {
}
public async loadPermission(filepath: string) {
- const { default: PermissionClass }: DefaultExport = await import(
- filepath
- );
+ const { default: PermissionClass } = (await import(filepath)) as DefaultExport<
+ typeof Permission
+ >;
const permission = await PermissionClass.getInstance();
this.application.serviceManager
.getServiceByName("permissionManager")
@@ -279,7 +265,7 @@ class ClassLoader {
}
public flattenCommandGroups() {
- const groups = this.configManager.systemConfig.commands.groups;
+ const groups = this.configManager.systemConfig.commands.groups as Record;
const groupNames = Object.keys(groups);
if (groupNames.length === 0) {
@@ -325,8 +311,9 @@ class ClassLoader {
groups: Record | null = null,
commandManager: CommandManagerServiceInterface = this.commandManager
) {
- const { default: CommandClass }: DefaultExport> =
- await import(filepath);
+ const { default: CommandClass } = (await import(filepath)) as DefaultExport<
+ Class
+ >;
await this.loadCommandClass(CommandClass, filepath, loadMetadata, groups, commandManager);
}
@@ -337,7 +324,7 @@ class ClassLoader {
groups: Record | null = null,
commandManager: CommandManagerServiceInterface = this.commandManager
) {
- const canBind = Reflect.hasMetadata("di:can-bind", CommandClass.prototype);
+ const canBind = Reflect.hasMetadata("di:can-bind", CommandClass.prototype as object);
const command = canBind
? this.getContainer().resolveByClass(CommandClass)
: new CommandClass(this.application);
@@ -373,7 +360,7 @@ class ClassLoader {
}
public async loadQueueClass(filepath: string) {
- const { default: QueueClass }: DefaultExport = await import(filepath);
+ const { default: QueueClass } = (await import(filepath)) as DefaultExport;
this.application.service("queueService").register(QueueClass);
this.application.logger.info("Loaded Queue: ", QueueClass.uniqueName);
}
@@ -387,7 +374,7 @@ class ClassLoader {
eventListeners: Reflect.getMetadata(
"event_listeners",
(finalObject as { prototype: object }).prototype
- )
+ ) as EventListenerInfo[]
};
const handlerData =
@@ -398,12 +385,10 @@ class ClassLoader {
listenerInfo.methodName as unknown as keyof typeof object
] as AnyFunction;
const handler = callback.bind(object);
- handlerData[listenerInfo.event as keyof typeof handlerData] ??= [] as AnyFunction[];
- handlerData[listenerInfo.event as keyof typeof handlerData].push(handler);
+ handlerData[listenerInfo.event] ??= [] as AnyFunction[];
+ handlerData[listenerInfo.event].push(handler);
- this.application
- .getClient()
- .addEventListener(listenerInfo.event as keyof ClientEvents, handler);
+ this.application.getClient().addEventListener(listenerInfo.event, handler);
}
this.eventHandlers.set(object, handlerData);
@@ -415,7 +400,7 @@ class ClassLoader {
}
}
- public async unloadEventsFromMetadata(object: object) {
+ public unloadEventsFromMetadata(object: object) {
const handlerData =
this.eventHandlers.get(object) ?? ({} as Record);
let count = 0;
diff --git a/src/framework/typescript/import/ClassLoaderError.ts b/src/framework/typescript/import/ClassLoaderError.ts
index 27c40f7b0..48f5a7435 100644
--- a/src/framework/typescript/import/ClassLoaderError.ts
+++ b/src/framework/typescript/import/ClassLoaderError.ts
@@ -1 +1,20 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
export default abstract class ClassLoaderError extends Error {}
diff --git a/src/framework/typescript/import/InvalidClassFileError.ts b/src/framework/typescript/import/InvalidClassFileError.ts
index 104d8de86..8a7b83373 100644
--- a/src/framework/typescript/import/InvalidClassFileError.ts
+++ b/src/framework/typescript/import/InvalidClassFileError.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import ClassLoaderError from "./ClassLoaderError";
export default class InvalidClassFileError extends ClassLoaderError {}
diff --git a/src/framework/typescript/import/NoClassDefFoundError.ts b/src/framework/typescript/import/NoClassDefFoundError.ts
index a9fa42667..a89180a72 100644
--- a/src/framework/typescript/import/NoClassDefFoundError.ts
+++ b/src/framework/typescript/import/NoClassDefFoundError.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import ClassLoaderError from "./ClassLoaderError";
export default class NoClassDefFoundError extends ClassLoaderError {}
\ No newline at end of file
diff --git a/src/framework/typescript/io/File.ts b/src/framework/typescript/io/File.ts
index eef436f39..22ab027ee 100644
--- a/src/framework/typescript/io/File.ts
+++ b/src/framework/typescript/io/File.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import type { Stats } from "fs";
import {
close,
@@ -75,7 +94,7 @@ export class File implements Disposable, AsyncDisposable {
public async readContents(buffer: boolean = false): Promise {
if (this.cache.handle) {
- return this.cache.handle!.readFile({
+ return this.cache.handle.readFile({
encoding: buffer ? null : "utf8"
});
}
@@ -87,7 +106,7 @@ export class File implements Disposable, AsyncDisposable {
public async readJson(): Promise {
if (this.cache.handle) {
return JSON.parse(
- await this.cache.handle!.readFile({
+ await this.cache.handle.readFile({
encoding: "utf8"
})
) as T;
diff --git a/src/framework/typescript/log/Logger.ts b/src/framework/typescript/log/Logger.ts
index 795fb5bf5..bff914fb4 100644
--- a/src/framework/typescript/log/Logger.ts
+++ b/src/framework/typescript/log/Logger.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2023 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -16,6 +16,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with SudoBot. If not, see .
*/
+
import { isDevelopmentMode } from "@framework/utils/utils";
import chalk from "chalk";
import { EventEmitter } from "events";
@@ -44,21 +45,21 @@ export class Logger {
private readonly name: string,
private readonly logTime: boolean = false
) {
- this.log = this.log.bind(this);
+ (this as unknown as Logger).log = (this as unknown as Logger).log.bind(this);
this.print = this.print.bind(this);
this.colorize = this.colorize.bind(this);
- this.debug = this.debug.bind(this);
+ this.debug = this.debug.bind(this as unknown as void);
this.perfStart = this.perfStart.bind(this);
this.perfEnd = this.perfEnd.bind(this);
- this.perf = this.perf.bind(this);
- this.info = this.info.bind(this);
- this.warn = this.warn.bind(this);
- this.error = this.error.bind(this);
- this.fatal = this.fatal.bind(this);
- this.critical = this.critical.bind(this);
- this.success = this.success.bind(this);
- this.event = this.event.bind(this);
- this.bug = this.bug.bind(this);
+ this.perf = this.perf.bind(this as unknown as void);
+ this.info = this.info.bind(this as unknown as void);
+ this.warn = this.warn.bind(this as unknown as void);
+ this.error = this.error.bind(this as unknown as void);
+ this.fatal = this.fatal.bind(this as unknown as void);
+ this.critical = this.critical.bind(this as unknown as void);
+ this.success = this.success.bind(this as unknown as void);
+ this.event = this.event.bind(this as unknown as void);
+ this.bug = this.bug.bind(this as unknown as void);
}
public on(event: "log", listener: (message: string) => void) {
@@ -76,7 +77,9 @@ export class Logger {
? "warn"
: "error";
const beginning = `${
- this.logTime ? `${chalk.gray(this.formatter.format(new Date()))} ` : ""
+ (this as unknown as Logger).logTime
+ ? `${chalk.gray(this.formatter.format(new Date()))} `
+ : ""
}${this.colorize(`[${this.name}:${levelName}]`, level)}`;
this.print(methodName, beginning, ...args);
@@ -132,16 +135,16 @@ export class Logger {
}
}
- public debug(...args: unknown[]) {
+ public debug(this: void, ...args: unknown[]) {
if (!isDevelopmentMode()) {
return;
}
- this.log(LogLevel.Debug, ...args);
+ (this as unknown as Logger).log(LogLevel.Debug, ...args);
}
- public bug(...args: unknown[]) {
- this.log(LogLevel.Bug, chalk.red("BUG:"), ...args);
+ public bug(this: void, ...args: unknown[]) {
+ (this as unknown as Logger).log(LogLevel.Bug, chalk.red("BUG:"), ...args);
}
public perfStart(id: string, ...args: unknown[]) {
@@ -152,40 +155,40 @@ export class Logger {
this.perf("timeEnd", id, ...args);
}
- private perf(method: "time" | "timeEnd", id: string, ...args: unknown[]) {
+ private perf(this: void, method: "time" | "timeEnd", id: string, ...args: unknown[]) {
if (!isDevelopmentMode()) {
return;
}
console[method](id);
- this.log(LogLevel.Performance, chalk.magenta(id), ...args);
+ (this as unknown as Logger).log(LogLevel.Performance, chalk.magenta(id), ...args);
}
- public info(...args: unknown[]) {
- this.log(LogLevel.Info, ...args);
+ public info(this: void, ...args: unknown[]) {
+ (this as unknown as Logger).log(LogLevel.Info, ...args);
}
- public warn(...args: unknown[]) {
- this.log(LogLevel.Warn, ...args);
+ public warn(this: void, ...args: unknown[]) {
+ (this as unknown as Logger).log(LogLevel.Warn, ...args);
}
- public error(...args: unknown[]) {
- this.log(LogLevel.Error, ...args);
+ public error(this: void, ...args: unknown[]) {
+ (this as unknown as Logger).log(LogLevel.Error, ...args);
}
- public fatal(...args: unknown[]) {
- this.log(LogLevel.Fatal, ...args);
+ public fatal(this: void, ...args: unknown[]) {
+ (this as unknown as Logger).log(LogLevel.Fatal, ...args);
}
- public critical(...args: unknown[]) {
- this.log(LogLevel.Critical, ...args);
+ public critical(this: void, ...args: unknown[]) {
+ (this as unknown as Logger).log(LogLevel.Critical, ...args);
}
- public success(...args: unknown[]) {
- this.log(LogLevel.Success, ...args);
+ public success(this: void, ...args: unknown[]) {
+ (this as unknown as Logger).log(LogLevel.Success, ...args);
}
- public event(...args: unknown[]) {
- this.log(LogLevel.Event, ...args);
+ public event(this: void, ...args: unknown[]) {
+ (this as unknown as Logger).log(LogLevel.Event, ...args);
}
}
diff --git a/src/framework/typescript/pagination/Pagination.ts b/src/framework/typescript/pagination/Pagination.ts
index 0ab567ff4..7a6c44a75 100644
--- a/src/framework/typescript/pagination/Pagination.ts
+++ b/src/framework/typescript/pagination/Pagination.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import Application from "@framework/app/Application";
import type BaseClient from "@framework/client/BaseClient";
import { findEmoji } from "@main/utils/emoji";
@@ -139,7 +158,7 @@ class Pagination {
public setMaxTimeout(timeout: number) {
this._timeout = setTimeout(() => {
this._timeout = undefined;
- this.destroy();
+ this.destroy().catch(Application.current().logger.error);
}, timeout);
return this;
diff --git a/src/framework/typescript/permissions/AbstractPermissionManager.ts b/src/framework/typescript/permissions/AbstractPermissionManager.ts
index 7226d3db1..ded9c82fe 100644
--- a/src/framework/typescript/permissions/AbstractPermissionManager.ts
+++ b/src/framework/typescript/permissions/AbstractPermissionManager.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -47,7 +47,9 @@ abstract class AbstractPermissionManager implements PermissionManagerInterface {
const instance = await Permission.resolve(permission);
if (!instance) {
- this.application.logger.warn(`Permission ${permission} does not exist.`);
+ this.application.logger.warn(
+ `Permission ${permission?.toString()} does not exist.`
+ );
return false;
}
@@ -76,7 +78,9 @@ abstract class AbstractPermissionManager implements PermissionManagerInterface {
: permission;
if (!instance) {
- this.application.logger.debug(`Permission ${permission} does not exist`);
+ this.application.logger.debug(
+ `Permission ${permission?.toString()} does not exist`
+ );
continue;
}
diff --git a/src/framework/typescript/permissions/AbstractPermissionManagerService.ts b/src/framework/typescript/permissions/AbstractPermissionManagerService.ts
index 7f421cb8a..6294c1065 100644
--- a/src/framework/typescript/permissions/AbstractPermissionManagerService.ts
+++ b/src/framework/typescript/permissions/AbstractPermissionManagerService.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -103,7 +103,7 @@ abstract class AbstractPermissionManagerService
return await systemAdminPermission.has(member);
}
- public async canBypassGuildRestrictions(member: GuildMember) {
+ public canBypassGuildRestrictions(member: GuildMember) {
return (
member.guild.ownerId === member.id ||
member.permissions.has(PermissionFlagsBits.Administrator, true)
diff --git a/src/framework/typescript/permissions/Permission.ts b/src/framework/typescript/permissions/Permission.ts
index f47552933..df879750b 100644
--- a/src/framework/typescript/permissions/Permission.ts
+++ b/src/framework/typescript/permissions/Permission.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -27,16 +27,10 @@ import { Singleton } from "../types/Singleton";
import type { SystemPermissionResolvable } from "./AbstractPermissionManagerService";
abstract class Permission extends Singleton {
- /**
- * The name of the permission.
- */
+
protected abstract readonly name: string;
- /**
- * The stringified representation of the object.
- *
- * @returns The name of the permission.
- */
+
public override toString(): string {
return this.name;
}
diff --git a/src/framework/typescript/permissions/PermissionDeniedError.ts b/src/framework/typescript/permissions/PermissionDeniedError.ts
index cd97ca3e3..484f8d8fe 100644
--- a/src/framework/typescript/permissions/PermissionDeniedError.ts
+++ b/src/framework/typescript/permissions/PermissionDeniedError.ts
@@ -1,21 +1,21 @@
/*
-* This file is part of SudoBot.
-*
-* Copyright (C) 2021-2024 OSN Developers.
-*
-* SudoBot is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Affero General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* SudoBot is distributed in the hope that it will be useful, but
-* WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU Affero General Public License for more details.
-*
-* You should have received a copy of the GNU Affero General Public License
-* along with SudoBot. If not, see .
-*/
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
import type { CommandPermissionLike } from "../commands/Command";
@@ -32,11 +32,7 @@ export class PermissionDeniedError extends Error {
}
}
-/**
- * Throws a PermissionDeniedError with the given permissions.
- *
- * @param permissions The permissions that were denied.
- */
+
export const deny = (
permissionsOrError: CommandPermissionLike[] | PermissionDeniedError | string = []
) => {
diff --git a/src/framework/typescript/permissions/PermissionFlag.ts b/src/framework/typescript/permissions/PermissionFlag.ts
index 84cae5613..61879fe7a 100644
--- a/src/framework/typescript/permissions/PermissionFlag.ts
+++ b/src/framework/typescript/permissions/PermissionFlag.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import type { PermissionsString } from "discord.js";
import { PermissionFlagsBits } from "discord.js";
diff --git a/src/framework/typescript/policies/Policy.ts b/src/framework/typescript/policies/Policy.ts
index 39396235e..1dfe96791 100644
--- a/src/framework/typescript/policies/Policy.ts
+++ b/src/framework/typescript/policies/Policy.ts
@@ -1,21 +1,21 @@
/*
-* This file is part of SudoBot.
-*
-* Copyright (C) 2021-2024 OSN Developers.
-*
-* SudoBot is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Affero General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* SudoBot is distributed in the hope that it will be useful, but
-* WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU Affero General Public License for more details.
-*
-* You should have received a copy of the GNU Affero General Public License
-* along with SudoBot. If not, see .
-*/
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
import type { Awaitable, User } from "discord.js";
import type { OptionalRecord } from "../types/OptionalRecord";
diff --git a/src/framework/typescript/polyfills/FileSystem.ts b/src/framework/typescript/polyfills/FileSystem.ts
index 6052661f6..41d184846 100644
--- a/src/framework/typescript/polyfills/FileSystem.ts
+++ b/src/framework/typescript/polyfills/FileSystem.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2023 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -27,16 +27,7 @@ type ReadFileContentOptions = {
type ReadFileResult = T extends true ? J : string;
-/**
- * A file system utility class, that works with both Node.js and Bun.
- */
export default class FileSystem {
- /**
- * Reads the contents of a file.
- * @param path - The path of the file to read.
- * @param options - The options for reading the file.
- * @returns A promise that resolves to the contents of the file.
- */
public static async readFileContents(
path: string,
{ json }: ReadFileContentOptions = {}
@@ -57,12 +48,6 @@ export default class FileSystem {
return contents as ReadFileResult;
}
- /**
- * Checks if a file exists.
- *
- * @param filePath - The path of the file to check.
- * @returns A promise that resolves to a boolean indicating if the file exists.
- */
public static async exists(filePath: string) {
if (process.versions.bun) {
return Bun.file(filePath).exists();
@@ -71,22 +56,16 @@ export default class FileSystem {
}
}
- /**
- * Writes the contents to a file.
- *
- * @param path - The path of the file to write to.
- * @param contents - The contents to write to the file.
- * @returns A promise that resolves when the file is written.
- * @throws An error if the file cannot be written.
- */
public static async writeFileContents(
path: string,
contents: J extends true ? object : StringLike,
json: J = false as J
): Promise {
if (process.versions.bun) {
+ // eslint-disable-next-line @typescript-eslint/no-base-to-string
await Bun.write(path, json ? JSON.stringify(contents) : contents.toString());
} else {
+ // eslint-disable-next-line @typescript-eslint/no-base-to-string
await writeFile(path, json ? JSON.stringify(contents) : contents.toString(), {
encoding: "utf-8"
});
diff --git a/src/framework/typescript/polyfills/Promise.ts b/src/framework/typescript/polyfills/Promise.ts
index 16ce756ca..61ee634d7 100644
--- a/src/framework/typescript/polyfills/Promise.ts
+++ b/src/framework/typescript/polyfills/Promise.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import assert from "assert";
export type PromiseWithResolversReturn = {
diff --git a/src/framework/typescript/queues/Queue.ts b/src/framework/typescript/queues/Queue.ts
index e1d91dea7..2f5660ff6 100644
--- a/src/framework/typescript/queues/Queue.ts
+++ b/src/framework/typescript/queues/Queue.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { queues } from "@main/models/Queue";
import type { Snowflake } from "discord.js";
import { and, eq } from "drizzle-orm";
@@ -168,22 +187,14 @@ abstract class Queue extends HasApplicati
(this.repeat ? clearInterval : clearTimeout)(this._timeout);
}
- /**
- * Schedules this queue to run at the specified time.
- *
- * @returns The ID of the queue
- */
+
public async schedule() {
const id = await this.save();
this.setTimeout();
return id;
}
- /**
- * Cancels this queue.
- *
- * @returns The ID of the queue
- */
+
public cancel() {
this.application.logger.debug(`Canceling queue: ${this._id}`);
this.clearTimeout();
diff --git a/src/framework/typescript/queues/QueueManager.ts b/src/framework/typescript/queues/QueueManager.ts
index 0473f0b6a..c4e74fd8c 100644
--- a/src/framework/typescript/queues/QueueManager.ts
+++ b/src/framework/typescript/queues/QueueManager.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { HasApplication } from "../types/HasApplication";
import type Queue from "./Queue";
import type { QueueOptions, StorableData } from "./Queue";
@@ -46,7 +65,7 @@ class QueueManager extends HasApplication {
: (queue as unknown as QueueConstructor);
if (!QueueClass) {
- throw new Error(`Queue with name ${queue} not found`);
+ throw new Error(`Queue with name ${queue?.toString()} not found`);
}
return new QueueClass(this.application, this, options);
diff --git a/src/framework/typescript/services/Name.ts b/src/framework/typescript/services/Name.ts
index 58534bf06..2b3765e9d 100644
--- a/src/framework/typescript/services/Name.ts
+++ b/src/framework/typescript/services/Name.ts
@@ -1,28 +1,28 @@
/*
-* This file is part of SudoBot.
-*
-* Copyright (C) 2021-2024 OSN Developers.
-*
-* SudoBot is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Affero General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* SudoBot is distributed in the hope that it will be useful, but
-* WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU Affero General Public License for more details.
-*
-* You should have received a copy of the GNU Affero General Public License
-* along with SudoBot. If not, see .
-*/
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
import Bind from "../container/Bind";
import type { Service } from "./Service";
export function Name(name: string) {
return (target: new (...args: never[]) => Service) => {
- Reflect.defineMetadata("service:name", name, target.prototype);
+ Reflect.defineMetadata("service:name", name, target.prototype as object);
return Bind(name)(target);
};
}
diff --git a/src/framework/typescript/services/Service.ts b/src/framework/typescript/services/Service.ts
index d0a687d10..99f45771b 100644
--- a/src/framework/typescript/services/Service.ts
+++ b/src/framework/typescript/services/Service.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
diff --git a/src/framework/typescript/services/ServiceManager.ts b/src/framework/typescript/services/ServiceManager.ts
index ae97d70f1..58ebc2d12 100644
--- a/src/framework/typescript/services/ServiceManager.ts
+++ b/src/framework/typescript/services/ServiceManager.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -59,10 +59,7 @@ class ServiceManager {
let servicePath = service;
for (const alias in this.kernelClass.aliases) {
- servicePath = servicePath.replace(
- `@${alias}`,
- this.kernelClass.aliases[alias as keyof typeof this.kernelClass.aliases]
- );
+ servicePath = servicePath.replace(`@${alias}`, this.kernelClass.aliases[alias]);
}
if (
@@ -89,8 +86,8 @@ class ServiceManager {
const instance = new ServiceClass(this.application);
const key =
- Reflect.getMetadata("service:name", ServiceClass.prototype) ??
- Reflect.getMetadata("di:bind_as", ServiceClass.prototype) ??
+ Reflect.getMetadata("service:name", ServiceClass.prototype as object) ??
+ Reflect.getMetadata("di:bind_as", ServiceClass.prototype as object) ??
ServiceClass.name;
Container.getInstance().bind(ServiceClass, {
@@ -102,7 +99,7 @@ class ServiceManager {
Container.getInstance().resolveProperties(ServiceClass, instance);
this.services.set(ServiceClass, instance);
- this.servicesMappedByName.set(key, instance);
+ this.servicesMappedByName.set(key as string, instance);
await instance.boot();
this.application.classLoader.loadEventsFromMetadata(instance, true);
this.application.logger.info(
diff --git a/src/framework/typescript/streams/ReducedStream.ts b/src/framework/typescript/streams/ReducedStream.ts
index 14aeac3ed..c1c82d91f 100644
--- a/src/framework/typescript/streams/ReducedStream.ts
+++ b/src/framework/typescript/streams/ReducedStream.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import type Stream from "@framework/streams/Stream";
import chalk from "chalk";
import util from "util";
diff --git a/src/framework/typescript/streams/Stream.ts b/src/framework/typescript/streams/Stream.ts
index 207c15b3a..23e4e3df0 100644
--- a/src/framework/typescript/streams/Stream.ts
+++ b/src/framework/typescript/streams/Stream.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import ReducedStream from "@framework/streams/ReducedStream";
import chalk from "chalk";
import util from "node:util";
diff --git a/src/framework/typescript/tools/PropertyReader.ts b/src/framework/typescript/tools/PropertyReader.ts
index c4f6af347..c702c5e3f 100644
--- a/src/framework/typescript/tools/PropertyReader.ts
+++ b/src/framework/typescript/tools/PropertyReader.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import type { z } from "zod";
import type { FileResolvable } from "../io/File";
import { File } from "../io/File";
@@ -5,49 +24,12 @@ import PropertySyntaxError from "./PropertySyntaxError";
type Schema = z.ZodObject>>;
-/**
- * Reads key-value pairs from a ".properties" file.
- *
- * The file should contain properties in the format:
- *
- * key1=value1
- * key2=value2
- *
- * Empty lines and lines starting with "#" are ignored.
- *
- * The values are parsed as follows:
- *
- * - "true" and "false" are parsed as booleans.
- * - Numbers are parsed as integers. The base can be specified using the prefixes:
- * - "0x" for hexadecimal.
- * - "0o" for octal.
- * - "0b" for binary.
- * - Otherwise, the number is parsed as decimal.
- * - Other values are parsed as strings.
- *
- * The properties can be nested using dots:
- *
- * key1.subkey1=value1
- * key1.subkey2=value2
- *
- * The properties can be parsed using a zod schema as well.
- *
- * @since 9.0.0
- * @category Tools
- */
+
class PropertyReader {
- /**
- * Creates a new properties reader.
- *
- * @param fileResolvable The file to read the properties from.
- */
+
public constructor(private readonly fileResolvable: FileResolvable) {}
- /**
- * Reads the properties from the file as plain key-value pairs.
- *
- * @returns {Promise>} The properties as plain key-value pairs.
- */
+
public async readPlain(): Promise> {
using file = new File(this.fileResolvable);
const lines = await file.readLines();
@@ -97,12 +79,7 @@ class PropertyReader {
return plainProperties;
}
- /**
- * Reads the properties from the file.
- *
- * @param schema The schema to parse the properties with.
- * @returns {Promise>} The properties.
- */
+
public async read(
schema?: T
): Promise> {
diff --git a/src/framework/typescript/tools/PropertySyntaxError.ts b/src/framework/typescript/tools/PropertySyntaxError.ts
index 69f44867d..488ca985c 100644
--- a/src/framework/typescript/tools/PropertySyntaxError.ts
+++ b/src/framework/typescript/tools/PropertySyntaxError.ts
@@ -1 +1,20 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
export default class PropertySyntaxError extends Error {}
\ No newline at end of file
diff --git a/src/framework/typescript/types/Builder.ts b/src/framework/typescript/types/Builder.ts
index 8283a75c2..a50335df6 100644
--- a/src/framework/typescript/types/Builder.ts
+++ b/src/framework/typescript/types/Builder.ts
@@ -1,21 +1,21 @@
/*
-* This file is part of SudoBot.
-*
-* Copyright (C) 2021-2024 OSN Developers.
-*
-* SudoBot is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Affero General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* SudoBot is distributed in the hope that it will be useful, but
-* WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU Affero General Public License for more details.
-*
-* You should have received a copy of the GNU Affero General Public License
-* along with SudoBot. If not, see .
-*/
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
interface Builder {
build(): T;
diff --git a/src/framework/typescript/types/ClientEvents.ts b/src/framework/typescript/types/ClientEvents.ts
index 0b6610cac..ddaed9937 100644
--- a/src/framework/typescript/types/ClientEvents.ts
+++ b/src/framework/typescript/types/ClientEvents.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2023 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -30,6 +30,7 @@ declare global {
normalMessageCreate: [message: Message];
normalMessageUpdate: [oldMessage: Message, newMessage: Message];
normalMessageDelete: [message: Message];
+ raw: [data: { t: string; d: unknown }];
}
}
diff --git a/src/framework/typescript/types/HasApplication.ts b/src/framework/typescript/types/HasApplication.ts
index 3acbd4bd3..ab37f66fa 100644
--- a/src/framework/typescript/types/HasApplication.ts
+++ b/src/framework/typescript/types/HasApplication.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
diff --git a/src/framework/typescript/types/HasClient.ts b/src/framework/typescript/types/HasClient.ts
index c302fa210..20274ad30 100644
--- a/src/framework/typescript/types/HasClient.ts
+++ b/src/framework/typescript/types/HasClient.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
diff --git a/src/framework/typescript/types/HasEventListeners.ts b/src/framework/typescript/types/HasEventListeners.ts
index fbadcdaac..5007f6f88 100644
--- a/src/framework/typescript/types/HasEventListeners.ts
+++ b/src/framework/typescript/types/HasEventListeners.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2023 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
diff --git a/src/framework/typescript/types/OptionalRecord.ts b/src/framework/typescript/types/OptionalRecord.ts
index 089c717af..67b9a24ac 100644
--- a/src/framework/typescript/types/OptionalRecord.ts
+++ b/src/framework/typescript/types/OptionalRecord.ts
@@ -1,20 +1,20 @@
/*
-* This file is part of SudoBot.
-*
-* Copyright (C) 2021-2024 OSN Developers.
-*
-* SudoBot is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Affero General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* SudoBot is distributed in the hope that it will be useful, but
-* WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU Affero General Public License for more details.
-*
-* You should have received a copy of the GNU Affero General Public License
-* along with SudoBot. If not, see .
-*/
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
export type OptionalRecord = Partial>;
diff --git a/src/framework/typescript/types/SerializableToJSON.ts b/src/framework/typescript/types/SerializableToJSON.ts
index 4e0fa4834..6694d6679 100644
--- a/src/framework/typescript/types/SerializableToJSON.ts
+++ b/src/framework/typescript/types/SerializableToJSON.ts
@@ -1,21 +1,21 @@
/*
-* This file is part of SudoBot.
-*
-* Copyright (C) 2021-2024 OSN Developers.
-*
-* SudoBot is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Affero General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* SudoBot is distributed in the hope that it will be useful, but
-* WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU Affero General Public License for more details.
-*
-* You should have received a copy of the GNU Affero General Public License
-* along with SudoBot. If not, see .
-*/
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
interface SerializableToJSON {
toJSON(): T;
diff --git a/src/framework/typescript/types/Singleton.ts b/src/framework/typescript/types/Singleton.ts
index fa1b30eae..eb455282a 100644
--- a/src/framework/typescript/types/Singleton.ts
+++ b/src/framework/typescript/types/Singleton.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -40,12 +40,12 @@ export class Singleton {
}
protected static createInstance(): Awaitable {
- return new this() as Singleton;
+ return new this();
}
}
export class ContainerSingleton extends Singleton {
protected static override createInstance(): Awaitable {
- return Container.getInstance().resolveByClass(this) as ContainerSingleton;
+ return Container.getInstance().resolveByClass(this);
}
}
diff --git a/src/framework/typescript/types/StringLike.ts b/src/framework/typescript/types/StringLike.ts
index 6c52b9f83..b9e228aff 100644
--- a/src/framework/typescript/types/StringLike.ts
+++ b/src/framework/typescript/types/StringLike.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
diff --git a/src/framework/typescript/types/TextBasedChannel.ts b/src/framework/typescript/types/TextBasedChannel.ts
index 9a21d90e4..cd938f145 100644
--- a/src/framework/typescript/types/TextBasedChannel.ts
+++ b/src/framework/typescript/types/TextBasedChannel.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import type { TextBasedChannel as DiscordTextBasedChannel } from "discord.js";
export type TextBasedChannel = Extract;
diff --git a/src/framework/typescript/types/Utils.ts b/src/framework/typescript/types/Utils.ts
index 2392f8339..e773e42ea 100644
--- a/src/framework/typescript/types/Utils.ts
+++ b/src/framework/typescript/types/Utils.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2023 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
diff --git a/src/framework/typescript/utils/channel.ts b/src/framework/typescript/utils/channel.ts
index 24e74d41c..37cecb8bf 100644
--- a/src/framework/typescript/utils/channel.ts
+++ b/src/framework/typescript/utils/channel.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { ChannelType } from "discord.js";
export const TextableChannelTypes = [
diff --git a/src/framework/typescript/utils/decorators.ts b/src/framework/typescript/utils/decorators.ts
index 383c70261..f1b965480 100644
--- a/src/framework/typescript/utils/decorators.ts
+++ b/src/framework/typescript/utils/decorators.ts
@@ -1,21 +1,21 @@
/*
-* This file is part of SudoBot.
-*
-* Copyright (C) 2021-2024 OSN Developers.
-*
-* SudoBot is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Affero General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* SudoBot is distributed in the hope that it will be useful, but
-* WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU Affero General Public License for more details.
-*
-* You should have received a copy of the GNU Affero General Public License
-* along with SudoBot. If not, see .
-*/
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
export function makeNoOpMethodDecorator() {
return (_target: object, _propertyKey: PropertyKey, _descriptor?: PropertyDescriptor) => {};
diff --git a/src/framework/typescript/utils/devflow.ts b/src/framework/typescript/utils/devflow.ts
index f33310989..607ff7adb 100644
--- a/src/framework/typescript/utils/devflow.ts
+++ b/src/framework/typescript/utils/devflow.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -33,11 +33,7 @@ TODO.Method = (what: string = "Not implemented") => {
};
};
-/**
- * This function is used to log an error message due to a
- * possible bug in the code. Similar to the BUG function in
- * the Linux kernel.
- */
+
export const BUG = (...args: unknown[]) => {
Application.current().logger.bug(...args);
console.trace();
diff --git a/src/framework/typescript/utils/embeds.ts b/src/framework/typescript/utils/embeds.ts
index 28803a8dc..f1ae28c29 100644
--- a/src/framework/typescript/utils/embeds.ts
+++ b/src/framework/typescript/utils/embeds.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import type { Client, Snowflake } from "discord.js";
import { type GuildBasedChannel, type Message, MessageType, type User } from "discord.js";
diff --git a/src/framework/typescript/utils/entities.ts b/src/framework/typescript/utils/entities.ts
index 8f96ec80d..497a70197 100644
--- a/src/framework/typescript/utils/entities.ts
+++ b/src/framework/typescript/utils/entities.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import type BaseClient from "@framework/client/BaseClient";
import type { Guild, Snowflake, TextBasedChannel } from "discord.js";
import { client } from "./helpers";
diff --git a/src/framework/typescript/utils/errors.ts b/src/framework/typescript/utils/errors.ts
index 0411ee095..6c69a38da 100644
--- a/src/framework/typescript/utils/errors.ts
+++ b/src/framework/typescript/utils/errors.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import type { DiscordAPIError } from "discord.js";
export function isDiscordAPIError(error: unknown): error is DiscordAPIError {
diff --git a/src/framework/typescript/utils/formatters.ts b/src/framework/typescript/utils/formatters.ts
index 67194e248..4c60264cd 100644
--- a/src/framework/typescript/utils/formatters.ts
+++ b/src/framework/typescript/utils/formatters.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
const k = 1024;
const dm = 2;
const sizes = ["bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
diff --git a/src/framework/typescript/utils/helpers.ts b/src/framework/typescript/utils/helpers.ts
index e5eb3d1f8..0ab19eee8 100644
--- a/src/framework/typescript/utils/helpers.ts
+++ b/src/framework/typescript/utils/helpers.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -34,7 +34,7 @@ export function service(refOrName: typeof Service | ServiceName): Service {
if (typeof refOrName === "string") {
return application().service(refOrName) as Service;
} else {
- return application().getService(refOrName as unknown as new () => Service) as Service;
+ return application().getService(refOrName as unknown as new () => Service);
}
}
diff --git a/src/framework/typescript/utils/logic.ts b/src/framework/typescript/utils/logic.ts
index a733a48c6..3687a9568 100644
--- a/src/framework/typescript/utils/logic.ts
+++ b/src/framework/typescript/utils/logic.ts
@@ -1,10 +1,22 @@
-/**
- * Returns the logical XOR of two boolean values.
+/*
+ * This file is part of SudoBot.
*
- * @param a - The first boolean value.
- * @param b - The second boolean value.
- * @returns The logical XOR of the two boolean values.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
*/
+
export const xor = (a: boolean, b: boolean) => a !== b;
/**
diff --git a/src/framework/typescript/utils/objects.ts b/src/framework/typescript/utils/objects.ts
index a1d87775e..25317405a 100644
--- a/src/framework/typescript/utils/objects.ts
+++ b/src/framework/typescript/utils/objects.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -198,12 +198,7 @@ export const pickCastArray = (target: object, key: string): T[] => {
: target[`${key}s` as keyof typeof target];
};
-/**
- * Unsets a property from an object or array.
- *
- * @param object The object or array to unset the property from.
- * @param accessor The accessor to the property to unset.
- */
+
export const unset = (object: object | unknown[], accessor: string) => {
assert(accessor, "Accessor must be provided");
diff --git a/src/framework/typescript/utils/string.ts b/src/framework/typescript/utils/string.ts
index d40257e17..a4e2bd383 100644
--- a/src/framework/typescript/utils/string.ts
+++ b/src/framework/typescript/utils/string.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
export function normalize(str: string, skip = false) {
if (skip) {
return str;
@@ -18,7 +37,7 @@ export function preformat(args: TemplateStringsArray, ...parts: unknown[]) {
let fullString = "";
for (const part of args) {
- fullString += part + (parts.shift() ?? "");
+ fullString += part + (parts.shift()?.toString() ?? "");
}
return fullString.replace(/^\s+|\s*\n$/gm, "");
diff --git a/src/framework/typescript/utils/user.ts b/src/framework/typescript/utils/user.ts
index fe4bd27d9..57902f127 100644
--- a/src/framework/typescript/utils/user.ts
+++ b/src/framework/typescript/utils/user.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
diff --git a/src/framework/typescript/utils/utils.ts b/src/framework/typescript/utils/utils.ts
index 50a8f896e..611982228 100644
--- a/src/framework/typescript/utils/utils.ts
+++ b/src/framework/typescript/utils/utils.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -17,6 +17,8 @@
* along with SudoBot. If not, see .
*/
+import Application from "@framework/app/Application";
+
export function escapeRegex(string: string) {
return string.replace(/[/\-\\^$*+?.()|[\]{}]/g, "\\$&");
}
@@ -51,3 +53,15 @@ export function isDevelopmentMode() {
process.env.SUDO_ENV === "dev"
);
}
+
+// eslint-disable-next-line @typescript-eslint/no-empty-function
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
+export function noOperation(..._args: any[]): void {
+ return;
+}
+
+export function suppressErrorNoReturn(value: unknown): void {
+ if (value instanceof Promise) {
+ value.catch(Application.current().logger.error);
+ }
+}
diff --git a/src/framework/typescript/utils/zod.ts b/src/framework/typescript/utils/zod.ts
index 62392194d..245de9188 100644
--- a/src/framework/typescript/utils/zod.ts
+++ b/src/framework/typescript/utils/zod.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import type { ZodType } from "zod";
import { ZodArray, ZodEffects, ZodNullable, ZodObject, ZodOptional } from "zod";
diff --git a/src/main/typescript/api/controllers/AnnouncementController.ts b/src/main/typescript/api/controllers/AnnouncementController.ts
index 0db3beef7..ccbdec05f 100644
--- a/src/main/typescript/api/controllers/AnnouncementController.ts
+++ b/src/main/typescript/api/controllers/AnnouncementController.ts
@@ -1,9 +1,28 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { Action } from "@framework/api/decorators/Action";
import Controller from "@framework/api/http/Controller";
class AnnouncementController extends Controller {
@Action("GET", "/announcements/latest")
- public async getLatest() {
+ public getLatest() {
return {
title: "Announcement",
content:
diff --git a/src/main/typescript/api/controllers/AuthController.ts b/src/main/typescript/api/controllers/AuthController.ts
index 9dfefe94d..eb06bcb3f 100644
--- a/src/main/typescript/api/controllers/AuthController.ts
+++ b/src/main/typescript/api/controllers/AuthController.ts
@@ -1,7 +1,7 @@
-/**
+/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2023 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -206,6 +206,8 @@ class AuthController extends Controller {
});
}
+ const token = await this.authService.provisionToken(user);
+
const guilds: APIGuild[] = [];
for (const guildId of user.guilds) {
@@ -225,7 +227,7 @@ class AuthController extends Controller {
discordId: user.discordId,
avatar: avatarURL
},
- token: user.token,
+ token,
expires: user.tokenExpiresAt?.getTime(),
guilds
};
diff --git a/src/main/typescript/api/controllers/ConfigController.ts b/src/main/typescript/api/controllers/ConfigController.ts
index 18c50a4ff..beee5fc89 100644
--- a/src/main/typescript/api/controllers/ConfigController.ts
+++ b/src/main/typescript/api/controllers/ConfigController.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { Action } from "@framework/api/decorators/Action";
import { RequireAuth } from "@framework/api/decorators/RequireAuth";
import { Validate } from "@framework/api/decorators/Validate";
@@ -16,7 +35,7 @@ class ConfigController extends Controller {
@Action("GET", "/guilds/:id/config")
@RequireAuth(true)
- public async view(request: Request) {
+ public view(request: Request) {
const { id } = request.params;
const guild = this.application.client.guilds.cache.get(id);
@@ -38,7 +57,7 @@ class ConfigController extends Controller {
@Action("PATCH", "/guilds/:id/config")
@RequireAuth(true)
@Validate(z.record(z.string(), z.any()))
- public async update(request: Request) {
+ public update(request: Request) {
const { id } = request.params;
const guild = this.application.client.guilds.cache.get(id);
@@ -86,8 +105,11 @@ class ConfigController extends Controller {
}
this._saveQueueTimeout ??= setTimeout(() => {
- this.configManager.write({ guild: true, system: false });
- this.configManager.load();
+ this.configManager
+ .write({ guild: true, system: false })
+ .then(() => this.configManager.load())
+ .catch(this.application.logger.error);
+
this._saveQueueTimeout = undefined;
}, 10_000);
diff --git a/src/main/typescript/api/controllers/GuildController.ts b/src/main/typescript/api/controllers/GuildController.ts
index 6fa59ec13..d0d13eb2a 100644
--- a/src/main/typescript/api/controllers/GuildController.ts
+++ b/src/main/typescript/api/controllers/GuildController.ts
@@ -1,7 +1,7 @@
-/**
+/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2023 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -28,7 +28,7 @@ class GuildController extends Controller {
@Action("GET", "/guilds/:guild")
@RequireAuth()
@EnableGuildAccessControl()
- public async view(request: Request) {
+ public view(request: Request) {
const { id } = request.params;
const guild = this.application.client.guilds.cache.get(id);
@@ -48,7 +48,7 @@ class GuildController extends Controller {
@Action("GET", "/guilds")
@RequireAuth()
- public async index(request: Request) {
+ public index(request: Request) {
const guilds = [];
for (const guild of this.application.client.guilds.cache.values()) {
@@ -66,8 +66,8 @@ class GuildController extends Controller {
@Action("GET", "/guilds/:id/roles")
@RequireAuth()
- public async getRoles(request: Request) {
- const {id} = request.params;
+ public getRoles(request: Request) {
+ const { id } = request.params;
const guild = this.application.client.guilds.cache.get(id);
if (!guild) {
@@ -80,14 +80,14 @@ class GuildController extends Controller {
return guild.roles.cache.map(role => ({
id: role.id,
name: role.name,
- color: role.color,
+ color: role.color
}));
}
@Action("GET", "/guilds/:id/channels")
@RequireAuth()
- public async getChannels(request: Request) {
- const {id} = request.params;
+ public getChannels(request: Request) {
+ const { id } = request.params;
const guild = this.application.client.guilds.cache.get(id);
if (!guild) {
@@ -100,7 +100,7 @@ class GuildController extends Controller {
return guild.channels.cache.map(channel => ({
id: channel.id,
name: channel.name,
- type: channel.type,
+ type: channel.type
}));
}
}
diff --git a/src/main/typescript/api/controllers/MainController.ts b/src/main/typescript/api/controllers/MainController.ts
index ae67beeb8..03247c79f 100644
--- a/src/main/typescript/api/controllers/MainController.ts
+++ b/src/main/typescript/api/controllers/MainController.ts
@@ -1,7 +1,7 @@
-/**
+/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2023 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -27,14 +27,14 @@ class MainController extends Controller {
protected readonly configManager!: ConfigurationManager;
@Action("GET", "/")
- public async index() {
+ public index() {
return {
message: "API server is up."
};
}
@Action("GET", "/status")
- public async status() {
+ public status() {
const { server_status, server_status_description, server_status_started_at } =
this.configManager.systemConfig.api;
diff --git a/src/main/typescript/api/controllers/VerificationController.ts b/src/main/typescript/api/controllers/VerificationController.ts
index 80cb91504..aec6829bf 100644
--- a/src/main/typescript/api/controllers/VerificationController.ts
+++ b/src/main/typescript/api/controllers/VerificationController.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { Action } from "@framework/api/decorators/Action";
import { Validate } from "@framework/api/decorators/Validate";
import Controller from "@framework/api/http/Controller";
diff --git a/src/main/typescript/arguments/RestRoleArgument.ts b/src/main/typescript/arguments/RestRoleArgument.ts
index 0f516b207..84ea0bd7b 100644
--- a/src/main/typescript/arguments/RestRoleArgument.ts
+++ b/src/main/typescript/arguments/RestRoleArgument.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import Argument from "@framework/arguments/Argument";
import { ErrorType } from "@framework/arguments/InvalidArgumentError";
import { fetchRole } from "@framework/utils/entities";
@@ -97,7 +116,7 @@ class RestRoleArgument extends Argument role?.name).join(", ");
+ return this.transformedValue.map(role => role?.name).join(", ");
}
}
diff --git a/src/main/typescript/automod/AIAutoModeration.ts b/src/main/typescript/automod/AIAutoModeration.ts
index 225449e6b..7a6b1bb4c 100644
--- a/src/main/typescript/automod/AIAutoModeration.ts
+++ b/src/main/typescript/automod/AIAutoModeration.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { Inject } from "@framework/container/Inject";
import { Name } from "@framework/services/Name";
import { Service } from "@framework/services/Service";
@@ -93,7 +112,7 @@ class AIAutoModeration extends Service {
if (
(messageOrMember instanceof Message && messageOrMember.author.bot) ||
(messageOrMember instanceof GuildMember && messageOrMember.user.bot) ||
- !this.configFor(messageOrMember.guild!.id!)?.enabled
+ !this.configFor(messageOrMember.guild!.id)?.enabled
) {
return false;
}
@@ -281,7 +300,7 @@ class AIAutoModeration extends Service {
for (const score in automatic_actions.stops) {
const actions =
- automatic_actions.stops[score as keyof typeof automatic_actions.stops];
+ automatic_actions.stops[score];
if (score !== "*" && Number.isNaN(+score)) {
this.application.logger.error(`Invalid stop score in config: ${score}`);
diff --git a/src/main/typescript/automod/AntiMemberJoinService.ts b/src/main/typescript/automod/AntiMemberJoinService.ts
index 2fd41fd31..5f067fa9f 100644
--- a/src/main/typescript/automod/AntiMemberJoinService.ts
+++ b/src/main/typescript/automod/AntiMemberJoinService.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { Inject } from "@framework/container/Inject";
import Duration from "@framework/datetime/Duration";
import { Name } from "@framework/services/Name";
diff --git a/src/main/typescript/automod/RaidProtectionService.ts b/src/main/typescript/automod/RaidProtectionService.ts
index 14105cf15..8aa523e82 100644
--- a/src/main/typescript/automod/RaidProtectionService.ts
+++ b/src/main/typescript/automod/RaidProtectionService.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { Inject } from "@framework/container/Inject";
import { GatewayEventListener } from "@framework/events/GatewayEventListener";
import { Name } from "@framework/services/Name";
diff --git a/src/main/typescript/automod/RuleModerationService.ts b/src/main/typescript/automod/RuleModerationService.ts
index 729e54d22..9dd8193b1 100644
--- a/src/main/typescript/automod/RuleModerationService.ts
+++ b/src/main/typescript/automod/RuleModerationService.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import FluentSet from "@framework/collections/FluentSet";
import { Inject } from "@framework/container/Inject";
import { GatewayEventListener } from "@framework/events/GatewayEventListener";
@@ -5,7 +24,7 @@ import { Name } from "@framework/services/Name";
import { Service } from "@framework/services/Service";
import { HasEventListeners } from "@framework/types/HasEventListeners";
import { LogEventType } from "@main/schemas/LoggingSchema";
-import { GuildMember, Message, Snowflake, TextChannel } from "discord.js";
+import { Awaitable, GuildMember, Message, Snowflake, TextChannel } from "discord.js";
import { MessageAutoModServiceContract } from "../contracts/MessageAutoModServiceContract";
import {
MessageRuleScope,
@@ -151,7 +170,7 @@ class RuleModerationService
throw new Error("Member and message is missing");
}
- const config = this.configFor(guildId!);
+ const config = this.configFor(guildId);
if (!config?.enabled) {
return false;
@@ -295,7 +314,7 @@ class RuleModerationService
message
? {
message,
- channel: message.channel! as TextChannel
+ channel: message.channel as TextChannel
}
: undefined
);
@@ -308,7 +327,7 @@ class RuleModerationService
}
await this.auditLoggingService.emitLogEvent(
- guildId!,
+ guildId,
LogEventType.SystemAutoModRuleModeration,
message ? "message" : "profile",
message ?? member,
@@ -336,14 +355,14 @@ class RuleModerationService
}
private configFor(guildId: Snowflake) {
- return this.configurationManager.config[guildId!]?.rule_moderation;
+ return this.configurationManager.config[guildId]?.rule_moderation;
}
private async shouldModerate(messageOrMember: Message | GuildMember) {
if (
(messageOrMember instanceof Message && messageOrMember.author.bot) ||
(messageOrMember instanceof GuildMember && messageOrMember.user.bot) ||
- !this.configFor(messageOrMember.guild!.id!)?.enabled
+ !this.configFor(messageOrMember.guild!.id)?.enabled
) {
return false;
}
@@ -369,18 +388,18 @@ class RuleModerationService
return this.permissionManagerService.canAutoModerate(finalMember);
}
- private async createRuleHandler(): Promise {
+ private createRuleHandler(): Awaitable {
const instance = new ModerationRuleHandler(this.application);
this.application.container.resolveProperties(ModerationRuleHandler, instance);
- await instance.boot?.();
+ instance.boot?.();
return instance;
}
- private async checkPreconditions(
+ private checkPreconditions(
member: GuildMember,
rule: MessageRuleType,
message?: Message
- ) {
+ ): Awaitable {
if (rule.for) {
const { roles, users, channels } = rule.for;
diff --git a/src/main/typescript/automod/SpamModerationService.ts b/src/main/typescript/automod/SpamModerationService.ts
index 80d1d3014..eef0e5e18 100644
--- a/src/main/typescript/automod/SpamModerationService.ts
+++ b/src/main/typescript/automod/SpamModerationService.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { Inject } from "@framework/container/Inject";
import { Name } from "@framework/services/Name";
import { Service } from "@framework/services/Service";
@@ -31,7 +50,7 @@ class SpamModerationService
private readonly permissionManagerService!: PermissionManagerService;
private configFor(guildId: Snowflake) {
- return this.configurationManager.config[guildId!]?.antispam;
+ return this.configurationManager.config[guildId]?.antispam;
}
private async shouldModerate(message: Message) {
diff --git a/src/main/typescript/automod/TriggerService.ts b/src/main/typescript/automod/TriggerService.ts
index 8fa56b28e..df68e0fd9 100644
--- a/src/main/typescript/automod/TriggerService.ts
+++ b/src/main/typescript/automod/TriggerService.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { Inject } from "@framework/container/Inject";
import { GatewayEventListener } from "@framework/events/GatewayEventListener";
import { Name } from "@framework/services/Name";
@@ -81,7 +100,7 @@ class TriggerService extends Service implements HasEventListeners {
const config = this.config(message.guildId!);
- if (!config?.enabled || config?.global_disabled_channels?.includes(message.channelId!)) {
+ if (!config?.enabled || config?.global_disabled_channels?.includes(message.channelId)) {
return true;
}
@@ -114,7 +133,7 @@ class TriggerService extends Service implements HasEventListeners {
}
this.processTrigger(trigger, {
- channelId: message.channelId!,
+ channelId: message.channelId,
roles: message.member!.roles.cache.keys(),
userId: message.author.id,
context: {
@@ -220,12 +239,12 @@ class TriggerService extends Service implements HasEventListeners {
}
}
- public async triggerMessageSticky(
+ public triggerMessageSticky(
trigger: Extract,
{ message }: TriggerHandlerContext
) {
- if (!this.lastStickyMessageQueues[`${message.guildId!}_${message.channelId!}`]) {
- this.lastStickyMessageQueues[`${message.guildId!}_${message.channelId!}`] = true;
+ if (!this.lastStickyMessageQueues[`${message.guildId!}_${message.channelId}`]) {
+ this.lastStickyMessageQueues[`${message.guildId!}_${message.channelId}`] = true;
setTimeout(async () => {
if (!isTextBasedChannel(message.channel)) {
@@ -233,12 +252,12 @@ class TriggerService extends Service implements HasEventListeners {
}
const lastStickyMessage =
- this.lastStickyMessages[`${message.guildId!}_${message.channelId!}`];
+ this.lastStickyMessages[`${message.guildId!}_${message.channelId}`];
if (lastStickyMessage) {
try {
await lastStickyMessage.delete();
- this.lastStickyMessages[`${message.guildId!}_${message.channelId!}`] =
+ this.lastStickyMessages[`${message.guildId!}_${message.channelId}`] =
undefined;
} catch (error) {
this.logger.error(error);
@@ -264,9 +283,9 @@ class TriggerService extends Service implements HasEventListeners {
]
});
- this.lastStickyMessages[`${message.guildId!}_${message.channelId!}`] =
+ this.lastStickyMessages[`${message.guildId!}_${message.channelId}`] =
sentMessage;
- this.lastStickyMessageQueues[`${message.guildId!}_${message.channelId!}`] =
+ this.lastStickyMessageQueues[`${message.guildId!}_${message.channelId}`] =
false;
} catch (error) {
this.logger.error(error);
diff --git a/src/main/typescript/automod/VerificationService.ts b/src/main/typescript/automod/VerificationService.ts
index bc6efd874..e7998e981 100644
--- a/src/main/typescript/automod/VerificationService.ts
+++ b/src/main/typescript/automod/VerificationService.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { Inject } from "@framework/container/Inject";
import { GatewayEventListener } from "@framework/events/GatewayEventListener";
import { Name } from "@framework/services/Name";
diff --git a/src/main/typescript/bun.ts b/src/main/typescript/bun.ts
index 3a760d601..c262d5d4e 100644
--- a/src/main/typescript/bun.ts
+++ b/src/main/typescript/bun.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2023 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
diff --git a/src/main/typescript/cache/CommandPermissionOverwriteCacheStore.ts b/src/main/typescript/cache/CommandPermissionOverwriteCacheStore.ts
index 09a14fc51..1de1a9102 100644
--- a/src/main/typescript/cache/CommandPermissionOverwriteCacheStore.ts
+++ b/src/main/typescript/cache/CommandPermissionOverwriteCacheStore.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import GuildStore from "@framework/cache/GuildStore";
import type { SystemPermissionLikeString } from "@framework/permissions/AbstractPermissionManagerService";
import { drizzle } from "@framework/utils/helpers";
@@ -100,13 +119,7 @@ class CommandPermissionOverwriteCacheStore extends GuildStore<
return this.get(guildId, name) ?? null;
}
- /**
- * The requirement logic is structured in an array of arrays, where each
- * array is a set of requirements that are checked with the AND operator.
- * And, the elements inside the inner array are checked with the OR operator.
- *
- * [[1, 2], [3, 4], [5, 6], 7] => (1 OR 2) AND (3 OR 4) AND (5 OR 6) AND 7
- */
+
protected makeLogicArray(array: Array): CommandOverwriteLogic {
const deepAnd = [];
const and = new Set();
diff --git a/src/main/typescript/commands/automation/AFKCommand.ts b/src/main/typescript/commands/automation/AFKCommand.ts
index 46e5467bd..b53861ea5 100644
--- a/src/main/typescript/commands/automation/AFKCommand.ts
+++ b/src/main/typescript/commands/automation/AFKCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { ArgumentSchema } from "@framework/arguments/ArgumentTypes";
import { ErrorType } from "@framework/arguments/InvalidArgumentError";
import RestStringArgument from "@framework/arguments/RestStringArgument";
diff --git a/src/main/typescript/commands/automation/AFKsCommand.ts b/src/main/typescript/commands/automation/AFKsCommand.ts
index 9ce89a802..061136ba8 100644
--- a/src/main/typescript/commands/automation/AFKsCommand.ts
+++ b/src/main/typescript/commands/automation/AFKsCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { Buildable, Command } from "@framework/commands/Command";
import Context from "@framework/commands/Context";
import InteractionContext from "@framework/commands/InteractionContext";
@@ -153,7 +172,7 @@ class AFKsCommand extends Command {
return;
}
- const count = await this.afkService.removeGuildAFKs(context.guildId!);
+ const count = await this.afkService.removeGuildAFKs(context.guildId);
await reply.edit({
embeds: [
diff --git a/src/main/typescript/commands/automation/AntiMemberJoinCommand.ts b/src/main/typescript/commands/automation/AntiMemberJoinCommand.ts
index 3bf7c91e3..417ac36e9 100644
--- a/src/main/typescript/commands/automation/AntiMemberJoinCommand.ts
+++ b/src/main/typescript/commands/automation/AntiMemberJoinCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { Command } from "@framework/commands/Command";
import type Context from "@framework/commands/Context";
import { Inject } from "@framework/container/Inject";
diff --git a/src/main/typescript/commands/automation/CreateReactionRoleCommand.ts b/src/main/typescript/commands/automation/CreateReactionRoleCommand.ts
index 0ce489e6d..41f978ecc 100644
--- a/src/main/typescript/commands/automation/CreateReactionRoleCommand.ts
+++ b/src/main/typescript/commands/automation/CreateReactionRoleCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { ArgumentSchema } from "@framework/arguments/ArgumentTypes";
import { ErrorType } from "@framework/arguments/InvalidArgumentError";
import RestStringArgument from "@framework/arguments/RestStringArgument";
diff --git a/src/main/typescript/commands/automation/ExpireCommand.ts b/src/main/typescript/commands/automation/ExpireCommand.ts
index 09c15a6a3..70912c385 100644
--- a/src/main/typescript/commands/automation/ExpireCommand.ts
+++ b/src/main/typescript/commands/automation/ExpireCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { ArgumentSchema } from "@framework/arguments/ArgumentTypes";
import DurationArgument from "@framework/arguments/DurationArgument";
import { ErrorType } from "@framework/arguments/InvalidArgumentError";
@@ -146,7 +165,8 @@ class ExpireCommand extends Command {
guildId: context.guildId,
runsAt: time.fromNow()
})
- .schedule();
+ .schedule()
+ .catch(this.application.logger.error);
} catch (error) {
this.application.logger.error(error);
@@ -161,13 +181,15 @@ class ExpireCommand extends Command {
await context.success("Message sent successfully.");
}
- this.systemAuditLogging.logEchoCommandExecuted({
- command: this.name,
- guild: context.guild,
- rawCommandContent: content,
- user: context.user,
- generatedMessageOptions: options
- });
+ this.systemAuditLogging
+ .logEchoCommandExecuted({
+ command: this.name,
+ guild: context.guild,
+ rawCommandContent: content,
+ user: context.user,
+ generatedMessageOptions: options
+ })
+ .catch(this.application.logger.error);
} catch (error) {
return void context.error(
error instanceof DirectiveParseError
diff --git a/src/main/typescript/commands/automation/QueueAddCommand.ts b/src/main/typescript/commands/automation/QueueAddCommand.ts
index 345a8ac44..10a7c7f17 100644
--- a/src/main/typescript/commands/automation/QueueAddCommand.ts
+++ b/src/main/typescript/commands/automation/QueueAddCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { ArgumentSchema } from "@framework/arguments/ArgumentTypes";
import DurationArgument from "@framework/arguments/DurationArgument";
import { ErrorType } from "@framework/arguments/InvalidArgumentError";
diff --git a/src/main/typescript/commands/automation/QueueCancelCommand.ts b/src/main/typescript/commands/automation/QueueCancelCommand.ts
index 232a3d1e3..f50ea6d65 100644
--- a/src/main/typescript/commands/automation/QueueCancelCommand.ts
+++ b/src/main/typescript/commands/automation/QueueCancelCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { ArgumentSchema } from "@framework/arguments/ArgumentTypes";
import IntegerArgument from "@framework/arguments/IntegerArgument";
import { ErrorType } from "@framework/arguments/InvalidArgumentError";
diff --git a/src/main/typescript/commands/automation/QueueCommand.ts b/src/main/typescript/commands/automation/QueueCommand.ts
index b258f3db3..bef3301a5 100644
--- a/src/main/typescript/commands/automation/QueueCommand.ts
+++ b/src/main/typescript/commands/automation/QueueCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import type { Buildable } from "@framework/commands/Command";
import { Command } from "@framework/commands/Command";
import { PermissionFlags } from "@framework/permissions/PermissionFlag";
diff --git a/src/main/typescript/commands/automation/QueueListCommand.ts b/src/main/typescript/commands/automation/QueueListCommand.ts
index 211a00fd8..a4132de0e 100644
--- a/src/main/typescript/commands/automation/QueueListCommand.ts
+++ b/src/main/typescript/commands/automation/QueueListCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { Command } from "@framework/commands/Command";
import type Context from "@framework/commands/Context";
import { Inject } from "@framework/container/Inject";
diff --git a/src/main/typescript/commands/automation/QueueViewCommand.ts b/src/main/typescript/commands/automation/QueueViewCommand.ts
index ef4675daa..5f924b6a8 100644
--- a/src/main/typescript/commands/automation/QueueViewCommand.ts
+++ b/src/main/typescript/commands/automation/QueueViewCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { ArgumentSchema } from "@framework/arguments/ArgumentTypes";
import IntegerArgument from "@framework/arguments/IntegerArgument";
import { ErrorType } from "@framework/arguments/InvalidArgumentError";
diff --git a/src/main/typescript/commands/automation/RemindCommand.ts b/src/main/typescript/commands/automation/RemindCommand.ts
index df2fddecd..9bb6848ca 100644
--- a/src/main/typescript/commands/automation/RemindCommand.ts
+++ b/src/main/typescript/commands/automation/RemindCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { ArgumentSchema } from "@framework/arguments/ArgumentTypes";
import DurationArgument from "@framework/arguments/DurationArgument";
import { ErrorType } from "@framework/arguments/InvalidArgumentError";
diff --git a/src/main/typescript/commands/automation/ReminderCommand.ts b/src/main/typescript/commands/automation/ReminderCommand.ts
index 7fea55e84..2c3d048a7 100644
--- a/src/main/typescript/commands/automation/ReminderCommand.ts
+++ b/src/main/typescript/commands/automation/ReminderCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import type { Buildable } from "@framework/commands/Command";
import { Command } from "@framework/commands/Command";
import type Context from "@framework/commands/Context";
diff --git a/src/main/typescript/commands/automation/ScheduleCommand.ts b/src/main/typescript/commands/automation/ScheduleCommand.ts
index 7395afaec..a01cce144 100644
--- a/src/main/typescript/commands/automation/ScheduleCommand.ts
+++ b/src/main/typescript/commands/automation/ScheduleCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { ArgumentSchema } from "@framework/arguments/ArgumentTypes";
import DurationArgument from "@framework/arguments/DurationArgument";
import { ErrorType } from "@framework/arguments/InvalidArgumentError";
@@ -148,7 +167,8 @@ class ScheduleCommand extends Command {
guildId: context.guild.id,
runsAt: time.fromNow()
})
- .schedule();
+ .schedule()
+ .catch(this.application.logger.error);
if (context.isLegacy()) {
await context.commandMessage.react(context.emoji("check")?.toString() || "✅");
diff --git a/src/main/typescript/commands/automation/SurveyCommand.ts b/src/main/typescript/commands/automation/SurveyCommand.ts
index 090da5a26..501f9c6c9 100644
--- a/src/main/typescript/commands/automation/SurveyCommand.ts
+++ b/src/main/typescript/commands/automation/SurveyCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { ActionRowBuilder, ButtonBuilder, HeadingLevel } from "@discordjs/builders";
import { ArgumentSchema } from "@framework/arguments/ArgumentTypes";
import { ErrorType } from "@framework/arguments/InvalidArgumentError";
diff --git a/src/main/typescript/commands/fun/CatCommand.ts b/src/main/typescript/commands/fun/CatCommand.ts
index 43c7c20c6..1ed3ad3fc 100644
--- a/src/main/typescript/commands/fun/CatCommand.ts
+++ b/src/main/typescript/commands/fun/CatCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { Command } from "@framework/commands/Command";
import type Context from "@framework/commands/Context";
import { env } from "@main/env/env";
diff --git a/src/main/typescript/commands/fun/DogCommand.ts b/src/main/typescript/commands/fun/DogCommand.ts
index c0ced070d..bba6704e0 100644
--- a/src/main/typescript/commands/fun/DogCommand.ts
+++ b/src/main/typescript/commands/fun/DogCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { Command } from "@framework/commands/Command";
import type Context from "@framework/commands/Context";
import { env } from "@main/env/env";
diff --git a/src/main/typescript/commands/fun/HttpCatCommand.ts b/src/main/typescript/commands/fun/HttpCatCommand.ts
index 0436e42ac..45375d518 100644
--- a/src/main/typescript/commands/fun/HttpCatCommand.ts
+++ b/src/main/typescript/commands/fun/HttpCatCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { ArgumentSchema } from "@framework/arguments/ArgumentTypes";
import IntegerArgument from "@framework/arguments/IntegerArgument";
import { ErrorType } from "@framework/arguments/InvalidArgumentError";
diff --git a/src/main/typescript/commands/fun/HttpDogCommand.ts b/src/main/typescript/commands/fun/HttpDogCommand.ts
index ac4070996..3a2d4bfb0 100644
--- a/src/main/typescript/commands/fun/HttpDogCommand.ts
+++ b/src/main/typescript/commands/fun/HttpDogCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { ArgumentSchema } from "@framework/arguments/ArgumentTypes";
import IntegerArgument from "@framework/arguments/IntegerArgument";
import { ErrorType } from "@framework/arguments/InvalidArgumentError";
diff --git a/src/main/typescript/commands/fun/JokeCommand.ts b/src/main/typescript/commands/fun/JokeCommand.ts
index 6a84079ea..5a040e754 100644
--- a/src/main/typescript/commands/fun/JokeCommand.ts
+++ b/src/main/typescript/commands/fun/JokeCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import type { Buildable } from "@framework/commands/Command";
import { Command } from "@framework/commands/Command";
import type Context from "@framework/commands/Context";
diff --git a/src/main/typescript/commands/fun/MixEmojiCommand.ts b/src/main/typescript/commands/fun/MixEmojiCommand.ts
index 87d6850d0..f89b65e8f 100644
--- a/src/main/typescript/commands/fun/MixEmojiCommand.ts
+++ b/src/main/typescript/commands/fun/MixEmojiCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { ArgumentSchema } from "@framework/arguments/ArgumentTypes";
import { ErrorType } from "@framework/arguments/InvalidArgumentError";
import StringArgument from "@framework/arguments/StringArgument";
diff --git a/src/main/typescript/commands/fun/PixabayCommand.ts b/src/main/typescript/commands/fun/PixabayCommand.ts
index 0bc720758..cfd17d063 100644
--- a/src/main/typescript/commands/fun/PixabayCommand.ts
+++ b/src/main/typescript/commands/fun/PixabayCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { ArgumentSchema } from "@framework/arguments/ArgumentTypes";
import { ErrorType } from "@framework/arguments/InvalidArgumentError";
import RestStringArgument from "@framework/arguments/RestStringArgument";
diff --git a/src/main/typescript/commands/information/AvatarCommand.ts b/src/main/typescript/commands/information/AvatarCommand.ts
index fb15d19bd..609493e60 100644
--- a/src/main/typescript/commands/information/AvatarCommand.ts
+++ b/src/main/typescript/commands/information/AvatarCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { ArgumentSchema } from "@framework/arguments/ArgumentTypes";
import GuildMemberArgument from "@framework/arguments/GuildMemberArgument";
import UserArgument from "@framework/arguments/UserArgument";
@@ -59,9 +78,9 @@ class AvatarCommand extends Command {
) {
try {
member = user
- ? (context.guild!.members.cache.get(user.id) ??
- (await context.guild!.members.fetch(user.id)))
- : (context.member! as GuildMember);
+ ? (context.guild.members.cache.get(user.id) ??
+ (await context.guild.members.fetch(user.id)))
+ : (context.member!);
} catch (e) {
return void (await context.error("Failed to fetch member."));
}
@@ -70,16 +89,16 @@ class AvatarCommand extends Command {
await context.reply({
embeds: [
new EmbedBuilder()
- .setColor(user!.accentColor ?? "#007bff")
+ .setColor(user.accentColor ?? "#007bff")
.setAuthor({
- name: member?.user.username ?? user!.username
+ name: member?.user.username ?? user.username
})
.setImage(
member?.displayAvatarURL({
size: 4096,
forceStatic: false
}) ??
- user!.displayAvatarURL({
+ user.displayAvatarURL({
size: 4096,
forceStatic: false
})
@@ -89,13 +108,13 @@ class AvatarCommand extends Command {
size: 4096,
forceStatic: false
}) ??
- user!.displayAvatarURL({
+ user.displayAvatarURL({
size: 4096,
forceStatic: false
})
)
.setFooter({
- text: `${user!.username} (${user!.id})`
+ text: `${user.username} (${user.id})`
})
],
components: [
@@ -108,7 +127,7 @@ class AvatarCommand extends Command {
size: 4096,
forceStatic: false
}) ??
- user!.displayAvatarURL({
+ user.displayAvatarURL({
size: 4096,
forceStatic: false
})
diff --git a/src/main/typescript/commands/information/CrisisCommand.ts b/src/main/typescript/commands/information/CrisisCommand.ts
index fc20f7073..ebb19ec45 100644
--- a/src/main/typescript/commands/information/CrisisCommand.ts
+++ b/src/main/typescript/commands/information/CrisisCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import type { Buildable } from "@framework/commands/Command";
import { Command } from "@framework/commands/Command";
import type InteractionContext from "@framework/commands/InteractionContext";
diff --git a/src/main/typescript/commands/information/EmojiCommand.ts b/src/main/typescript/commands/information/EmojiCommand.ts
index 8d152b63c..961d12a49 100644
--- a/src/main/typescript/commands/information/EmojiCommand.ts
+++ b/src/main/typescript/commands/information/EmojiCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { ArgumentSchema } from "@framework/arguments/ArgumentTypes";
import { ErrorType } from "@framework/arguments/InvalidArgumentError";
import StringArgument from "@framework/arguments/StringArgument";
@@ -52,7 +71,7 @@ class EmojiCommand extends Command {
? emojiString.substring(2, emojiString.length - 1)
: emojiString;
- const emoji = await this.application.client.emojis.cache.find(
+ const emoji = this.application.client.emojis.cache.find(
e =>
e.name === emojiSubString ||
e.identifier === emojiSubString ||
diff --git a/src/main/typescript/commands/information/EncourageCommand.ts b/src/main/typescript/commands/information/EncourageCommand.ts
index 404b59e62..4ce2c9e6d 100644
--- a/src/main/typescript/commands/information/EncourageCommand.ts
+++ b/src/main/typescript/commands/information/EncourageCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import type { Buildable } from "@framework/commands/Command";
import { Command } from "@framework/commands/Command";
import type Context from "@framework/commands/Context";
diff --git a/src/main/typescript/commands/information/ProfileCommand.ts b/src/main/typescript/commands/information/ProfileCommand.ts
index 127a91334..2242be87b 100644
--- a/src/main/typescript/commands/information/ProfileCommand.ts
+++ b/src/main/typescript/commands/information/ProfileCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { ArgumentSchema } from "@framework/arguments/ArgumentTypes";
import GuildMemberArgument from "@framework/arguments/GuildMemberArgument";
import UserArgument from "@framework/arguments/UserArgument";
@@ -139,7 +158,7 @@ class ProfileCommand extends Command {
return (count / ProfileCommand.MAX_PERMISSION_COUNT) * 100;
}
- private async getMemberNameBadge(_member: GuildMember | undefined, isSystemAdmin: boolean) {
+ private getMemberNameBadge(_member: GuildMember | undefined, isSystemAdmin: boolean) {
let badges = "";
if (isSystemAdmin) {
@@ -211,7 +230,7 @@ class ProfileCommand extends Command {
}
}
const orderedRoles = isMember
- ? [...member!.roles.cache.values()]
+ ? [...member.roles.cache.values()]
.filter(role => role.id !== context.guildId)
.sort((role1, role2) => {
return role2.position - role1.position;
@@ -225,9 +244,9 @@ class ProfileCommand extends Command {
: orderedRoles
: ([] as Role[])
)!
- .reduce((acc, value) => `${acc} ${roleMention(value.id)}`, "")!
- .trim()!;
- const statusText = isMember ? this.getStatusText(context, member!) : null;
+ .reduce((acc, value) => `${acc} ${roleMention(value.id)}`, "")
+ .trim();
+ const statusText = isMember ? this.getStatusText(context, member) : null;
const isSystemAdmin =
this.application
.service("configManager")
@@ -235,12 +254,12 @@ class ProfileCommand extends Command {
(member &&
member instanceof GuildMember &&
(await this.permissionManagerService.isSystemAdmin(member)));
- const nameBadges = user!.displayName
+ const nameBadges = user.displayName
? " " +
- (await this.getMemberNameBadge(
+ this.getMemberNameBadge(
member instanceof GuildMember ? member : undefined,
isSystemAdmin
- ))
+ )
: "";
const fields: APIEmbedField[] = [
@@ -248,13 +267,13 @@ class ProfileCommand extends Command {
? [
{
name: "Nickname",
- value: `${member!.nickname?.replace(/\*<>@_~\|/g, "") ?? "*Nickname is not set*"}`
+ value: `${member.nickname?.replace(/\*<>@_~\|/g, "") ?? "*Nickname is not set*"}`
}
]
: []),
{
name: "Display Name",
- value: `${user!.displayName ? user!.displayName.replace(/\*<>@_~\|/g, "") + nameBadges : "*Display name is not set*"}`
+ value: `${user.displayName ? user.displayName.replace(/\*<>@_~\|/g, "") + nameBadges : "*Display name is not set*"}`
},
{
name: "Account Created",
@@ -265,8 +284,8 @@ class ProfileCommand extends Command {
? [
{
name: "Joined at",
- value: `${member!.joinedAt!.toLocaleDateString("en-US")} (${time(
- member!.joinedAt!,
+ value: `${member.joinedAt!.toLocaleDateString("en-US")} (${time(
+ member.joinedAt!,
"R"
)})`,
inline: true
@@ -292,10 +311,7 @@ class ProfileCommand extends Command {
const badges = [
...getUserBadges(user),
- ...(await this.getMemberDescriptiveBadges(
- isMember ? (member as GuildMember) : undefined,
- isSystemAdmin
- ))
+ ...(await this.getMemberDescriptiveBadges(isMember ? member : undefined, isSystemAdmin))
];
if (badges.length > 0) {
@@ -309,7 +325,7 @@ class ProfileCommand extends Command {
try {
await user.fetch(true);
- banner = user!.bannerURL({ size: 4096, forceStatic: false }) ?? undefined;
+ banner = user.bannerURL({ size: 4096, forceStatic: false }) ?? undefined;
} catch (e) {
this.application.logger.debug(e);
}
@@ -322,9 +338,9 @@ class ProfileCommand extends Command {
}
: undefined
})
- .setColor(user!.hexAccentColor ? user!.hexAccentColor! : "#007bff")
+ .setColor(user.hexAccentColor ? user.hexAccentColor : "#007bff")
.setAuthor({
- name: user.tag!,
+ name: user.tag,
iconURL: user.displayAvatarURL()
})
.setThumbnail(
@@ -336,7 +352,7 @@ class ProfileCommand extends Command {
.setFields(fields)
.setFooter({
text:
- `${user.bot ? "Bot" : "User"} • ${member!.id}` +
+ `${user.bot ? "Bot" : "User"} • ${member.id}` +
(isMember
? ` • Has ${this.calculatePermissionPercentage(member)}% permissions`
: "")
diff --git a/src/main/typescript/commands/information/ServerStatsCommand.ts b/src/main/typescript/commands/information/ServerStatsCommand.ts
index 0c5af5f6f..5c6033d2e 100644
--- a/src/main/typescript/commands/information/ServerStatsCommand.ts
+++ b/src/main/typescript/commands/information/ServerStatsCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import type { Buildable } from "@framework/commands/Command";
import { Command } from "@framework/commands/Command";
import type Context from "@framework/commands/Context";
@@ -15,27 +34,27 @@ class ServerStatsCommand extends Command {
public override async execute(context: Context): Promise {
const memberCount =
- context.guild!.members.cache.size > context.guild!.memberCount
- ? context.guild!.members.cache.size
- : context.guild!.memberCount;
+ context.guild.members.cache.size > context.guild.memberCount
+ ? context.guild.members.cache.size
+ : context.guild.memberCount;
let botCount = 0,
humanCount = 0;
- for (const member of context.guild!.members.cache.values()) {
+ for (const member of context.guild.members.cache.values()) {
if (member.user.bot) botCount++;
else humanCount++;
}
- const channelCount = context.guild!.channels.cache.size;
- const roleCount = context.guild!.roles.cache.size;
+ const channelCount = context.guild.channels.cache.size;
+ const roleCount = context.guild.roles.cache.size;
await context.reply({
embeds: [
{
color: 0x007bff,
author: {
- name: `Statistics of ${context.guild!.name}`,
- icon_url: context.guild!.iconURL() ?? undefined
+ name: `Statistics of ${context.guild.name}`,
+ icon_url: context.guild.iconURL() ?? undefined
},
fields: [
{
diff --git a/src/main/typescript/commands/information/UserLookupCommand.ts b/src/main/typescript/commands/information/UserLookupCommand.ts
index a8c1e542f..2ae5b94c7 100644
--- a/src/main/typescript/commands/information/UserLookupCommand.ts
+++ b/src/main/typescript/commands/information/UserLookupCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { ArgumentSchema } from "@framework/arguments/ArgumentTypes";
import GuildMemberArgument from "@framework/arguments/GuildMemberArgument";
import UserArgument from "@framework/arguments/UserArgument";
diff --git a/src/main/typescript/commands/moderation/BanCommand.ts b/src/main/typescript/commands/moderation/BanCommand.ts
index 1ae476ae1..230c87f3b 100644
--- a/src/main/typescript/commands/moderation/BanCommand.ts
+++ b/src/main/typescript/commands/moderation/BanCommand.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
diff --git a/src/main/typescript/commands/moderation/BeanCommand.ts b/src/main/typescript/commands/moderation/BeanCommand.ts
index b3552af2e..00bd90182 100644
--- a/src/main/typescript/commands/moderation/BeanCommand.ts
+++ b/src/main/typescript/commands/moderation/BeanCommand.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -107,7 +107,7 @@ class BeanCommand extends Command {
): Promise {
const { member, reason } = args;
- if (await protectSystemAdminsFromCommands(this.application, context, member.id)) {
+ if (protectSystemAdminsFromCommands(this.application, context, member.id)) {
return;
}
diff --git a/src/main/typescript/commands/moderation/ClearCommand.ts b/src/main/typescript/commands/moderation/ClearCommand.ts
index 3a588033e..cd4cb50e4 100644
--- a/src/main/typescript/commands/moderation/ClearCommand.ts
+++ b/src/main/typescript/commands/moderation/ClearCommand.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
diff --git a/src/main/typescript/commands/moderation/DMHistoryCommand.ts b/src/main/typescript/commands/moderation/DMHistoryCommand.ts
index 1c59f4bf8..fcca0b7fc 100644
--- a/src/main/typescript/commands/moderation/DMHistoryCommand.ts
+++ b/src/main/typescript/commands/moderation/DMHistoryCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { Command, CommandMessage } from "@framework/commands/Command";
import Context from "@framework/commands/Context";
import { Inject } from "@framework/container/Inject";
diff --git a/src/main/typescript/commands/moderation/EchoCommand.ts b/src/main/typescript/commands/moderation/EchoCommand.ts
index 179526aec..034ad620e 100644
--- a/src/main/typescript/commands/moderation/EchoCommand.ts
+++ b/src/main/typescript/commands/moderation/EchoCommand.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -164,13 +164,15 @@ class EchoCommand extends Command {
await context.success("Message sent successfully.");
}
- this.systemAuditLogging.logEchoCommandExecuted({
- command: this.name,
- guild: context.guild,
- rawCommandContent: content,
- user: context.user,
- generatedMessageOptions: options
- });
+ this.systemAuditLogging
+ .logEchoCommandExecuted({
+ command: this.name,
+ guild: context.guild,
+ rawCommandContent: content,
+ user: context.user,
+ generatedMessageOptions: options
+ })
+ .catch(this.application.logger.error);
} catch (error) {
return void context.error(
error instanceof DirectiveParseError
diff --git a/src/main/typescript/commands/moderation/EditMessageCommand.ts b/src/main/typescript/commands/moderation/EditMessageCommand.ts
index fe455a8e7..9f2b13474 100644
--- a/src/main/typescript/commands/moderation/EditMessageCommand.ts
+++ b/src/main/typescript/commands/moderation/EditMessageCommand.ts
@@ -1,7 +1,7 @@
-/**
+/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -116,13 +116,15 @@ export default class EditMessageCommand extends Command implements HasEventListe
return;
}
- this.systemAuditLogging.logEchoCommandExecuted({
- command: this.name,
- guild: interaction.guild!,
- rawCommandContent: content,
- user: interaction.user,
- generatedMessageOptions: options
- });
+ this.systemAuditLogging
+ .logEchoCommandExecuted({
+ command: this.name,
+ guild: interaction.guild!,
+ rawCommandContent: content,
+ user: interaction.user,
+ generatedMessageOptions: options
+ })
+ .catch(this.application.logger.error);
} catch (error) {
return void interaction.editReply(
error instanceof DirectiveParseError
diff --git a/src/main/typescript/commands/moderation/FakeBanCommand.ts b/src/main/typescript/commands/moderation/FakeBanCommand.ts
index a165ecba2..578591305 100644
--- a/src/main/typescript/commands/moderation/FakeBanCommand.ts
+++ b/src/main/typescript/commands/moderation/FakeBanCommand.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
diff --git a/src/main/typescript/commands/moderation/InfractionClearCommand.ts b/src/main/typescript/commands/moderation/InfractionClearCommand.ts
index cf65a5b0b..40d0264de 100644
--- a/src/main/typescript/commands/moderation/InfractionClearCommand.ts
+++ b/src/main/typescript/commands/moderation/InfractionClearCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { ArgumentSchema } from "@framework/arguments/ArgumentTypes";
import { ErrorType } from "@framework/arguments/InvalidArgumentError";
import StringArgument from "@framework/arguments/StringArgument";
diff --git a/src/main/typescript/commands/moderation/InfractionCommand.ts b/src/main/typescript/commands/moderation/InfractionCommand.ts
index ceea7b800..048700996 100644
--- a/src/main/typescript/commands/moderation/InfractionCommand.ts
+++ b/src/main/typescript/commands/moderation/InfractionCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import type { Buildable } from "@framework/commands/Command";
import { Command, type SubcommandMeta } from "@framework/commands/Command";
import { PermissionFlags } from "@framework/permissions/PermissionFlag";
diff --git a/src/main/typescript/commands/moderation/InfractionCreateCommand.ts b/src/main/typescript/commands/moderation/InfractionCreateCommand.ts
index 88663627f..9a16eab87 100644
--- a/src/main/typescript/commands/moderation/InfractionCreateCommand.ts
+++ b/src/main/typescript/commands/moderation/InfractionCreateCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { ArgumentSchema } from "@framework/arguments/ArgumentTypes";
import { ErrorType } from "@framework/arguments/InvalidArgumentError";
import RestStringArgument from "@framework/arguments/RestStringArgument";
diff --git a/src/main/typescript/commands/moderation/InfractionDeleteCommand.ts b/src/main/typescript/commands/moderation/InfractionDeleteCommand.ts
index 242d7980a..7033ec264 100644
--- a/src/main/typescript/commands/moderation/InfractionDeleteCommand.ts
+++ b/src/main/typescript/commands/moderation/InfractionDeleteCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { ArgumentSchema } from "@framework/arguments/ArgumentTypes";
import IntegerArgument from "@framework/arguments/IntegerArgument";
import { ErrorType } from "@framework/arguments/InvalidArgumentError";
@@ -59,7 +78,7 @@ class InfractionDeleteCommand extends Command {
});
const infraction: Infraction | undefined = await this.infractionManager.deleteById(
- context.guildId!,
+ context.guildId,
args.id
);
diff --git a/src/main/typescript/commands/moderation/InfractionDurationCommand.ts b/src/main/typescript/commands/moderation/InfractionDurationCommand.ts
index 17ca7cc94..561327cd1 100644
--- a/src/main/typescript/commands/moderation/InfractionDurationCommand.ts
+++ b/src/main/typescript/commands/moderation/InfractionDurationCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { ArgumentSchema } from "@framework/arguments/ArgumentTypes";
import DurationArgument from "@framework/arguments/DurationArgument";
import IntegerArgument from "@framework/arguments/IntegerArgument";
@@ -95,9 +114,9 @@ class InfractionDurationCommand extends Command {
}
const { error, infraction, success } = await this.infractionManager.updateDurationById(
- context.guildId!,
+ context.guildId,
id,
- typeof duration === "string" ? null : (duration as Duration),
+ typeof duration === "string" ? null : (duration),
!context.isChatInput() || context.options.getBoolean("notify") !== false
);
diff --git a/src/main/typescript/commands/moderation/InfractionListCommand.ts b/src/main/typescript/commands/moderation/InfractionListCommand.ts
index 6b6402368..54b57874b 100644
--- a/src/main/typescript/commands/moderation/InfractionListCommand.ts
+++ b/src/main/typescript/commands/moderation/InfractionListCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { ArgumentSchema } from "@framework/arguments/ArgumentTypes";
import UserArgument from "@framework/arguments/UserArgument";
import { Command, CommandMessage } from "@framework/commands/Command";
@@ -57,7 +76,7 @@ class InfractionListCommand extends Command {
});
const infractions: Infraction[] = await this.infractionManager.getUserInfractions(
- context.guildId!,
+ context.guildId,
args.user.id
);
diff --git a/src/main/typescript/commands/moderation/InfractionReasonCommand.ts b/src/main/typescript/commands/moderation/InfractionReasonCommand.ts
index 834b64a2f..310eb0bcf 100644
--- a/src/main/typescript/commands/moderation/InfractionReasonCommand.ts
+++ b/src/main/typescript/commands/moderation/InfractionReasonCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { ArgumentSchema } from "@framework/arguments/ArgumentTypes";
import IntegerArgument from "@framework/arguments/IntegerArgument";
import { ErrorType } from "@framework/arguments/InvalidArgumentError";
@@ -73,7 +92,7 @@ class InfractionReasonCommand extends Command {
const { id, reason } = args;
const isSuccess = await this.infractionManager.updateReasonById(
- context.guildId!,
+ context.guildId,
id,
reason,
!context.isChatInput() || context.options.getBoolean("notify") !== false
diff --git a/src/main/typescript/commands/moderation/InfractionViewCommand.ts b/src/main/typescript/commands/moderation/InfractionViewCommand.ts
index 743e40516..ae7662657 100644
--- a/src/main/typescript/commands/moderation/InfractionViewCommand.ts
+++ b/src/main/typescript/commands/moderation/InfractionViewCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { ArgumentSchema } from "@framework/arguments/ArgumentTypes";
import IntegerArgument from "@framework/arguments/IntegerArgument";
import { ErrorType } from "@framework/arguments/InvalidArgumentError";
@@ -148,7 +167,7 @@ class InfractionViewCommand extends Command {
});
const infraction: Infraction | undefined = await this.infractionManager.getById(
- context.guildId!,
+ context.guildId,
args.id
);
diff --git a/src/main/typescript/commands/moderation/KickCommand.ts b/src/main/typescript/commands/moderation/KickCommand.ts
index 9415d2861..cae0a5bc0 100644
--- a/src/main/typescript/commands/moderation/KickCommand.ts
+++ b/src/main/typescript/commands/moderation/KickCommand.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
diff --git a/src/main/typescript/commands/moderation/LockAllCommand.ts b/src/main/typescript/commands/moderation/LockAllCommand.ts
index 474e5c313..cc5f7e035 100644
--- a/src/main/typescript/commands/moderation/LockAllCommand.ts
+++ b/src/main/typescript/commands/moderation/LockAllCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { Command } from "@framework/commands/Command";
import type Context from "@framework/commands/Context";
import { Inject } from "@framework/container/Inject";
@@ -20,17 +39,19 @@ class LockAllCommand extends Command {
const { alreadyLocked, errors, permissionErrors, success, total, skipped } =
await this.channelLockManager.lockAll(context.guild);
- message.edit({
- content: null,
- embeds: [
- {
- color: 0x007bff,
- description:
- `## :lock: Locked ${success}/${total} Channels\n**Total**: ${total}\n**Success**: ${success}\n**Skipped:** ${skipped}\n**Already Locked**: ${alreadyLocked}\n**Missing permissions**: ${permissionErrors}` +
- (errors.length > 0 ? `\n\n__Errors__:\n${errors.join("\n")}` : "")
- }
- ]
- });
+ message
+ .edit({
+ content: null,
+ embeds: [
+ {
+ color: 0x007bff,
+ description:
+ `## :lock: Locked ${success}/${total} Channels\n**Total**: ${total}\n**Success**: ${success}\n**Skipped:** ${skipped}\n**Already Locked**: ${alreadyLocked}\n**Missing permissions**: ${permissionErrors}` +
+ (errors.length > 0 ? `\n\n__Errors__:\n${errors.join("\n")}` : "")
+ }
+ ]
+ })
+ .catch(this.application.logger.error);
}
}
diff --git a/src/main/typescript/commands/moderation/LockCommand.ts b/src/main/typescript/commands/moderation/LockCommand.ts
index 6d9567899..1e7fc4b40 100644
--- a/src/main/typescript/commands/moderation/LockCommand.ts
+++ b/src/main/typescript/commands/moderation/LockCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { ArgumentSchema } from "@framework/arguments/ArgumentTypes";
import ChannelArgument from "@framework/arguments/ChannelArgument";
import type { Buildable } from "@framework/commands/Command";
diff --git a/src/main/typescript/commands/moderation/MassBanCommand.ts b/src/main/typescript/commands/moderation/MassBanCommand.ts
index fcecc7c6b..7f5177715 100644
--- a/src/main/typescript/commands/moderation/MassBanCommand.ts
+++ b/src/main/typescript/commands/moderation/MassBanCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { Buildable, Command, CommandMessage } from "@framework/commands/Command";
import Context from "@framework/commands/Context";
import { Inject } from "@framework/container/Inject";
diff --git a/src/main/typescript/commands/moderation/MassKickCommand.ts b/src/main/typescript/commands/moderation/MassKickCommand.ts
index d4c68ea1c..9aba510da 100644
--- a/src/main/typescript/commands/moderation/MassKickCommand.ts
+++ b/src/main/typescript/commands/moderation/MassKickCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { Buildable, Command, CommandMessage } from "@framework/commands/Command";
import Context from "@framework/commands/Context";
import { Inject } from "@framework/container/Inject";
diff --git a/src/main/typescript/commands/moderation/ModMessageCommand.ts b/src/main/typescript/commands/moderation/ModMessageCommand.ts
index c4a5fb1fa..6fdb8d74b 100644
--- a/src/main/typescript/commands/moderation/ModMessageCommand.ts
+++ b/src/main/typescript/commands/moderation/ModMessageCommand.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
diff --git a/src/main/typescript/commands/moderation/ModStatsCommand.ts b/src/main/typescript/commands/moderation/ModStatsCommand.ts
index 492792f00..a6f84346b 100644
--- a/src/main/typescript/commands/moderation/ModStatsCommand.ts
+++ b/src/main/typescript/commands/moderation/ModStatsCommand.ts
@@ -1,7 +1,7 @@
-/**
+/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -108,7 +108,7 @@ export default class ModStatsCommand extends Command {
return { data };
}
)
- .setMessageOptionsBuilder(async ({ data, maxPages, page }) => {
+ .setMessageOptionsBuilder(({ data, maxPages, page }) => {
let description = "";
for (const infraction of data) {
diff --git a/src/main/typescript/commands/moderation/MuteCommand.ts b/src/main/typescript/commands/moderation/MuteCommand.ts
index 961f5070a..fcbdcaed2 100644
--- a/src/main/typescript/commands/moderation/MuteCommand.ts
+++ b/src/main/typescript/commands/moderation/MuteCommand.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
diff --git a/src/main/typescript/commands/moderation/NoteCommand.ts b/src/main/typescript/commands/moderation/NoteCommand.ts
index 23dfb4af9..b6b0ca5f2 100644
--- a/src/main/typescript/commands/moderation/NoteCommand.ts
+++ b/src/main/typescript/commands/moderation/NoteCommand.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
diff --git a/src/main/typescript/commands/moderation/ReportMessageCommand.ts b/src/main/typescript/commands/moderation/ReportMessageCommand.ts
index 85c7be23c..b89f3a5b3 100644
--- a/src/main/typescript/commands/moderation/ReportMessageCommand.ts
+++ b/src/main/typescript/commands/moderation/ReportMessageCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import type { Buildable } from "@framework/commands/Command";
import { Command } from "@framework/commands/Command";
import { ContextType } from "@framework/commands/ContextType";
diff --git a/src/main/typescript/commands/moderation/RoleCommand.ts b/src/main/typescript/commands/moderation/RoleCommand.ts
index f6fb5829e..3e7d74656 100644
--- a/src/main/typescript/commands/moderation/RoleCommand.ts
+++ b/src/main/typescript/commands/moderation/RoleCommand.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
diff --git a/src/main/typescript/commands/moderation/SaveMessageCommand.ts b/src/main/typescript/commands/moderation/SaveMessageCommand.ts
index 99396990d..38bc679a8 100644
--- a/src/main/typescript/commands/moderation/SaveMessageCommand.ts
+++ b/src/main/typescript/commands/moderation/SaveMessageCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { Buildable, Command } from "@framework/commands/Command";
import Context from "@framework/commands/Context";
import { ContextType } from "@framework/commands/ContextType";
diff --git a/src/main/typescript/commands/moderation/SendCommand.ts b/src/main/typescript/commands/moderation/SendCommand.ts
index c421a2102..4168f7144 100644
--- a/src/main/typescript/commands/moderation/SendCommand.ts
+++ b/src/main/typescript/commands/moderation/SendCommand.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -145,13 +145,15 @@ class SendCommand extends Command {
await context.success("Message sent successfully.");
}
- this.systemAuditLogging.logEchoCommandExecuted({
- command: this.name,
- guild: context.guild,
- rawCommandContent: content,
- user: context.user,
- generatedMessageOptions: options
- });
+ this.systemAuditLogging
+ .logEchoCommandExecuted({
+ command: this.name,
+ guild: context.guild,
+ rawCommandContent: content,
+ user: context.user,
+ generatedMessageOptions: options
+ })
+ .catch(this.application.logger.error);
} catch (error) {
return void context.error(
error instanceof DirectiveParseError
diff --git a/src/main/typescript/commands/moderation/SendHistoryCommand.ts b/src/main/typescript/commands/moderation/SendHistoryCommand.ts
index 2d528be89..1a9addd06 100644
--- a/src/main/typescript/commands/moderation/SendHistoryCommand.ts
+++ b/src/main/typescript/commands/moderation/SendHistoryCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { ArgumentSchema } from "@framework/arguments/ArgumentTypes";
import UserArgument from "@framework/arguments/UserArgument";
import { Buildable, Command, CommandMessage } from "@framework/commands/Command";
diff --git a/src/main/typescript/commands/moderation/SendReplyCommand.ts b/src/main/typescript/commands/moderation/SendReplyCommand.ts
index 8f64dc10f..fd826940b 100644
--- a/src/main/typescript/commands/moderation/SendReplyCommand.ts
+++ b/src/main/typescript/commands/moderation/SendReplyCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { Buildable, Command } from "@framework/commands/Command";
import Context from "@framework/commands/Context";
import { ContextType } from "@framework/commands/ContextType";
@@ -129,13 +148,15 @@ class SendReplyCommand
}
}
- this.systemAuditLogging.logEchoCommandExecuted({
- command: this.name,
- guild: interaction.guild!,
- rawCommandContent: content,
- user: interaction.user,
- generatedMessageOptions: options
- });
+ this.systemAuditLogging
+ .logEchoCommandExecuted({
+ command: this.name,
+ guild: interaction.guild!,
+ rawCommandContent: content,
+ user: interaction.user,
+ generatedMessageOptions: options
+ })
+ .catch(this.application.logger.error);
} catch (error) {
return void interaction.editReply(
error instanceof DirectiveParseError
diff --git a/src/main/typescript/commands/moderation/ShotCommand.ts b/src/main/typescript/commands/moderation/ShotCommand.ts
index 38dfaff71..37adc9373 100644
--- a/src/main/typescript/commands/moderation/ShotCommand.ts
+++ b/src/main/typescript/commands/moderation/ShotCommand.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -124,7 +124,7 @@ class ShotCommand extends Command {
): Promise {
const { member, reason } = args;
- if (await protectSystemAdminsFromCommands(this.application, context, member.id)) {
+ if (protectSystemAdminsFromCommands(this.application, context, member.id)) {
return;
}
diff --git a/src/main/typescript/commands/moderation/UnbanCommand.ts b/src/main/typescript/commands/moderation/UnbanCommand.ts
index 9d114093f..59216fac3 100644
--- a/src/main/typescript/commands/moderation/UnbanCommand.ts
+++ b/src/main/typescript/commands/moderation/UnbanCommand.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
diff --git a/src/main/typescript/commands/moderation/UnlockAllCommand.ts b/src/main/typescript/commands/moderation/UnlockAllCommand.ts
index ef6881814..5de2ce08e 100644
--- a/src/main/typescript/commands/moderation/UnlockAllCommand.ts
+++ b/src/main/typescript/commands/moderation/UnlockAllCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { Command } from "@framework/commands/Command";
import type Context from "@framework/commands/Context";
import { Inject } from "@framework/container/Inject";
@@ -23,17 +42,19 @@ class UnlockAllCommand extends Command {
const { notLocked, errors, permissionErrors, success, total, skipped } =
await this.channelLockManager.unlockAll(context.guild);
- message.edit({
- content: null,
- embeds: [
- {
- color: 0x007bff,
- description:
- `## :closed_lock_with_key: Unlocked ${success}/${total} Channels\n**Total**: ${total}\n**Success**: ${success}\n**Skipped:** ${skipped}\n**Not Locked**: ${notLocked}\n**Missing permissions**: ${permissionErrors}` +
- (errors.length > 0 ? `\n\n__Errors__:\n${errors.join("\n")}` : "")
- }
- ]
- });
+ message
+ .edit({
+ content: null,
+ embeds: [
+ {
+ color: 0x007bff,
+ description:
+ `## :closed_lock_with_key: Unlocked ${success}/${total} Channels\n**Total**: ${total}\n**Success**: ${success}\n**Skipped:** ${skipped}\n**Not Locked**: ${notLocked}\n**Missing permissions**: ${permissionErrors}` +
+ (errors.length > 0 ? `\n\n__Errors__:\n${errors.join("\n")}` : "")
+ }
+ ]
+ })
+ .catch(this.application.logger.error);
}
}
diff --git a/src/main/typescript/commands/moderation/UnlockCommand.ts b/src/main/typescript/commands/moderation/UnlockCommand.ts
index 2c1c1c291..56f311135 100644
--- a/src/main/typescript/commands/moderation/UnlockCommand.ts
+++ b/src/main/typescript/commands/moderation/UnlockCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { ArgumentSchema } from "@framework/arguments/ArgumentTypes";
import ChannelArgument from "@framework/arguments/ChannelArgument";
import type { Buildable } from "@framework/commands/Command";
diff --git a/src/main/typescript/commands/moderation/UnmuteCommand.ts b/src/main/typescript/commands/moderation/UnmuteCommand.ts
index 1cf404ab0..cb042a2df 100644
--- a/src/main/typescript/commands/moderation/UnmuteCommand.ts
+++ b/src/main/typescript/commands/moderation/UnmuteCommand.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
diff --git a/src/main/typescript/commands/moderation/WarnCommand.ts b/src/main/typescript/commands/moderation/WarnCommand.ts
index 9ed520218..b2128b99a 100644
--- a/src/main/typescript/commands/moderation/WarnCommand.ts
+++ b/src/main/typescript/commands/moderation/WarnCommand.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
diff --git a/src/main/typescript/commands/settings/.gitignore b/src/main/typescript/commands/settings/.gitignore
index a5166348b..67787f492 100644
--- a/src/main/typescript/commands/settings/.gitignore
+++ b/src/main/typescript/commands/settings/.gitignore
@@ -1 +1 @@
-TestCommand.ts
\ No newline at end of file
+TestCommand.ts
diff --git a/src/main/typescript/commands/settings/AboutCommand.ts b/src/main/typescript/commands/settings/AboutCommand.ts
index 3df7e819e..2e84dbfb0 100644
--- a/src/main/typescript/commands/settings/AboutCommand.ts
+++ b/src/main/typescript/commands/settings/AboutCommand.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
diff --git a/src/main/typescript/commands/settings/BlockedTokenCommand.ts b/src/main/typescript/commands/settings/BlockedTokenCommand.ts
index 7c58d6a47..92de560f0 100644
--- a/src/main/typescript/commands/settings/BlockedTokenCommand.ts
+++ b/src/main/typescript/commands/settings/BlockedTokenCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import type { Buildable } from "@framework/commands/Command";
import { Command } from "@framework/commands/Command";
import type InteractionContext from "@framework/commands/InteractionContext";
diff --git a/src/main/typescript/commands/settings/BlockedWordCommand.ts b/src/main/typescript/commands/settings/BlockedWordCommand.ts
index d00d3f88f..19e1745a5 100644
--- a/src/main/typescript/commands/settings/BlockedWordCommand.ts
+++ b/src/main/typescript/commands/settings/BlockedWordCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import type { Buildable } from "@framework/commands/Command";
import { Command } from "@framework/commands/Command";
import type InteractionContext from "@framework/commands/InteractionContext";
diff --git a/src/main/typescript/commands/settings/ConfigCommand.ts b/src/main/typescript/commands/settings/ConfigCommand.ts
index 4286ede97..5007e13f9 100644
--- a/src/main/typescript/commands/settings/ConfigCommand.ts
+++ b/src/main/typescript/commands/settings/ConfigCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import type { Buildable, SubcommandMeta } from "@framework/commands/Command";
import { Command } from "@framework/commands/Command";
import InteractionContext from "@framework/commands/InteractionContext";
diff --git a/src/main/typescript/commands/settings/EvalCommand.ts b/src/main/typescript/commands/settings/EvalCommand.ts
index 83990e6be..af9fb501e 100644
--- a/src/main/typescript/commands/settings/EvalCommand.ts
+++ b/src/main/typescript/commands/settings/EvalCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { ArgumentSchema } from "@framework/arguments/ArgumentTypes";
import { ErrorType } from "@framework/arguments/InvalidArgumentError";
import RestStringArgument from "@framework/arguments/RestStringArgument";
@@ -341,9 +360,9 @@ class EvalCommand extends Command {
}
} catch (error) {
if ("stack" in (error as Error) && "message" in (error as Error)) {
- uncaughtErrorHandler(error as Error);
+ uncaughtErrorHandler(error as Error).catch(this.application.logger.error);
} else {
- rejectionHandler(error);
+ rejectionHandler(error).catch(this.application.logger.error);
}
}
diff --git a/src/main/typescript/commands/settings/HelpCommand.ts b/src/main/typescript/commands/settings/HelpCommand.ts
index 16ac41593..36575b66c 100644
--- a/src/main/typescript/commands/settings/HelpCommand.ts
+++ b/src/main/typescript/commands/settings/HelpCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import Application from "@framework/app/Application";
import { ArgumentSchema } from "@framework/arguments/ArgumentTypes";
import StringArgument from "@framework/arguments/StringArgument";
diff --git a/src/main/typescript/commands/settings/PermissionCommand.ts b/src/main/typescript/commands/settings/PermissionCommand.ts
index eeaafd931..99cec0f55 100644
--- a/src/main/typescript/commands/settings/PermissionCommand.ts
+++ b/src/main/typescript/commands/settings/PermissionCommand.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -317,9 +317,9 @@ class PermissionCommand extends Command {
}
)
.setLimit(10)
- .setCountGetter(async () => overwriteCount)
+ .setCountGetter(() => overwriteCount)
.setMaxTimeout(Pagination.DEFAULT_TIMEOUT)
- .setMessageOptionsBuilder(async ({ data, maxPages, page }) => {
+ .setMessageOptionsBuilder(({ data, maxPages, page }) => {
let content = "";
for (const overwrite of data) {
diff --git a/src/main/typescript/commands/settings/RestartCommand.ts b/src/main/typescript/commands/settings/RestartCommand.ts
index c793bd37d..e04e5d39d 100644
--- a/src/main/typescript/commands/settings/RestartCommand.ts
+++ b/src/main/typescript/commands/settings/RestartCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import type { Buildable } from "@framework/commands/Command";
import { Command } from "@framework/commands/Command";
import type Context from "@framework/commands/Context";
@@ -88,7 +107,7 @@ class RestartCommand extends Command {
components: [new ActionRowBuilder().addComponents(...buttons)]
});
- await this.startupManager.requestRestart({
+ this.startupManager.requestRestart({
guildId,
channelId,
message: `Restart command was executed by ${interaction.user.username} (${interaction.user.id})`,
@@ -135,8 +154,8 @@ class RestartCommand extends Command {
components: [
new ActionRowBuilder().addComponents(
...this.buildButtons(
- context.guildId!,
- context.channelId!,
+ context.guildId,
+ context.channelId,
context.member!.user.id,
mfaKey
)
@@ -146,25 +165,27 @@ class RestartCommand extends Command {
if (reply) {
setTimeout(() => {
- reply.edit({
- embeds: [
- {
- color: 0xf14a60,
- description: `### ${context.emoji("restart")} System Restart\nOperation cancelled due to inactivity.`
- }
- ],
- components: [
- new ActionRowBuilder().addComponents(
- ...this.buildButtons(
- context.guildId!,
- context.channelId!,
- context.member!.user.id,
- mfaKey,
- true
+ reply
+ .edit({
+ embeds: [
+ {
+ color: 0xf14a60,
+ description: `### ${context.emoji("restart")} System Restart\nOperation cancelled due to inactivity.`
+ }
+ ],
+ components: [
+ new ActionRowBuilder().addComponents(
+ ...this.buildButtons(
+ context.guildId,
+ context.channelId,
+ context.member!.user.id,
+ mfaKey,
+ true
+ )
)
- )
- ]
- });
+ ]
+ })
+ .catch(this.application.logger.error);
}, 180_000); // 3 minutes
}
}
diff --git a/src/main/typescript/commands/settings/SystemStatusCommand.ts b/src/main/typescript/commands/settings/SystemStatusCommand.ts
index 7a99ce871..30e9f4618 100644
--- a/src/main/typescript/commands/settings/SystemStatusCommand.ts
+++ b/src/main/typescript/commands/settings/SystemStatusCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import type { Buildable } from "@framework/commands/Command";
import { Command } from "@framework/commands/Command";
import type Context from "@framework/commands/Context";
@@ -118,9 +137,9 @@ class SystemStatusCommand extends Command {
};
if (context.isLegacy() && message) {
- message.edit({ embeds: [embed] });
+ message.edit({ embeds: [embed] }).catch(this.application.logger.error);
} else if (context.isChatInput()) {
- context.replyEmbed(embed);
+ context.replyEmbed(embed).catch(this.application.logger.error);
}
}
}
diff --git a/src/main/typescript/commands/settings/UpdateCommand.ts b/src/main/typescript/commands/settings/UpdateCommand.ts
index abee6b9f3..a7424cb71 100644
--- a/src/main/typescript/commands/settings/UpdateCommand.ts
+++ b/src/main/typescript/commands/settings/UpdateCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import type { Buildable } from "@framework/commands/Command";
import { Command } from "@framework/commands/Command";
import type Context from "@framework/commands/Context";
@@ -191,7 +210,7 @@ class UpdateCommand extends Command {
})
.catch(this.application.logger.error);
- await this.startupManager.requestRestart({ metadata: "update" });
+ this.startupManager.requestRestart({ metadata: "update" });
}
});
diff --git a/src/main/typescript/commands/settings/UpdateCommandsCommand.ts b/src/main/typescript/commands/settings/UpdateCommandsCommand.ts
index 0cf3e7695..dccb03207 100644
--- a/src/main/typescript/commands/settings/UpdateCommandsCommand.ts
+++ b/src/main/typescript/commands/settings/UpdateCommandsCommand.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
diff --git a/src/main/typescript/commands/system/ReloadCommand.ts b/src/main/typescript/commands/system/ReloadCommand.ts
index 93b79feb3..a60e0f130 100644
--- a/src/main/typescript/commands/system/ReloadCommand.ts
+++ b/src/main/typescript/commands/system/ReloadCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { ArgumentSchema } from "@framework/arguments/ArgumentTypes";
import { ErrorType } from "@framework/arguments/InvalidArgumentError";
import StringArgument from "@framework/arguments/StringArgument";
diff --git a/src/main/typescript/commands/system/SystemBanCommand.ts b/src/main/typescript/commands/system/SystemBanCommand.ts
index 8291811dc..187431f5a 100644
--- a/src/main/typescript/commands/system/SystemBanCommand.ts
+++ b/src/main/typescript/commands/system/SystemBanCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { ArgumentSchema } from "@framework/arguments/ArgumentTypes";
import UserArgument from "@framework/arguments/UserArgument";
import type { Buildable } from "@framework/commands/Command";
diff --git a/src/main/typescript/commands/system/SystemUnbanCommand.ts b/src/main/typescript/commands/system/SystemUnbanCommand.ts
index 32c809caa..345e0e1ab 100644
--- a/src/main/typescript/commands/system/SystemUnbanCommand.ts
+++ b/src/main/typescript/commands/system/SystemUnbanCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { ArgumentSchema } from "@framework/arguments/ArgumentTypes";
import UserArgument from "@framework/arguments/UserArgument";
import type { Buildable } from "@framework/commands/Command";
diff --git a/src/main/typescript/commands/tools/ArchiveCommand.ts b/src/main/typescript/commands/tools/ArchiveCommand.ts
index 5da78aa1c..1d36967eb 100644
--- a/src/main/typescript/commands/tools/ArchiveCommand.ts
+++ b/src/main/typescript/commands/tools/ArchiveCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { ArgumentSchema } from "@framework/arguments/ArgumentTypes";
import ChannelArgument from "@framework/arguments/ChannelArgument";
import { Command, type Buildable } from "@framework/commands/Command";
diff --git a/src/main/typescript/commands/tools/EmbedBuildCommand.ts b/src/main/typescript/commands/tools/EmbedBuildCommand.ts
index ff70b7c30..5f75c1c82 100644
--- a/src/main/typescript/commands/tools/EmbedBuildCommand.ts
+++ b/src/main/typescript/commands/tools/EmbedBuildCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { ArgumentSchema } from "@framework/arguments/ArgumentTypes";
import { ErrorType } from "@framework/arguments/InvalidArgumentError";
import RestStringArgument from "@framework/arguments/RestStringArgument";
diff --git a/src/main/typescript/commands/tools/EmbedCommand.ts b/src/main/typescript/commands/tools/EmbedCommand.ts
index 283180e17..02c971972 100644
--- a/src/main/typescript/commands/tools/EmbedCommand.ts
+++ b/src/main/typescript/commands/tools/EmbedCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import AbstractRootCommand from "@framework/commands/AbstractRootCommand";
import { PermissionFlags } from "@framework/permissions/PermissionFlag";
import type { Buildable } from "@framework/commands/Command";
diff --git a/src/main/typescript/commands/tools/EmbedSchemaCommand.ts b/src/main/typescript/commands/tools/EmbedSchemaCommand.ts
index c9afcc5a3..eca4c1295 100644
--- a/src/main/typescript/commands/tools/EmbedSchemaCommand.ts
+++ b/src/main/typescript/commands/tools/EmbedSchemaCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { Command } from "@framework/commands/Command";
import { PermissionFlags } from "@framework/permissions/PermissionFlag";
import type LegacyContext from "@framework/commands/LegacyContext";
diff --git a/src/main/typescript/commands/tools/EmbedSendCommand.ts b/src/main/typescript/commands/tools/EmbedSendCommand.ts
index 06936854c..54326d767 100644
--- a/src/main/typescript/commands/tools/EmbedSendCommand.ts
+++ b/src/main/typescript/commands/tools/EmbedSendCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { Command } from "@framework/commands/Command";
import { PermissionFlags } from "@framework/permissions/PermissionFlag";
import type LegacyContext from "@framework/commands/LegacyContext";
diff --git a/src/main/typescript/commands/tools/ExtractEmojisCommand.ts b/src/main/typescript/commands/tools/ExtractEmojisCommand.ts
index 37696e08c..92ce0f9ec 100644
--- a/src/main/typescript/commands/tools/ExtractEmojisCommand.ts
+++ b/src/main/typescript/commands/tools/ExtractEmojisCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { ArgumentSchema } from "@framework/arguments/ArgumentTypes";
import { ErrorType } from "@framework/arguments/InvalidArgumentError";
import StringArgument from "@framework/arguments/StringArgument";
diff --git a/src/main/typescript/commands/tools/SetSlowmodeCommand.ts b/src/main/typescript/commands/tools/SetSlowmodeCommand.ts
index 179491738..8e2709f3a 100644
--- a/src/main/typescript/commands/tools/SetSlowmodeCommand.ts
+++ b/src/main/typescript/commands/tools/SetSlowmodeCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { ArgumentSchema } from "@framework/arguments/ArgumentTypes";
import ChannelArgument from "@framework/arguments/ChannelArgument";
import DurationArgument from "@framework/arguments/DurationArgument";
diff --git a/src/main/typescript/commands/tools/SnippetCommand.ts b/src/main/typescript/commands/tools/SnippetCommand.ts
index b2be3ee21..5b4d468dc 100644
--- a/src/main/typescript/commands/tools/SnippetCommand.ts
+++ b/src/main/typescript/commands/tools/SnippetCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import AbstractRootCommand from "@framework/commands/AbstractRootCommand";
import type { Buildable } from "@framework/commands/Command";
import { PermissionFlags } from "@framework/permissions/PermissionFlag";
diff --git a/src/main/typescript/commands/tools/SnippetCreateCommand.ts b/src/main/typescript/commands/tools/SnippetCreateCommand.ts
index 14aa95153..bf38dbbc9 100644
--- a/src/main/typescript/commands/tools/SnippetCreateCommand.ts
+++ b/src/main/typescript/commands/tools/SnippetCreateCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { ArgumentSchema } from "@framework/arguments/ArgumentTypes";
import { ErrorType } from "@framework/arguments/InvalidArgumentError";
import RestStringArgument from "@framework/arguments/RestStringArgument";
diff --git a/src/main/typescript/commands/tools/SnippetDeleteCommand.ts b/src/main/typescript/commands/tools/SnippetDeleteCommand.ts
index 3fe9cb099..922908796 100644
--- a/src/main/typescript/commands/tools/SnippetDeleteCommand.ts
+++ b/src/main/typescript/commands/tools/SnippetDeleteCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { ArgumentSchema } from "@framework/arguments/ArgumentTypes";
import { ErrorType } from "@framework/arguments/InvalidArgumentError";
import StringArgument from "@framework/arguments/StringArgument";
diff --git a/src/main/typescript/commands/tools/SnippetEditCommand.ts b/src/main/typescript/commands/tools/SnippetEditCommand.ts
index 63f55b1ef..723f6c34b 100644
--- a/src/main/typescript/commands/tools/SnippetEditCommand.ts
+++ b/src/main/typescript/commands/tools/SnippetEditCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { ArgumentSchema } from "@framework/arguments/ArgumentTypes";
import { ErrorType } from "@framework/arguments/InvalidArgumentError";
import RestStringArgument from "@framework/arguments/RestStringArgument";
diff --git a/src/main/typescript/commands/tools/SnippetListCommand.ts b/src/main/typescript/commands/tools/SnippetListCommand.ts
index 0fdb1148a..29bae1785 100644
--- a/src/main/typescript/commands/tools/SnippetListCommand.ts
+++ b/src/main/typescript/commands/tools/SnippetListCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { Command } from "@framework/commands/Command";
import type Context from "@framework/commands/Context";
import { Inject } from "@framework/container/Inject";
@@ -22,7 +41,7 @@ class SnippetListCommand extends Command {
private readonly snippetManagerService!: SnippetManagerService;
public override async execute(context: Context): Promise {
- const snippets = await this.snippetManagerService.getSnippets(context.guildId);
+ const snippets = this.snippetManagerService.getSnippets(context.guildId);
if (snippets.length === 0) {
await context.error("No snippets found.");
diff --git a/src/main/typescript/commands/tools/SnippetPushFileCommand.ts b/src/main/typescript/commands/tools/SnippetPushFileCommand.ts
index 10a522494..9192f533c 100644
--- a/src/main/typescript/commands/tools/SnippetPushFileCommand.ts
+++ b/src/main/typescript/commands/tools/SnippetPushFileCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { ArgumentSchema } from "@framework/arguments/ArgumentTypes";
import { ErrorType } from "@framework/arguments/InvalidArgumentError";
import StringArgument from "@framework/arguments/StringArgument";
@@ -54,7 +73,7 @@ class SnippetPushFileCommand extends Command {
const snippet = await this.snippetManagerService.pushAttachment(
name,
[...context.attachments.map(a => a.proxyURL).values()],
- context.guildId!
+ context.guildId
);
if (!snippet) {
diff --git a/src/main/typescript/commands/tools/SnippetRenameCommand.ts b/src/main/typescript/commands/tools/SnippetRenameCommand.ts
index f425956af..5a048e9c5 100644
--- a/src/main/typescript/commands/tools/SnippetRenameCommand.ts
+++ b/src/main/typescript/commands/tools/SnippetRenameCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { ArgumentSchema } from "@framework/arguments/ArgumentTypes";
import { ErrorType } from "@framework/arguments/InvalidArgumentError";
import StringArgument from "@framework/arguments/StringArgument";
diff --git a/src/main/typescript/commands/tools/TranslateCommand.ts b/src/main/typescript/commands/tools/TranslateCommand.ts
index 68655a60a..3ddea93a4 100644
--- a/src/main/typescript/commands/tools/TranslateCommand.ts
+++ b/src/main/typescript/commands/tools/TranslateCommand.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { ArgumentSchema } from "@framework/arguments/ArgumentTypes";
import { ErrorType } from "@framework/arguments/InvalidArgumentError";
import RestStringArgument from "@framework/arguments/RestStringArgument";
@@ -12,8 +31,7 @@ import TranslationService from "@main/services/TranslationService";
import {
type ApplicationCommandOptionChoiceData,
EmbedBuilder,
- type Interaction,
- User
+ type Interaction
} from "discord.js";
type TranslateCommandArgs = {
@@ -85,7 +103,7 @@ class TranslateCommand extends Command {
}
@GatewayEventListener("interactionCreate")
- public async onInteractionCreate(interaction: Interaction) {
+ public onInteractionCreate(interaction: Interaction) {
if (!interaction.isAutocomplete() || interaction.commandName !== this.name) {
return;
}
@@ -206,12 +224,10 @@ class TranslateCommand extends Command {
color: 0x007bff,
author: {
name: context.isMessageContextMenu()
- ? (context.commandMessage.targetMessage.author as User).username
+ ? context.commandMessage.targetMessage.author.username
: "Translation",
iconURL: context.isMessageContextMenu()
- ? (
- context.commandMessage.targetMessage.author as User
- ).displayAvatarURL()
+ ? context.commandMessage.targetMessage.author.displayAvatarURL()
: undefined
},
description: translation,
diff --git a/src/main/typescript/constants/Colors.ts b/src/main/typescript/constants/Colors.ts
index 05099db37..6b2fc5c37 100644
--- a/src/main/typescript/constants/Colors.ts
+++ b/src/main/typescript/constants/Colors.ts
@@ -1,21 +1,21 @@
/*
-* This file is part of SudoBot.
-*
-* Copyright (C) 2021-2024 OSN Developers.
-*
-* SudoBot is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Affero General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* SudoBot is distributed in the hope that it will be useful, but
-* WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU Affero General Public License for more details.
-*
-* You should have received a copy of the GNU Affero General Public License
-* along with SudoBot. If not, see .
-*/
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
import { Colors as DiscordColors } from "discord.js";
diff --git a/src/main/typescript/constants/Limits.ts b/src/main/typescript/constants/Limits.ts
index ae75597c4..7b8e74be6 100644
--- a/src/main/typescript/constants/Limits.ts
+++ b/src/main/typescript/constants/Limits.ts
@@ -1,21 +1,21 @@
/*
-* This file is part of SudoBot.
-*
-* Copyright (C) 2021-2024 OSN Developers.
-*
-* SudoBot is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Affero General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* SudoBot is distributed in the hope that it will be useful, but
-* WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU Affero General Public License for more details.
-*
-* You should have received a copy of the GNU Affero General Public License
-* along with SudoBot. If not, see .
-*/
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
export enum Limits {
Reason = 2000
diff --git a/src/main/typescript/contracts/MessageAutoModServiceContract.ts b/src/main/typescript/contracts/MessageAutoModServiceContract.ts
index 5f766759b..1373009da 100644
--- a/src/main/typescript/contracts/MessageAutoModServiceContract.ts
+++ b/src/main/typescript/contracts/MessageAutoModServiceContract.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import type { Service } from "@framework/services/Service";
import type { Message } from "discord.js";
diff --git a/src/main/typescript/contracts/ModerationRuleHandlerContract.ts b/src/main/typescript/contracts/ModerationRuleHandlerContract.ts
index c68a1d4cf..be0430fd4 100644
--- a/src/main/typescript/contracts/ModerationRuleHandlerContract.ts
+++ b/src/main/typescript/contracts/ModerationRuleHandlerContract.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import type { APIEmbed, Awaitable, GuildMember, Message } from "discord.js";
import type { MessageRuleType } from "../schemas/MessageRuleSchema";
diff --git a/src/main/typescript/core/Client.ts b/src/main/typescript/core/Client.ts
index 4975606c4..ce8c32729 100644
--- a/src/main/typescript/core/Client.ts
+++ b/src/main/typescript/core/Client.ts
@@ -1,7 +1,7 @@
-/**
+/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2023 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
diff --git a/src/main/typescript/core/DiscordKernel.ts b/src/main/typescript/core/DiscordKernel.ts
index d7aa92a52..e246236b5 100644
--- a/src/main/typescript/core/DiscordKernel.ts
+++ b/src/main/typescript/core/DiscordKernel.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -213,7 +213,7 @@ class DiscordKernel extends Kernel {
if (process.env.SERVER_ONLY_MODE) {
await application.service("apiServer").boot();
- await application.service("apiServer").start();
+ application.service("apiServer").start();
} else {
this.logger.debug("Attempting to log into Discord...");
await application.getClient().login(process.env.TOKEN);
diff --git a/src/main/typescript/core/FatalError.ts b/src/main/typescript/core/FatalError.ts
index 7f3e6e65f..424717257 100644
--- a/src/main/typescript/core/FatalError.ts
+++ b/src/main/typescript/core/FatalError.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
class FatalError extends Error {}
export default FatalError;
\ No newline at end of file
diff --git a/src/main/typescript/decorators/AcceptsMessageRuleScopes.ts b/src/main/typescript/decorators/AcceptsMessageRuleScopes.ts
index fe2ec4db1..f6396f15d 100644
--- a/src/main/typescript/decorators/AcceptsMessageRuleScopes.ts
+++ b/src/main/typescript/decorators/AcceptsMessageRuleScopes.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import type { MessageRuleScope } from "../contracts/ModerationRuleHandlerContract";
export function AcceptsMessageRuleScopes(...scopes: MessageRuleScope[]) {
diff --git a/src/main/typescript/decorators/AcceptsModerationRuleContextType.ts b/src/main/typescript/decorators/AcceptsModerationRuleContextType.ts
index 0f7fe5338..345f8408a 100644
--- a/src/main/typescript/decorators/AcceptsModerationRuleContextType.ts
+++ b/src/main/typescript/decorators/AcceptsModerationRuleContextType.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import type { ModerationRuleContextType } from "../contracts/ModerationRuleHandlerContract";
export function AcceptsModerationRuleContextType(type: ModerationRuleContextType) {
diff --git a/src/main/typescript/directives/EmbedDirective.ts b/src/main/typescript/directives/EmbedDirective.ts
index d8a4da840..e16a63674 100644
--- a/src/main/typescript/directives/EmbedDirective.ts
+++ b/src/main/typescript/directives/EmbedDirective.ts
@@ -1,10 +1,29 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import type { ParserState } from "@framework/directives/Directive";
import Directive from "@framework/directives/Directive";
import DirectiveParseError from "@framework/directives/DirectiveParseError";
import type DirectiveParser from "@framework/directives/DirectiveParser";
+import { escapeRegex } from "@framework/utils/utils";
import type { APIEmbed } from "discord.js";
import { z } from "zod";
-import { escapeRegex } from "@framework/utils/utils";
class EmbedDirective extends Directive {
public override readonly name = "embed";
@@ -56,7 +75,7 @@ class EmbedDirective extends Directive {
.optional()
});
- public override async apply(parser: DirectiveParser, state: ParserState, arg: APIEmbed) {
+ public override apply(parser: DirectiveParser, state: ParserState, arg: APIEmbed) {
const embed = EmbedDirective.discordApiEmbedSchema.safeParse(arg);
if (!embed.success) {
@@ -80,7 +99,7 @@ class EmbedDirective extends Directive {
}
state.data.embeds ??= [];
- (state.data.embeds as Array)!.push(embed.data);
+ (state.data.embeds as Array).push(embed.data);
}
}
diff --git a/src/main/typescript/drizzle/QueryLogger.ts b/src/main/typescript/drizzle/QueryLogger.ts
index 5eb8d4ff4..9865191eb 100644
--- a/src/main/typescript/drizzle/QueryLogger.ts
+++ b/src/main/typescript/drizzle/QueryLogger.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { Logger } from "@framework/log/Logger";
import chalk from "chalk";
import type { Logger as DrizzleLogger } from "drizzle-orm";
diff --git a/src/main/typescript/env/env.ts b/src/main/typescript/env/env.ts
index c83cc82d1..8ad4a464a 100644
--- a/src/main/typescript/env/env.ts
+++ b/src/main/typescript/env/env.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import Environment from "@framework/env/Environment";
import type { EnvironmentVariableRecord } from "@main/schemas/EnvironmentVariableSchema";
import { EnvironmentVariableSchema } from "@main/schemas/EnvironmentVariableSchema";
diff --git a/src/main/typescript/events/GuildAuditLogEntryCreateEventListener.ts b/src/main/typescript/events/GuildAuditLogEntryCreateEventListener.ts
index 22d2bc224..e76452ee8 100644
--- a/src/main/typescript/events/GuildAuditLogEntryCreateEventListener.ts
+++ b/src/main/typescript/events/GuildAuditLogEntryCreateEventListener.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { Inject } from "@framework/container/Inject";
import EventListener from "@framework/events/EventListener";
import { Events } from "@framework/types/ClientEvents";
@@ -19,7 +38,7 @@ class GuildAuditLogEntryCreateEventListener extends EventListener.
+ */
+
import { Inject } from "@framework/container/Inject";
import EventListener from "@framework/events/EventListener";
import { Events } from "@framework/types/ClientEvents";
diff --git a/src/main/typescript/events/ReadyEventListener.ts b/src/main/typescript/events/ReadyEventListener.ts
index 3dcad3c0c..5669ac24e 100644
--- a/src/main/typescript/events/ReadyEventListener.ts
+++ b/src/main/typescript/events/ReadyEventListener.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -53,15 +53,14 @@ class ReadyEventListener extends EventListener {
this.logger.info(`Logged in as: ${this.client.user?.username}`);
this.configManager.onReady();
- this.startupManager.onReady();
- this.commandManager.onReady();
- this.queueService.onReady();
- this.application.service("apiServer").onReady();
+ this.startupManager.onReady().catch(this.application.logger.error);
+ this.commandManager.onReady().catch(this.application.logger.error);
+ this.queueService.onReady().catch(this.application.logger.error);
+ this.application.service("apiServer").onReady().catch(this.application.logger.error);
- const homeGuild = await this.client.getHomeGuild();
-
- if (this.configManager.systemConfig.sync_emojis) {
+ if (this.configManager.systemConfig.sync_emojis && process.env.HOME_GUILD_ID) {
try {
+ const homeGuild = await this.client.getHomeGuild();
const emojis = await homeGuild.emojis.fetch();
for (const [id, emoji] of emojis) {
@@ -70,21 +69,23 @@ class ReadyEventListener extends EventListener {
}
}
- this.logger.info("Successfully synced the emojis of home guild.");
+ this.logger.info("Successfully synced the emojis of home guild");
} catch (e) {
this.logger.error(e);
this.logger.warn(
- "Failed to fetch some of the emojis. The bot may not show some of the emojis in it's responses if dependent on guild-specific emojis."
+ "Failed to fetch some of the emojis. The bot may not show some of the emojis in it's responses if dependent on guild-specific emojis"
);
}
+ }
+ if (this.configManager.systemConfig.sync_emojis) {
try {
await this.application.client.application?.emojis.fetch();
- this.logger.info("Successfully synced the application emojis.");
+ this.logger.info("Successfully synced the application emojis");
} catch (e) {
this.logger.error(e);
this.logger.warn(
- "Failed to fetch some of the emojis. The bot may not show some of the emojis in it's responses if dependent on application-specific emojis."
+ "Failed to fetch some of the emojis. The bot may not show some of the emojis in it's responses if dependent on application-specific emojis"
);
}
}
diff --git a/src/main/typescript/events/interaction/InteractionCreateEventListener.ts b/src/main/typescript/events/interaction/InteractionCreateEventListener.ts
index 904ee6099..a62414c31 100644
--- a/src/main/typescript/events/interaction/InteractionCreateEventListener.ts
+++ b/src/main/typescript/events/interaction/InteractionCreateEventListener.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
diff --git a/src/main/typescript/events/member/GuildMemberAddEventListener.ts b/src/main/typescript/events/member/GuildMemberAddEventListener.ts
index 4ad2318f9..baa45c528 100644
--- a/src/main/typescript/events/member/GuildMemberAddEventListener.ts
+++ b/src/main/typescript/events/member/GuildMemberAddEventListener.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { Inject } from "@framework/container/Inject";
import EventListener from "@framework/events/EventListener";
import { Events } from "@framework/types/ClientEvents";
@@ -20,9 +39,11 @@ class GuildMemberAddEventListener extends EventListener {
protected readonly antiMemberJoinService!: AntiMemberJoinService;
public override async execute(member: GuildMember): Promise {
- this.auditLoggingService.emitLogEvent(member.guild.id, LogEventType.GuildMemberAdd, member);
+ this.auditLoggingService
+ .emitLogEvent(member.guild.id, LogEventType.GuildMemberAdd, member)
+ .catch(this.application.logger.error);
await this.antiMemberJoinService.onGuildMemberAdd(member);
- this.infractionManager.reapplyMuteIfNeeded(member);
+ this.infractionManager.reapplyMuteIfNeeded(member).catch(this.application.logger.error);
}
}
diff --git a/src/main/typescript/events/member/GuildMemberRemoveEventListener.ts b/src/main/typescript/events/member/GuildMemberRemoveEventListener.ts
index 6b6ba5131..9ac3f7472 100644
--- a/src/main/typescript/events/member/GuildMemberRemoveEventListener.ts
+++ b/src/main/typescript/events/member/GuildMemberRemoveEventListener.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { Inject } from "@framework/container/Inject";
import EventListener from "@framework/events/EventListener";
import { Events } from "@framework/types/ClientEvents";
@@ -50,10 +69,8 @@ class GuildMemberRemoveEventListener extends EventListener.
+ */
+
import { Inject } from "@framework/container/Inject";
import EventListener from "@framework/events/EventListener";
import { Events } from "@framework/types/ClientEvents";
diff --git a/src/main/typescript/events/message/MessageCreateEventListener.ts b/src/main/typescript/events/message/MessageCreateEventListener.ts
index 3f930de8f..6a3228ea6 100644
--- a/src/main/typescript/events/message/MessageCreateEventListener.ts
+++ b/src/main/typescript/events/message/MessageCreateEventListener.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -57,7 +57,7 @@ class MessageCreateEventListener extends EventListener {
private readonly listeners: Array<(message: Message) => unknown> = [];
- public override async onInitialize() {
+ public override onInitialize() {
this.listeners.push(
this.ruleModerationService.onMessageCreate.bind(this.ruleModerationService),
this.spamModerationService.onMessageCreate.bind(this.spamModerationService),
diff --git a/src/main/typescript/events/message/MessageDeleteEventListener.ts b/src/main/typescript/events/message/MessageDeleteEventListener.ts
index 90cb4cfe6..15e622ffe 100644
--- a/src/main/typescript/events/message/MessageDeleteEventListener.ts
+++ b/src/main/typescript/events/message/MessageDeleteEventListener.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { Inject } from "@framework/container/Inject";
import EventListener from "@framework/events/EventListener";
import { NonPartialGroupDMChannel } from "@framework/types/ClientEvents";
@@ -80,12 +99,9 @@ class MessageDeleteEventListener extends EventListener {
setTimeout(async () => {
const moderator = await this.findResponsibleModerator(message);
- this.auditLoggingService.emitLogEvent(
- message.guildId!,
- LogEventType.MessageDelete,
- message,
- moderator
- );
+ this.auditLoggingService
+ .emitLogEvent(message.guildId, LogEventType.MessageDelete, message, moderator)
+ .catch(this.application.logger.error);
}, 100);
}
}
diff --git a/src/main/typescript/events/message/MessageUpdateEventListener.ts b/src/main/typescript/events/message/MessageUpdateEventListener.ts
index f0110067b..6a93e7232 100644
--- a/src/main/typescript/events/message/MessageUpdateEventListener.ts
+++ b/src/main/typescript/events/message/MessageUpdateEventListener.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { Inject } from "@framework/container/Inject";
import EventListener from "@framework/events/EventListener";
import type AIAutoModeration from "@main/automod/AIAutoModeration";
@@ -28,12 +47,14 @@ class MessageUpdateEventListener extends EventListener {
return;
}
- this.auditLoggingService.emitLogEvent(
- newMessage.guildId!,
- LogEventType.MessageUpdate,
- oldMessage as Message,
- newMessage as Message
- );
+ this.auditLoggingService
+ .emitLogEvent(
+ newMessage.guildId,
+ LogEventType.MessageUpdate,
+ oldMessage as Message,
+ newMessage
+ )
+ .catch(this.application.logger.error);
if (
oldMessage.content !== newMessage.content ||
diff --git a/src/main/typescript/extensions/Extension.ts b/src/main/typescript/extensions/Extension.ts
index e23faa7a3..eb0e1443d 100644
--- a/src/main/typescript/extensions/Extension.ts
+++ b/src/main/typescript/extensions/Extension.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2023 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -158,7 +158,7 @@ export abstract class Extension {
}
for (const service of services) {
- this.serviceManager.loadServiceClass(service);
+ this.serviceManager.loadServiceClass(service).catch(this.application.logger.error);
}
}
}
diff --git a/src/main/typescript/extensions/ExtensionInfo.ts b/src/main/typescript/extensions/ExtensionInfo.ts
index c81c2e77a..34f1dc1fc 100644
--- a/src/main/typescript/extensions/ExtensionInfo.ts
+++ b/src/main/typescript/extensions/ExtensionInfo.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2023 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
diff --git a/src/main/typescript/main.ts b/src/main/typescript/main.ts
index 11af82400..a904aa2e8 100644
--- a/src/main/typescript/main.ts
+++ b/src/main/typescript/main.ts
@@ -1,7 +1,7 @@
-/**
+/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2023 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -16,6 +16,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with SudoBot. If not, see .
*/
+
import "dotenv/config";
import "module-alias/register";
import "reflect-metadata";
diff --git a/src/main/typescript/models/AFKEntry.ts b/src/main/typescript/models/AFKEntry.ts
index d5d0ec134..0f83c7bf4 100644
--- a/src/main/typescript/models/AFKEntry.ts
+++ b/src/main/typescript/models/AFKEntry.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { sql } from "drizzle-orm";
import { boolean, integer, pgTable, serial, timestamp, varchar } from "drizzle-orm/pg-core";
diff --git a/src/main/typescript/models/ChannelLock.ts b/src/main/typescript/models/ChannelLock.ts
index 302626c11..56535520e 100644
--- a/src/main/typescript/models/ChannelLock.ts
+++ b/src/main/typescript/models/ChannelLock.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { json, pgTable, serial, timestamp, varchar } from "drizzle-orm/pg-core";
export const channelLocks = pgTable("channel_locks", {
diff --git a/src/main/typescript/models/CommandPermissionOverwrite.ts b/src/main/typescript/models/CommandPermissionOverwrite.ts
index c3497e239..d95861dc7 100644
--- a/src/main/typescript/models/CommandPermissionOverwrite.ts
+++ b/src/main/typescript/models/CommandPermissionOverwrite.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { pgEnum } from "@framework/database/Enum";
import { sql } from "drizzle-orm";
import {
diff --git a/src/main/typescript/models/Infraction.ts b/src/main/typescript/models/Infraction.ts
index 9cc4f91e0..0593c6038 100644
--- a/src/main/typescript/models/Infraction.ts
+++ b/src/main/typescript/models/Infraction.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { pgEnum } from "@framework/database/Enum";
import { integer, json, pgTable, serial, timestamp, varchar } from "drizzle-orm/pg-core";
diff --git a/src/main/typescript/models/MuteRecord.ts b/src/main/typescript/models/MuteRecord.ts
index 3e606e40f..9028958d1 100644
--- a/src/main/typescript/models/MuteRecord.ts
+++ b/src/main/typescript/models/MuteRecord.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { sql } from "drizzle-orm";
import { pgTable, serial, timestamp, varchar } from "drizzle-orm/pg-core";
diff --git a/src/main/typescript/models/PermissionLevel.ts b/src/main/typescript/models/PermissionLevel.ts
index d1eb079f9..73b9af750 100644
--- a/src/main/typescript/models/PermissionLevel.ts
+++ b/src/main/typescript/models/PermissionLevel.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { sql } from "drizzle-orm";
import { boolean, integer, pgTable, serial, text, timestamp, varchar } from "drizzle-orm/pg-core";
diff --git a/src/main/typescript/models/PermissionOverwrite.ts b/src/main/typescript/models/PermissionOverwrite.ts
index 47fee749e..e855549bc 100644
--- a/src/main/typescript/models/PermissionOverwrite.ts
+++ b/src/main/typescript/models/PermissionOverwrite.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { sql } from "drizzle-orm";
import { boolean, integer, pgTable, serial, text, timestamp, varchar } from "drizzle-orm/pg-core";
diff --git a/src/main/typescript/models/Queue.ts b/src/main/typescript/models/Queue.ts
index 23865efb9..6df4f40e3 100644
--- a/src/main/typescript/models/Queue.ts
+++ b/src/main/typescript/models/Queue.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { boolean, json, pgTable, serial, timestamp, varchar } from "drizzle-orm/pg-core";
export const queues = pgTable("queues", {
diff --git a/src/main/typescript/models/ReactionRole.ts b/src/main/typescript/models/ReactionRole.ts
index 7815aa2f4..369c3ef73 100644
--- a/src/main/typescript/models/ReactionRole.ts
+++ b/src/main/typescript/models/ReactionRole.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { sql } from "drizzle-orm";
import { boolean, integer, pgTable, serial, timestamp, varchar } from "drizzle-orm/pg-core";
diff --git a/src/main/typescript/models/Snippet.ts b/src/main/typescript/models/Snippet.ts
index b8784fb74..c2f696ac6 100644
--- a/src/main/typescript/models/Snippet.ts
+++ b/src/main/typescript/models/Snippet.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { pgEnum } from "@framework/database/Enum";
import { sql } from "drizzle-orm";
import { boolean, integer, pgTable, serial, timestamp, varchar } from "drizzle-orm/pg-core";
diff --git a/src/main/typescript/models/User.ts b/src/main/typescript/models/User.ts
index 12fbd5888..ed2590e19 100644
--- a/src/main/typescript/models/User.ts
+++ b/src/main/typescript/models/User.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { sql } from "drizzle-orm";
import { integer, pgTable, serial, timestamp, varchar } from "drizzle-orm/pg-core";
diff --git a/src/main/typescript/models/VerificationEntry.ts b/src/main/typescript/models/VerificationEntry.ts
index f85cd6faf..541a44891 100644
--- a/src/main/typescript/models/VerificationEntry.ts
+++ b/src/main/typescript/models/VerificationEntry.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { integer, json, pgTable, serial, timestamp, varchar } from "drizzle-orm/pg-core";
import { verificationMethodEnum } from "./VerificationRecord";
diff --git a/src/main/typescript/models/VerificationRecord.ts b/src/main/typescript/models/VerificationRecord.ts
index 3970ea624..e90035c40 100644
--- a/src/main/typescript/models/VerificationRecord.ts
+++ b/src/main/typescript/models/VerificationRecord.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { pgEnum } from "@framework/database/Enum";
import { pgTable, serial, timestamp, varchar } from "drizzle-orm/pg-core";
diff --git a/src/main/typescript/permissions/SystemAdminPermission.ts b/src/main/typescript/permissions/SystemAdminPermission.ts
index c412f3275..6f24ad51d 100644
--- a/src/main/typescript/permissions/SystemAdminPermission.ts
+++ b/src/main/typescript/permissions/SystemAdminPermission.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -20,20 +20,9 @@
import { Inject } from "@framework/container/Inject";
import { Logger } from "@framework/log/Logger";
import { Permission } from "@framework/permissions/Permission";
-import { GuildMember } from "discord.js";
+import { Awaitable, GuildMember } from "discord.js";
import type ConfigurationManager from "../services/ConfigurationManager";
-/**
- * System Administrator permission. Grants access to
- * every resource and allows every action, ignoring
- * all permission checks.
- *
- * This is the only permission that might be invoked
- * twice or more in a single command execution.
- *
- * Therefore, it is important to not put any heavy
- * operations in this permission.
- */
class SystemAdminPermission extends Permission {
protected override readonly name = "system.admin";
@@ -43,7 +32,7 @@ class SystemAdminPermission extends Permission {
@Inject()
private readonly logger!: Logger;
- public override async validate(member: GuildMember): Promise {
+ public override validate(member: GuildMember): Awaitable {
const has = this.configManager.systemConfig.system_admins.includes(member.id);
if (has) {
diff --git a/src/main/typescript/policies/BallotPolicy.ts b/src/main/typescript/policies/BallotPolicy.ts
index e9a72962c..eb67fdc4a 100644
--- a/src/main/typescript/policies/BallotPolicy.ts
+++ b/src/main/typescript/policies/BallotPolicy.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
diff --git a/src/main/typescript/queues/CommandExecutionQueue.ts b/src/main/typescript/queues/CommandExecutionQueue.ts
index aba193e1d..c0cd5fb50 100644
--- a/src/main/typescript/queues/CommandExecutionQueue.ts
+++ b/src/main/typescript/queues/CommandExecutionQueue.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import Queue from "@framework/queues/Queue";
import { fetchChannel, fetchMember } from "@framework/utils/entities";
import type {
@@ -70,7 +89,7 @@ class CommandExecutionQueue extends Queue {
copy!.reply = (...args: [MessagePayload | MessageReplyOptions | string]) =>
message.reply(...(args as [MessageCreateOptions | string]));
- copy!.delete = () => Promise.resolve(message!);
+ copy!.delete = () => Promise.resolve(message);
copy!.react = () =>
Promise.resolve(null as unknown as ReturnType["react"]>);
diff --git a/src/main/typescript/queues/InfractionChannelDeleteQueue.ts b/src/main/typescript/queues/InfractionChannelDeleteQueue.ts
index 894f88465..2bc8b8a50 100644
--- a/src/main/typescript/queues/InfractionChannelDeleteQueue.ts
+++ b/src/main/typescript/queues/InfractionChannelDeleteQueue.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import Queue from "@framework/queues/Queue";
import { fetchChannel } from "@framework/utils/entities";
import type { Snowflake } from "discord.js";
@@ -38,7 +57,9 @@ class InfractionChannelDeleteQueue extends Queue.
+ */
+
import Queue from "@framework/queues/Queue";
import type { InfractionCreatePayload } from "@main/models/Infraction";
import { infractions, InfractionType } from "@main/models/Infraction";
diff --git a/src/main/typescript/queues/MessageDeleteQueue.ts b/src/main/typescript/queues/MessageDeleteQueue.ts
index eb46ba044..bea4604b3 100644
--- a/src/main/typescript/queues/MessageDeleteQueue.ts
+++ b/src/main/typescript/queues/MessageDeleteQueue.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import Queue from "@framework/queues/Queue";
import { fetchChannel, fetchMessage } from "@framework/utils/entities";
import type { Snowflake } from "discord.js";
diff --git a/src/main/typescript/queues/MessageScheduleQueue.ts b/src/main/typescript/queues/MessageScheduleQueue.ts
index 79f54e738..abf40cc1b 100644
--- a/src/main/typescript/queues/MessageScheduleQueue.ts
+++ b/src/main/typescript/queues/MessageScheduleQueue.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import Queue from "@framework/queues/Queue";
import { fetchChannel, fetchUser } from "@framework/utils/entities";
import MessageDeleteQueue from "@main/queues/MessageDeleteQueue";
@@ -58,7 +77,8 @@ class MessageScheduleQueue extends Queue {
guildId,
runsAt: new Date(Date.now() + deleteAfter)
})
- .schedule();
+ .schedule()
+ .catch(this.application.logger.error);
}
} catch (error) {
this.application.logger.error(error);
@@ -68,13 +88,16 @@ class MessageScheduleQueue extends Queue {
const user = await fetchUser(this.application.client, this.userId);
if (user) {
- this.application.service("systemAuditLogging").logEchoCommandExecuted({
- command: "schedule",
- guild,
- rawCommandContent: content,
- generatedMessageOptions: options,
- user
- });
+ this.application
+ .service("systemAuditLogging")
+ .logEchoCommandExecuted({
+ command: "schedule",
+ guild,
+ rawCommandContent: content,
+ generatedMessageOptions: options,
+ user
+ })
+ .catch(this.application.logger.error);
}
} catch (error) {
this.application.logger.error(error);
diff --git a/src/main/typescript/queues/ReminderQueue.ts b/src/main/typescript/queues/ReminderQueue.ts
index b3ec18311..b81ac03de 100644
--- a/src/main/typescript/queues/ReminderQueue.ts
+++ b/src/main/typescript/queues/ReminderQueue.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import Queue from "@framework/queues/Queue";
import { fetchUser } from "@framework/utils/entities";
import { Colors } from "@main/constants/Colors";
diff --git a/src/main/typescript/queues/RoleQueue.ts b/src/main/typescript/queues/RoleQueue.ts
index 664b62368..81b633d14 100644
--- a/src/main/typescript/queues/RoleQueue.ts
+++ b/src/main/typescript/queues/RoleQueue.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import Queue from "@framework/queues/Queue";
import type { Snowflake } from "discord.js";
import { safeMemberFetch } from "../utils/fetch";
diff --git a/src/main/typescript/queues/UnbanQueue.ts b/src/main/typescript/queues/UnbanQueue.ts
index 439ea63c9..5e310ef80 100644
--- a/src/main/typescript/queues/UnbanQueue.ts
+++ b/src/main/typescript/queues/UnbanQueue.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import Queue from "@framework/queues/Queue";
import type { Snowflake } from "discord.js";
import { safeUserFetch } from "../utils/fetch";
diff --git a/src/main/typescript/queues/UnmuteQueue.ts b/src/main/typescript/queues/UnmuteQueue.ts
index 5bf14d691..e35454a74 100644
--- a/src/main/typescript/queues/UnmuteQueue.ts
+++ b/src/main/typescript/queues/UnmuteQueue.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import Queue from "@framework/queues/Queue";
import type { Snowflake } from "discord.js";
import { italic } from "discord.js";
diff --git a/src/main/typescript/queues/VerificationExpiredQueue.ts b/src/main/typescript/queues/VerificationExpiredQueue.ts
index dffa8e3ed..8b5391b42 100644
--- a/src/main/typescript/queues/VerificationExpiredQueue.ts
+++ b/src/main/typescript/queues/VerificationExpiredQueue.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import Queue from "@framework/queues/Queue";
import type { Snowflake } from "discord.js";
diff --git a/src/main/typescript/schemas/EnvironmentVariableSchema.ts b/src/main/typescript/schemas/EnvironmentVariableSchema.ts
index ee90c3d2c..9cf7cbe32 100644
--- a/src/main/typescript/schemas/EnvironmentVariableSchema.ts
+++ b/src/main/typescript/schemas/EnvironmentVariableSchema.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { z } from "zod";
export const EnvironmentVariableSchema = z.object({
diff --git a/src/main/typescript/schemas/GuildConfigSchema.ts b/src/main/typescript/schemas/GuildConfigSchema.ts
index 343ca9bdd..afbfe7001 100644
--- a/src/main/typescript/schemas/GuildConfigSchema.ts
+++ b/src/main/typescript/schemas/GuildConfigSchema.ts
@@ -1,7 +1,7 @@
-/**
+/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2023 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
diff --git a/src/main/typescript/schemas/LoggingSchema.ts b/src/main/typescript/schemas/LoggingSchema.ts
index 0b0842729..c5483c14e 100644
--- a/src/main/typescript/schemas/LoggingSchema.ts
+++ b/src/main/typescript/schemas/LoggingSchema.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import type Duration from "@framework/datetime/Duration";
import type { RuleExecResult } from "@main/contracts/ModerationRuleHandlerContract";
import type { MessageRuleType } from "@main/schemas/MessageRuleSchema";
diff --git a/src/main/typescript/schemas/MessageRuleSchema.ts b/src/main/typescript/schemas/MessageRuleSchema.ts
index 9575c28c6..bbd26cc80 100644
--- a/src/main/typescript/schemas/MessageRuleSchema.ts
+++ b/src/main/typescript/schemas/MessageRuleSchema.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2023 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
diff --git a/src/main/typescript/schemas/ModerationActionSchema.ts b/src/main/typescript/schemas/ModerationActionSchema.ts
index b165a76f1..bc0e39baa 100644
--- a/src/main/typescript/schemas/ModerationActionSchema.ts
+++ b/src/main/typescript/schemas/ModerationActionSchema.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { z } from "zod";
import { zSnowflake } from "./SnowflakeSchema";
diff --git a/src/main/typescript/schemas/SnowflakeSchema.ts b/src/main/typescript/schemas/SnowflakeSchema.ts
index 67c7e65c3..d674e4d79 100644
--- a/src/main/typescript/schemas/SnowflakeSchema.ts
+++ b/src/main/typescript/schemas/SnowflakeSchema.ts
@@ -1,21 +1,21 @@
/*
-* This file is part of SudoBot.
-*
-* Copyright (C) 2021-2023 OSN Developers.
-*
-* SudoBot is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Affero General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* SudoBot is distributed in the hope that it will be useful, but
-* WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU Affero General Public License for more details.
-*
-* You should have received a copy of the GNU Affero General Public License
-* along with SudoBot. If not, see .
-*/
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
import { z } from "zod";
diff --git a/src/main/typescript/schemas/SurveySystemConfigSchema.ts b/src/main/typescript/schemas/SurveySystemConfigSchema.ts
index ace302e24..9e6291f00 100644
--- a/src/main/typescript/schemas/SurveySystemConfigSchema.ts
+++ b/src/main/typescript/schemas/SurveySystemConfigSchema.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { zSnowflake } from "@main/schemas/SnowflakeSchema";
import { z } from "zod";
diff --git a/src/main/typescript/schemas/SystemConfigSchema.ts b/src/main/typescript/schemas/SystemConfigSchema.ts
index 827ca6803..092382b7a 100644
--- a/src/main/typescript/schemas/SystemConfigSchema.ts
+++ b/src/main/typescript/schemas/SystemConfigSchema.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2023 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -24,8 +24,8 @@ type ApplicationActivityType = keyof typeof ActivityType;
export const SystemConfigSchema = z.object({
$schema: z.string().optional(),
- sync_emojis: z.boolean().default(false),
- emoji_resolve_strategy: z.enum(["both", "home_guild","application"]).default("both"),
+ sync_emojis: z.boolean().default(true),
+ emoji_resolve_strategy: z.enum(["both", "home_guild", "application"]).default("both"),
system_admins: z.array(z.string()).default([]),
snippets: z
.object({
diff --git a/src/main/typescript/schemas/TriggerSchema.ts b/src/main/typescript/schemas/TriggerSchema.ts
index 950f145b6..5a0610ea9 100644
--- a/src/main/typescript/schemas/TriggerSchema.ts
+++ b/src/main/typescript/schemas/TriggerSchema.ts
@@ -1,21 +1,21 @@
/*
-* This file is part of SudoBot.
-*
-* Copyright (C) 2021-2023 OSN Developers.
-*
-* SudoBot is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Affero General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* SudoBot is distributed in the hope that it will be useful, but
-* WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU Affero General Public License for more details.
-*
-* You should have received a copy of the GNU Affero General Public License
-* along with SudoBot. If not, see .
-*/
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
import { z } from "zod";
import { zSnowflake } from "./SnowflakeSchema";
diff --git a/src/main/typescript/security/CommandRateLimiter.ts b/src/main/typescript/security/CommandRateLimiter.ts
index e18f30478..967076771 100644
--- a/src/main/typescript/security/CommandRateLimiter.ts
+++ b/src/main/typescript/security/CommandRateLimiter.ts
@@ -1,8 +1,27 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import type Application from "@framework/app/Application";
import type { CommandManagerServiceInterface } from "@framework/contracts/CommandManagerServiceInterface";
import type CommandRateLimiterContract from "@framework/contracts/CommandRateLimiterContract";
import { HasApplication } from "@framework/types/HasApplication";
-import type { Snowflake } from "discord.js";
+import type { Awaitable, Snowflake } from "discord.js";
import { Collection } from "discord.js";
class CommandRateLimiter extends HasApplication implements CommandRateLimiterContract {
@@ -25,19 +44,11 @@ class CommandRateLimiter extends HasApplication implements CommandRateLimiterCon
}, CommandRateLimiter.INTERVAL);
}
- /**
- * Check if a command is rate limited for a user, and increment the attempt count if it is.
- *
- * @param commandName The command to check. Must be the canonical name of the command.
- * @param guildId The guild ID to check.
- * @param userId The user ID to check.
- * @returns A boolean indicating if the command is rate limited.
- */
- public async isRateLimitedWithHit(
+ public isRateLimitedWithHit(
commandName: string,
guildId: Snowflake,
userId: Snowflake
- ): Promise {
+ ): Awaitable {
const config =
this.application.service("configManager").config[guildId]?.commands?.ratelimiting;
const globalKey = `${userId}_${commandName}` as const;
diff --git a/src/main/typescript/security/DiscordPermissionManager.ts b/src/main/typescript/security/DiscordPermissionManager.ts
index 875c8bb43..76a1879bc 100644
--- a/src/main/typescript/security/DiscordPermissionManager.ts
+++ b/src/main/typescript/security/DiscordPermissionManager.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -24,11 +24,7 @@ import type { SystemPermissionResolvable } from "@framework/permissions/Abstract
import { Permission } from "@framework/permissions/Permission";
import type { GuildMember, PermissionResolvable } from "discord.js";
-/**
- * A permission manager that uses Discord permissions to control access to resources.
- *
- * @since 9.0.0
- */
+
class DiscordPermissionManager extends AbstractPermissionManager {
public override async getMemberPermissions(member: GuildMember): Promise {
return {
diff --git a/src/main/typescript/security/LayeredPermissionManager.ts b/src/main/typescript/security/LayeredPermissionManager.ts
index 74b0bb9ec..8b740a8c0 100644
--- a/src/main/typescript/security/LayeredPermissionManager.ts
+++ b/src/main/typescript/security/LayeredPermissionManager.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -32,11 +32,7 @@ type CachedPermissionOverwrite = Omit;
};
-/**
- * A permission manager that uses layered permissions overwrites to control access to resources.
- *
- * @since 9.0.0
- */
+
class LayeredPermissionManager extends AbstractPermissionManager {
protected readonly overwrites = new Collection<
`${Snowflake}:${Snowflake}`,
diff --git a/src/main/typescript/security/LevelBasedPermissionManager.ts b/src/main/typescript/security/LevelBasedPermissionManager.ts
index 44acc269d..535a31c31 100644
--- a/src/main/typescript/security/LevelBasedPermissionManager.ts
+++ b/src/main/typescript/security/LevelBasedPermissionManager.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -33,11 +33,7 @@ type MinimalPermissionLevelInfo = {
grantedSystemPermissions: FluentSet;
};
-/**
- * A permission manager that uses permission levels to control access to resources.
- *
- * @since 9.0.0
- */
+
class LevelBasedPermissionManager extends AbstractPermissionManager {
protected readonly levels = new Collection<
`${Snowflake}:${Snowflake}`,
diff --git a/src/main/typescript/security/ModerationRuleHandler.ts b/src/main/typescript/security/ModerationRuleHandler.ts
index c296cc046..304e2fb2b 100644
--- a/src/main/typescript/security/ModerationRuleHandler.ts
+++ b/src/main/typescript/security/ModerationRuleHandler.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import * as cache from "@framework/cache/GlobalStore";
import { Inject } from "@framework/container/Inject";
import { HasApplication } from "@framework/types/HasApplication";
@@ -77,7 +96,7 @@ class ModerationRuleHandler extends HasApplication implements ModerationRuleHand
@Inject("imageRecognitionService")
private readonly imageRecognitionService!: ImageRecognitionService;
- public async boot() {
+ public boot() {
setInterval(
() => {
this.computedRegexCache = new WeakMap();
@@ -544,7 +563,7 @@ class ModerationRuleHandler extends HasApplication implements ModerationRuleHand
fields: [
{
name: token ? "Token" : "Word",
- value: `${spoiler(token ?? word!)}`
+ value: `${spoiler(token ?? word)}`
}
]
};
@@ -703,7 +722,7 @@ class ModerationRuleHandler extends HasApplication implements ModerationRuleHand
fields: [
{
name: token ? "Token" : "Word",
- value: `${spoiler(token ?? word!)}`
+ value: `${spoiler(token ?? word)}`
}
]
};
@@ -1190,7 +1209,7 @@ class ModerationRuleHandler extends HasApplication implements ModerationRuleHand
}
@AcceptsModerationRuleContextType("profile")
- public async profile_filter(context: ProfileContext<"profile_filter">) {
+ public profile_filter(context: ProfileContext<"profile_filter">) {
const { member } = context;
const stringsToCheck = [member.user.displayName, member.nickname, member.user.username];
diff --git a/src/main/typescript/services/AFKService.ts b/src/main/typescript/services/AFKService.ts
index 2dd3ac110..6772d9b49 100644
--- a/src/main/typescript/services/AFKService.ts
+++ b/src/main/typescript/services/AFKService.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { Name } from "@framework/services/Name";
import { Service } from "@framework/services/Service";
import { HasEventListeners } from "@framework/types/HasEventListeners";
@@ -9,8 +28,8 @@ import { and, eq, inArray } from "drizzle-orm";
@Name("afkService")
class AFKService extends Service implements HasEventListeners {
- public readonly cache = new Collection<`${Snowflake | "global"}::${Snowflake}`, AFKEntry>();
- protected readonly modified = new Set<`${Snowflake | "global"}::${Snowflake}`>();
+ public readonly cache = new Collection<`${string}::${Snowflake}`, AFKEntry>();
+ protected readonly modified = new Set<`${string}::${Snowflake}`>();
protected timeout?: ReturnType;
public override async boot(): Promise {
@@ -44,12 +63,12 @@ class AFKService extends Service implements HasEventListeners {
return entry;
}
- public isAFK(userId: Snowflake, guildId: Snowflake | "global") {
+ public isAFK(userId: Snowflake, guildId: Snowflake) {
const key = `${guildId}::${userId}` as const;
return this.cache.has(key);
}
- public getAFK(userId: Snowflake, guildId: Snowflake | "global") {
+ public getAFK(userId: Snowflake, guildId: Snowflake) {
const key = `${guildId}::${userId}` as const;
return this.cache.get(key);
}
@@ -114,7 +133,7 @@ class AFKService extends Service implements HasEventListeners {
private queueSync() {
this.timeout ??= setTimeout(async () => {
for (const key of this.modified) {
- const [guildId, userId] = key.split("::") as [Snowflake | "global", Snowflake];
+ const [guildId, userId] = key.split("::") as [Snowflake, Snowflake];
const entry = this.cache.get(key);
if (!entry) {
@@ -142,7 +161,7 @@ class AFKService extends Service implements HasEventListeners {
}, 7_000);
}
- public async addMention({
+ public addMention({
guildId,
mentionId,
userId,
@@ -172,7 +191,7 @@ class AFKService extends Service implements HasEventListeners {
return entry;
}
- public async switchContext(userId: Snowflake, guildId: Snowflake | "global") {
+ public async switchContext(userId: Snowflake, guildId: Snowflake) {
const globalEntry = this.cache.get(`global::${userId}`);
const guildEntry = this.cache.get(`${guildId}::${userId}`);
@@ -274,7 +293,7 @@ class AFKService extends Service implements HasEventListeners {
const guildAFK = this.cache.get(`${message.guildId}::${mentionedUser.id}`);
if (globalAFK || guildAFK) {
- await this.addMention({
+ this.addMention({
userId: mentionedUser.id,
mentionId: message.author.id,
guildId: message.guildId,
@@ -338,7 +357,7 @@ class AFKService extends Service implements HasEventListeners {
type SetAFKOptions = {
userId: Snowflake;
reason: string | undefined;
- guildId: Snowflake | "global";
+ guildId: string;
};
type AddMentionOptions = {
diff --git a/src/main/typescript/services/AuditLoggingService.ts b/src/main/typescript/services/AuditLoggingService.ts
index ece74f8a4..2d385281f 100644
--- a/src/main/typescript/services/AuditLoggingService.ts
+++ b/src/main/typescript/services/AuditLoggingService.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { Inject } from "@framework/container/Inject";
import { GatewayEventListener } from "@framework/events/GatewayEventListener";
import { Name } from "@framework/services/Name";
@@ -67,6 +86,8 @@ type WebhookInfo =
attempts: number;
};
+/* eslint-disable @typescript-eslint/unbound-method */
+
@Name("auditLoggingService")
class AuditLoggingService extends Service {
private readonly webhooks = new Collection<`${Snowflake}::${Snowflake}`, WebhookInfo>();
@@ -312,7 +333,7 @@ class AuditLoggingService extends Service {
}
private configFor(guildId: Snowflake) {
- return this.configurationManager.config[guildId!]?.logging;
+ return this.configurationManager.config[guildId]?.logging;
}
private async send({
@@ -439,7 +460,7 @@ class AuditLoggingService extends Service {
this.webhooks.set(`${guildId}::${channelId}`, webhookClient);
configManager.config[guildId]!.logging!.hooks ??= {};
- configManager.config[guildId]!.logging!.hooks![channel.id] = webhook.id;
+ configManager.config[guildId]!.logging!.hooks[channel.id] = webhook.id;
await configManager.write();
}
}
@@ -662,7 +683,7 @@ class AuditLoggingService extends Service {
const fields = [
{
name: "Channel",
- value: channelInfo(oldMessage.channel!),
+ value: channelInfo(oldMessage.channel),
inline: true
},
{
@@ -1234,7 +1255,10 @@ class AuditLoggingService extends Service {
name: "Roles",
value:
member.roles.cache.size > 1
- ? member.roles.cache.map(r => roleMention(r.id)).join(", ")
+ ? member.roles.cache
+ .filter(r => r.id !== member.guild.id)
+ .map(r => roleMention(r.id))
+ .join(", ")
: italic("None")
},
{
diff --git a/src/main/typescript/services/AuthService.ts b/src/main/typescript/services/AuthService.ts
index ea0b39d5d..81df5dd1d 100644
--- a/src/main/typescript/services/AuthService.ts
+++ b/src/main/typescript/services/AuthService.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { Name } from "@framework/services/Name";
import { Service } from "@framework/services/Service";
import { User, users } from "@main/models/User";
@@ -7,7 +26,7 @@ import jwt from "jsonwebtoken";
@Name("authService")
class AuthService extends Service {
- private async generateToken(user: User) {
+ private generateToken(user: User) {
return jwt.sign(
{
id: user.id,
@@ -42,8 +61,18 @@ class AuthService extends Service {
};
}
+ await this.provisionToken(user);
+
+ return {
+ success: true,
+ user
+ };
+ }
+
+ public async provisionToken(user: User) {
if (!user.token || !user.tokenExpiresAt || user.tokenExpiresAt.getTime() <= Date.now()) {
- const token = await this.generateToken(user);
+ this.application.logger.debug(`Provisioning token for user ${user.username}`);
+ const token = this.generateToken(user);
const tokenExpiresAt = new Date(Date.now() + 48 * 60 * 60 * 1000);
await this.application.database.drizzle
@@ -58,10 +87,7 @@ class AuthService extends Service {
user.tokenExpiresAt = tokenExpiresAt;
}
- return {
- success: true,
- user
- };
+ return user.token;
}
}
diff --git a/src/main/typescript/services/AutoRoleService.ts b/src/main/typescript/services/AutoRoleService.ts
index 91cae458a..0d3e7f8fc 100644
--- a/src/main/typescript/services/AutoRoleService.ts
+++ b/src/main/typescript/services/AutoRoleService.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { Inject } from "@framework/container/Inject";
import { GatewayEventListener } from "@framework/events/GatewayEventListener";
import { Name } from "@framework/services/Name";
diff --git a/src/main/typescript/services/BumpReminderService.ts b/src/main/typescript/services/BumpReminderService.ts
index 21053ab12..245e1fef4 100644
--- a/src/main/typescript/services/BumpReminderService.ts
+++ b/src/main/typescript/services/BumpReminderService.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { Inject } from "@framework/container/Inject";
import { GatewayEventListener } from "@framework/events/GatewayEventListener";
import { Name } from "@framework/services/Name";
@@ -61,7 +80,7 @@ class BumpReminderService extends Service {
if (
!enabled ||
- disabled_channels?.includes(message.channelId!) ||
+ disabled_channels?.includes(message.channelId) ||
!message.interactionMetadata?.user ||
!isTextBasedChannel(message.channel)
) {
diff --git a/src/main/typescript/services/ChannelLockManager.ts b/src/main/typescript/services/ChannelLockManager.ts
index fca3077cd..d31cb7101 100644
--- a/src/main/typescript/services/ChannelLockManager.ts
+++ b/src/main/typescript/services/ChannelLockManager.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import APIErrors from "@framework/errors/APIErrors";
import { Name } from "@framework/services/Name";
import { Service } from "@framework/services/Service";
@@ -8,7 +27,7 @@ import { and, eq, inArray } from "drizzle-orm";
@Name("channelLockManager")
class ChannelLockManager extends Service {
- private filter(permission: string) {
+ private filter(this: void, permission: string) {
return [
"SendMessages",
"SendTTSMessages",
diff --git a/src/main/typescript/services/CommandManager.ts b/src/main/typescript/services/CommandManager.ts
index 9bbd75ea9..d92b941cb 100644
--- a/src/main/typescript/services/CommandManager.ts
+++ b/src/main/typescript/services/CommandManager.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -173,8 +173,9 @@ class CommandManager extends Service implements CommandManagerServiceInterface {
) {
if (isDevelopmentMode() && !global) {
this.client.guilds.cache
- .find(g => g.id === process.env.HOME_GUILD_ID!)
- ?.commands.set(commands);
+ .find(g => g.id === process.env.HOME_GUILD_ID)
+ ?.commands.set(commands)
+ .catch(this.application.logger.error);
guildId = process.env.HOME_GUILD_ID;
} else {
await this.client.application?.commands.set(commands);
@@ -202,7 +203,7 @@ class CommandManager extends Service implements CommandManagerServiceInterface {
return this.ratelimiter;
}
- public async addCommand(
+ public addCommand(
command: Command,
loadMetadata = true,
groups: Record | null = null,
@@ -212,7 +213,7 @@ class CommandManager extends Service implements CommandManagerServiceInterface {
let aliasGroupSet = false;
if (loadMetadata && previousCommand) {
- await this.application.classLoader.unloadEventsFromMetadata(previousCommand);
+ this.application.classLoader.unloadEventsFromMetadata(previousCommand);
}
const loweredName = command.name.toLowerCase();
@@ -245,7 +246,7 @@ class CommandManager extends Service implements CommandManagerServiceInterface {
return;
}
- await this.application.classLoader.unloadEventsFromMetadata(previousCommand);
+ this.application.classLoader.unloadEventsFromMetadata(previousCommand);
this.commands.delete(command.name.toLowerCase());
for (const alias of command.aliases) {
@@ -268,7 +269,7 @@ class CommandManager extends Service implements CommandManagerServiceInterface {
return;
}
- const config = this.configManager.config[message.guildId!];
+ const config = this.configManager.config[message.guildId];
if (!config) {
return;
@@ -330,9 +331,9 @@ class CommandManager extends Service implements CommandManagerServiceInterface {
const context = new LegacyContext(commandName, content, message, args, argv);
const respondOnFail =
- this.configManager.config[message.guildId!]?.commands.respond_on_precondition_fail;
+ this.configManager.config[message.guildId]?.commands.respond_on_precondition_fail;
- if (command.isDisabled(message.guildId!)) {
+ if (command.isDisabled(message.guildId)) {
respondOnFail && (await context.error("This command is disabled."));
return;
}
@@ -344,7 +345,7 @@ class CommandManager extends Service implements CommandManagerServiceInterface {
: this.getCanonicalName(commandName);
const subcommand = this.getCommand(key);
- if (subcommand && subcommand.isDisabled(message.guildId!)) {
+ if (subcommand && subcommand.isDisabled(message.guildId)) {
respondOnFail && (await context.error("This command is disabled."));
return;
}
@@ -533,7 +534,7 @@ class CommandManager extends Service implements CommandManagerServiceInterface {
return true;
}
- const mode = this.configManager.config[context.guildId!]?.permissions.mode;
+ const mode = this.configManager.config[context.guildId]?.permissions.mode;
if (mode !== "levels") {
this.application.logger.warn(
diff --git a/src/main/typescript/services/ConfigurationManager.ts b/src/main/typescript/services/ConfigurationManager.ts
index ed39e7d71..9c5347ce7 100644
--- a/src/main/typescript/services/ConfigurationManager.ts
+++ b/src/main/typescript/services/ConfigurationManager.ts
@@ -1,7 +1,7 @@
-/**
+/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2023 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -126,7 +126,7 @@ export default class ConfigurationManager
if (!process.env.NO_GENERATE_CONFIG_SCHEMA) {
this.application.logger.info("Generating configuration schema files");
- this.generateSchema();
+ this.generateSchema().catch(this.application.logger.error);
}
}
diff --git a/src/main/typescript/services/DatabaseService.ts b/src/main/typescript/services/DatabaseService.ts
index 15742a80c..7ac5897d8 100644
--- a/src/main/typescript/services/DatabaseService.ts
+++ b/src/main/typescript/services/DatabaseService.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import Application from "@framework/app/Application";
import { Name } from "@framework/services/Name";
import { Service } from "@framework/services/Service";
diff --git a/src/main/typescript/services/DirectiveParsingService.ts b/src/main/typescript/services/DirectiveParsingService.ts
index ee7346df5..1e8c10538 100644
--- a/src/main/typescript/services/DirectiveParsingService.ts
+++ b/src/main/typescript/services/DirectiveParsingService.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import DirectiveParser from "@framework/directives/DirectiveParser";
import { Name } from "@framework/services/Name";
import { Service } from "@framework/services/Service";
diff --git a/src/main/typescript/services/ExtensionManager.ts b/src/main/typescript/services/ExtensionManager.ts
index 4c1c50ee3..200f519d3 100644
--- a/src/main/typescript/services/ExtensionManager.ts
+++ b/src/main/typescript/services/ExtensionManager.ts
@@ -1,7 +1,7 @@
-/**
+/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2023 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -362,11 +362,15 @@ export default class ExtensionManager extends Service {
const tsconfigExists = existsSync(tsconfigPath);
- if (!tsconfigExists || await readlink(tsconfigPath).catch(() => "") !== (loadingTypeScript ? bunTsconfigPath : nodeTsconfigPath)) {
+ if (
+ !tsconfigExists ||
+ (await readlink(tsconfigPath).catch(() => "")) !==
+ (loadingTypeScript ? bunTsconfigPath : nodeTsconfigPath)
+ ) {
if (tsconfigExists) {
await fs.rm(tsconfigPath);
}
-
+
if (process.platform === "win32") {
await fs.cp(
loadingTypeScript ? bunTsconfigPath : nodeTsconfigPath,
@@ -466,10 +470,10 @@ export default class ExtensionManager extends Service {
default: Event
}: { default: new (application: Application) => EventListener } =
await import(filePath);
- await this.loadEventClass(extensionId, Event);
+ this.loadEventClass(extensionId, Event);
}
- public async loadEventClass(
+ public loadEventClass(
extensionId: string,
Event: new (application: Application) => EventListener
) {
diff --git a/src/main/typescript/services/ExtensionPostBootManager.ts b/src/main/typescript/services/ExtensionPostBootManager.ts
index 7c8ed1253..9394db53e 100644
--- a/src/main/typescript/services/ExtensionPostBootManager.ts
+++ b/src/main/typescript/services/ExtensionPostBootManager.ts
@@ -1,3 +1,22 @@
+/*
+ * This file is part of SudoBot.
+ *
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
+ *
+ * SudoBot is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SudoBot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SudoBot. If not, see .
+ */
+
import { Inject } from "@framework/container/Inject";
import { Name } from "@framework/services/Name";
import { Service } from "@framework/services/Service";
diff --git a/src/main/typescript/services/ImageRecognitionService.ts b/src/main/typescript/services/ImageRecognitionService.ts
index da3688410..6960a5974 100644
--- a/src/main/typescript/services/ImageRecognitionService.ts
+++ b/src/main/typescript/services/ImageRecognitionService.ts
@@ -1,7 +1,7 @@
-/**
+/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -148,7 +148,7 @@ class ImageRecognitionService extends Service {
}
const tensor = this.tensorFlow.node.decodeImage(image, 3, undefined, false);
- const predictions = await this.nsfwJsModel!.classify(tensor as Tensor3D);
+ const predictions = await this.nsfwJsModel!.classify(tensor);
const result: Record = {};
for (const prediction of predictions) {
diff --git a/src/main/typescript/services/InfractionManager.ts b/src/main/typescript/services/InfractionManager.ts
index 655741ccf..181ae9789 100644
--- a/src/main/typescript/services/InfractionManager.ts
+++ b/src/main/typescript/services/InfractionManager.ts
@@ -1,7 +1,7 @@
/*
* This file is part of SudoBot.
*
- * Copyright (C) 2021-2024 OSN Developers.
+ * Copyright (C) 2021, 2022, 2023, 2024 OSN Developers.
*
* SudoBot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
@@ -25,7 +25,7 @@ import { Name } from "@framework/services/Name";
import { Service } from "@framework/services/Service";
import { fetchMember, fetchUser } from "@framework/utils/entities";
import { isDiscordAPIError } from "@framework/utils/errors";
-import { also } from "@framework/utils/utils";
+import { also, suppressErrorNoReturn } from "@framework/utils/utils";
import {
Infraction,
InfractionCreatePayload,
@@ -442,7 +442,12 @@ class InfractionManager extends Service {
}
}
- callback?.(newInfraction);
+ const promise = callback?.(newInfraction);
+
+ if (promise instanceof Promise) {
+ promise.catch(this.application.logger.error);
+ }
+
return newInfraction;
}
);
@@ -1674,7 +1679,8 @@ class InfractionManager extends Service {
records.map(r => r.id)
)
)
- .then();
+ .then()
+ .catch(this.application.logger.error);
}
this.auditLoggingService
@@ -2327,8 +2333,8 @@ class InfractionManager extends Service {
this.application.logger.error("Bulk ban error", error);
if (error instanceof DiscordAPIError && error.code === 500000) {
- onError?.("failed_to_ban");
- onMassBanComplete?.([], allUsers, allUsers, "failed_to_ban");
+ suppressErrorNoReturn(onError?.("failed_to_ban"));
+ suppressErrorNoReturn(onMassBanComplete?.([], allUsers, allUsers, "failed_to_ban"));
return {
status: "failed",
@@ -2336,8 +2342,8 @@ class InfractionManager extends Service {
};
}
- onError?.("bulk_ban_failed");
- onMassBanComplete?.([], allUsers, allUsers, "bulk_ban_failed");
+ suppressErrorNoReturn(onError?.("bulk_ban_failed"));
+ suppressErrorNoReturn(onMassBanComplete?.([], allUsers, allUsers, "bulk_ban_failed"));
return {
status: "failed",
@@ -2365,7 +2371,8 @@ class InfractionManager extends Service {
this.application.database.drizzle
.insert(infractions)
.values(infractionCreatePayloads)
- .then();
+ .then()
+ .catch(this.application.logger.error);
}
this.auditLoggingService
@@ -2472,7 +2479,8 @@ class InfractionManager extends Service {
this.application.database.drizzle
.insert(infractions)
.values(infractionCreatePayloads)
- .then();
+ .then()
+ .catch(this.application.logger.error);
}
this.auditLoggingService
@@ -2505,18 +2513,6 @@ class InfractionManager extends Service {
? not(eq(infractions.deliveryStatus, InfractionDeliveryStatus.NotDelivered))
: undefined
)
-
- /**
- * {
- guildId: guild.id,
- userId: user.id,
- deliveryStatus: onlyNotified
- ? {
- not: InfractionDeliveryStatus.NotDelivered
- }
- : undefined
- }
- */
});
const table = new AsciiTable3("Infractions");
@@ -2831,14 +2827,14 @@ type CreateUserMassBanPayload = {
users: Array;
deletionTimeframe?: Duration;
duration?: Duration;
- onMassBanComplete?(
+ onMassBanComplete?: (
bannedUsers: Snowflake[],
failedUsers: Snowflake[],
allUsers: Snowflake[],
errorType?: string
- ): Awaitable;
- onMassBanStart?(): Awaitable;
- onError?(type: string): Awaitable;
+ ) => Awaitable