This commit is contained in:
Mirco Wittrien 2022-10-13 12:44:23 +02:00
parent 98b7f935e5
commit 3dfe62f0ec
2 changed files with 24 additions and 26 deletions

View File

@ -2,7 +2,7 @@
* @name BDFDB
* @author DevilBro
* @authorId 278543574059057154
* @version 2.7.3
* @version 2.7.4
* @description Required Library for DevilBro's Plugins
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
@ -2402,7 +2402,6 @@ module.exports = (_ => {
if (InternalData.PatchModules[type].nonProps) foundModule = Internal.checkModuleProps(module, InternalData.PatchModules[type].nonProps, {hasNot: true}) ? module : null;
if (InternalData.PatchModules[type].nonProtos) foundModule = Internal.checkModuleProtos(module, InternalData.PatchModules[type].nonProtos, {hasNot: true}) ? module : null;
}
if (type == "GuildChannelUserContextMenu" && module._originalFunction) console.log(foundModule, module);
if (foundModule) {
if (useCache) {
if (!Cache.modules.patch) Cache.modules.patch = {};
@ -2561,7 +2560,7 @@ module.exports = (_ => {
let instance = Node.prototype.isPrototypeOf(nodeOrInstance) ? BDFDB.ReactUtils.getInstance(nodeOrInstance) : nodeOrInstance;
if (!BDFDB.ObjectUtils.is(instance) && !BDFDB.ArrayUtils.is(instance) || instance.props && typeof instance.props.children == "function") return [null, -1];
config.name = config.name && [config.name].flat().filter(n => n && InternalData.PatchModules && InternalData.PatchModules[n]);
config.name = config.name && [config.name].flat().filter(n => n);
config.type = config.type && [config.type].flat().filter(n => n);
config.key = config.key && [config.key].flat().filter(n => n);
config.props = config.props && [config.props].flat().filter(n => n);
@ -2630,7 +2629,7 @@ module.exports = (_ => {
function check (instance) {
if (!instance || instance == parent) return false;
let props = instance.stateNode ? instance.stateNode.props : instance.props;
if (config.name && instance.type && config.name.some(name => Internal.isCorrectModule(instance.type.render || instance.type.type || instance.type, name))) return true;
if (config.name && instance.type && config.name.some(name => instance.type.displayName == name || instance.type.name == name || Internal.isCorrectModule(instance.type.render || instance.type.type || instance.type, name))) return true;
if (config.type && config.type.some(type => instance.type == type)) return true;
if (config.key && config.key.some(key => instance.key == key)) return true;
if (config.props && props && config.props[config.someProps ? "some" : "every"](prop => BDFDB.ArrayUtils.is(prop) ? (BDFDB.ArrayUtils.is(prop[1]) ? prop[1].some(checkValue => propCheck(props, prop[0], checkValue)) : propCheck(props, prop[0], prop[1])) : props[prop] !== undefined)) return true;
@ -2646,7 +2645,7 @@ module.exports = (_ => {
let instance = Node.prototype.isPrototypeOf(nodeOrInstance) ? BDFDB.ReactUtils.getInstance(nodeOrInstance) : nodeOrInstance;
if (!BDFDB.ObjectUtils.is(instance) && !BDFDB.ArrayUtils.is(instance)) return null;
config.name = config.name && [config.name].flat().filter(n => n && InternalData.PatchModules && InternalData.PatchModules[n]);
config.name = config.name && [config.name].flat().filter(n => n);
config.type = config.type && [config.type].flat().filter(n => n);
config.key = config.key && [config.key].flat().filter(n => n);
config.props = config.props && [config.props].flat().filter(n => n);
@ -2723,7 +2722,7 @@ module.exports = (_ => {
function check (instance) {
if (!instance || instance == parent) return false;
let props = instance.stateNode ? instance.stateNode.props : instance.props;
if (config.name && instance.type && config.name.some(name => Internal.isCorrectModule(instance.type.render || instance.type.type || instance.type, name))) return true;
if (config.name && instance.type && config.name.some(name => instance.type.displayName == name || instance.type.name == name || Internal.isCorrectModule(instance.type.render || instance.type.type || instance.type, name))) return true;
if (config.type && config.type.some(type => instance.type == type)) return true;
if (config.key && config.key.some(key => instance.key == key)) return true;
if (config.props && props && config.props[config.someProps ? "some" : "every"](prop => BDFDB.ArrayUtils.is(prop) ? (BDFDB.ArrayUtils.is(prop[1]) ? prop[1].some(checkValue => propCheck(props, prop[0], checkValue)) : propCheck(props, prop[0], prop[1])) : props[prop] !== undefined)) return true;
@ -2765,7 +2764,7 @@ module.exports = (_ => {
let instance = Node.prototype.isPrototypeOf(nodeOrInstance) ? BDFDB.ReactUtils.getInstance(nodeOrInstance) : nodeOrInstance;
if (!BDFDB.ObjectUtils.is(instance)) return config.all ? (config.group ? {} : []) : null;
config.name = config.name && [config.name].flat().filter(n => n && InternalData.PatchModules && InternalData.PatchModules[n]);
config.name = config.name && [config.name].flat().filter(n => n);
config.type = config.type && [config.type].flat().filter(n => n);
config.key = config.key && [config.key].flat().filter(n => n);
config.props = config.props && [config.props].flat().filter(n => n);
@ -2804,7 +2803,7 @@ module.exports = (_ => {
let props = instance.stateNode ? instance.stateNode.props : instance.props;
let foundName = "";
if (instance.stateNode && !Node.prototype.isPrototypeOf(instance.stateNode) && (
config.name && instance.type && config.name.some(name => {if (Internal.isCorrectModule(instance.type.render || instance.type.type || instance.type, name)) {
config.name && instance.type && config.name.some(name => {if (instance.type.displayName == name || instance.type.name == name || Internal.isCorrectModule(instance.type.render || instance.type.type || instance.type, name)) {
foundName = name; return true;
}}) ||
config.type && instance.type && config.type.some(type => instance.type == type) ||
@ -8356,18 +8355,17 @@ module.exports = (_ => {
after: e => {
let module = e.methodArguments[0] && (e.methodArguments[0].type || e.methodArguments[0].render || e.methodArguments[0]);
if (!module || typeof module != "function" || !PluginStores.modulePatches.after || module.prototype && typeof module.prototype.render == "function") return;
else if (e.returnValue) for (const type in PluginStores.modulePatches.after) if (Internal.isCorrectModule(module, type, true)) {
for (let plugin of PluginStores.modulePatches.after[type].flat(10)) {
if (!BDFDB.PatchUtils.isPatched(plugin, e.returnValue, "type")) BDFDB.PatchUtils.patch(plugin, e.returnValue, "type", {after: e2 => Internal.initiatePatch(plugin, type, {
arguments: e2.methodArguments,
instance: e2.thisObject,
returnvalue: e2.returnValue,
component: e.methodArguments[0],
name: type,
methodname: "type",
patchtypes: ["after"]
})});
}
else if (e.returnValue && e.returnValue.type) for (const type in PluginStores.modulePatches.after) if (Internal.isCorrectModule(module, type, true)) {
let toBePatched = typeof e.returnValue.type != "function" && typeof e.returnValue.type.type == "function" ? e.returnValue.type : e.returnValue;
for (let plugin of PluginStores.modulePatches.after[type].flat(10)) if (!BDFDB.PatchUtils.isPatched(plugin, toBePatched, "type")) BDFDB.PatchUtils.patch(plugin, toBePatched, "type", {after: e2 => Internal.initiatePatch(plugin, type, {
arguments: e2.methodArguments,
instance: e2.thisObject,
returnvalue: e2.returnValue,
component: e.methodArguments[0],
name: type,
methodname: "type",
patchtypes: ["after"]
})});
break;
}
}

View File

@ -2,7 +2,7 @@
* @name ServerCounter
* @author DevilBro
* @authorId 278543574059057154
* @version 1.0.5
* @version 1.0.6
* @description Adds a Server Counter to the Server List
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
@ -58,10 +58,10 @@ module.exports = (_ => {
} : (([Plugin, BDFDB]) => {
return class ServerCounter extends Plugin {
onLoad () {
this.patchedModules = {
after: {
Guilds: "type"
}
this.modulePatches = {
after: [
"GuildsBar"
]
};
}
@ -73,7 +73,7 @@ module.exports = (_ => {
BDFDB.DiscordUtils.rerenderAll();
}
processGuilds (e) {
processGuildsBar (e) {
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,