Update ServerHider.plugin.js

This commit is contained in:
Mirco Wittrien 2020-11-16 10:41:44 +01:00
parent a677a31016
commit 42ef3b0f08
1 changed files with 16 additions and 3 deletions

View File

@ -14,12 +14,12 @@ module.exports = (_ => {
"info": { "info": {
"name": "ServerHider", "name": "ServerHider",
"author": "DevilBro", "author": "DevilBro",
"version": "6.1.8", "version": "6.1.9",
"description": "Hide Servers in your Serverlist" "description": "Hide Servers in your Serverlist"
}, },
"changeLog": { "changeLog": {
"fixed": { "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") { if (typeof e.returnvalue.props.children == "function") {
let childrenRender = e.returnvalue.props.children; let childrenRender = e.returnvalue.props.children;
e.returnvalue.props.children = (...args) => { 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); let children = childrenRender(...args);
this.handleGuilds(children); this.handleGuilds(children);
return children; return children;
}; };
} }
else this.handleGuilds(e.returnvalue); else this.handleGuilds(returnvalue);
} }
handleGuilds (returnvalue) { handleGuilds (returnvalue) {