From 256949815082967b2f01082b727c9a51a0611ab2 Mon Sep 17 00:00:00 2001 From: Mirco Wittrien Date: Wed, 16 Sep 2020 16:20:38 +0200 Subject: [PATCH] Update RemoveBlockedMessages.plugin.js --- .../RemoveBlockedMessages.plugin.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Plugins/RemoveBlockedMessages/RemoveBlockedMessages.plugin.js b/Plugins/RemoveBlockedMessages/RemoveBlockedMessages.plugin.js index 8912bb6098..e18632661b 100644 --- a/Plugins/RemoveBlockedMessages/RemoveBlockedMessages.plugin.js +++ b/Plugins/RemoveBlockedMessages/RemoveBlockedMessages.plugin.js @@ -4,15 +4,15 @@ var RemoveBlockedMessages = (_ => { return class RemoveBlockedMessages { getName () {return "RemoveBlockedMessages";} - getVersion () {return "1.0.4";} + getVersion () {return "1.0.5";} getAuthor () {return "DevilBro";} - getDescription () {return "Removes blocked messages completely.";} + getDescription () {return "Completely removes blocked messages.";} constructor () { this.changelog = { - "fixed":[["Message Update","Fixed for yet another message update provided by our best friend discord"]] + "fixed":[["Date Deviders","No longer shows date deviders of blocked messages"]] }; this.patchedModules = { @@ -75,7 +75,14 @@ var RemoveBlockedMessages = (_ => { processMessages (e) { let messagesIns = e.returnvalue.props.children; - if (BDFDB.ArrayUtils.is(messagesIns.props.channelStream)) messagesIns.props.channelStream = [].concat(messagesIns.props.channelStream.filter(n => n.type != "MESSAGE_GROUP_BLOCKED")); + if (BDFDB.ArrayUtils.is(messagesIns.props.channelStream)) { + let oldStream = messagesIns.props.channelStream.filter(n => n.type != "MESSAGE_GROUP_BLOCKED"), newChannelStream = []; + for (let i in oldStream) { + let next = parseInt(i)+1; + if (oldStream[i].type != "DIVIDER" || (oldStream[next] && oldStream[i].type == "DIVIDER" && oldStream[next].type != "DIVIDER" && oldStream.slice(next).some(nextStream => nextStream.type != "DIVIDER"))) newChannelStream.push(oldStream[i]); + } + messagesIns.props.channelStream = newChannelStream; + } if (BDFDB.ObjectUtils.is(messagesIns.props.messages) && BDFDB.ArrayUtils.is(messagesIns.props.messages._array)) { let messages = messagesIns.props.messages; messagesIns.props.messages = new BDFDB.DiscordObjects.Messages(messages);