From d51b2888e01548c3d7cbb5161f4f9ac39a5a903b Mon Sep 17 00:00:00 2001 From: fumiichan <35658068+fumiichan@users.noreply.github.com> Date: Sun, 2 Feb 2025 21:56:52 +0900 Subject: [PATCH] Fix hiding messages automatically that doesn't contain media --- src/plugins/hideAttachments/index.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/plugins/hideAttachments/index.tsx b/src/plugins/hideAttachments/index.tsx index 6c177e213..938f9726c 100644 --- a/src/plugins/hideAttachments/index.tsx +++ b/src/plugins/hideAttachments/index.tsx @@ -64,6 +64,10 @@ const toggleHide = async (channelId: string, messageId: string): Promise = * @returns {boolean} */ const shouldHideByUserIdFilter = (payload: IMessage, userFilters: string[]): boolean => { + if (!payload.attachments.length && !payload.embeds.length) { + return false; + } + for (const id of userFilters) { if (payload.author.id === id) { return true; @@ -73,6 +77,11 @@ const shouldHideByUserIdFilter = (payload: IMessage, userFilters: string[]): boo return false; }; +/** + * Checks if the embed should be hidden + * @param {Embed[]} embeds List of embeds + * @param {string[]} domainList List of domains + */ const shouldHideEmbed = (embeds: Embed[], domainList: string[]): boolean => { for (const embed of embeds) { if (!embed.url) {