Merge branch 'main' into development
diff --git a/package.json b/package.json
index 2ff313c..08ca2f2 100644
--- a/package.json
+++ b/package.json
@@ -5,7 +5,6 @@
"@tensorflow/tfjs": "^3.18.0",
"@tensorflow/tfjs-node": "^3.18.0",
"@total-typescript/ts-reset": "^0.3.7",
- "@tsconfig/node18-strictest-esm": "^1.0.0",
"@types/gm": "^1.25.0",
"@types/node": "^18.14.6",
"@ungap/structured-clone": "^1.0.1",
@@ -82,7 +81,7 @@
"prettier": "^2.7.1",
"prettier-eslint": "^15.0.1",
"tsc-suppress": "^1.0.7",
- "typescript": "^4.9.4",
+ "typescript": "^5.0.0",
"yarn-audit-fix": "^9.3.9"
}
}
diff --git a/src/commands/mod/about.ts b/src/commands/mod/about.ts
index 6f8b74c..d346156 100644
--- a/src/commands/mod/about.ts
+++ b/src/commands/mod/about.ts
@@ -444,7 +444,7 @@
const check = (interaction: CommandInteraction) => {
const member = interaction.member as GuildMember;
- if (!member.permissions.has("ModerateMembers")) return "You do not have the *Moderate Members* permission";
+ if (!member.permissions.has("ManageMessages")) return "You do not have the *Moderate Members* permission";
return true;
};
diff --git a/src/commands/mod/warn.ts b/src/commands/mod/warn.ts
index 0424d48..4d333d2 100644
--- a/src/commands/mod/warn.ts
+++ b/src/commands/mod/warn.ts
@@ -300,7 +300,7 @@
const check = (interaction: CommandInteraction | ButtonInteraction, partial: boolean = false, target?: GuildMember) => {
if (!interaction.guild) return;
const member = interaction.member as GuildMember;
- if (!member.permissions.has("ModerateMembers")) return "You do not have the *Moderate Members* permission";
+ if (!member.permissions.has("ManageMessages")) return "You do not have the *Moderate Members* permission";
if (partial) return true;
let apply: GuildMember;
if (interaction.isButton()) {
diff --git a/src/commands/settings/automod.ts b/src/commands/settings/automod.ts
index a854fc5..522d928 100644
--- a/src/commands/settings/automod.ts
+++ b/src/commands/settings/automod.ts
@@ -1087,34 +1087,34 @@
if (i.isButton()) {
await client.database.guilds.write(interaction.guild.id, { filters: current });
await client.memory.forceUpdate(interaction.guild.id);
- config = current;
+ config = _.cloneDeep(current);
current = _.cloneDeep(config);
} else {
switch (i.values[0]) {
case "invites": {
- config.invite = await inviteMenu(i, m, _.isEqual(config, current), config.invite);
+ current.invite = await inviteMenu(i, m, _.isEqual(config, current), current.invite);
break;
}
case "mentions": {
- config.pings = await mentionMenu(i, m, _.isEqual(config, current), config.pings);
+ current.pings = await mentionMenu(i, m, _.isEqual(config, current), current.pings);
break;
}
case "words": {
- config.wordFilter = await wordMenu(i, m, _.isEqual(config, current), config.wordFilter);
+ current.wordFilter = await wordMenu(i, m, _.isEqual(config, current), current.wordFilter);
break;
}
case "malware": {
- config.malware = !config.malware;
+ current.malware = !current.malware;
break;
}
case "images": {
- const next = await imageMenu(i, m, _.isEqual(config, current), config.images);
- config.images = next;
+ const next = await imageMenu(i, m, _.isEqual(config, current), current.images);
+ current.images = next;
break;
}
case "clean": {
const next = await cleanMenu(i, m, _.isEqual(config, current), config.clean);
- config.clean = next;
+ current.clean = next;
break;
}
}
diff --git a/src/reflex/scanners.ts b/src/reflex/scanners.ts
index cdfb56b..0ae285a 100644
--- a/src/reflex/scanners.ts
+++ b/src/reflex/scanners.ts
@@ -219,7 +219,7 @@
// Does the username contain filtered words
// Does the nickname contain filtered words
let nameCheck;
- if(member.nickname) {
+ if (member.nickname) {
nameCheck = TestString(member.nickname ?? "", loose, strict, guildData.filters.wordFilter.enabled);
} else {
nameCheck = TestString(member.user.username, loose, strict, guildData.filters.wordFilter.enabled);
@@ -239,13 +239,7 @@
// Does the nickname contain an invite
const nicknameInviteCheck =
guildData.filters.invite.enabled && /discord\.gg\/[a-zA-Z0-9]+/gi.test(member.nickname ?? "");
- if (
- nameCheck !== null ||
- avatarCheck ||
- inviteCheck ||
- nicknameInviteCheck ||
- avatarTextCheck !== null
- ) {
+ if (nameCheck !== null || avatarCheck || inviteCheck || nicknameInviteCheck || avatarTextCheck !== null) {
const infractions = [];
if (nameCheck !== null) {
infractions.push(`Name contains a ${nameCheck.type}ly filtered word (${nameCheck.word})`);
diff --git a/tsconfig.json b/tsconfig.json
index 1df2f7d..1da4a03 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,6 +1,19 @@
{
- "extends": "@tsconfig/node18-strictest-esm/tsconfig.json",
+ "$schema": "https://json.schemastore.org/tsconfig",
+ "display": "Node 18 + ESM + Strictest",
"compilerOptions": {
+ "lib": ["es2022"],
+ "strict": true,
+ "exactOptionalPropertyTypes": true,
+ "noFallthroughCasesInSwitch": true,
+ "noImplicitOverride": true,
+ "noPropertyAccessFromIndexSignature": true,
+ "noUncheckedIndexedAccess": true,
+ "noUnusedLocals": true,
+ "noUnusedParameters": true,
+ "forceConsistentCasingInFileNames": true,
+ "allowUnusedLabels": false,
+ "allowUnreachableCode": false,
"module": "NodeNext",
"target": "es2020",
"sourceMap": true,
@@ -11,7 +24,8 @@
"resolveJsonModule": true,
"moduleResolution": "NodeNext",
"skipLibCheck": true,
- "noImplicitReturns": false
+ "noImplicitReturns": false,
+ "checkJs": true
},
"include": ["src/**/*", "src/*", "src/config/main.d.ts", "src/config/main.ts"],
"exclude": ["src/Unfinished/**/*", "src/reflex/nsfwjs/**/*"]