diff options
author | Berlin <39058370+somerandomcloud@users.noreply.github.com> | 2022-11-18 05:12:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-18 05:12:45 +0100 |
commit | 503a2ec517dbcd6c2514629bbe67a31d2ddeec89 (patch) | |
tree | 32a04a9e00fa02163d8bc2c5102fdc7decbe98b4 /src/plugins/noBlockedMessages.ts | |
parent | 83b3b1f16b65eda408dd0a5984543bd9e6c15f3d (diff) | |
download | Vencord-503a2ec517dbcd6c2514629bbe67a31d2ddeec89.tar.gz Vencord-503a2ec517dbcd6c2514629bbe67a31d2ddeec89.tar.bz2 Vencord-503a2ec517dbcd6c2514629bbe67a31d2ddeec89.zip |
Add option to ignore incoming blocked messages (#179)
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) }); |