aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/apiNotices.ts
blob: 1b4f11517e4fb0dea9c96c6f2730e4bb824467c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import { Devs } from "../utils/constants";
import definePlugin from "../utils/types";

export default definePlugin({
    name: "ApiNotices",
    description: "Fixes notices being automatically dismissed",
    authors: [Devs.Ven],
    required: true,
    patches: [
        {
            find: "updateNotice:",
            replacement: [
                {
                    match: /;(.{1,2}=null;)(?=.{0,50}updateNotice)/g,
                    replace:
                        ';if(Vencord.Api.Notices.currentNotice)return !1;$1'
                },
                {
                    match: /(?<=NOTICE_DISMISS:function.+?){(?=if\(null==(.+?)\))/,
                    replace: '{if($1?.id=="VencordNotice")return ($1=null,Vencord.Api.Notices.nextNotice(),true);'
                }
            ]
        }
    ],
});