From fa8712815731c1121820fd46ff4eacd9f81427ef Mon Sep 17 00:00:00 2001 From: Zack Rauen Date: Wed, 28 Jul 2021 09:10:27 -0400 Subject: [PATCH] Expose getPatchesByCaller --- CHANGELOG.md | 1 + README.md | 2 +- renderer/src/data/changelog.js | 3 ++- renderer/src/modules/pluginapi.js | 4 ++++ 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8603f789..59c5ec29 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ This changelog starts with the restructured 1.0.0 release that happened after co ## 1.2.1 ### Added +- Added `getPatchesByCaller` to `BdApi.Patcher` ### Removed diff --git a/README.md b/README.md index 2f81e1dd..693054f7 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ BD has some other built-in features such as Emotes from Twitch, FFZ, and BBTV, a The easiest way to find plugins and themes is to browse them on [our website: https://betterdiscord.app/](https://betterdiscord.app/). Additionally, in our [support servers](#support-servers) we have channels with lists of official plugins and themes. ### Support Servers? -There are two: [The main server](https://discord.gg/0Tmfo5ZbORCRqbAd), and [the backup](https://discord.gg/2HScm8j). +There are two: [The main server](https://discord.gg/bnSUxedypU), and [the backup](https://discord.gg/XqSpb9e3dq). diff --git a/renderer/src/data/changelog.js b/renderer/src/data/changelog.js index 4aef9e0e..0af5cfe8 100644 --- a/renderer/src/data/changelog.js +++ b/renderer/src/data/changelog.js @@ -16,8 +16,9 @@ export default { title: "Power Users & Developers", type: "improved", items: [ - "Plugin data retrieval will now turn the correct values instead of `undefined` for falsey values.", + "Plugin data retrieval will now return the correct values instead of `undefined` for falsey values.", "Plugin data can now be set before being retrieved.", + "The `Patcher` in `BdApi` now has a `getPatchesByCaller` function which will return all the patches corresponding to a caller string.", "Plugins that fail on initial load will no longer be forever in a broken state. Thanks, Strencher. (https://github.com/Strencher)", "React DevTools should now work on Linux! Thanks, Qb. (https://github.com/QbDesu)" ] diff --git a/renderer/src/modules/pluginapi.js b/renderer/src/modules/pluginapi.js index 9a3ddfd4..cc8f5f0a 100644 --- a/renderer/src/modules/pluginapi.js +++ b/renderer/src/modules/pluginapi.js @@ -296,6 +296,10 @@ BdApi.Patcher = { before: (caller, moduleToPatch, functionName, callback, options = {}) => BdApi.Patcher.patch(caller, moduleToPatch, functionName, callback, Object.assign(options, {type: "before"})), instead: (caller, moduleToPatch, functionName, callback, options = {}) => BdApi.Patcher.patch(caller, moduleToPatch, functionName, callback, Object.assign(options, {type: "instead"})), after: (caller, moduleToPatch, functionName, callback, options = {}) => BdApi.Patcher.patch(caller, moduleToPatch, functionName, callback, Object.assign(options, {type: "after"})), + getPatchesByCaller: (caller) => { + if (typeof(caller) !== "string") return Logger.err("BdApi.Patcher", "Parameter 0 of getPatchesByCaller must be a string representing the caller"); + return Patcher.getPatchesByCaller(caller); + }, unpatchAll: (caller) => { if (typeof(caller) !== "string") return Logger.err("BdApi.Patcher", "Parameter 0 of unpatchAll must be a string representing the caller"); return Patcher.unpatchAll(caller);