Closed moeshin closed 1 year ago
Module filter functions take exports, module, id as parameters in that order. See the BetterDiscord docs: https://docs.betterdiscord.app/api/webpack#getmodule. The JSDoc comment in the BetterDiscord source code apparently hasn't been updated (last changed 3 years ago). The BandagedBD BdApi types should not be used as a reference, they have been outdated and lacking for a long time. I am not sure how much the update earlier this year improved.
exports is required, other params are optional.
export type ModuleFilter = (
exports: any,
module?: {
id: number;
loaded: true;
exports: any;
},
id?: string,
) => boolean;
Good find, it seems waitForModule
got left out when the new parameters got introduced.
https://github.com/BetterDiscord/BetterDiscord/blob/b62deff1407c52bda5415a2d464de9566a78e4f4/renderer/src/modules/webpackmodules.js#L8-L13
https://github.com/DefinitelyTyped/DefinitelyTyped/blob/39359c8466846541b5b3298165ef79c509f0cd09/types/bandagedbd__bdapi/index.d.ts#L1273