diff options
Diffstat (limited to 'src/plugins/noBlockedMessages.ts')
-rw-r--r-- | src/plugins/noBlockedMessages.ts | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/src/plugins/noBlockedMessages.ts b/src/plugins/noBlockedMessages.ts index 6c7a496..f6f226f 100644 --- a/src/plugins/noBlockedMessages.ts +++ b/src/plugins/noBlockedMessages.ts @@ -17,12 +17,16 @@ */ import { Devs } from "../utils/constants"; -import definePlugin from "../utils/types"; +import { lazyWebpack } from "../utils/misc"; +import definePlugin, { OptionType } from "../utils/types"; +import { Settings } from "../Vencord"; +import { filters } from "../webpack"; +const RelationshipStore = lazyWebpack(filters.byProps("getRelationships", "isBlocked")); export default definePlugin({ name: "NoBlockedMessages", description: "Hides all blocked messages from chat completely.", - authors: [Devs.rushii], + authors: [Devs.rushii, Devs.Samu], patches: [ { find: 'safety_prompt:"DMSpamExperiment",response:"show_redacted_messages"', @@ -32,6 +36,26 @@ export default definePlugin({ replace: ".collapsedReason;return null;return;" } ] + }, + { + find: "displayName=\"MessageStore\"", + predicate: () => Settings.plugins.NoBlockedMessages.ignoreBlockedMessages === true, + replacement: [ + { + match: /(?<=MESSAGE_CREATE:function\((\w)\){var \w=\w\.channelId,\w=\w\.message,\w=\w\.isPushNotification,\w=\w\.\w\.getOrCreate\(\w\));/, + replace: ";if(Vencord.Plugins.plugins.IgnoreBlockedUsers.isBlocked(n))return;" + } + ] } - ] + ], + options: { + ignoreBlockedMessages: { + description: "Completely ignores (recent) incoming messages from blocked users (locally).", + type: OptionType.BOOLEAN, + default: false, + restartNeeded: true, + }, + }, + isBlocked: message => + RelationshipStore.isBlocked(message.author.id) }); |