This commit is contained in:
Mirco Wittrien 2022-02-11 17:36:57 +01:00
parent 217a3cb192
commit 9eb8aeb457
2 changed files with 29 additions and 45 deletions

View File

@ -8139,7 +8139,7 @@ module.exports = (_ => {
avatarWrapper.props.children = BDFDB.TimeUtils.suppress((...args) => {
let renderedChildren = renderChildren(...args);
return InternalBDFDB._processAvatarRender(e.instance.props.message.author, renderedChildren, BDFDB.disCN.messageavatar) || renderedChildren;
});
}, "Error in Avatar Render of MessageHeader!");
}
else if (avatarWrapper && avatarWrapper.type == "img") e.returnvalue.props.children[0] = InternalBDFDB._processAvatarRender(e.instance.props.message.author, avatarWrapper) || avatarWrapper;
}
@ -8234,56 +8234,35 @@ module.exports = (_ => {
InternalBDFDB.patchContextMenu = function (plugin, type, module) {
if (!module || !module.default) return;
plugin = plugin == BDFDB && InternalBDFDB || plugin;
if (!module.default.displayName || module.default.displayName.indexOf("ContextMenu") == -1) {
BDFDB.PatchUtils.patch(plugin, module, "default", {after: e => {
if (typeof plugin[`on${type}`] != "function") return;
else if (e.returnValue && e.returnValue.props.children && e.returnValue.props.children.type && e.returnValue.props.children.type.displayName) {
const call = (props, returnValue, name) => plugin[`on${type}`]({
instance: {props: props},
returnvalue: returnValue,
component: module,
methodname: "default",
type: name
});
BDFDB.PatchUtils.patch(plugin, module, "default", {after: e => {
if (typeof plugin[`on${type}`] != "function") return;
else if (e.returnValue && e.returnValue.props.children) {
if (e.returnValue.props.children.type && e.returnValue.props.children.type.displayName) {
let name = e.returnValue.props.children.type.displayName;
let originalReturn = e.returnValue.props.children.type(e.returnValue.props.children.props);
let newType = props => {
const returnValue = BDFDB.ReactUtils.createElement(originalReturn.type, originalReturn.props);
if (returnValue.props.children) plugin[`on${type}`]({
instance: {props: props},
returnvalue: returnValue,
component: module,
methodname: "default",
type: name
});
if (returnValue.props.children) call(props, returnValue, name);
else BDFDB.PatchUtils.patch(plugin, returnValue, "type", {after: e2 => {
if (e2.returnValue && typeof plugin[`on${type}`] == "function") plugin[`on${type}`]({
instance: {props: e2.methodArguments[0]},
returnvalue: e2.returnValue,
component: module,
methodname: "default",
type: name
});
}});
if (e2.returnValue && typeof plugin[`on${type}`] == "function") call(e2.methodArguments[0], e2.returnValue, name);
}}, {noCache: true});
return returnValue;
};
newType.displayName = name;
e.returnValue.props.children = BDFDB.ReactUtils.createElement(newType, e.returnValue.props.children.props);
}
}}, {name: type});
}
else BDFDB.PatchUtils.patch(plugin, module, "default", {after: e => {
if (typeof plugin[`on${type}`] != "function") return;
else if (e.returnValue.props.children) plugin[`on${type}`]({
instance: {props: e.methodArguments[0]},
returnvalue: e.returnValue,
component: module,
methodname: "default",
type: module.default.displayName
});
}
else BDFDB.PatchUtils.patch(plugin, e.returnValue, "type", {after: e2 => {
if (e2.returnValue && typeof plugin[`on${type}`] == "function") plugin[`on${type}`]({
instance: {props: e2.methodArguments[0]},
returnvalue: e2.returnValue,
component: module,
methodname: "default",
type: module.default.displayName
});
}});
}});
if (e2.returnValue && typeof plugin[`on${type}`] == "function") call(e2.methodArguments[0], e2.returnValue, module.default.displayName);
}}, {noCache: true});
}}, {name: type});
};
BDFDB.ReactUtils.instanceKey = Object.keys(document.querySelector(BDFDB.dotCN.app) || {}).some(n => n.startsWith("__reactInternalInstance")) ? "_reactInternalFiber" : "_reactInternals";
@ -8408,7 +8387,7 @@ module.exports = (_ => {
});
}}, {noCache: true});
return renderedPopout;
});
}, "Error in Popout Render of MessageOptionToolbar!");
}
}}, {once: true});
}});

View File

@ -2,7 +2,7 @@
* @name EditUsers
* @author DevilBro
* @authorId 278543574059057154
* @version 4.4.7
* @version 4.4.8
* @description Allows you to locally edit Users
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
@ -17,8 +17,13 @@ module.exports = (_ => {
"info": {
"name": "EditUsers",
"author": "DevilBro",
"version": "4.4.7",
"version": "4.4.8",
"description": "Allows you to locally edit Users"
},
"changeLog": {
"improved": {
"Colored Text": "If you are using BetterRoleColors to color messages as the same color as the role and set a custom color with EditUsers, the message color will use the custom color again, like it used to with Colored Text in BD"
}
}
};
@ -695,7 +700,7 @@ module.exports = (_ => {
if (content && content.type && content.type.type && content.props.message && this.shouldChangeInChat(content.props.message.channel_id)) {
let data = changedUsers[content.props.message.author.id];
if (data) {
let messageColor = data.color5 || (BDFDB.BDUtils.getSettings(BDFDB.BDUtils.settingsIds.coloredText) && (data.color1 && data.useRoleColor && (BDFDB.LibraryModules.MemberStore.getMember((BDFDB.LibraryModules.ChannelStore.getChannel(content.props.message.channel_id) || {}).guild_id, content.props.message.author.id) || {}).colorString || data.color1));
let messageColor = data.color5 || (BDFDB.ObjectUtils.get(BDFDB.BDUtils.getPlugin("BetterRoleColors", true), "settings.modules.chat") && (data.color1 && data.useRoleColor && (BDFDB.LibraryModules.MemberStore.getMember((BDFDB.LibraryModules.ChannelStore.getChannel(content.props.message.channel_id) || {}).guild_id, content.props.message.author.id) || {}).colorString || data.color1));
if (messageColor) {
let message = new BDFDB.DiscordObjects.Message(Object.assign({}, content.props.message, {author: this.getUserData(content.props.message.author.id, true, false, content.props.message.author)}));
message.colorString = BDFDB.ColorUtils.convert(BDFDB.ObjectUtils.is(messageColor) ? messageColor[0] : messageColor, "HEX");
@ -776,7 +781,7 @@ module.exports = (_ => {
}
else if (e.instance.props.message.state != BDFDB.DiscordConstants.MessageStates.SEND_FAILED) {
let data = changedUsers[e.instance.props.message.author.id];
let messageColor = data && (data.color5 || (BDFDB.BDUtils.getSettings(BDFDB.BDUtils.settingsIds.coloredText) && (data.color1 && data.useRoleColor && (BDFDB.LibraryModules.MemberStore.getMember((BDFDB.LibraryModules.ChannelStore.getChannel(e.instance.props.message.channel_id) || {}).guild_id, e.instance.props.message.author.id) || {}).colorString || data.color1)));
let messageColor = data && (data.color5 || (BDFDB.ObjectUtils.get(BDFDB.BDUtils.getPlugin("BetterRoleColors", true), "settings.modules.chat") && (data.color1 && data.useRoleColor && (BDFDB.LibraryModules.MemberStore.getMember((BDFDB.LibraryModules.ChannelStore.getChannel(e.instance.props.message.channel_id) || {}).guild_id, e.instance.props.message.author.id) || {}).colorString || data.color1)));
if (messageColor) {
if (BDFDB.ObjectUtils.is(messageColor)) e.returnvalue.props.children = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextGradientElement, {
gradient: BDFDB.ColorUtils.createGradient(messageColor),