From 42ef3b0f08cd9779ad16353f875e116ff1983917 Mon Sep 17 00:00:00 2001 From: Mirco Wittrien Date: Mon, 16 Nov 2020 10:41:44 +0100 Subject: [PATCH] Update ServerHider.plugin.js --- Plugins/ServerHider/ServerHider.plugin.js | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/Plugins/ServerHider/ServerHider.plugin.js b/Plugins/ServerHider/ServerHider.plugin.js index b233244361..4423b8d096 100644 --- a/Plugins/ServerHider/ServerHider.plugin.js +++ b/Plugins/ServerHider/ServerHider.plugin.js @@ -14,12 +14,12 @@ module.exports = (_ => { "info": { "name": "ServerHider", "author": "DevilBro", - "version": "6.1.8", + "version": "6.1.9", "description": "Hide Servers in your Serverlist" }, "changeLog": { "fixed": { - "Crash": "Fixed the crash issue that occured one some plugins" + "Works again": "Can discord stop messing with the server list, jeez" } } }; @@ -150,12 +150,25 @@ module.exports = (_ => { if (typeof e.returnvalue.props.children == "function") { let childrenRender = e.returnvalue.props.children; e.returnvalue.props.children = (...args) => { + let children = childrenRender(...args); + this.checkTree(children); + return children; + }; + } + 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 = (...args) => { let children = childrenRender(...args); this.handleGuilds(children); return children; }; } - else this.handleGuilds(e.returnvalue); + else this.handleGuilds(returnvalue); } handleGuilds (returnvalue) {