42 lines
1.3 kB
1
import type { ExtensionWebpackModule, Patch } from "@moonlight-mod/types";
2
3
export const patches: Patch[] = [
4
{
5
find: ".GUILD_RAID_NOTIFICATION:",
6
replace: {
7
match: /(?<=return(\(0,.\.jsx\))\(.+?\);)case .{1,2}\..{1,3}\.GUILD_RAID_NOTIFICATION:/,
8
replacement: (orig, createElement) =>
9
`case "__moonlight_notice":return${createElement}(require("notices_component").default,{});${orig}`
10
}
11
},
12
{
13
find: '"NoticeStore"',
14
replace: [
15
{
16
match: /\[.{1,2}\..{1,3}\.CONNECT_SPOTIFY\]:{/,
17
replacement: (orig: string) =>
18
`__moonlight_notice:{predicate:()=>require("notices_notices").default.shouldShowNotice()},${orig}`
19
},
20
{
21
match: /=\[(.{1,2}\..{1,3}\.QUARANTINED,)/g,
22
replacement: (_, orig) => `=["__moonlight_notice",${orig}`
23
}
24
]
25
}
26
];
27
28
export const webpackModules: Record<string, ExtensionWebpackModule> = {
29
notices: {
30
dependencies: [{ id: "discord/packages/flux" }, { id: "discord/Dispatcher" }]
31
},
32
33
component: {
34
dependencies: [
35
{ id: "react" },
36
{ id: "discord/Dispatcher" },
37
{ id: "discord/components/common/index" },
38
{ id: "discord/packages/flux" },
39
{ ext: "notices", id: "notices" }
40
]
41
}
42
};
43