From e2c47dc6be07be0f5ac971ddbdd11f9ceffb307c Mon Sep 17 00:00:00 2001 From: Mirco Wittrien Date: Wed, 28 Sep 2022 16:08:05 +0200 Subject: [PATCH] stuff --- Library/0BDFDB.plugin.js | 15 +++++++++++++-- Library/_res/0BDFDB.data.json | 1 + 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Library/0BDFDB.plugin.js b/Library/0BDFDB.plugin.js index aa7311417d..8eb49826b7 100644 --- a/Library/0BDFDB.plugin.js +++ b/Library/0BDFDB.plugin.js @@ -2279,7 +2279,7 @@ module.exports = (_ => { methodname: e.originalMethodName, patchtypes: [patchType] }) - }, {name, noCache: true}); + }, {name: config.name, noCache: true}); }}, {name: config.name}); } else { @@ -4356,8 +4356,19 @@ module.exports = (_ => { for (let i in newV.reverse()) newValue += (newV[i] * (10 ** i)); return (newValue - oldValue) / (10 ** (length-1)); }; - + + var SettingsStore; BDFDB.DiscordUtils = {}; + BDFDB.DiscordUtils.getSettings = function (typeName) { + if (!SettingsStore) SettingsStore = (Object.entries(BDFDB.ModuleUtils.findByProperties("updateAsync", {defaultExport: false}).exports).find(n => n && n[1] && n[1].ProtoClass && n[1].ProtoClass.typeName && n[1].ProtoClass.typeName.indexOf("Preload") > -1) || [])[1]; + if (SettingsStore) return typeName ? (SettingsStore.getCurrentValue() || {})[guildFolders] : SettingsStore.getCurrentValue() || {}; + }; + BDFDB.DiscordUtils = {}; + BDFDB.DiscordUtils.setSettings = function (typeName, writer) { + if (!typeName || typeof writer != "function") return; + if (!SettingsStore) SettingsStore = (Object.entries(BDFDB.ModuleUtils.findByProperties("updateAsync", {defaultExport: false}).exports).find(n => n && n[1] && n[1].ProtoClass && n[1].ProtoClass.typeName && n[1].ProtoClass.typeName.indexOf("Preload") > -1) || [])[1]; + if (SettingsStore) SettingsStore.updateAsyn(typeName, writer, BDFDB.DiscordConstants.UserSettingsActionTypes.SLOW_USER_ACTION); + }; BDFDB.DiscordUtils.openLink = function (url, config = {}) { if ((config.inBuilt || config.inBuilt === undefined && Internal.settings.general.useChromium) && Internal.LibraryRequires.electron && Internal.LibraryRequires.electron.remote) { let browserWindow = new Internal.LibraryRequires.electron.remote.BrowserWindow({ diff --git a/Library/_res/0BDFDB.data.json b/Library/_res/0BDFDB.data.json index 40b2500e19..8f7d59889e 100644 --- a/Library/_res/0BDFDB.data.json +++ b/Library/_res/0BDFDB.data.json @@ -60,6 +60,7 @@ "StatusTypes": ["STREAMING", "UNKNOWN", "DND"], "UserFlags": ["HYPESQUAD", "BUG_HUNTER_LEVEL_1", "STAFF"], "UserNotificationSettings": ["NULL", "NO_MESSAGES", "ALL_MESSAGES"], + "UserSettingsActionTypes": ["SLOW_USER_ACTION", "DAILY"], "UserSettingsSections": ["ACCOUNT", "DEVELOPER_OPTIONS", "DISMISSIBLE_CONTENT_OPTIONS"] }, "LibraryModulesFunctionsMap": {