From 86143e7031ff609bdbcdaa280953aa7e64fe10ed Mon Sep 17 00:00:00 2001 From: Almeida Date: Sat, 4 Sep 2021 17:23:31 +0100 Subject: [PATCH] Don't match video embed descriptions (#256) --- .../Automod/functions/matchMultipleTextTypesOnMessage.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/src/plugins/Automod/functions/matchMultipleTextTypesOnMessage.ts b/backend/src/plugins/Automod/functions/matchMultipleTextTypesOnMessage.ts index 10188f7e..08492589 100644 --- a/backend/src/plugins/Automod/functions/matchMultipleTextTypesOnMessage.ts +++ b/backend/src/plugins/Automod/functions/matchMultipleTextTypesOnMessage.ts @@ -1,4 +1,4 @@ -import { Constants } from "discord.js"; +import { Constants, MessageEmbed } from "discord.js"; import { GuildPluginData } from "knub"; import { SavedMessage } from "../../../data/entities/SavedMessage"; import { resolveMember } from "../../../utils"; @@ -32,9 +32,9 @@ export async function* matchMultipleTextTypesOnMessage( yield ["message", msg.data.content]; } - if (trigger.match_embeds && msg.data.embeds && msg.data.embeds.length) { - const copiedEmbed = JSON.parse(JSON.stringify(msg.data.embeds[0])); - if (copiedEmbed.type === "video") { + if (trigger.match_embeds && msg.data.embeds?.length) { + const copiedEmbed: MessageEmbed = JSON.parse(JSON.stringify(msg.data.embeds[0])); + if (copiedEmbed.video) { copiedEmbed.description = ""; // The description is not rendered, hence it doesn't need to be matched } yield ["embed", JSON.stringify(copiedEmbed)];