Remove bad banned words implementation

This commit is contained in:
Madeline
2022-12-17 18:45:42 +11:00
parent d1c90c8c09
commit 444e815690
9 changed files with 5 additions and 60 deletions
+1 -2
View File
@@ -1,7 +1,7 @@
import "missing-native-js-functions";
import { Server, ServerOptions } from "lambert-server";
import { Authentication, CORS } from "./middlewares/";
import { BannedWords, Config, initDatabase, initEvent } from "@fosscord/util";
import { Config, initDatabase, initEvent } from "@fosscord/util";
import { ErrorHandler } from "./middlewares/ErrorHandler";
import { BodyParser } from "./middlewares/BodyParser";
import { Router, Request, Response, NextFunction } from "express";
@@ -38,7 +38,6 @@ export class FosscordServer extends Server {
await Config.init();
await initEvent();
await initInstance();
await BannedWords.init();
let logRequests = process.env["LOG_REQUESTS"] != undefined;
if (logRequests) {
@@ -12,7 +12,6 @@ import {
Snowflake,
uploadFile,
MessageCreateSchema,
BannedWords,
DiscordApiErrors,
} from "@fosscord/util";
import { Router, Response, Request } from "express";
@@ -44,10 +43,6 @@ router.patch(
const { message_id, channel_id } = req.params;
var body = req.body as MessageCreateSchema;
if (body.content)
if (BannedWords.find(body.content))
throw DiscordApiErrors.AUTOMODERATOR_BLOCK;
const message = await Message.findOneOrFail({
where: { id: message_id, channel_id },
relations: ["attachments"],
@@ -15,7 +15,6 @@ import {
Role,
MessageCreateSchema,
ReadState,
BannedWords,
DiscordApiErrors,
} from "@fosscord/util";
import { HTTPError } from "lambert-server";
@@ -192,10 +191,6 @@ router.post(
var body = req.body as MessageCreateSchema;
const attachments: Attachment[] = [];
if (body.content)
if (BannedWords.find(body.content))
throw DiscordApiErrors.AUTOMODERATOR_BLOCK;
const channel = await Channel.findOneOrFail({
where: { id: channel_id },
relations: ["recipients", "recipients.user"],