Expose getPatchesByCaller

This commit is contained in:
Zack Rauen 2021-07-28 09:10:27 -04:00
parent 91249fe2b4
commit fa87128157
4 changed files with 8 additions and 2 deletions

View File

@ -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

View File

@ -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 <u>official</u> 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).

View File

@ -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)"
]

View File

@ -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);