Add option to ignore incoming blocked messages (#179)
This commit is contained in:
parent
83b3b1f16b
commit
503a2ec517
|
@ -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)
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue