summary refs log tree commit diff
path: root/src/util
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-10-25 10:58:36 +1100
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-10-25 10:58:36 +1100
commitf5b50ed3a89dce8e9ec89c1bc25f08c56ef80e50 (patch)
tree1b0e6522b3ac776949fb0f0fd5620d2c20034db7 /src/util
parentFix tweets with only video breaking embeds (diff)
downloadserver-f5b50ed3a89dce8e9ec89c1bc25f08c56ef80e50.tar.xz
Move message auto mod to the api route instead of a @beforeinsert/update method
Diffstat (limited to 'src/util')
-rw-r--r--src/util/entities/Message.ts16
-rw-r--r--src/util/util/Constants.ts4
2 files changed, 4 insertions, 16 deletions
diff --git a/src/util/entities/Message.ts b/src/util/entities/Message.ts
index a52b4785..013de378 100644
--- a/src/util/entities/Message.ts
+++ b/src/util/entities/Message.ts
@@ -5,8 +5,6 @@ import { Channel } from "./Channel";
 import { InteractionType } from "../interfaces/Interaction";
 import { Application } from "./Application";
 import {
-	BeforeInsert,
-	BeforeUpdate,
 	Column,
 	CreateDateColumn,
 	Entity,
@@ -23,8 +21,6 @@ import { Guild } from "./Guild";
 import { Webhook } from "./Webhook";
 import { Sticker } from "./Sticker";
 import { Attachment } from "./Attachment";
-import { BannedWords } from "../util";
-import { HTTPError } from "lambert-server";
 
 export enum MessageType {
 	DEFAULT = 0,
@@ -206,18 +202,6 @@ export class Message extends BaseClass {
 
 	@Column({ type: "simple-json", nullable: true })
 	components?: MessageComponent[];
-
-	@BeforeUpdate()
-	@BeforeInsert()
-	validate() {
-		if (this.content) {
-			if (BannedWords.find(this.content))
-				throw new HTTPError(
-					"Message was blocked by automatic moderation",
-					200000,
-				);
-		}
-	}
 }
 
 export interface MessageComponent {
diff --git a/src/util/util/Constants.ts b/src/util/util/Constants.ts
index 7c5b7dcb..46cf2e4f 100644
--- a/src/util/util/Constants.ts
+++ b/src/util/util/Constants.ts
@@ -973,6 +973,10 @@ export const DiscordApiErrors = {
 		undefined,
 		["5"],
 	),
+	AUTOMODERATOR_BLOCK: new ApiError(
+		"Message was blocked by automatic moderation",
+		200000,
+	),
 
 	//Other errors
 	UNKNOWN_VOICE_STATE: new ApiError("Unknown Voice State", 10065, 404),