Skip to content
This repository was archived by the owner on Oct 9, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .ecosystem.config.js → .ecosystem.config.cjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
export default {
module.exports = {
apps: [
{
name: 'interchat',
script: 'build/index.js',
script: 'build/cluster.js',
node_args: "--max-old-space-size=4096 --import ./build/instrument.js",
env_production: {
NODE_ENV: 'production',
},
autorestart: true,
},
],
};
};
69 changes: 0 additions & 69 deletions .github/workflows/docker.yml

This file was deleted.

21 changes: 12 additions & 9 deletions src/managers/BlacklistManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,16 @@ export default class BlacklistManager {
if (this.scheduler.taskNames.includes(name)) this.scheduler.stopTask(name);

const execute = async () => {
if (SuperClient.instance?.user) {
await logUnblacklist(hubId, {
type,
targetId: id,
mod: SuperClient.instance.user,
reason: 'Blacklist duration expired.',
}).catch(() => null);
}

await this.removeBlacklist(type, hubId, id);
if (!SuperClient.instance?.user) return;
await logUnblacklist(hubId, {
type,
targetId: id,
mod: SuperClient.instance.user,
reason: 'Blacklist duration expired.',
});
};

this.scheduler.addTask(name, expires, execute);
Expand All @@ -98,7 +100,7 @@ export default class BlacklistManager {
type: 'user' | 'server',
id: Snowflake,
opts: {
hubId: string,
hubId: string;
expires?: Date;
reason?: string;
},
Expand Down Expand Up @@ -223,7 +225,8 @@ export default class BlacklistManager {
moderatorId: Snowflake,
expires?: Date,
) {
const guild = typeof server === 'string' ? await SuperClient.instance.fetchGuild(server) : server;
const guild =
typeof server === 'string' ? await SuperClient.instance.fetchGuild(server) : server;
if (!guild) return null;

const dbGuild = await db.blacklistedServers.upsert({
Expand Down
29 changes: 12 additions & 17 deletions src/scripts/network/runChecks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { containsInviteLinks, replaceLinks } from '../../utils/Utils.js';
import { check as checkProfanity } from '../../utils/Profanity.js';
import { runAntiSpam } from './antiSpam.js';
import { analyzeImageForNSFW, isUnsafeImage } from '../../utils/NSFWDetection.js';
import { logBlacklist } from '../../utils/HubLogger/ModLogs.js';

// if account is created within the last 7 days
export const isNewUser = (message: Message) => {
Expand Down Expand Up @@ -40,27 +41,21 @@ export const isCaughtSpam = async (
) => {
const antiSpamResult = runAntiSpam(message.author, 3);
if (!antiSpamResult) return false;
const { blacklistManager } = message.client;
const { addUserBlacklist, notifyBlacklist, scheduleRemoval } = message.client.blacklistManager;

if (settings.has('SpamFilter') && antiSpamResult.infractions >= 3) {
await blacklistManager.addUserBlacklist(
hubId,
message.author.id,
'Auto-blacklisted for spamming.',
message.client.user.id,
60 * 5000,
);
blacklistManager.scheduleRemoval('user', message.author.id, hubId, 60 * 5000);
blacklistManager
.notifyBlacklist('user', message.author.id, {
hubId,
expires: new Date(Date.now() + 60 * 5000),
reason: 'Auto-blacklisted for spamming.',
})
.catch(() => null);
const expires = new Date(Date.now() + 60 * 5000);
const reason = 'Auto-blacklisted for spamming.';
const target = message.author;
const mod = message.client.user;

await addUserBlacklist(hubId, target.id, reason, mod.id, 60 * 5000);
scheduleRemoval('user', target.id, hubId, 60 * 5000);
await notifyBlacklist('user', target.id, { hubId, expires, reason }).catch(() => null);
await logBlacklist(hubId, message.client, { target, mod, reason, expires }).catch(() => null);
}

message.react(emojis.timeout).catch(() => null);
await message.react(emojis.timeout).catch(() => null);
return true;
};

Expand Down
4 changes: 2 additions & 2 deletions src/utils/Constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ export const REGEX = {
IMGUR_LINKS:
/(?:https?:\/\/)?(?:www\.)?imgur\.com\/(?:a\/|gallery\/)?([a-zA-Z0-9]+)(?:\.[a-zA-Z]+)?/i,
/** matches profanity words */
PROFANITY: new RegExp(profanity.map((word) => `\\b${word}\\b|${word}`).join('|'), 'gi'),
PROFANITY: new RegExp(profanity.map((word) => `\\b${word}\\b`).join('|'), 'gi'),
/** matches slurs */
SLURS: new RegExp(slurs.map((word) => `\\b${word}\\b|${word}`).join('|'), 'gi'),
SLURS: new RegExp(slurs.map((word) => `\\b${word}\\b`).join('|'), 'gi'),
TENOR_LINKS: /https:\/\/tenor\.com\/view\/.*-(\d+)/,
EMOJI: /<(a)?:([a-zA-Z0-9_]+):(\d+)>/,
BANNED_WEBHOOK_WORDS: /discord|clyde|```/gi,
Expand Down
1 change: 1 addition & 0 deletions src/utils/HubLogger/ModLogs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ export const logUnblacklist = async (
if (opts.type === 'user') {
blacklisted = await BlacklistManager.fetchUserBlacklist(hub.id, opts.targetId);
const user = await opts.mod.client.users.fetch(opts.targetId).catch(() => null);

name = user?.username ?? `${blacklisted?.username}`;
originalReason = blacklisted?.blacklistedFrom.find((h) => h.hubId === hub.id)?.reason;
}
Expand Down
35 changes: 23 additions & 12 deletions src/utils/JSON/profanity.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
{
"slurs": ["nigga", "nigg", "niggas", "nigger", "n1gger", "n1gg3r", "niger", "kys", "nig", "fag", "faggot", "fagger"],
"slurs": [
"nigga",
"nigg",
"niggas",
"nigger",
"n1gger",
"n1gg3r",
"niger",
"kys",
"fagg",
"fagger",
"fag",
"fagging",
"faggitt",
"faggot",
"faggs",
"fagot",
"fagots",
"fags",
"n i g g a",
"n i g g e r",
"n i g g"
],

"profanity": [
"orgy",
Expand All @@ -11,9 +33,6 @@
"a55",
"anal",
"ar5e",
"arrse",
"arse",
"ass",
"ass-fucker",
"asses",
"assfucker",
Expand Down Expand Up @@ -130,14 +149,6 @@
"f u c k",
"f u c k e r",
"f4nny",
"fag",
"fagging",
"faggitt",
"faggot",
"faggs",
"fagot",
"fagots",
"fags",
"fanny",
"fannyflaps",
"fannyfucker",
Expand Down