This commit is contained in:
Mirco Wittrien 2020-09-11 19:31:36 +02:00
parent 3dcbdc768a
commit 1da72ed36a
47 changed files with 137 additions and 150 deletions

View File

@ -64,7 +64,6 @@ module.exports = (_ => {
if (this.started) return;
this.started = true;
BDFDB.TimeUtils.suppress(_ => {
BDFDB.DOMUtils.appendLocalStyle(config.name, BDFDB.DOMUtils.formatCSS(config.css));
BDFDB.PluginUtils.init(this);
if (typeof this.onStart == "function") this.onStart();
}, "Failed to start plugin!", config.name)();
@ -201,7 +200,9 @@ module.exports = (_ => {
let startMsg = BDFDB.LanguageUtils.LibraryStringsFormat("toast_plugin_started", "v" + plugin.version);
BDFDB.LogUtils.log(startMsg, plugin.name);
if (settings.showToasts && !BDFDB.BDUtils.getSettings(BDFDB.BDUtils.settingsIds.showToasts)) BDFDB.NotificationUtils.toast(`${plugin.name} ${startMsg}`, {nopointer: true});
if (plugin.css) BDFDB.DOMUtils.appendLocalStyle(plugin.name, plugin.css);
InternalBDFDB.patchPlugin(plugin);
InternalBDFDB.addSpecialListeners(plugin);
@ -3236,10 +3237,6 @@ module.exports = (_ => {
container = Node.prototype.isPrototypeOf(container) ? container : document.head;
BDFDB.DOMUtils.remove(container.querySelectorAll(`style[id="${id}CSS"]`));
};
BDFDB.DOMUtils.formatCSS = function (css) {
if (typeof css != "string") return "";
return css.replace(/[\n\t\r]/g, "").replace(/\[REPLACE_CLASS_([A-z0-9_]+?)\]/g, function(a, b) {return BDFDB.dotCN[b];});
};
BDFDB.ModalUtils = {};
BDFDB.ModalUtils.open = function (plugin, config) {
@ -7175,13 +7172,6 @@ module.exports = (_ => {
};
InternalBDFDB.addSpecialListeners(BDFDB);
let BasePopout = BDFDB.ModuleUtils.findByName("BasePopout"), ReferencePositionLayer = BDFDB.ModuleUtils.findByName("ReferencePositionLayer");
if (BasePopout && ReferencePositionLayer) BDFDB.PatchUtils.patch(BDFDB, BasePopout.prototype, "renderLayer", {after: e => {
if (e.returnValue && e.thisObject.isBDFDBpopout) {
e.returnValue = BDFDB.ReactUtils.createPortal(BDFDB.ReactUtils.createElement(ReferencePositionLayer, e.returnValue.props), document.querySelector(BDFDB.dotCN.appmount + " > " + BDFDB.dotCN.itemlayercontainer));
}
}});
if (InternalComponents.LibraryComponents.GuildComponents.BlobMask) {
let newBadges = ["lowerLeftBadge", "upperLeftBadge"];
@ -7440,7 +7430,7 @@ module.exports = (_ => {
}
require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/_res/BDFDB.raw.css", (error, response, body) => {
if (!error && body) BDFDB.DOMUtils.appendLocalStyle("BDFDB", BDFDB.DOMUtils.formatCSS(body));
if (!error && body) BDFDB.DOMUtils.appendLocalStyle("BDFDB", body.replace(/[\n\t\r]/g, "").replace(/\[REPLACE_CLASS_([A-z0-9_]+?)\]/g, function(a, b) {return BDFDB.dotCN[b];}));
});
window.BDFDB_Global.loaded = true;

View File

@ -11195,13 +11195,6 @@
};
InternalBDFDB.addSpecialListeners(BDFDB);
let BasePopout = BDFDB.ModuleUtils.findByName("BasePopout"), ReferencePositionLayer = BDFDB.ModuleUtils.findByName("ReferencePositionLayer");
if (BasePopout && ReferencePositionLayer) BDFDB.ModuleUtils.patch(BDFDB, BasePopout.prototype, "renderLayer", {after: e => {
if (e.returnValue && e.thisObject.isBDFDBpopout) {
e.returnValue = BDFDB.ReactUtils.createPortal(BDFDB.ReactUtils.createElement(ReferencePositionLayer, e.returnValue.props), document.querySelector(BDFDB.dotCN.appmount + " > " + BDFDB.dotCN.itemlayercontainer));
}
}});
if (InternalComponents.LibraryComponents.GuildComponents.BlobMask) {
let newBadges = ["lowerLeftBadge", "upperLeftBadge"];
@ -11321,6 +11314,10 @@
InternalBDFDB.forceUpdateAll();
BDFDB.ReactUtils.findChildren = BDFDB.ReactUtils.findParent;
BDFDB.ObjectUtils.get = BDFDB.ReactUtils.getValue;
BDFDB.PatchUtils = BDFDB.ModuleUtils;
if (BDFDB.UserUtils.me.id == myId) {
for (let module in DiscordClassModules) if (!DiscordClassModules[module]) BDFDB.LogUtils.warn(module + " not initialized in DiscordClassModules");

File diff suppressed because one or more lines are too long

View File

@ -328,7 +328,7 @@ var BadgesEverywhere = (_ => {
BDFDB.DataUtils.save(badgeCache, this, "badgeCache");
}
BDFDB.ModuleUtils.patch(this, BDFDB.LibraryModules.DispatchApiUtils, "dispatch", {after: e => {
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.DispatchApiUtils, "dispatch", {after: e => {
if (BDFDB.ObjectUtils.is(e.methodArguments[0]) && e.methodArguments[0].type == BDFDB.DiscordConstants.ActionTypes.USER_PROFILE_MODAL_FETCH_SUCCESS && e.methodArguments[0].user) {
let userCopy = Object.assign({}, e.methodArguments[0].user);
if (e.methodArguments[0].premium_since) userCopy.flags += nitroflag;
@ -378,7 +378,7 @@ var BadgesEverywhere = (_ => {
processMemberListItem (e) {
if (e.instance.props.user && settings.showInMemberList) {
this.injectBadges(e.instance, BDFDB.ReactUtils.getValue(e.returnvalue, "props.decorators.props.children"), e.instance.props.user, "list");
this.injectBadges(e.instance, BDFDB.ObjectUtils.get(e.returnvalue, "props.decorators.props.children"), e.instance.props.user, "list");
}
}
@ -493,7 +493,7 @@ var BadgesEverywhere = (_ => {
badges = BDFDB.DataUtils.get(this, "badges");
indicators = BDFDB.DataUtils.get(this, "indicators");
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
BDFDB.MessageUtils.rerenderAll();
}
}

View File

@ -161,7 +161,7 @@ var BetterFriendList = (_ => {
for (let type in BDFDB.DiscordConstants.RelationshipTypes) relationshipCount[type] = 0;
for (let id in relationships) relationshipCount[relationships[id]]++;
for (let child of e.returnvalue.props.children) if (child && child.props.id != "ADD_FRIEND") {
let newChildren = [child.props.children].flat().filter(child => BDFDB.ReactUtils.getValue(child, "type.displayName") != "NumberBadge");
let newChildren = [child.props.children].flat().filter(child => BDFDB.ObjectUtils.get(child, "type.displayName") != "NumberBadge");
switch (child.props.id) {
case "ALL":
newChildren.push(this.createBadge(relationshipCount[BDFDB.DiscordConstants.RelationshipTypes.FRIEND]));
@ -292,7 +292,7 @@ var BetterFriendList = (_ => {
processPeopleListItem (e) {
if (e.node) {
BDFDB.TimeUtils.clear(rerenderTimeout);
rerenderTimeout = BDFDB.TimeUtils.timeout(_ => {BDFDB.ModuleUtils.forceAllUpdates(this, "TabBar");}, 1000);
rerenderTimeout = BDFDB.TimeUtils.timeout(_ => {BDFDB.PatchUtils.forceAllUpdates(this, "TabBar");}, 1000);
}
else {
if (e.instance.props.user.id == placeHolderId) return null;
@ -324,7 +324,7 @@ var BetterFriendList = (_ => {
forceUpdateAll() {
settings = BDFDB.DataUtils.get(this, "settings");
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
this.rerenderList();
}
}

View File

@ -54,7 +54,7 @@ var BetterNsfwTag = (_ => {
BDFDB.PluginUtils.init(this);
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
}
else console.error(`%c[${this.getName()}]%c`, "color: #3a71c1; font-weight: 700;", "", "Fatal Error: Could not load BD functions!");
}
@ -63,7 +63,7 @@ var BetterNsfwTag = (_ => {
if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
this.stopping = true;
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
BDFDB.PluginUtils.clear(this);
}

View File

@ -193,7 +193,7 @@ var BetterSearchPage = (_ => {
forceUpdateAll () {
settings = BDFDB.DataUtils.get(this, "settings");
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
}
}
})();

View File

@ -117,7 +117,7 @@ var CharCounter = (_ => {
if (this.started) return;
BDFDB.PluginUtils.init(this);
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
}
else console.error(`%c[${this.getName()}]%c`, "color: #3a71c1; font-weight: 700;", "", "Fatal Error: Could not load BD functions!");
}
@ -127,7 +127,7 @@ var CharCounter = (_ => {
if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
this.stopping = true;
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
BDFDB.PluginUtils.clear(this);
}

View File

@ -372,19 +372,19 @@ var ChatAliases = (_ => {
}
processChannelTextAreaForm (e) {
if (!BDFDB.ModuleUtils.isPatched(this, e.instance, "handleSendMessage")) BDFDB.ModuleUtils.patch(this, e.instance, "handleSendMessage", {before: e2 => {
if (!BDFDB.PatchUtils.isPatched(this, e.instance, "handleSendMessage")) BDFDB.PatchUtils.patch(this, e.instance, "handleSendMessage", {before: e2 => {
if (settings.triggerNormal) this.handleSubmit(e, e2, 0);
}}, {force: true, noCache: true});
}
processMessageEditor (e) {
if (!BDFDB.ModuleUtils.isPatched(this, e.instance, "onSubmit")) BDFDB.ModuleUtils.patch(this, e.instance, "onSubmit", {before: e2 => {
if (!BDFDB.PatchUtils.isPatched(this, e.instance, "onSubmit")) BDFDB.PatchUtils.patch(this, e.instance, "onSubmit", {before: e2 => {
if (settings.triggerEdit) this.handleSubmit(e, e2, 0);
}}, {force: true, noCache: true});
}
processUpload (e) {
if (!BDFDB.ModuleUtils.isPatched(this, e.instance, "submitUpload")) BDFDB.ModuleUtils.patch(this, e.instance, "submitUpload", {before: e2 => {
if (!BDFDB.PatchUtils.isPatched(this, e.instance, "submitUpload")) BDFDB.PatchUtils.patch(this, e.instance, "submitUpload", {before: e2 => {
if (settings.triggerUpload) this.handleSubmit(e, e2, 1);
}}, {force: true, noCache: true});
}
@ -394,7 +394,7 @@ var ChatAliases = (_ => {
amounts = BDFDB.DataUtils.get(this, "amounts");
configs = BDFDB.DataUtils.get(this, "configs");
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
}
handleSubmit (e, e2, textIndex) {

View File

@ -310,7 +310,7 @@ var ChatFilter = (_ => {
}
processMessage (e) {
let message = BDFDB.ReactUtils.getValue(e, "instance.props.childrenMessageContent.props.message");
let message = BDFDB.ObjectUtils.get(e, "instance.props.childrenMessageContent.props.message");
if (message) {
if (oldBlockedMessages[message.id]) e.returnvalue.props.className = BDFDB.DOMUtils.formatClassName(e.returnvalue.props.className, BDFDB.disCN._chatfilterblocked);
else if (oldCensoredMessages[message.id]) e.returnvalue.props.className = BDFDB.DOMUtils.formatClassName(e.returnvalue.props.className, BDFDB.disCN._chatfiltercensored);
@ -511,7 +511,7 @@ var ChatFilter = (_ => {
oldBlockedMessages = {};
oldCensoredMessages = {};
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
BDFDB.MessageUtils.rerenderAll();
}
}

View File

@ -272,7 +272,7 @@ var CompleteTimestamps = (_ => {
}
processMessage (e) {
if (BDFDB.ReactUtils.getValue(e, "instance.props.childrenHeader.type.type.displayName") == "MessageTimestamp" && settings.changeForChat) {
if (BDFDB.ObjectUtils.get(e, "instance.props.childrenHeader.type.type.displayName") == "MessageTimestamp" && settings.changeForChat) {
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {name: e.instance.props.childrenHeader.type});
if (index > -1) this.changeTimestamp(children, index, {child:false, tooltip:true});
}
@ -425,7 +425,7 @@ var CompleteTimestamps = (_ => {
formats = BDFDB.DataUtils.get(this, "formats");
amounts = BDFDB.DataUtils.get(this, "amounts");
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
BDFDB.MessageUtils.rerenderAll();
}
}

View File

@ -356,7 +356,7 @@ var CreationDate = (_ => {
formats = BDFDB.DataUtils.get(this, "formats");
amounts = BDFDB.DataUtils.get(this, "amounts");
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
}
setLabelsByLanguage () {

View File

@ -236,7 +236,7 @@ var CustomQuoter = (_ => {
if (this.started) return;
BDFDB.PluginUtils.init(this);
BDFDB.ModuleUtils.patch(this, BDFDB.LibraryModules.QuoteUtils, "createQuotedText", {instead: e => {
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.QuoteUtils, "createQuotedText", {instead: e => {
return this.parseQuote(e.methodArguments[0], e.methodArguments[1]);
}});
@ -374,7 +374,7 @@ var CustomQuoter = (_ => {
settings = BDFDB.DataUtils.get(this, "settings");
formats = Object.assign({"Standard": "$quote $mention"}, BDFDB.DataUtils.load(this, "formats"));
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
BDFDB.MessageUtils.rerenderAll();
}
}

View File

@ -121,12 +121,12 @@ var DisplayLargeMessages = (_ => {
if (this.started) return;
BDFDB.PluginUtils.init(this);
BDFDB.ModuleUtils.patch(this, BDFDB.LibraryModules.MessageUtils, "startEditMessage", {before: e => {
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.MessageUtils, "startEditMessage", {before: e => {
let encodedContent = encodedMessages[e.methodArguments[1]];
if (encodedContent != null) e.methodArguments[2] = encodedContent.content;
}});
BDFDB.ModuleUtils.patch(this, BDFDB.LibraryModules.MessageUtils, "editMessage", {before: e => {
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.MessageUtils, "editMessage", {before: e => {
let encodedContent = encodedMessages[e.methodArguments[1]];
let oldMessage = oldMessages[e.methodArguments[1]];
if (encodedContent != null) encodedContent.content = e.methodArguments[2].content;
@ -261,7 +261,7 @@ var DisplayLargeMessages = (_ => {
settings = BDFDB.DataUtils.get(this, "settings");
amounts = BDFDB.DataUtils.get(this, "amounts");
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
BDFDB.MessageUtils.rerenderAll();
}

View File

@ -105,7 +105,7 @@ var DisplayServersAsChannels = (_ => {
BDFDB.DOMUtils.addClass(document.body, BDFDB.disCN._displayserversaschannelsstyled);
BDFDB.ModuleUtils.patch(this, BDFDB.LibraryComponents.GuildComponents.Guild.prototype, "render", {after: e => {
BDFDB.PatchUtils.patch(this, BDFDB.LibraryComponents.GuildComponents.Guild.prototype, "render", {after: e => {
if (e.thisObject.props.list) this.processGuild({instance:e.thisObject, returnvalue:e.returnValue, methodname:"render"});
}});
@ -283,7 +283,7 @@ var DisplayServersAsChannels = (_ => {
settings = BDFDB.DataUtils.get(this, "settings");
amounts = BDFDB.DataUtils.get(this, "amounts");
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
BDFDB.GuildUtils.rerenderAll();
}

View File

@ -237,7 +237,7 @@ var EditChannels = (_ => {
}
processAuditLog (e) {
let channel = BDFDB.ReactUtils.getValue(e.instance, "props.log.options.channel");
let channel = BDFDB.ObjectUtils.get(e.instance, "props.log.options.channel");
if (channel && settings.changeInAuditLog) {
if (!e.returnvalue) e.instance.props.log.options.channel = this.getChannelData(channel.id);
else {
@ -481,7 +481,7 @@ var EditChannels = (_ => {
settings = BDFDB.DataUtils.get(this, "settings");
this.changeAppTitle();
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
BDFDB.ReactUtils.forceUpdate(BDFDB.ReactUtils.findOwner(document.querySelector(BDFDB.dotCN.app), {name:"Channel", unlimited:true}));
}

View File

@ -119,7 +119,7 @@ var EditServers = (_ => {
if (this.started) return;
BDFDB.PluginUtils.init(this);
BDFDB.ModuleUtils.patch(this, BDFDB.LibraryModules.IconUtils, "getGuildBannerURL", {instead:e => {
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.IconUtils, "getGuildBannerURL", {instead:e => {
let guild = BDFDB.LibraryModules.GuildStore.getGuild(e.methodArguments[0].id);
if (guild) {
if (e.methodArguments[0].id == "410787888507256842") return guild.banner;
@ -129,12 +129,12 @@ var EditServers = (_ => {
return e.callOriginalMethod();
}});
BDFDB.ModuleUtils.patch(this, BDFDB.LibraryComponents.GuildComponents.Guild.prototype, "render", {
BDFDB.PatchUtils.patch(this, BDFDB.LibraryComponents.GuildComponents.Guild.prototype, "render", {
before: e => {this.processGuild({instance:e.thisObject, returnvalue:e.returnValue, methodname:"render"});},
after: e => {this.processGuild({instance:e.thisObject, returnvalue:e.returnValue, methodname:"render"});}
});
BDFDB.ModuleUtils.patch(this, BDFDB.LibraryComponents.Connectors.Link.prototype, "render", {
BDFDB.PatchUtils.patch(this, BDFDB.LibraryComponents.Connectors.Link.prototype, "render", {
after: e => {
if (e.thisObject.props.className && e.thisObject.props.className.indexOf(BDFDB.disCN.guildiconwrapper) > -1) this.processGuildAcronym({instance:e.thisObject, returnvalue:e.returnValue, methodname:"render"});
}
@ -232,7 +232,7 @@ var EditServers = (_ => {
processGuildAcronym (e) {
if (typeof e.returnvalue.props.children == "function" && settings.changeInGuildList) {
let pathname = BDFDB.ReactUtils.getValue(e.instance, "props.to.pathname");
let pathname = BDFDB.ObjectUtils.get(e.instance, "props.to.pathname");
let data = pathname && changedGuilds[(pathname.split("/channels/")[1] || "").split("/")[0]];
if (data) {
let renderChildren = e.returnvalue.props.children;
@ -372,7 +372,7 @@ var EditServers = (_ => {
changedGuilds = BDFDB.DataUtils.load(this, "servers");
settings = BDFDB.DataUtils.get(this, "settings");
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
}
openGuildSettingsModal (guildId) {

View File

@ -198,9 +198,9 @@ var EditUsers = (_ => {
let observer = new MutationObserver(_ => {this.changeAppTitle();});
BDFDB.ObserverUtils.connect(this, document.head.querySelector("title"), {name:"appTitleObserver", instance:observer}, {childList:true});
let searchGroupData = BDFDB.ReactUtils.getValue(BDFDB.ModuleUtils.findByName("SearchPopoutComponent", false), "exports.GroupData");
let searchGroupData = BDFDB.ObjectUtils.get(BDFDB.ModuleUtils.findByName("SearchPopoutComponent", false), "exports.GroupData");
if (BDFDB.ObjectUtils.is(searchGroupData)) {
BDFDB.ModuleUtils.patch(this, searchGroupData.FILTER_FROM, "component", {after: e => {
BDFDB.PatchUtils.patch(this, searchGroupData.FILTER_FROM, "component", {after: e => {
if (typeof e.returnValue.props.renderResult == "function") {
let renderResult = e.returnValue.props.renderResult;
e.returnValue.props.renderResult = (...args) => {
@ -210,7 +210,7 @@ var EditUsers = (_ => {
}
}
}});
BDFDB.ModuleUtils.patch(this, searchGroupData.FILTER_MENTIONS, "component", {after: e => {
BDFDB.PatchUtils.patch(this, searchGroupData.FILTER_MENTIONS, "component", {after: e => {
if (typeof e.returnValue.props.renderResult == "function") {
let renderResult = e.returnValue.props.renderResult;
e.returnValue.props.renderResult = (...args) => {
@ -682,7 +682,7 @@ var EditUsers = (_ => {
}
else {
this.changeUserColor(e.returnvalue.props.name, e.instance.props.user.id, {changeBackground: true, modify: BDFDB.ObjectUtils.extract(Object.assign({}, e.instance.props, e.instance.state), "hovered", "selected")});
this.injectBadge(BDFDB.ReactUtils.getValue(e.returnvalue, "props.decorators.props.children"), e.instance.props.user.id, BDFDB.LibraryModules.LastGuildStore.getGuildId(), 2, {
this.injectBadge(BDFDB.ObjectUtils.get(e.returnvalue, "props.decorators.props.children"), e.instance.props.user.id, BDFDB.LibraryModules.LastGuildStore.getGuildId(), 2, {
tagClass: BDFDB.disCN.bottagmember
});
}
@ -812,7 +812,7 @@ var EditUsers = (_ => {
}
processSearchPopoutComponent (e) {
if (BDFDB.ArrayUtils.is(BDFDB.ReactUtils.getValue(e, "instance.props.resultsState.autocompletes")) && settings.changeInSearchPopout) {
if (BDFDB.ArrayUtils.is(BDFDB.ObjectUtils.get(e, "instance.props.resultsState.autocompletes")) && settings.changeInSearchPopout) {
for (let autocomplete of e.instance.props.resultsState.autocompletes) if (autocomplete && BDFDB.ArrayUtils.is(autocomplete.results)) for (let result of autocomplete.results) if (result.user) result.user = this.getUserData(result.user.id);
}
}
@ -1016,7 +1016,7 @@ var EditUsers = (_ => {
settings = BDFDB.DataUtils.get(this, "settings");
this.changeAppTitle();
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
BDFDB.MessageUtils.rerenderAll();
}

View File

@ -79,7 +79,7 @@ var EmojiStatistics = (_ => {
if (this.started) return;
BDFDB.PluginUtils.init(this);
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
}
else console.error(`%c[${this.getName()}]%c`, "color: #3a71c1; font-weight: 700;", "", "Fatal Error: Could not load BD functions!");
}
@ -88,7 +88,7 @@ var EmojiStatistics = (_ => {
if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
this.stopping = true;
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
BDFDB.PluginUtils.clear(this);
}

View File

@ -60,7 +60,7 @@ var ForceImagePreviews = (_ => {
if (this.started) return;
BDFDB.PluginUtils.init(this);
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
BDFDB.MessageUtils.rerenderAll();
}
else console.error(`%c[${this.getName()}]%c`, "color: #3a71c1; font-weight: 700;", "", "Fatal Error: Could not load BD functions!");
@ -70,7 +70,7 @@ var ForceImagePreviews = (_ => {
if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
this.stopping = true;
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
BDFDB.MessageUtils.rerenderAll();
BDFDB.PluginUtils.clear(this);

View File

@ -468,7 +468,7 @@ var FriendNotifications = (_ => {
this.startInterval();
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
}
else console.error(`%c[${this.getName()}]%c`, "color: #3a71c1; font-weight: 700;", "", "Fatal Error: Could not load BD functions!");
}
@ -479,7 +479,7 @@ var FriendNotifications = (_ => {
BDFDB.TimeUtils.clear(checkInterval);
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
BDFDB.PluginUtils.clear(this);
}
@ -493,7 +493,7 @@ var FriendNotifications = (_ => {
delete this.SettingsUpdated;
this.startInterval();
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
}
}

View File

@ -262,7 +262,7 @@ var GoogleTranslateOption = (_ => {
}
processChannelTextAreaForm (e) {
BDFDB.ModuleUtils.patch(this, e.instance, "handleSendMessage", {instead: e2 => {
BDFDB.PatchUtils.patch(this, e.instance, "handleSendMessage", {instead: e2 => {
if (translating) {
e2.stopOriginalMethodCall();
this.translateText(e2.methodArguments[0], "message", (translation, input, output) => {
@ -894,7 +894,7 @@ var GoogleTranslateOption = (_ => {
favorites = BDFDB.DataUtils.load(this, "favorites");
this.setLanguages();
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
BDFDB.MessageUtils.rerenderAll();
}

View File

@ -58,7 +58,7 @@ var HideMutedCategories = (_ => {
if (this.started) return;
BDFDB.PluginUtils.init(this);
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
}
else {
console.error(`%c[${this.getName()}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
@ -69,7 +69,7 @@ var HideMutedCategories = (_ => {
if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
this.stopping = true;
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
BDFDB.PluginUtils.clear(this);
}

View File

@ -7,13 +7,13 @@ var ImageUtilities = (_ => {
const ImageDetails = class ImageDetails extends BdApi.React.Component {
componentDidMount() {
this.props.attachment = BDFDB.ReactUtils.findValue(BDFDB.ReactUtils.getValue(this, "_reactInternalFiber.return"), "attachment", {up: true});
this.props.attachment = BDFDB.ReactUtils.findValue(BDFDB.ObjectUtils.get(this, "_reactInternalFiber.return"), "attachment", {up: true});
BDFDB.ReactUtils.forceUpdate(this);
}
componentDidUpdate() {
if ((!this.props.attachment || !this.props.attachment.size) && !this.props.loaded) {
this.props.loaded = true;
this.props.attachment = BDFDB.ReactUtils.findValue(BDFDB.ReactUtils.getValue(this, "_reactInternalFiber.return"), "attachment", {up: true});
this.props.attachment = BDFDB.ReactUtils.findValue(BDFDB.ObjectUtils.get(this, "_reactInternalFiber.return"), "attachment", {up: true});
BDFDB.ReactUtils.forceUpdate(this);
}
}
@ -299,7 +299,7 @@ var ImageUtilities = (_ => {
BDFDB.TimeUtils.timeout(_ => {clickedImage = null;});
});
BDFDB.ModuleUtils.patch(this, (BDFDB.ModuleUtils.findByName("renderImageComponent", false).exports || {}), "renderImageComponent", {after: e => {
BDFDB.PatchUtils.patch(this, (BDFDB.ModuleUtils.findByName("renderImageComponent", false).exports || {}), "renderImageComponent", {after: e => {
if (e.returnValue && e.returnValue.type && (e.returnValue.type.displayName == "LazyImageZoomable" || e.returnValue.type.displayName == "LazyImage") && e.methodArguments[0].original && e.methodArguments[0].src.indexOf("https://media.discordapp.net/attachments") == 0 && (e.methodArguments[0].className || "").indexOf(BDFDB.disCN.embedthumbnail) == -1) return this.injectImageDetails(e.methodArguments[0], e.returnValue);
}});
@ -921,7 +921,7 @@ var ImageUtilities = (_ => {
engines = BDFDB.DataUtils.get(this, "engines");
enabledEngines = BDFDB.ObjectUtils.filter(engines, n => n);
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
BDFDB.MessageUtils.rerenderAll();
}

View File

@ -369,7 +369,7 @@ var JoinedAtDate = (_ => {
formats = BDFDB.DataUtils.get(this, "formats");
amounts = BDFDB.DataUtils.get(this, "amounts");
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
}
setLabelsByLanguage () {

View File

@ -239,7 +239,7 @@ var LastMessageDate = (_ => {
}
}, BDFDB.LanguageUtils.languages);
BDFDB.ModuleUtils.patch(this, BDFDB.LibraryModules.DispatchApiUtils, "dirtyDispatch", {after: e => {
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.DispatchApiUtils, "dirtyDispatch", {after: e => {
if (BDFDB.ObjectUtils.is(e.methodArguments[0]) && e.methodArguments[0].type == BDFDB.DiscordConstants.ActionTypes.MESSAGE_CREATE && e.methodArguments[0].message) {
let message = e.methodArguments[0].message;
let guildId = message.guild_id || message.channel_id;
@ -393,7 +393,7 @@ var LastMessageDate = (_ => {
formats = BDFDB.DataUtils.get(this, "formats");
amounts = BDFDB.DataUtils.get(this, "amounts");
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
}
setLabelsByLanguage () {

View File

@ -413,7 +413,7 @@ var NotificationSounds = (_ => {
if (this.started) return;
BDFDB.PluginUtils.init(this);
BDFDB.ModuleUtils.patch(this, BDFDB.LibraryModules.DispatchApiUtils, "dirtyDispatch", {before: e => {
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.DispatchApiUtils, "dirtyDispatch", {before: e => {
if (BDFDB.ObjectUtils.is(e.methodArguments[0]) && e.methodArguments[0].type == BDFDB.DiscordConstants.ActionTypes.MESSAGE_CREATE && e.methodArguments[0].message) {
let message = e.methodArguments[0].message;
let guildId = message.guild_id || null;
@ -454,7 +454,7 @@ var NotificationSounds = (_ => {
}
}});
BDFDB.ModuleUtils.patch(this, BDFDB.LibraryModules.SoundUtils, "playSound", {instead: e => {
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.SoundUtils, "playSound", {instead: e => {
let type = e.methodArguments[0];
if (choices[type]) BDFDB.TimeUtils.timeout(_ => {
if (type == "message1") {
@ -469,7 +469,7 @@ var NotificationSounds = (_ => {
});
else e.callOriginalMethod();
}});
BDFDB.ModuleUtils.patch(this, BDFDB.LibraryModules.SoundUtils, "createSound", {after: e => {
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.SoundUtils, "createSound", {after: e => {
let type = e.methodArguments[0];
let audio = new Audio();
audio.src = choices[type].src;
@ -498,7 +498,7 @@ var NotificationSounds = (_ => {
let callListenerModule = BDFDB.ModuleUtils.findByProperties("handleRingUpdate");
if (callListenerModule) {
callListenerModule.terminate();
BDFDB.ModuleUtils.patch(this, callListenerModule, "handleRingUpdate", {instead: e => {
BDFDB.PatchUtils.patch(this, callListenerModule, "handleRingUpdate", {instead: e => {
BDFDB.LibraryModules.CallUtils.getCalls().filter(call => call.ringing.length > 0 && BDFDB.LibraryModules.VoiceUtils.getCurrentClientVoiceChannelId() === call.channelId).length > 0 && !BDFDB.LibraryModules.SoundStateUtils.isSoundDisabled("call_calling") && !BDFDB.LibraryModules.StreamerModeStore.disableSounds ? callAudio.loop() : callAudio.stop();
}});
callListenerModule.initialize();
@ -555,7 +555,7 @@ var NotificationSounds = (_ => {
repatchIncoming = true;
callAudio = BDFDB.LibraryModules.SoundUtils.createSound("call_calling");
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
}
loadAudios () {

View File

@ -157,7 +157,7 @@ var OldTitleBar = (_ => {
BDFDB.PluginUtils.init(this);
BDFDB.ListenerUtils.add(this, window, "resize", e => {
BDFDB.ModuleUtils.forceAllUpdates(this, ["HeaderBarContainer", "StandardSidebarView"]);
BDFDB.PatchUtils.forceAllUpdates(this, ["HeaderBarContainer", "StandardSidebarView"]);
});
BDFDB.DOMUtils.addClass(document.body, BDFDB.disCN._oldtitlebarenabled);
@ -206,7 +206,7 @@ var OldTitleBar = (_ => {
processHeaderBarContainer (e) {
if (!settings.addOldBar) return;
let children = BDFDB.ReactUtils.getValue(e.returnvalue, "props.toolbar.props.children");
let children = BDFDB.ObjectUtils.get(e.returnvalue, "props.toolbar.props.children");
if (!children) {
let [oldToolbarParent, oldToolbarIndex] = BDFDB.ReactUtils.findParent(e.returnvalue, {key: "OldTitleBar-toolbar"});
if (oldToolbarIndex > -1) oldToolbarParent.splice(oldToolbarIndex, 1);
@ -304,7 +304,7 @@ var OldTitleBar = (_ => {
forceUpdateAll () {
settings = BDFDB.DataUtils.get(this, "settings");
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
}
}
})();

View File

@ -198,7 +198,7 @@ var OwnerTag = (_ => {
processMemberListItem (e) {
let userType = this.getUserType(e.instance.props.user, e.instance.props.channel && e.instance.props.channel.id);
if (userType && settings.addInMemberList) {
this.injectOwnerTag(BDFDB.ReactUtils.getValue(e.returnvalue, "props.decorators.props.children"), e.instance.props.user, userType, 1, {
this.injectOwnerTag(BDFDB.ObjectUtils.get(e.returnvalue, "props.decorators.props.children"), e.instance.props.user, userType, 1, {
tagClass: BDFDB.disCN.bottagmember
});
}
@ -339,7 +339,7 @@ var OwnerTag = (_ => {
settings = BDFDB.DataUtils.get(this, "settings");
inputs = BDFDB.DataUtils.get(this, "inputs");
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
BDFDB.MessageUtils.rerenderAll();
}

View File

@ -194,7 +194,7 @@ var PersonalPins = (_ => {
}
processHeaderBarContainer (e) {
let [children, index] = BDFDB.ReactUtils.findParent(BDFDB.ReactUtils.getValue(e.returnvalue, "props.toolbar"), {name: "FluxContainer(Search)"});
let [children, index] = BDFDB.ReactUtils.findParent(BDFDB.ObjectUtils.get(e.returnvalue, "props.toolbar"), {name: "FluxContainer(Search)"});
if (index > -1) children.splice(index, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.PopoutContainer, {
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, {
text: this.labels.popout_note_text,
@ -376,7 +376,7 @@ var PersonalPins = (_ => {
}
containsSearchkey (data, key, searchkey) {
let value = BDFDB.ReactUtils.getValue(data, key);
let value = BDFDB.ObjectUtils.get(data, key);
return value && value.toUpperCase().indexOf(searchkey) > -1
}
@ -538,7 +538,7 @@ var PersonalPins = (_ => {
forceUpdateAll() {
choices = BDFDB.DataUtils.get(this, "choices");
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
}

View File

@ -493,8 +493,8 @@ var PinDMs = (_ => {
}
let pinnedIds = BDFDB.ObjectUtils.toArray(e.instance.props.pinnedChannelIds).reverse();
BDFDB.ModuleUtils.unpatch(this, e.instance, "renderDM");
BDFDB.ModuleUtils.patch(this, e.instance, "renderDM", {before: e2 => {
BDFDB.PatchUtils.unpatch(this, e.instance, "renderDM");
BDFDB.PatchUtils.patch(this, e.instance, "renderDM", {before: e2 => {
if (e2.methodArguments[0] != 0) e2.methodArguments[1] += pinnedIds.slice(0, e2.methodArguments[0] - 1).flat().length;
}, after: e2 => {
if (e2.methodArguments[0] != 0) {
@ -556,11 +556,11 @@ var PinDMs = (_ => {
BDFDB.ReactUtils.forceUpdate(e.instance);
}
if (draggedChannel) {
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {filter: child => BDFDB.ReactUtils.getValue(child, "props.channel.id") == draggedChannel});
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {filter: child => BDFDB.ObjectUtils.get(child, "props.channel.id") == draggedChannel});
children.splice(index, 1);
}
if (this.hoveredChannel) {
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {filter: child => BDFDB.ReactUtils.getValue(child, "props.channel.id") == this.hoveredChannel});
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {filter: child => BDFDB.ObjectUtils.get(child, "props.channel.id") == this.hoveredChannel});
children.splice(index + 1, 0, BDFDB.ReactUtils.createElement("div", {
className: BDFDB.disCNS.guildouter + BDFDB.disCN._pindmsrecentplaceholder,
children: BDFDB.ReactUtils.createElement("div", {
@ -675,7 +675,7 @@ var PinDMs = (_ => {
if (Math.sqrt((event.pageX - event2.pageX)**2) > 20 || Math.sqrt((event.pageY - event2.pageY)**2) > 20) {
BDFDB.ListenerUtils.stopEvent(event);
draggedChannel = e.instance.props.channel.id;
BDFDB.ModuleUtils.forceAllUpdates(this, "UnreadDMs");
BDFDB.PatchUtils.forceAllUpdates(this, "UnreadDMs");
let dragPreview = this.createDragPreview(e.node, event2);
document.removeEventListener("mousemove", mousemove);
document.removeEventListener("mouseup", mouseup);
@ -686,14 +686,14 @@ var PinDMs = (_ => {
let update = maybeHoveredChannel != hoveredChannel;
if (maybeHoveredChannel) hoveredChannel = maybeHoveredChannel;
else hoveredChannel = null;
if (update) BDFDB.ModuleUtils.forceAllUpdates(this, "UnreadDMs");
if (update) BDFDB.PatchUtils.forceAllUpdates(this, "UnreadDMs");
};
let releasing = event3 => {
BDFDB.DOMUtils.remove(dragPreview);
if (hoveredChannel) releasedChannel = hoveredChannel;
else draggedChannel = null;
hoveredChannel = null;
BDFDB.ModuleUtils.forceAllUpdates(this, "UnreadDMs");
BDFDB.PatchUtils.forceAllUpdates(this, "UnreadDMs");
document.removeEventListener("mousemove", dragging);
document.removeEventListener("mouseup", releasing);
};
@ -713,7 +713,7 @@ var PinDMs = (_ => {
}
}
if (e.node && e.methodname == "componentWillUnmount") {
BDFDB.ModuleUtils.forceAllUpdates(this, "PrivateChannelsList");
BDFDB.PatchUtils.forceAllUpdates(this, "PrivateChannelsList");
}
if (e.returnvalue && this.isPinned(e.instance.props.channel.id, "pinnedRecents") && settings.showPinIcon) {
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {name:"BlobMask"});
@ -861,10 +861,10 @@ var PinDMs = (_ => {
updateContainer (type) {
switch (type) {
case "dmCategories":
BDFDB.ModuleUtils.forceAllUpdates(this, "PrivateChannelsList");
BDFDB.PatchUtils.forceAllUpdates(this, "PrivateChannelsList");
break;
case "pinnedRecents":
BDFDB.ModuleUtils.forceAllUpdates(this, "UnreadDMs");
BDFDB.PatchUtils.forceAllUpdates(this, "UnreadDMs");
break;
}
}
@ -891,7 +891,7 @@ var PinDMs = (_ => {
settings = BDFDB.DataUtils.get(this, "settings");
BDFDB.ReactUtils.forceUpdate(BDFDB.ReactUtils.findOwner(document.querySelector(BDFDB.dotCN.app), {name:"FluxContainer(PrivateChannels)", all:true, unlimited:true}));
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
}
createDragPreview (div, event) {

View File

@ -559,7 +559,7 @@ var PluginRepo = (_ => {
customList = BDFDB.DataUtils.load(this, "custom");
customList = BDFDB.ArrayUtils.is(customList) ? customList : [];
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
}
onSettingsClosed () {
@ -610,7 +610,7 @@ var PluginRepo = (_ => {
}
processStandardSidebarView (e) {
if (BDFDB.ReactUtils.getValue(e, "instance.props.content.props.section") == "pluginrepo") {
if (BDFDB.ObjectUtils.get(e, "instance.props.content.props.section") == "pluginrepo") {
let content = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", BDFDB.disCN.settingswindowcontentregion]]});
if (content) content.props.className = BDFDB.DOMUtils.formatClassName(BDFDB.disCN._repolistwrapper, content.props.className);
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {props: [["className", BDFDB.disCN.settingswindowcontentregionscroller]]});

View File

@ -345,7 +345,7 @@ var ReadAllNotificationsButton = (_ => {
forceUpdateAll () {
settings = BDFDB.DataUtils.get(this, "settings");
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
}
setLabelsByLanguage () {

View File

@ -173,7 +173,7 @@ var RemoveNicknames = (_ => {
processMessageContent (e) {
if (BDFDB.ArrayUtils.is(e.instance.props.content) && settings.changeInMentions) for (let ele of e.instance.props.content) {
if (BDFDB.ReactUtils.isValidElement(ele) && ele.type && (ele.type.displayName || "").toLowerCase().indexOf("popout") > -1 && typeof ele.props.render == "function") {
if (BDFDB.ReactUtils.getValue(ele, "props.children.type.displayName") == "Mention") {
if (BDFDB.ObjectUtils.get(ele, "props.children.type.displayName") == "Mention") {
let newName = this.getNewName(BDFDB.LibraryModules.UserStore.getUser(ele.props.render().props.userId));
if (newName) ele.props.children.props.children[0] = "@" + newName;
}
@ -199,7 +199,7 @@ var RemoveNicknames = (_ => {
forceUpdateAll () {
settings = BDFDB.DataUtils.get(this, "settings");
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
BDFDB.MessageUtils.rerenderAll();
}
}

View File

@ -62,7 +62,7 @@ var SendLargeMessages = (_ => {
if (this.started) return;
BDFDB.PluginUtils.init(this);
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
}
else console.error(`%c[${this.getName()}]%c`, "color: #3a71c1; font-weight: 700;", "", "Fatal Error: Could not load BD functions!");
}
@ -72,7 +72,7 @@ var SendLargeMessages = (_ => {
if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
this.stopping = true;
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
BDFDB.PluginUtils.clear(this);
}
@ -82,7 +82,7 @@ var SendLargeMessages = (_ => {
// Begin of own functions
processChannelTextAreaForm (e) {
if (!BDFDB.ModuleUtils.isPatched(this, e.instance, "handleSendMessage")) BDFDB.ModuleUtils.patch(this, e.instance, "handleSendMessage", {instead: e2 => {
if (!BDFDB.PatchUtils.isPatched(this, e.instance, "handleSendMessage")) BDFDB.PatchUtils.patch(this, e.instance, "handleSendMessage", {instead: e2 => {
if (e2.methodArguments[0].length > BDFDB.DiscordConstants.MAX_MESSAGE_LENGTH) {
e2.stopOriginalMethodCall();
let messages = this.formatText(e2.methodArguments[0]);

View File

@ -49,7 +49,7 @@ var ServerCounter = (_ => {
if (this.started) return;
BDFDB.PluginUtils.init(this);
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
}
else {
console.error(`%c[${this.getName()}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
@ -60,7 +60,7 @@ var ServerCounter = (_ => {
if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
this.stopping = true;
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
BDFDB.PluginUtils.clear(this);
}

View File

@ -12,7 +12,7 @@ var ServerDetails = (_ => {
componentDidUpdate() {
if (amounts.tooltipDelay && this.state.delayed && !this.state.repositioned) {
this.state.repositioned = true;
let tooltip = BDFDB.DOMUtils.getParent(BDFDB.dotCN.tooltip, BDFDB.ReactUtils.getValue(this, "_reactInternalFiber.return.return.stateNode.containerInfo"));
let tooltip = BDFDB.DOMUtils.getParent(BDFDB.dotCN.tooltip, BDFDB.ObjectUtils.get(this, "_reactInternalFiber.return.return.stateNode.containerInfo"));
if (tooltip) tooltip.update();
}
}
@ -20,7 +20,7 @@ var ServerDetails = (_ => {
if (amounts.tooltipDelay && !this.state.delayed) {
BDFDB.TimeUtils.timeout(_ => {
this.state.delayed = true;
let tooltip = BDFDB.DOMUtils.getParent(BDFDB.dotCN.tooltip, BDFDB.ReactUtils.getValue(this, "_reactInternalFiber.return.return.stateNode.containerInfo"));
let tooltip = BDFDB.DOMUtils.getParent(BDFDB.dotCN.tooltip, BDFDB.ObjectUtils.get(this, "_reactInternalFiber.return.return.stateNode.containerInfo"));
if (tooltip) BDFDB.DOMUtils.addClass(tooltip, BDFDB.disCN._serverdetailstooltip);
BDFDB.ReactUtils.forceUpdate(this);
}, amounts.tooltipDelay * 1000);
@ -390,7 +390,7 @@ var ServerDetails = (_ => {
if (this.started) return;
BDFDB.PluginUtils.init(this);
BDFDB.ModuleUtils.patch(this, BDFDB.LibraryComponents.GuildComponents.Guild.prototype, "render", {after: e => {
BDFDB.PatchUtils.patch(this, BDFDB.LibraryComponents.GuildComponents.Guild.prototype, "render", {after: e => {
this.processGuild({instance:e.thisObject, returnvalue:e.returnValue, methodname:"render"});
}});
@ -533,7 +533,7 @@ var ServerDetails = (_ => {
}
`);
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
}
setLabelsByLanguage () {

View File

@ -298,7 +298,7 @@ var ServerFolders = (_ => {
BDFDB.DataUtils.save(customIcons, _this, "customicons");
this.props.open = null;
this.props.closed = null;
BDFDB.ModuleUtils.forceAllUpdates(_this, "GuildFolderSettingsModal");
BDFDB.PatchUtils.forceAllUpdates(_this, "GuildFolderSettingsModal");
BDFDB.NotificationUtils.toast("Custom Icon was added to selection", {type:"success"});
});
})
@ -493,7 +493,7 @@ var ServerFolders = (_ => {
BDFDB.PluginUtils.init(this);
let forceClosing = false;
BDFDB.ModuleUtils.patch(this, BDFDB.LibraryModules.GuildUtils, "toggleGuildFolderExpand", {after: e => {
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.GuildUtils, "toggleGuildFolderExpand", {after: e => {
if (settings.closeOtherFolders && !forceClosing) {
forceClosing = true;
for (let openFolderId of BDFDB.LibraryModules.FolderUtils.getExpandedFolders()) if (openFolderId != e.methodArguments[0]) BDFDB.LibraryModules.GuildUtils.toggleGuildFolderExpand(openFolderId);
@ -1149,7 +1149,7 @@ var ServerFolders = (_ => {
customIcons = BDFDB.DataUtils.load(this, "customicons");
BDFDB.ReactUtils.forceUpdate(folderGuildContent);
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
BDFDB.GuildUtils.rerenderAll();
}

View File

@ -34,7 +34,7 @@ var ServerHider = (_ => {
onClick: _ => {
BDFDB.ModalUtils.confirm(this, "Are you sure you want to unhide all servers and folders?", _ => {
BDFDB.DataUtils.save([], this, "hidden");
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
});
},
children: BDFDB.LanguageUtils.LanguageStrings.RESET
@ -74,7 +74,7 @@ var ServerHider = (_ => {
if (this.started) return;
BDFDB.PluginUtils.init(this);
BDFDB.ModuleUtils.patch(this, BDFDB.LibraryModules.FolderStore, "getGuildFolderById", {after: e => {
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.FolderStore, "getGuildFolderById", {after: e => {
let hiddenGuildIds = BDFDB.DataUtils.load(this, "hidden", "servers") || [];
if (e.returnValue && hiddenGuildIds.length) {
let folder = Object.assign({}, e.returnValue);
@ -84,7 +84,7 @@ var ServerHider = (_ => {
}
}});
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
}
else console.error(`%c[${this.getName()}]%c`, "color: #3a71c1; font-weight: 700;", "", "Fatal Error: Could not load BD functions!");
}
@ -93,7 +93,7 @@ var ServerHider = (_ => {
if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
this.stopping = true;
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
BDFDB.PluginUtils.clear(this);
}
@ -263,7 +263,7 @@ var ServerHider = (_ => {
let switchInstances = BDFDB.ReactUtils.findOwner(instance, {name:"BDFDB_Switch", all:true, unlimited:true});
for (let switchIns of switchInstances) switchIns.props.value = enabled;
BDFDB.ReactUtils.forceUpdate(switchInstances);
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
}
}]
});
@ -274,7 +274,7 @@ var ServerHider = (_ => {
if (force || (force === undefined && array.includes(id))) BDFDB.ArrayUtils.remove(array, id, true);
else array.push(id);
BDFDB.DataUtils.save(array, this, "hidden", type);
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
}
setLabelsByLanguage () {

View File

@ -220,19 +220,19 @@ var ShowHiddenChannels = (_ => {
let loadedCollapselist = BDFDB.DataUtils.load(this, "categorydata");
this.saveCollapselist(!BDFDB.ArrayUtils.is(loadedCollapselist) ? [] : loadedCollapselist);
BDFDB.ModuleUtils.patch(this, BDFDB.LibraryModules.UnreadChannelUtils, "hasUnread", {after: e => {
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.UnreadChannelUtils, "hasUnread", {after: e => {
return e.returnValue && !this.isChannelHidden(e.methodArguments[0]);
}});
BDFDB.ModuleUtils.patch(this, BDFDB.LibraryModules.UnreadChannelUtils, "getMentionCount", {after: e => {
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.UnreadChannelUtils, "getMentionCount", {after: e => {
return this.isChannelHidden(e.methodArguments[0]) ? 0 : e.returnValue;
}});
BDFDB.ModuleUtils.patch(this, BDFDB.LibraryModules.CategoryCollapseStore, "isCollapsed", {after: e => {
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.CategoryCollapseStore, "isCollapsed", {after: e => {
if (e.methodArguments[0] && e.methodArguments[0].endsWith("hidden")) return collapselist.includes(e.methodArguments[0]);
}});
BDFDB.ModuleUtils.patch(this, BDFDB.LibraryModules.CategoryCollapseUtils, "categoryCollapse", {before: e => {
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.CategoryCollapseUtils, "categoryCollapse", {before: e => {
if (e.methodArguments[0] && e.methodArguments[0].endsWith("hidden")) {
if (!collapselist.includes(e.methodArguments[0])) {
collapselist.push(e.methodArguments[0]);
@ -241,7 +241,7 @@ var ShowHiddenChannels = (_ => {
}
}});
BDFDB.ModuleUtils.patch(this, BDFDB.LibraryModules.CategoryCollapseUtils, "categoryExpand", {before: e => {
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.CategoryCollapseUtils, "categoryExpand", {before: e => {
if (e.methodArguments[0] && e.methodArguments[0].endsWith("hidden")) {
if (collapselist.includes(e.methodArguments[0])) {
BDFDB.ArrayUtils.remove(collapselist, e.methodArguments[0], true);
@ -250,7 +250,7 @@ var ShowHiddenChannels = (_ => {
}
}});
BDFDB.ModuleUtils.patch(this, BDFDB.LibraryModules.GuildChannelStore, "getTextChannelNameDisambiguations", {after: e => {
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.GuildChannelStore, "getTextChannelNameDisambiguations", {after: e => {
let all = BDFDB.LibraryModules.ChannelStore.getChannels();
for (let channel_id in all) if (all[channel_id].guild_id == e.methodArguments[0] && !e.returnValue[channel_id] && (all[channel_id].type != BDFDB.DiscordConstants.ChannelTypes.GUILD_CATEGORY && all[channel_id].type != BDFDB.DiscordConstants.ChannelTypes.GUILD_VOICE)) e.returnValue[channel_id] = {id: channel_id, name: all[channel_id].name};
}});
@ -315,7 +315,7 @@ var ShowHiddenChannels = (_ => {
else BDFDB.ArrayUtils.remove(blacklist, e.instance.props.guild.id, true);
this.saveBlacklist(BDFDB.ArrayUtils.removeCopies(blacklist));
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
}
}));
}
@ -473,7 +473,7 @@ var ShowHiddenChannels = (_ => {
forceUpdateAll() {
settings = BDFDB.DataUtils.get(this, "settings");
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
}
showAccessModal (channel, allowed) {

View File

@ -455,7 +455,7 @@ var SpellCheck = (_ => {
choices = BDFDB.DataUtils.get(this, "choices");
amounts = BDFDB.DataUtils.get(this, "amounts");
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
}
setLabelsByLanguage () {

View File

@ -130,7 +130,7 @@ var SpotifyControls = (_ => {
playerSize: playerSize,
style: this.props.maximized ? {marginRight: 4} : {},
onClick: _ => {
let url = BDFDB.ReactUtils.getValue(playbackState, "item.external_urls.spotify") || BDFDB.ReactUtils.getValue(playbackState, "context.external_urls.spotify");
let url = BDFDB.ObjectUtils.get(playbackState, "item.external_urls.spotify") || BDFDB.ObjectUtils.get(playbackState, "context.external_urls.spotify");
if (url) {
BDFDB.LibraryRequires.electron.clipboard.write({text:url});
BDFDB.NotificationUtils.toast("Song URL was copied to clipboard.", {type: "success"});
@ -650,18 +650,18 @@ var SpotifyControls = (_ => {
if (this.started) return;
BDFDB.PluginUtils.init(this);
BDFDB.ModuleUtils.patch(this, BDFDB.LibraryModules.SpotifyTrackUtils, "getActivity", {after: e => {
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.SpotifyTrackUtils, "getActivity", {after: e => {
if (e.methodArguments[0] !== false) {
if (e.returnValue && e.returnValue.name == "Spotify") this.updatePlayer(e.returnValue);
else if (!e.returnValue) this.updatePlayer(null);
}
}});
BDFDB.ModuleUtils.patch(this, BDFDB.LibraryModules.SpotifyTrackUtils, "wasAutoPaused", {instead: e => {
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.SpotifyTrackUtils, "wasAutoPaused", {instead: e => {
return false;
}});
BDFDB.ModuleUtils.patch(this, BDFDB.LibraryModules.SpotifyUtils, "pause", {instead: e => {
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.SpotifyUtils, "pause", {instead: e => {
return false;
}});
@ -711,7 +711,7 @@ var SpotifyControls = (_ => {
processAppView (e) {
if (typeof insertPatchCancel == "function") insertPatchCancel();
insertPatchCancel = BDFDB.ModuleUtils.patch(this, e.instance, "renderChannelSidebar", {after: e2 => {
insertPatchCancel = BDFDB.PatchUtils.patch(this, e.instance, "renderChannelSidebar", {after: e2 => {
let [children, index] = BDFDB.ReactUtils.findParent(e2.returnValue, {props: [["section", BDFDB.DiscordConstants.AnalyticsSections.ACCOUNT_PANEL]]});
if (index > -1) children.splice(index - 1, 0, BDFDB.ReactUtils.createElement(SpotifyControlsComponent, {
song: BDFDB.LibraryModules.SpotifyTrackUtils.getActivity(false),
@ -732,7 +732,7 @@ var SpotifyControls = (_ => {
settings = BDFDB.DataUtils.get(this, "settings");
buttonConfigs = BDFDB.DataUtils.get(this, "buttonConfigs");
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
}
}
})();

View File

@ -857,7 +857,7 @@ var ThemeRepo = (_ => {
customList = BDFDB.DataUtils.load(this, "custom");
customList = BDFDB.ArrayUtils.is(customList) ? customList : [];
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
}
onSettingsClosed () {
@ -912,7 +912,7 @@ var ThemeRepo = (_ => {
}
processStandardSidebarView (e) {
if (BDFDB.ReactUtils.getValue(e, "instance.props.content.props.section") == "themerepo") {
if (BDFDB.ObjectUtils.get(e, "instance.props.content.props.section") == "themerepo") {
let content = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", BDFDB.disCN.settingswindowcontentregion]]});
if (content) content.props.className = BDFDB.DOMUtils.formatClassName(BDFDB.disCN._repolistwrapper, content.props.className);
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {props: [["className", BDFDB.disCN.settingswindowcontentregionscroller]]});

View File

@ -81,7 +81,7 @@ var ThemeSettings = (_ => {
appendSettingsButton (card) {
if (card.querySelector(".theme-settings-button")) return;
let addon = BDFDB.ReactUtils.getValue(BDFDB.ReactUtils.getInstance(card), "return.stateNode.props.addon");
let addon = BDFDB.ObjectUtils.get(BDFDB.ReactUtils.getInstance(card), "return.stateNode.props.addon");
if (addon && !addon.plugin) {
let vars = this.getThemeVars(addon.css);
if (vars.length) {

View File

@ -68,7 +68,7 @@ var TimedLightDarkMode = (_ => {
if (this.started) return;
BDFDB.PluginUtils.init(this);
BDFDB.ModuleUtils.patch(this, BDFDB.LibraryModules.SettingsUtils, "updateLocalSettings", {after: e => {
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.SettingsUtils, "updateLocalSettings", {after: e => {
if (BDFDB.ObjectUtils.is(e.methodArguments[0]) && e.methodArguments[0].theme) {
BDFDB.TimeUtils.clear(changeTimeout);
disableChanging = true;
@ -80,7 +80,7 @@ var TimedLightDarkMode = (_ => {
this.startInterval();
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
}
else console.error(`%c[${this.getName()}]%c`, "color: #3a71c1; font-weight: 700;", "", "Fatal Error: Could not load BD functions!");
}

View File

@ -162,7 +162,7 @@ var TopRoleEverywhere = (_ => {
processMemberListItem (e) {
if (e.instance.props.user && settings.showInMemberList) {
this.injectRoleTag(BDFDB.ReactUtils.getValue(e.returnvalue, "props.decorators.props.children"), e.instance.props.user, "member", {
this.injectRoleTag(BDFDB.ObjectUtils.get(e.returnvalue, "props.decorators.props.children"), e.instance.props.user, "member", {
tagClass: BDFDB.disCN.bottagmember
});
}
@ -241,7 +241,7 @@ var TopRoleEverywhere = (_ => {
forceUpdateAll () {
settings = BDFDB.DataUtils.get(this, "settings");
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
BDFDB.MessageUtils.rerenderAll();
}
}

View File

@ -54,7 +54,7 @@ var WriteUpperCase = (_ => {
if (this.started) return;
BDFDB.PluginUtils.init(this);
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PatchUtils.forceAllUpdates(this);
}
else console.error(`%c[${this.getName()}]%c`, "color: #3a71c1; font-weight: 700;", "", "Fatal Error: Could not load BD functions!");
}