From eb2bf4a104aef33997d8ddc6ff774a560119d473 Mon Sep 17 00:00:00 2001 From: Mirco Wittrien <mirco.wittrien@gmail.com> Date: Sat, 9 Oct 2021 14:02:30 +0200 Subject: [PATCH] Update ServerCounter.plugin.js --- Plugins/ServerCounter/ServerCounter.plugin.js | 38 ++----------------- 1 file changed, 4 insertions(+), 34 deletions(-) diff --git a/Plugins/ServerCounter/ServerCounter.plugin.js b/Plugins/ServerCounter/ServerCounter.plugin.js index 9f1f0f24af..725b69b8aa 100644 --- a/Plugins/ServerCounter/ServerCounter.plugin.js +++ b/Plugins/ServerCounter/ServerCounter.plugin.js @@ -2,7 +2,7 @@ * @name ServerCounter * @author DevilBro * @authorId 278543574059057154 - * @version 1.0.3 + * @version 1.0.4 * @description Adds a Server Counter to the Server List * @invite Jx3TjNS * @donate https://www.paypal.me/MircoWittrien @@ -17,13 +17,8 @@ module.exports = (_ => { "info": { "name": "ServerCounter", "author": "DevilBro", - "version": "1.0.3", + "version": "1.0.4", "description": "Adds a Server Counter to the Server List" - }, - "changeLog": { - "fixed": { - "Works again": "Can discord stop messing with the server list, jeez" - } } }; @@ -77,7 +72,7 @@ module.exports = (_ => { onLoad () { this.patchedModules = { after: { - Guilds: "render" + Guilds: "type" } }; } @@ -91,32 +86,7 @@ module.exports = (_ => { } processGuilds (e) { - if (typeof e.returnvalue.props.children == "function") { - let childrenRender = e.returnvalue.props.children; - e.returnvalue.props.children = BDFDB.TimeUtils.suppress((...args) => { - let children = childrenRender(...args); - this.checkTree(children); - return children; - }, "", this); - } - else this.checkTree(e.returnvalue); - } - - checkTree (returnvalue) { - let tree = BDFDB.ReactUtils.findChild(returnvalue, {filter: n => n && n.props && typeof n.props.children == "function"}); - if (tree) { - let childrenRender = tree.props.children; - tree.props.children = BDFDB.TimeUtils.suppress((...args) => { - let children = childrenRender(...args); - this.injectCounter(children); - return children; - }, "", this); - } - else this.injectCounter(returnvalue); - } - - injectCounter (returnvalue) { - let [children, index] = BDFDB.ReactUtils.findParent(returnvalue, {name: "ConnectedUnreadDMs"}); + let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {name: "UnreadDMs"}); if (index > -1) children.splice(index + 1, 0, BDFDB.ReactUtils.createElement("div", { className: BDFDB.disCNS.guildouter + BDFDB.disCN._servercounterservercountwrap, children: BDFDB.ReactUtils.createElement("div", {