Update ServerCounter.plugin.js

This commit is contained in:
Mirco Wittrien 2021-10-09 14:02:30 +02:00 committed by GitHub
parent 304d9147cf
commit eb2bf4a104
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 34 deletions

View File

@ -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", {