From 1e01f852173e0e5fe1ba92782e3e569fe7fca46e Mon Sep 17 00:00:00 2001 From: sadan4 <117494111+sadan4@users.noreply.github.com> Date: Fri, 4 Oct 2024 05:29:59 -0400 Subject: [PATCH] NoBlockedMessages: Fix conflict with MessageLogger (#2921) --- src/plugins/noBlockedMessages/index.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/plugins/noBlockedMessages/index.ts b/src/plugins/noBlockedMessages/index.ts index 7c87a7ab..3c4a2d75 100644 --- a/src/plugins/noBlockedMessages/index.ts +++ b/src/plugins/noBlockedMessages/index.ts @@ -25,6 +25,12 @@ import { Message } from "discord-types/general"; const RelationshipStore = findByPropsLazy("getRelationships", "isBlocked"); +interface MessageDeleteProps { + collapsedReason: { + message: string; + }; +} + export default definePlugin({ name: "NoBlockedMessages", description: "Hides all blocked messages from chat completely.", @@ -35,7 +41,7 @@ export default definePlugin({ replacement: [ { match: /let\{[^}]*collapsedReason[^}]*\}/, - replace: "return null;$&" + replace: "if($self.shouldHide(arguments[0]))return null;$&" } ] }, @@ -68,5 +74,9 @@ export default definePlugin({ } catch (e) { new Logger("NoBlockedMessages").error("Failed to check if user is blocked:", e); } + }, + + shouldHide(props: MessageDeleteProps) { + return !props?.collapsedReason?.message.includes("deleted"); } });