Update RemoveBlockedUsers.plugin.js

This commit is contained in:
Mirco Wittrien 2022-04-22 18:33:34 +02:00
parent 14d4e9fe3f
commit 98a6ce8f1c
1 changed files with 12 additions and 18 deletions

View File

@ -2,7 +2,7 @@
* @name RemoveBlockedUsers * @name RemoveBlockedUsers
* @author DevilBro * @author DevilBro
* @authorId 278543574059057154 * @authorId 278543574059057154
* @version 1.4.5 * @version 1.4.6
* @description Removes blocked Messages/Users * @description Removes blocked Messages/Users
* @invite Jx3TjNS * @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien * @donate https://www.paypal.me/MircoWittrien
@ -17,15 +17,12 @@ module.exports = (_ => {
"info": { "info": {
"name": "RemoveBlockedUsers", "name": "RemoveBlockedUsers",
"author": "DevilBro", "author": "DevilBro",
"version": "1.4.5", "version": "1.4.6",
"description": "Removes blocked Messages/Users" "description": "Removes blocked Messages/Users"
}, },
"changeLog": { "changeLog": {
"fixed": { "fixed": {
"Offline List": "Sometimes clickling a User in the Offline List would cause others to vanish, fixed" "Server Message Indicator": "No longer shows an unread Indicator for Servers if all new messages are from blocked ppl"
},
"improved": {
"Activity List": "No longer shows blocked ppl in the Activity List (wtf Discord?)"
} }
} }
}; };
@ -144,9 +141,7 @@ module.exports = (_ => {
}}); }});
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.UnreadChannelUtils, "hasUnread", {after: e => { BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.UnreadChannelUtils, "hasUnread", {after: e => {
if (e.returnValue && this.settings.notifcations.messages) { if (e.returnValue && this.settings.notifcations.messages && BDFDB.LibraryModules.UnreadChannelUtils.getUnreadCount(e.methodArguments[0]) < BDFDB.DiscordConstants.MAX_MESSAGES_PER_CHANNEL) {
let count = BDFDB.LibraryModules.UnreadChannelUtils.getUnreadCount(e.methodArguments[0]);
if (count > 0 && count < BDFDB.DiscordConstants.MAX_MESSAGES_PER_CHANNEL) {
let id = BDFDB.LibraryModules.UnreadChannelUtils.lastMessageId(e.methodArguments[0]); let id = BDFDB.LibraryModules.UnreadChannelUtils.lastMessageId(e.methodArguments[0]);
let message = id && BDFDB.LibraryModules.MessageStore.getMessage(e.methodArguments[0], id); let message = id && BDFDB.LibraryModules.MessageStore.getMessage(e.methodArguments[0], id);
if (message && message.blocked) { if (message && message.blocked) {
@ -158,7 +153,6 @@ module.exports = (_ => {
} }
} }
} }
}
}}); }});
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.UnreadGuildUtils, "hasUnread", {after: e => { BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.UnreadGuildUtils, "hasUnread", {after: e => {