18 lines
730 B
1
import spacepack from "@moonlight-mod/wp/spacepack_spacepack";
2
3
// spacepack.require.m[moonlight.moonmap.modules["discord/modules/menus/web/Menu"]].toString();
4
let code =
5
spacepack.require.m[
6
spacepack.findByCode("Menu API only allows Items and groups of Items as children.")[0].id
7
].toString();
8
9
const parserSym = code.match(/(?<=_patchMenu\(.,).+?(?=\()/)![0];
10
11
code = code.replace(/{(.):\(\)=>./, (orig, e) => `{${e}:()=>${parserSym}`);
12
const mod = new Function("module", "exports", "require", `(${code}).apply(this, arguments)`);
13
14
const exp: any = {};
15
mod({}, exp, require);
16
17
const parser = spacepack.findFunctionByStrings(exp, "Menu API only allows Items and groups of Items as children.")!;
18
module.exports = parser;
19