This commit is contained in:
Mirco Wittrien 2021-07-05 16:33:10 +02:00
parent 796b600016
commit a544e8f44d
15 changed files with 72 additions and 72 deletions

View File

@ -2970,11 +2970,11 @@ module.exports = (_ => {
BDFDB.PatchUtils.patch({name: "BDFDB GuildUtils"}, GuildsPrototype, "render", {after: e => {
if (typeof e.returnValue.props.children == "function") {
let childrenRender = e.returnValue.props.children;
e.returnValue.props.children = (...args) => {
e.returnValue.props.children = BDFDB.TimeUtils.suppress((...args) => {
let children = childrenRender(...args);
injectPlaceholder(children);
return children;
};
});
}
else injectPlaceholder(e.returnValue);
}}, {once: true});
@ -7895,10 +7895,10 @@ module.exports = (_ => {
let avatarWrapper = BDFDB.ObjectUtils.get(e, "returnvalue.props.children.0");
if (avatarWrapper && avatarWrapper.props && typeof avatarWrapper.props.children == "function") {
let renderChildren = avatarWrapper.props.children;
avatarWrapper.props.children = (...args) => {
avatarWrapper.props.children = BDFDB.TimeUtils.suppress((...args) => {
let renderedChildren = renderChildren(...args);
return InternalBDFDB._processAvatarRender(e.instance.props.message.author, renderedChildren) || renderedChildren;
};
});
}
else if (avatarWrapper && avatarWrapper.type == "img") e.returnvalue.props.children[0] = InternalBDFDB._processAvatarRender(e.instance.props.message.author, avatarWrapper) || avatarWrapper;
}
@ -7988,13 +7988,13 @@ module.exports = (_ => {
InternalBDFDB.executeExtraPatchedPatches("MessageOptionToolbar", {instance: {props: e2.methodArguments[0]}, returnvalue: e2.returnValue, methodname: "default"});
if (menu && typeof menu.props.renderPopout == "function") {
let renderPopout = menu.props.renderPopout;
menu.props.renderPopout = (...args) => {
menu.props.renderPopout = BDFDB.TimeUtils.suppress((...args) => {
let renderedPopout = renderPopout(...args);
BDFDB.PatchUtils.patch(BDFDB, renderedPopout, "type", {after: e3 => {
InternalBDFDB.executeExtraPatchedPatches("MessageOptionContextMenu", {instance: {props: e3.methodArguments[0]}, returnvalue: e3.returnValue, methodname: "default"});
}}, {noCache: true});
return renderedPopout;
}
});
}
}}, {once: true});
}});

View File

@ -393,11 +393,11 @@ module.exports = (_ => {
else if (this.settings.general.addMutualGuild && e.instance.props.mutualGuilds && e.instance.props.mutualGuilds.length) {
if (typeof e.returnvalue.props.children == "function") {
let childrenRender = e.returnvalue.props.children;
e.returnvalue.props.children = (...args) => {
e.returnvalue.props.children = BDFDB.TimeUtils.suppress((...args) => {
let children = childrenRender(...args);
this.injectMutualGuilds(children, e.instance.props.mutualGuilds);
return children;
};
}, "", this);
}
else this.injectMutualGuilds(e.returnvalue, e.instance.props.mutualGuilds);
}

View File

@ -212,11 +212,11 @@ module.exports = (_ => {
};
if (typeof e.returnvalue.props.children == "function") {
let childrenRender = e.returnvalue.props.children;
e.returnvalue.props.children = (...args) => {
e.returnvalue.props.children = BDFDB.TimeUtils.suppress((...args) => {
let children = childrenRender(...args);
process(children);
return children;
};
}, "", this);
}
else process(e.returnvalue);
}
@ -233,11 +233,11 @@ module.exports = (_ => {
if (e.instance.props.log && this.settings.general.showInAuditLogs) {
if (typeof e.returnvalue.props.children == "function") {
let childrenRender = e.returnvalue.props.children;
e.returnvalue.props.children = (...args) => {
e.returnvalue.props.children = BDFDB.TimeUtils.suppress((...args) => {
let children = childrenRender(...args);
this.editLog(e.instance.props.log, children);
return children;
};
}, "", this);
}
else this.editLog(e.instance.props.log, e.returnvalue);
}

View File

@ -168,11 +168,11 @@ module.exports = (_ => {
processGuilds (e) {
if (typeof e.returnvalue.props.children == "function") {
let childrenRender = e.returnvalue.props.children;
e.returnvalue.props.children = (...args) => {
e.returnvalue.props.children = BDFDB.TimeUtils.suppress((...args) => {
let children = childrenRender(...args);
this.checkTree(children);
return children;
};
}, "", this);
}
else this.checkTree(e.returnvalue);
}
@ -181,11 +181,11 @@ module.exports = (_ => {
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) => {
tree.props.children = BDFDB.TimeUtils.suppress((...args) => {
let children = childrenRender(...args);
this.handleGuilds(children);
return children;
};
}, "", this);
}
else this.handleGuilds(returnvalue);
}
@ -300,11 +300,11 @@ module.exports = (_ => {
};
if (children[index].props.children && children[index].props.children.props && typeof children[index].props.children.props.children == "function") {
let childrenRender = children[index].props.children.props.children;
children[index].props.children.props.children = (...args) => {
children[index].props.children.props.children = BDFDB.TimeUtils.suppress((...args) => {
let renderedChildren = childrenRender(...args);
insertBadges(renderedChildren);
return renderedChildren;
};
}, "", this);
}
else insertBadges(children[index]);
}
@ -350,11 +350,11 @@ module.exports = (_ => {
};
if (typeof children[index].props.children == "function") {
let childrenRender = children[index].props.children;
children[index].props.children = (...args) => {
children[index].props.children = BDFDB.TimeUtils.suppress((...args) => {
let renderedChildren = childrenRender(...args);
insertElements(renderedChildren);
return renderedChildren;
};
}, "", this);
}
else insertElements(children[index]);
}

View File

@ -284,7 +284,7 @@ module.exports = (_ => {
else {
if (typeof e.returnvalue.props.children == "function") {
let childrenRender = e.returnvalue.props.children;
e.returnvalue.props.children = (...args) => {
e.returnvalue.props.children = BDFDB.TimeUtils.suppress((...args) => {
let children = childrenRender(...args);
let channelName = BDFDB.ReactUtils.findChild(children, {name: "AutocompleteRowHeading"});
if (channelName) this.changeChannelColor(channelName, e.instance.props.channel.id);
@ -295,7 +295,7 @@ module.exports = (_ => {
if (categoryName) this.changeChannelColor(categoryName, e.instance.props.category.id);
}
return children;
};
}, "", this);
}
}
}
@ -402,18 +402,18 @@ module.exports = (_ => {
let channelIcon = this.settings.general.changeChannelIcon && BDFDB.ReactUtils.findChild(e.returnvalue, {name: "ChannelItemIcon"});
if (channelIcon && typeof channelIcon.type == "function") {
let type = channelIcon.type;
channelIcon.type = (...args) => {
channelIcon.type = BDFDB.TimeUtils.suppress((...args) => {
let returnValue = type(...args);
if (returnValue && typeof returnValue.props.children == "function") {
let childrenRender = returnValue.props.children;
returnValue.props.children = (...args2) => {
returnValue.props.children = BDFDB.TimeUtils.suppress((...args2) => {
let renderedChildren = childrenRender(...args2);
this.changeChannelIconColor(renderedChildren.props.children, e.instance.props.channel.id, modify);
return renderedChildren;
};
}, "", this);
}
return returnValue;
};
}, "", this);
}
}
}
@ -428,11 +428,11 @@ module.exports = (_ => {
let avatar = BDFDB.ReactUtils.findChild(e.returnvalue, {filter: c => c && c.props && !isNaN(parseInt(c.props.id))});
if (avatar && typeof avatar.props.children == "function") {
let childrenRender = avatar.props.children;
avatar.props.children = (...args) => {
avatar.props.children = BDFDB.TimeUtils.suppress((...args) => {
let renderedChildren = childrenRender(...args);
if (renderedChildren && renderedChildren.props) renderedChildren.props.icon = this.getGroupIcon(e.instance.props.channel.id);
return renderedChildren;
};
}, "", this);
}
}
}
@ -546,11 +546,11 @@ module.exports = (_ => {
if (name || color) {
if (typeof e.returnvalue.props.children == "function") {
let renderChildren = e.returnvalue.props.children;
e.returnvalue.props.children = (...args) => {
e.returnvalue.props.children = BDFDB.TimeUtils.suppress((...args) => {
let children = renderChildren(...args);
this.changeMention(children, {name, color});
return children;
};
}, "", this);
}
else this.changeMention(e.returnvalue, {name, color});
}

View File

@ -419,12 +419,12 @@ module.exports = (_ => {
else {
if (typeof e.returnvalue.props.children == "function") {
let childrenRender = e.returnvalue.props.children;
e.returnvalue.props.children = (...args) => {
e.returnvalue.props.children = BDFDB.TimeUtils.suppress((...args) => {
let children = childrenRender(...args);
let userName = BDFDB.ReactUtils.findChild(children, {name: "AutocompleteRowHeading"});
if (userName) this.changeUserColor(userName, e.instance.props.user.id);
return children;
};
}, "", this);
}
}
}
@ -619,12 +619,12 @@ module.exports = (_ => {
let tooltip = BDFDB.ReactUtils.findChild(e.returnvalue, {name: "Tooltip"});
if (tooltip && typeof tooltip.props.children == "function") {
let renderChildren = tooltip.props.children;
tooltip.props.children = (...args) => {
tooltip.props.children = BDFDB.TimeUtils.suppress((...args) => {
let renderedChildren = renderChildren(...args);
let userName = BDFDB.ReactUtils.findChild(renderedChildren, {name: "PanelTitle"});
if (userName) this.changeUserColor(userName, e.instance.props.currentUser.id);
return renderedChildren;
}
}, "", this);
}
}
}
@ -715,11 +715,11 @@ module.exports = (_ => {
if (messageUsername) {
if (messageUsername.props && typeof messageUsername.props.children == "function") {
let renderChildren = messageUsername.props.children;
messageUsername.props.children = (...args) => {
messageUsername.props.children = BDFDB.TimeUtils.suppress((...args) => {
let renderedChildren = renderChildren(...args);
this.changeUserColor(renderedChildren, author.id, {guildId: (BDFDB.LibraryModules.ChannelStore.getChannel(e.instance.props.message.channel_id) || {}).guild_id});
return renderedChildren;
}
}, "", this);
}
else this.changeUserColor(messageUsername, author.id, {guildId: (BDFDB.LibraryModules.ChannelStore.getChannel(e.instance.props.message.channel_id) || {}).guild_id});
}
@ -822,11 +822,11 @@ module.exports = (_ => {
if (e.instance.props.userId && this.settings.places.mentions && changedUsers[e.instance.props.userId] && this.shouldchat()) {
if (typeof e.returnvalue.props.children == "function") {
let renderChildren = e.returnvalue.props.children;
e.returnvalue.props.children = (...args) => {
e.returnvalue.props.children = BDFDB.TimeUtils.suppress((...args) => {
let children = renderChildren(...args);
this.changeMention(BDFDB.ReactUtils.findChild(children, {name: "Mention"}), changedUsers[e.instance.props.userId]);
return children;
};
}, "", this);
}
else this.changeMention(BDFDB.ReactUtils.findChild(e.returnvalue, {name: "Mention"}), changedUsers[e.instance.props.userId]);
}
@ -843,11 +843,11 @@ module.exports = (_ => {
if (data.name || data.color1) {
if (typeof e.returnvalue.props.children == "function") {
let renderChildren = e.returnvalue.props.children;
e.returnvalue.props.children = (...args) => {
e.returnvalue.props.children = BDFDB.TimeUtils.suppress((...args) => {
let children = renderChildren(...args);
this.changeMention(children, data);
return children;
};
}, "", this);
}
else this.changeMention(e.returnvalue, data);
}
@ -1030,11 +1030,11 @@ module.exports = (_ => {
let avatar = BDFDB.ReactUtils.findChild(e.returnvalue, {filter: c => c && c.props && !isNaN(parseInt(c.props.id))});
if (avatar && typeof avatar.props.children == "function") {
let childrenRender = avatar.props.children;
avatar.props.children = (...args) => {
avatar.props.children = BDFDB.TimeUtils.suppress((...args) => {
let renderedChildren = childrenRender(...args);
if (renderedChildren && renderedChildren.props) renderedChildren.props.icon = this.getUserAvatar(recipientId);
return renderedChildren;
};
}, "", this);
}
}
}
@ -1114,7 +1114,7 @@ module.exports = (_ => {
if (e.instance.props.channel && e.instance.props.channel.isDM() && this.settings.places.recentDms && typeof e.returnvalue.props.children == "function") {
let recipientId = e.instance.props.channel.getRecipientId();
let renderChildren = e.returnvalue.props.children;
e.returnvalue.props.children = (...args) => {
e.returnvalue.props.children = BDFDB.TimeUtils.suppress((...args) => {
let renderedChildren = renderChildren(...args);
let userName = BDFDB.ReactUtils.findChild(renderedChildren, {name: "PanelSubtext"});
if (userName) {
@ -1122,7 +1122,7 @@ module.exports = (_ => {
this.changeUserColor(userName, recipientId);
}
return renderedChildren;
};
}, "", this);
}
}

View File

@ -727,11 +727,11 @@ module.exports = (_ => {
if (this.settings.general.addOnlineCount) {
if (typeof e.returnvalue.props.children == "function") {
let childrenRender = e.returnvalue.props.children;
e.returnvalue.props.children = (...args) => {
e.returnvalue.props.children = BDFDB.TimeUtils.suppress((...args) => {
let children = childrenRender(...args);
this.checkTree(children);
return children;
};
}, "", this);
}
else this.checkTree(e.returnvalue);
}
@ -741,11 +741,11 @@ module.exports = (_ => {
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) => {
tree.props.children = BDFDB.TimeUtils.suppress((...args) => {
let children = childrenRender(...args);
this.injectCounter(children);
return children;
};
}, "", this);
}
else this.injectCounter(returnvalue);
}

View File

@ -123,11 +123,11 @@ module.exports = (_ => {
let tree = BDFDB.ReactUtils.findChild(e.returnvalue, {filter: n => n && n.props && typeof n.props.children == "function"});
if (tree) {
let childrenRender = tree.props.children;
tree.props.children = (...args) => {
tree.props.children = BDFDB.TimeUtils.suppress((...args) => {
let children = childrenRender(...args);
this.patchList(e.instance.props.guild.id, children);
return children;
};
}, "", this);
}
else this.patchList(e.instance.props.guild.id, e.returnvalue);
}

View File

@ -983,7 +983,7 @@ module.exports = (_ => {
let attachment = BDFDB.ReactUtils.findValue(e.instance, "attachment", {up: true});
if (attachment) {
let renderChildren = e.returnvalue.props.children;
e.returnvalue.props.children = (...args) => {
e.returnvalue.props.children = BDFDB.TimeUtils.suppress((...args) => {
return BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, {
text: `${attachment.filename}\n${BDFDB.NumberUtils.formatBytes(attachment.size)}\n${attachment.width}x${attachment.height}px`,
tooltipConfig: {
@ -992,7 +992,7 @@ module.exports = (_ => {
},
children: renderChildren(...args)
});
};
}, "", this);
}
}
}

View File

@ -408,11 +408,11 @@ module.exports = (_ => {
else {
if (typeof e.returnvalue.props.children == "function") {
let childrenRender = e.returnvalue.props.children;
e.returnvalue.props.children = (...args) => {
e.returnvalue.props.children = BDFDB.TimeUtils.suppress((...args) => {
let children = childrenRender(...args);
this.injectCategories(e.instance, children, categories);
return children;
};
}, "", this);
}
else this.injectCategories(e.instance, e.returnvalue, categories);
}

View File

@ -295,11 +295,11 @@ module.exports = (_ => {
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) => {
tree.props.children = BDFDB.TimeUtils.suppress((...args) => {
let children = childrenRender(...args);
this.handleGuilds(children);
return children;
};
}, "", this);
}
else this.handleGuilds(returnvalue);
}

View File

@ -225,11 +225,11 @@ module.exports = (_ => {
if (!newName) return;
if (typeof e.returnvalue.props.children == "function") {
let renderChildren = e.returnvalue.props.children;
e.returnvalue.props.children = (...args) => {
e.returnvalue.props.children = BDFDB.TimeUtils.suppress((...args) => {
let children = renderChildren(...args);
this.changeMention(BDFDB.ReactUtils.findChild(children, {name: "Mention"}), newName);
return children;
};
}, "", this);
}
else this.changeMention(BDFDB.ReactUtils.findChild(e.returnvalue, {name: "Mention"}), newName);
}
@ -240,11 +240,11 @@ module.exports = (_ => {
let newName = this.getNewName(BDFDB.LibraryModules.UserStore.getUser(e.instance.props.id));
if (newName) {
let renderChildren = e.returnvalue.props.children;
e.returnvalue.props.children = (...args) => {
e.returnvalue.props.children = BDFDB.TimeUtils.suppress((...args) => {
let children = renderChildren(...args);
this.changeMention(children, newName);
return children;
};
}, "", this);
}
}
}

View File

@ -93,11 +93,11 @@ module.exports = (_ => {
processGuilds (e) {
if (typeof e.returnvalue.props.children == "function") {
let childrenRender = e.returnvalue.props.children;
e.returnvalue.props.children = (...args) => {
e.returnvalue.props.children = BDFDB.TimeUtils.suppress((...args) => {
let children = childrenRender(...args);
this.checkTree(children);
return children;
};
}, "", this);
}
else this.checkTree(e.returnvalue);
}
@ -106,11 +106,11 @@ module.exports = (_ => {
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) => {
tree.props.children = BDFDB.TimeUtils.suppress((...args) => {
let children = childrenRender(...args);
this.injectCounter(children);
return children;
};
}, "", this);
}
else this.injectCounter(returnvalue);
}

View File

@ -678,11 +678,11 @@ module.exports = (_ => {
}
if (typeof e.returnvalue.props.children == "function") {
let childrenRender = e.returnvalue.props.children;
e.returnvalue.props.children = (...args) => {
e.returnvalue.props.children = BDFDB.TimeUtils.suppress((...args) => {
let children = childrenRender(...args);
this.checkTree(children);
return children;
};
}, "", this);
}
else this.checkTree(e.returnvalue);
}
@ -692,11 +692,11 @@ module.exports = (_ => {
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) => {
tree.props.children = BDFDB.TimeUtils.suppress((...args) => {
let children = childrenRender(...args);
this.handleGuilds(children);
return children;
};
}, "", this);
}
else this.handleGuilds(returnvalue);
}

View File

@ -194,11 +194,11 @@ module.exports = (_ => {
processGuilds (e) {
if (typeof e.returnvalue.props.children == "function") {
let childrenRender = e.returnvalue.props.children;
e.returnvalue.props.children = (...args) => {
e.returnvalue.props.children = BDFDB.TimeUtils.suppress((...args) => {
let children = childrenRender(...args);
this.checkTree(children);
return children;
};
}, "", this);
}
else this.checkTree(e.returnvalue);
}
@ -207,11 +207,11 @@ module.exports = (_ => {
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) => {
tree.props.children = BDFDB.TimeUtils.suppress((...args) => {
let children = childrenRender(...args);
this.handleGuilds(children);
return children;
};
}, "", this);
}
else this.handleGuilds(returnvalue);
}