karin-plugin-mys-core 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +674 -0
- package/lib/apps/MiHoYoLogin.d.ts +3 -1
- package/lib/apps/MiHoYoLogin.js +177 -109
- package/lib/apps/MysDevice.d.ts +2 -2
- package/lib/apps/MysDevice.js +65 -23
- package/lib/apps/UIDManage.d.ts +10 -0
- package/lib/apps/UIDManage.js +52 -0
- package/lib/array-CZDr9qst.d.ts +62 -0
- package/lib/chunk-2DHTKQ34.js +0 -0
- package/lib/chunk-3BIQN6QA.js +27 -0
- package/lib/chunk-3CNBOOKY.js +31 -0
- package/lib/chunk-5NA7ZPDS.js +54 -0
- package/lib/chunk-6PIXUPZ6.js +82 -0
- package/lib/chunk-7KEG6SDX.js +0 -0
- package/lib/chunk-7SZX3RBZ.js +0 -0
- package/lib/chunk-7VAWV6ZE.js +0 -0
- package/lib/chunk-7WESXE4X.js +29 -0
- package/lib/chunk-7YZHHLS5.js +130 -0
- package/lib/chunk-ARLTXJFJ.js +0 -0
- package/lib/chunk-CFS2WFOO.js +0 -0
- package/lib/chunk-EMAUATE3.js +217 -0
- package/lib/chunk-FBWSEBAW.js +0 -0
- package/lib/chunk-FOAQZIZ2.js +0 -0
- package/lib/chunk-G547WVGV.js +73 -0
- package/lib/chunk-G5W5WAY5.js +64 -0
- package/lib/chunk-HVYNK5BN.js +45 -0
- package/lib/chunk-I7XZONDN.js +13 -0
- package/lib/chunk-IVZICDGW.js +19 -0
- package/lib/chunk-JBGXPVO2.js +179 -0
- package/lib/chunk-JRH4JC43.js +0 -0
- package/lib/chunk-JVJQKRJ4.js +89 -0
- package/lib/chunk-K5U2O3HH.js +0 -0
- package/lib/chunk-KN5SHBVI.js +30 -0
- package/lib/chunk-LG34FPBI.js +50 -0
- package/lib/chunk-LJSDSOY6.js +0 -0
- package/lib/chunk-LYTNREAI.js +0 -0
- package/lib/chunk-MWYDWDR4.js +0 -0
- package/lib/chunk-QMSYS77M.js +38 -0
- package/lib/chunk-SEWEEPJN.js +0 -0
- package/lib/{chunk-JML6VYXN.js → chunk-SHLPPEAY.js} +13 -17
- package/lib/chunk-SHW6FHIB.js +10 -0
- package/lib/chunk-W4DBT7AD.js +0 -0
- package/lib/chunk-X75DW4KI.js +510 -0
- package/lib/chunk-XQWTJIT4.js +0 -0
- package/lib/chunk-Y3J3J5B2.js +124 -0
- package/lib/chunk-Z5I6A73Y.js +0 -0
- package/lib/common-Dw5l6Uud.d.ts +33 -0
- package/lib/define-BWuQ7acM.d.ts +131 -0
- package/lib/dir.d.ts +11 -13
- package/lib/dir.js +1 -1
- package/lib/exports/config/array.d.ts +1 -0
- package/lib/exports/config/array.js +7 -0
- package/lib/exports/config/config.d.ts +1 -0
- package/lib/exports/config/config.js +8 -0
- package/lib/exports/config/index.d.ts +2 -0
- package/lib/exports/config/index.js +14 -0
- package/lib/exports/config/types/config.d.ts +12 -0
- package/lib/exports/config/types/config.js +1 -0
- package/lib/exports/config/types/index.d.ts +1 -0
- package/lib/exports/config/types/index.js +2 -0
- package/lib/exports/database/database.d.ts +30 -0
- package/lib/exports/database/database.js +18 -0
- package/lib/exports/database/dbs/base.d.ts +23 -0
- package/lib/exports/database/dbs/base.js +15 -0
- package/lib/exports/database/dbs/index.d.ts +4 -0
- package/lib/exports/database/dbs/index.js +23 -0
- package/lib/exports/database/dbs/sqlite3.d.ts +23 -0
- package/lib/exports/database/dbs/sqlite3.js +19 -0
- package/lib/exports/database/dbs/table.d.ts +13 -0
- package/lib/exports/database/dbs/table.js +19 -0
- package/lib/exports/database/index.d.ts +12 -0
- package/lib/exports/database/index.js +62 -0
- package/lib/exports/database/tables/index.d.ts +9 -0
- package/lib/exports/database/tables/index.js +39 -0
- package/lib/exports/database/tables/mysAccountInfo.d.ts +9 -0
- package/lib/exports/database/tables/mysAccountInfo.js +23 -0
- package/lib/exports/database/tables/mysDeviceInfo.d.ts +9 -0
- package/lib/exports/database/tables/mysDeviceInfo.js +26 -0
- package/lib/exports/database/tables/mysUserInfo.d.ts +9 -0
- package/lib/exports/database/tables/mysUserInfo.js +23 -0
- package/lib/exports/database/types/database.d.ts +6 -0
- package/lib/exports/database/types/database.js +1 -0
- package/lib/exports/database/types/dbs/base.d.ts +114 -0
- package/lib/exports/database/types/dbs/base.js +11 -0
- package/lib/exports/database/types/dbs/index.d.ts +2 -0
- package/lib/exports/database/types/dbs/index.js +12 -0
- package/lib/exports/database/types/index.d.ts +6 -0
- package/lib/exports/database/types/index.js +24 -0
- package/lib/exports/database/types/tables/index.d.ts +5 -0
- package/lib/exports/database/types/tables/index.js +13 -0
- package/lib/exports/database/types/tables/mysAccountInfo.d.ts +14 -0
- package/lib/exports/database/types/tables/mysAccountInfo.js +7 -0
- package/lib/exports/database/types/tables/mysDeviceInfo.d.ts +19 -0
- package/lib/exports/database/types/tables/mysDeviceInfo.js +1 -0
- package/lib/exports/database/types/tables/mysUserInfo.d.ts +31 -0
- package/lib/exports/database/types/tables/mysUserInfo.js +7 -0
- package/lib/exports/mys/api/apis.d.ts +82 -0
- package/lib/exports/mys/api/apis.js +57 -0
- package/lib/exports/mys/api/app.d.ts +60 -0
- package/lib/exports/mys/api/app.js +31 -0
- package/lib/exports/mys/api/define.d.ts +6 -0
- package/lib/exports/mys/api/define.js +43 -0
- package/lib/exports/mys/api/index.d.ts +11 -0
- package/lib/exports/mys/api/index.js +64 -0
- package/lib/exports/mys/index.d.ts +13 -0
- package/lib/exports/mys/index.js +77 -0
- package/lib/exports/mys/types/api/define.d.ts +6 -0
- package/lib/exports/mys/types/api/define.js +1 -0
- package/lib/exports/mys/types/api/index.d.ts +6 -0
- package/lib/exports/mys/types/api/index.js +2 -0
- package/lib/exports/mys/types/index.d.ts +10 -0
- package/lib/exports/mys/types/index.js +12 -0
- package/lib/exports/mys/types/user/game.d.ts +10 -0
- package/lib/exports/mys/types/user/game.js +1 -0
- package/lib/exports/mys/types/user/index.d.ts +10 -0
- package/lib/exports/mys/types/user/index.js +9 -0
- package/lib/exports/mys/types/user/userInfo.d.ts +10 -0
- package/lib/exports/mys/types/user/userInfo.js +7 -0
- package/lib/exports/mys/user/deviceInfo.d.ts +11 -0
- package/lib/exports/mys/user/deviceInfo.js +29 -0
- package/lib/exports/mys/user/game.d.ts +20 -0
- package/lib/exports/mys/user/game.js +7 -0
- package/lib/exports/mys/user/index.d.ts +12 -0
- package/lib/exports/mys/user/index.js +51 -0
- package/lib/exports/mys/user/userInfo.d.ts +10 -0
- package/lib/exports/mys/user/userInfo.js +45 -0
- package/lib/exports/utils/common.d.ts +1 -0
- package/lib/exports/utils/common.js +13 -0
- package/lib/exports/utils/index.d.ts +2 -0
- package/lib/exports/utils/index.js +12 -0
- package/lib/exports/utils/render.d.ts +21 -0
- package/lib/exports/utils/render.js +7 -0
- package/lib/index-DEEWbZ0V.d.ts +102 -0
- package/lib/index.js +1 -1
- package/package.json +29 -15
- package/resources/fonts/HYWenHei-55W.ttf +0 -0
- package/resources/image/launcher-icon//345/216/237/347/245/236.png +0 -0
- package/resources/image/launcher-icon//345/264/251/345/235/2173.png +0 -0
- package/resources/image/launcher-icon//345/264/251/345/235/217/345/255/246/345/233/2552.png +0 -0
- package/resources/image/launcher-icon//345/264/251/345/235/217/357/274/232/345/233/240/347/274/230/347/262/276/347/201/265.png +0 -0
- package/resources/image/launcher-icon//345/264/251/345/235/217/357/274/232/346/230/237/347/251/271/351/223/201/351/201/223.png +0 -0
- package/resources/image/launcher-icon//346/230/237/345/270/203/350/260/267/345/234/260.png +0 -0
- package/resources/image/launcher-icon//346/234/252/345/256/232/344/272/213/344/273/266/347/260/277.png +0 -0
- package/resources/image/launcher-icon//347/273/235/345/214/272/351/233/266.png +0 -0
- package/resources/image/mys-logo.png +0 -0
- package/resources/template/ShowBindAccount/index.css +1 -0
- package/resources/template/ShowBindAccount/index.html +65 -0
- package/resources/template/ShowBindDevice/index.html +20 -0
- package/resources/template/ShowBindDevice/inex.css +1 -0
- package/resources/template/layout/default.css +1 -0
- package/resources/template/layout/default.html +27 -0
- package/lib/app.d.ts +0 -2
- package/lib/base-BJv9XnQP.d.ts +0 -120
- package/lib/chunk-CQNW7LJI.js +0 -38
- package/lib/chunk-MV2UE7C7.js +0 -410
- package/lib/chunk-NHUNEZXM.js +0 -371
- package/lib/chunk-WYRIRWT5.js +0 -213
- package/lib/database-byVXw91u.d.ts +0 -5
- package/lib/define-pa_pWNWT.d.ts +0 -182
- package/lib/exports/core.d.ts +0 -249
- package/lib/exports/core.js +0 -45
- package/lib/exports/database.d.ts +0 -48
- package/lib/exports/database.js +0 -20
- package/lib/exports/types.d.ts +0 -5
- package/lib/exports/types.js +0 -13
- package/lib/index.d.ts +0 -2
- package/lib/web.config.d.ts +0 -5
- package/lib/web.config.js +0 -55
package/lib/apps/MiHoYoLogin.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ShowBindAccountCmdFunc
|
|
3
|
+
} from "../chunk-JBGXPVO2.js";
|
|
1
4
|
import {
|
|
2
5
|
UserInfo,
|
|
3
6
|
fetchQRcode,
|
|
@@ -5,22 +8,53 @@ import {
|
|
|
5
8
|
getTokenByGameToken,
|
|
6
9
|
getUserFullInfo,
|
|
7
10
|
queryQRcode
|
|
8
|
-
} from "../chunk-
|
|
9
|
-
import "../chunk-
|
|
11
|
+
} from "../chunk-X75DW4KI.js";
|
|
12
|
+
import "../chunk-3CNBOOKY.js";
|
|
13
|
+
import "../chunk-3BIQN6QA.js";
|
|
14
|
+
import "../chunk-G5W5WAY5.js";
|
|
15
|
+
import "../chunk-7VAWV6ZE.js";
|
|
16
|
+
import "../chunk-LJSDSOY6.js";
|
|
17
|
+
import "../chunk-CFS2WFOO.js";
|
|
18
|
+
import "../chunk-MWYDWDR4.js";
|
|
19
|
+
import "../chunk-FOAQZIZ2.js";
|
|
20
|
+
import "../chunk-IVZICDGW.js";
|
|
21
|
+
import "../chunk-XQWTJIT4.js";
|
|
22
|
+
import "../chunk-7SZX3RBZ.js";
|
|
23
|
+
import "../chunk-W4DBT7AD.js";
|
|
24
|
+
import "../chunk-Z5I6A73Y.js";
|
|
25
|
+
import "../chunk-7WESXE4X.js";
|
|
26
|
+
import "../chunk-KN5SHBVI.js";
|
|
27
|
+
import "../chunk-QMSYS77M.js";
|
|
28
|
+
import "../chunk-SEWEEPJN.js";
|
|
29
|
+
import "../chunk-5NA7ZPDS.js";
|
|
30
|
+
import "../chunk-G547WVGV.js";
|
|
31
|
+
import "../chunk-EMAUATE3.js";
|
|
32
|
+
import "../chunk-Y3J3J5B2.js";
|
|
33
|
+
import "../chunk-7KEG6SDX.js";
|
|
34
|
+
import "../chunk-FBWSEBAW.js";
|
|
35
|
+
import "../chunk-JVJQKRJ4.js";
|
|
36
|
+
import "../chunk-LYTNREAI.js";
|
|
37
|
+
import "../chunk-K5U2O3HH.js";
|
|
38
|
+
import "../chunk-I7XZONDN.js";
|
|
39
|
+
import "../chunk-SHW6FHIB.js";
|
|
40
|
+
import "../chunk-JRH4JC43.js";
|
|
41
|
+
import "../chunk-ARLTXJFJ.js";
|
|
10
42
|
import {
|
|
11
43
|
common_exports
|
|
12
|
-
} from "../chunk-
|
|
13
|
-
import "../chunk-
|
|
14
|
-
import "../chunk-
|
|
44
|
+
} from "../chunk-LG34FPBI.js";
|
|
45
|
+
import "../chunk-HVYNK5BN.js";
|
|
46
|
+
import "../chunk-2DHTKQ34.js";
|
|
47
|
+
import "../chunk-SHLPPEAY.js";
|
|
48
|
+
import "../chunk-7YZHHLS5.js";
|
|
49
|
+
import "../chunk-6PIXUPZ6.js";
|
|
15
50
|
import "../chunk-MLKGABMK.js";
|
|
16
51
|
|
|
17
52
|
// src/apps/MiHoYoLogin.ts
|
|
18
53
|
import karin, { common as karinCommon, logger, segment } from "node-karin";
|
|
19
|
-
import lodash from "node-karin/lodash";
|
|
20
54
|
import QR from "qrcode";
|
|
21
55
|
var QRCodes = /* @__PURE__ */ new Map();
|
|
22
56
|
var MiHoYoLoginQRCode = karin.command(
|
|
23
|
-
/^#?(
|
|
57
|
+
/^#?(扫码|米哈游|mys)(登录|绑定)$/i,
|
|
24
58
|
async (e) => {
|
|
25
59
|
const qrcode = QRCodes.get(e.userId);
|
|
26
60
|
if (qrcode) {
|
|
@@ -33,47 +67,49 @@ var MiHoYoLoginQRCode = karin.command(
|
|
|
33
67
|
}
|
|
34
68
|
QRCodes.set(e.userId, true);
|
|
35
69
|
const device = common_exports.randomString(64, "All");
|
|
36
|
-
const QRcode = await fetchQRcode().request({ device });
|
|
70
|
+
const QRcode = (await fetchQRcode.init(null).request({ device })).data;
|
|
37
71
|
if (!QRcode?.data?.url) {
|
|
38
72
|
QRCodes.delete(e.userId);
|
|
39
|
-
e.reply("\u83B7\u53D6\u4E8C\u7EF4\u7801\u5931\u8D25\u3001\u8BF7\u7A0D\u540E\u518D\u8BD5", { at: true });
|
|
73
|
+
e.reply("\u83B7\u53D6\u4E8C\u7EF4\u7801\u5931\u8D25\u3001\u8BF7\u7A0D\u540E\u518D\u8BD5...", { at: true });
|
|
40
74
|
return true;
|
|
41
75
|
}
|
|
42
76
|
const image = (await QR.toDataURL(QRcode.data.url)).replace("data:image/png;base64,", "base64://");
|
|
43
77
|
if (!image) {
|
|
44
78
|
QRCodes.delete(e.userId);
|
|
45
|
-
e.reply("\u751F\u6210\u4E8C\u7EF4\u7801\u5931\u8D25\u3001\u8BF7\u7A0D\u540E\u518D\u8BD5", { at: true });
|
|
79
|
+
e.reply("\u751F\u6210\u4E8C\u7EF4\u7801\u5931\u8D25\u3001\u8BF7\u7A0D\u540E\u518D\u8BD5...", { at: true });
|
|
46
80
|
return true;
|
|
47
81
|
}
|
|
48
82
|
QRCodes.set(e.userId, image);
|
|
49
83
|
e.reply(["\u8BF7\u4F7F\u7528\u7C73\u6E38\u793E\u626B\u7801\u767B\u5F55", segment.image(image)], { at: true, recallMsg: 60 });
|
|
84
|
+
setTimeout(() => {
|
|
85
|
+
QRCodes.delete(e.userId);
|
|
86
|
+
}, 5 * 60 * 1e3);
|
|
50
87
|
let data, Scanned;
|
|
51
88
|
const ticket = QRcode.data.url.split("ticket=")[1];
|
|
52
89
|
for (let n = 1; n < 60; n++) {
|
|
53
90
|
await karinCommon.sleep(5e3);
|
|
54
91
|
try {
|
|
55
|
-
const
|
|
56
|
-
if (!
|
|
57
|
-
if (
|
|
58
|
-
e.reply(res3.message, { at: true, recallMsg: 60 });
|
|
92
|
+
const res = (await queryQRcode.init(null).request({ device, ticket })).data;
|
|
93
|
+
if (!res) continue;
|
|
94
|
+
if (res.retcode === 3503) {
|
|
59
95
|
QRCodes.delete(e.userId);
|
|
96
|
+
e.reply(res.message, { at: true });
|
|
60
97
|
return true;
|
|
61
98
|
}
|
|
62
|
-
if (
|
|
63
|
-
e.reply("\u4E8C\u7EF4\u7801\u5DF2\u8FC7\u671F\uFF0C\u8BF7\u91CD\u65B0\u767B\u5F55", { at: true, recallMsg: 60 });
|
|
99
|
+
if (res.retcode !== 0) {
|
|
64
100
|
QRCodes.delete(e.userId);
|
|
101
|
+
e.reply("\u4E8C\u7EF4\u7801\u5DF2\u8FC7\u671F\uFF0C\u8BF7\u91CD\u65B0\u767B\u5F55", { at: true });
|
|
65
102
|
return true;
|
|
66
103
|
}
|
|
67
|
-
if (
|
|
104
|
+
if (res.data.stat === "Scanned") {
|
|
68
105
|
if (Scanned) {
|
|
69
|
-
e.reply("\u4E8C\u7EF4\u7801\u5DF2\u626B\u63CF\uFF0C\u8BF7\u786E\u8BA4\u767B\u5F55", { at: true
|
|
106
|
+
e.reply("\u4E8C\u7EF4\u7801\u5DF2\u626B\u63CF\uFF0C\u8BF7\u786E\u8BA4\u767B\u5F55", { at: true });
|
|
70
107
|
} else {
|
|
71
108
|
Scanned = true;
|
|
72
109
|
QRCodes.set(e.userId, true);
|
|
73
110
|
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
data = JSON.parse(res3.data.payload.raw);
|
|
111
|
+
} else if (res.data.stat === "Confirmed") {
|
|
112
|
+
data = JSON.parse(res.data.payload.raw);
|
|
77
113
|
break;
|
|
78
114
|
}
|
|
79
115
|
} catch (err) {
|
|
@@ -81,41 +117,105 @@ var MiHoYoLoginQRCode = karin.command(
|
|
|
81
117
|
break;
|
|
82
118
|
}
|
|
83
119
|
}
|
|
84
|
-
if (!data?.uid
|
|
85
|
-
e.reply("\u7C73\u6E38\u793E\u767B\u5F55\u5931\u8D25", { at: true });
|
|
120
|
+
if (!data?.uid || !data?.token) {
|
|
86
121
|
QRCodes.delete(e.userId);
|
|
122
|
+
e.reply("\u7C73\u6E38\u793E\u767B\u5F55\u5931\u8D25", { at: true });
|
|
87
123
|
return true;
|
|
88
124
|
}
|
|
89
|
-
const
|
|
125
|
+
const Token = (await getTokenByGameToken.init(null).request({
|
|
90
126
|
account_id: parseInt(data.uid),
|
|
91
127
|
game_token: data.token
|
|
92
|
-
});
|
|
93
|
-
if (!
|
|
94
|
-
e.reply("\u83B7\u53D6Token\u5931\u8D25", { at: true });
|
|
128
|
+
})).data;
|
|
129
|
+
if (!Token?.data?.token?.token) {
|
|
95
130
|
QRCodes.delete(e.userId);
|
|
131
|
+
e.reply("\u83B7\u53D6Token\u5931\u8D25\uFF0C\u8BF7\u91CD\u65B0\u767B\u5F55\u3002", { at: true });
|
|
96
132
|
return true;
|
|
97
133
|
}
|
|
98
|
-
const
|
|
99
|
-
|
|
134
|
+
const stokenParams = {
|
|
135
|
+
stuid: Token.data.user_info.aid,
|
|
136
|
+
stoken: Token.data.token.token,
|
|
137
|
+
mid: Token.data.user_info.mid
|
|
138
|
+
};
|
|
139
|
+
const CookieAccountInfo = (await getCookieAccountInfoByGameToken.init(null).request({
|
|
100
140
|
account_id: data.uid,
|
|
101
141
|
game_token: data.token
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
142
|
+
})).data;
|
|
143
|
+
if (!CookieAccountInfo?.data?.cookie_token) {
|
|
144
|
+
QRCodes.delete(e.userId);
|
|
145
|
+
e.reply("\u83B7\u53D6CookieToken\u5931\u8D25\uFF0C\u8BF7\u91CD\u65B0\u767B\u5F55\u3002", { at: true });
|
|
146
|
+
return true;
|
|
147
|
+
}
|
|
148
|
+
const cookieParams = {
|
|
149
|
+
ltuid: stokenParams.stuid,
|
|
150
|
+
ltoken: stokenParams.stoken,
|
|
151
|
+
cookie_token: CookieAccountInfo.data.cookie_token,
|
|
152
|
+
account_id: stokenParams.stuid
|
|
153
|
+
};
|
|
154
|
+
const errMsg = await BindStoken(e.userId, stokenParams, { cookieParams, Serv: "mihoyo" /* cn */ });
|
|
155
|
+
if (errMsg) {
|
|
156
|
+
e.reply(errMsg, { at: true });
|
|
157
|
+
return true;
|
|
158
|
+
}
|
|
106
159
|
QRCodes.delete(e.userId);
|
|
107
|
-
return
|
|
160
|
+
return await ShowBindAccountCmdFunc(e);
|
|
161
|
+
}
|
|
162
|
+
);
|
|
163
|
+
var BindCookieByMessage = karin.command(
|
|
164
|
+
/^#?绑定(米游社)?(cookie|ck)$/i,
|
|
165
|
+
async (e) => {
|
|
166
|
+
const cookieMsg = e.msg.replace(/^#?绑定(米游社)?(cookie|ck)/i, "").trim();
|
|
167
|
+
const cookieObj = common_exports.StrToObj(cookieMsg.replace(/[#'" ]/g, ""), ";");
|
|
168
|
+
const errMsg = await BindCookie(e.userId, cookieObj, 1 /* CK */);
|
|
169
|
+
if (errMsg) {
|
|
170
|
+
e.reply(errMsg, { at: true });
|
|
171
|
+
return true;
|
|
172
|
+
}
|
|
173
|
+
return await ShowBindAccountCmdFunc(e);
|
|
108
174
|
}
|
|
109
175
|
);
|
|
110
|
-
var
|
|
111
|
-
|
|
176
|
+
var BindStokenByMessage = karin.command(
|
|
177
|
+
/^#?绑定(米游社)?(stoken|sk)$/i,
|
|
178
|
+
async (e) => {
|
|
179
|
+
const stokenMsg = e.msg.replace(/^#?绑定(米游社)?(stoken|sk)$/i, "").trim();
|
|
180
|
+
const stokenObj = common_exports.StrToObj(stokenMsg.replace(/[#'" ]/g, ""), ";");
|
|
181
|
+
if (!stokenObj.stoken || !(stokenObj.stuid || stokenObj.ltuid) || !stokenObj.mid) {
|
|
182
|
+
e.reply("\u53D1\u9001Stoken\u4E0D\u5B8C\u6574\uFF0C\u5EFA\u8BAE\u4F7F\u7528#\u7C73\u54C8\u6E38\u767B\u5F55", { at: true });
|
|
183
|
+
return true;
|
|
184
|
+
}
|
|
185
|
+
const errMsg = await BindStoken(e.userId, {
|
|
186
|
+
stuid: stokenObj.stuid || stokenObj.ltuid,
|
|
187
|
+
stoken: stokenObj.stoken,
|
|
188
|
+
mid: stokenObj.mid
|
|
189
|
+
});
|
|
190
|
+
if (errMsg) {
|
|
191
|
+
e.reply(errMsg, { at: true });
|
|
192
|
+
return true;
|
|
193
|
+
}
|
|
194
|
+
return await ShowBindAccountCmdFunc(e);
|
|
195
|
+
}
|
|
196
|
+
);
|
|
197
|
+
var BindStoken = async (userId, stokenParams, option) => {
|
|
198
|
+
const updata = Object.keys(option?.cookieParams || {}).length > 0 ? { Serv: option.Serv, cookieParams: option.cookieParams, message: "" } : await UserInfo.refreshCookie(stokenParams, option?.Serv ?? ["mihoyo" /* cn */, "hoyolab" /* os */]);
|
|
199
|
+
if (updata.message) return updata.message;
|
|
200
|
+
const userInfo = await UserInfo.create(userId);
|
|
201
|
+
await userInfo.saveUserInfo({
|
|
202
|
+
stuids: userInfo.stuids.add(stokenParams.stuid, true)
|
|
203
|
+
});
|
|
204
|
+
await userInfo.saveMysAccountInfo(stokenParams.stuid, {
|
|
205
|
+
type: updata.Serv,
|
|
206
|
+
stoken: common_exports.ObjToStr(stokenParams, ";")
|
|
207
|
+
});
|
|
208
|
+
logger.mark(`[${userId}] \u4FDD\u5B58Stoken\u6210\u529F [stuid: ${stokenParams.stuid}]`);
|
|
209
|
+
const errMsg = await BindCookie(userId, updata.cookieParams, 3 /* CS */, updata.Serv);
|
|
210
|
+
if (errMsg) return errMsg;
|
|
211
|
+
return false;
|
|
212
|
+
};
|
|
213
|
+
var BindCookie = async (userId, cookieObj, perm, Serv) => {
|
|
112
214
|
if (!cookieObj.cookie_token && !cookieObj.cookie_token_v2) {
|
|
113
|
-
return "\u53D1\u9001Cookie\u4E0D\u5B8C\u6574\uFF0C\u5EFA\u8BAE\u4F7F\u7528#\
|
|
215
|
+
return "\u53D1\u9001Cookie\u4E0D\u5B8C\u6574(cookie_token\u7F3A\u5931)\uFF0C\u5EFA\u8BAE\u4F7F\u7528#\u7C73\u54C8\u6E38\u767B\u5F55\u3002";
|
|
114
216
|
}
|
|
115
217
|
const ltuid = cookieObj.ltuid || cookieObj.login_uid || cookieObj.ltuid_v2 || cookieObj.account_id_v2 || cookieObj.ltmid_v2;
|
|
116
|
-
if (!ltuid)
|
|
117
|
-
return "\u53D1\u9001Cookie\u4E0D\u5B8C\u6574\uFF0C\u5EFA\u8BAE\u4F7F\u7528#\u626B\u7801\u767B\u5F55";
|
|
118
|
-
}
|
|
218
|
+
if (!ltuid) return "\u53D1\u9001Cookie\u4E0D\u5B8C\u6574\uFF0C\u5EFA\u8BAE\u4F7F\u7528#\u7C73\u54C8\u6E38\u767B\u5F55\u3002";
|
|
119
219
|
let cookieParams = {};
|
|
120
220
|
let flagV2 = false;
|
|
121
221
|
if (cookieObj.cookie_token_v2 && (cookieObj.account_mid_v2 || cookieObj.ltmid_v2)) {
|
|
@@ -139,32 +239,37 @@ var bingCookie = async (userId, cookie, Serv = "mihoyo" /* cn */) => {
|
|
|
139
239
|
cookieParams.mi18nLang = cookieObj.mi18nLang;
|
|
140
240
|
}
|
|
141
241
|
const cookieStr = common_exports.ObjToStr(cookieParams, ";");
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
242
|
+
const uidList = await (async () => {
|
|
243
|
+
const errMsg = [];
|
|
244
|
+
for (const serv of Serv ? [Serv] : ["mihoyo" /* cn */, "hoyolab" /* os */]) {
|
|
245
|
+
const result = await UserInfo.refreshUid({
|
|
246
|
+
userId,
|
|
247
|
+
type: serv,
|
|
248
|
+
ltuid,
|
|
249
|
+
cookie: cookieStr,
|
|
250
|
+
deviceMd5: ""
|
|
251
|
+
}, perm);
|
|
252
|
+
if (!result.message) {
|
|
253
|
+
return result;
|
|
254
|
+
}
|
|
255
|
+
errMsg.push(result.message);
|
|
256
|
+
}
|
|
257
|
+
return {
|
|
258
|
+
Serv: Serv || "mihoyo" /* cn */,
|
|
259
|
+
uids: [],
|
|
260
|
+
message: errMsg.pop() || ""
|
|
261
|
+
};
|
|
262
|
+
})();
|
|
263
|
+
if (uidList.message) return uidList.message;
|
|
264
|
+
if (flagV2 && isNaN(+cookieParams.ltuid)) {
|
|
265
|
+
const userFullInfo = (await getUserFullInfo.init({
|
|
160
266
|
type: uidList.Serv,
|
|
161
267
|
ltuid,
|
|
162
|
-
cookie: cookieStr
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
}
|
|
268
|
+
cookie: cookieStr,
|
|
269
|
+
deviceMd5: ""
|
|
270
|
+
}).request(null)).data;
|
|
271
|
+
if (userFullInfo.data.user_info.uid) {
|
|
272
|
+
cookieParams.ltuid = cookieParams.account_id = userFullInfo.data.user_info.uid;
|
|
168
273
|
} else {
|
|
169
274
|
logger.mark(`\u7ED1\u5B9ACookie\u9519\u8BEF2\uFF1A${userFullInfo?.message || "Cookie\u9519\u8BEF"}`);
|
|
170
275
|
return `\u7ED1\u5B9ACookie\u5931\u8D25\uFF1A${userFullInfo?.message || "Cookie\u9519\u8BEF"}`;
|
|
@@ -172,58 +277,21 @@ var bingCookie = async (userId, cookie, Serv = "mihoyo" /* cn */) => {
|
|
|
172
277
|
}
|
|
173
278
|
const userInfo = await UserInfo.create(userId);
|
|
174
279
|
await userInfo.saveUserInfo({
|
|
175
|
-
...uidList.uids.
|
|
176
|
-
|
|
280
|
+
...uidList.uids.reduce((acc, cur) => {
|
|
281
|
+
acc[cur.columnKey] = cur.data;
|
|
282
|
+
return acc;
|
|
283
|
+
}, {}),
|
|
284
|
+
ltuids: userInfo.ltuids.add(cookieParams.ltuid, true)
|
|
177
285
|
});
|
|
178
286
|
await userInfo.saveMysAccountInfo(cookieParams.ltuid, {
|
|
179
287
|
type: uidList.Serv,
|
|
180
288
|
cookie: common_exports.ObjToStr(cookieParams, ";")
|
|
181
289
|
});
|
|
182
290
|
logger.mark(`[${userId}] \u4FDD\u5B58Cookie\u6210\u529F [ltuid:${cookieParams.ltuid}]`);
|
|
183
|
-
|
|
184
|
-
lodash.forEach(uidList.uids.data, (uids, game) => {
|
|
185
|
-
sendMsg.push(`\u3010${uidList.uids.names[game]}\u3011\uFF1A${Object.keys(uids).join("\u3001")}`);
|
|
186
|
-
});
|
|
187
|
-
return `Cookie\u7ED1\u5B9A\u6210\u529F\uFF01
|
|
188
|
-
${sendMsg.join("\n")}`;
|
|
189
|
-
};
|
|
190
|
-
var bingStoken = async (userId, stoken, option) => {
|
|
191
|
-
const { cookie = "", Serv = "mihoyo" /* cn */ } = option || {};
|
|
192
|
-
const stokenObj = common_exports.StrToObj(stoken.replace(/[#'" ]/g, ""), ";");
|
|
193
|
-
if (!stokenObj.stoken || !(stokenObj.stuid || stokenObj.ltuid) || !stokenObj.mid) {
|
|
194
|
-
return "\u53D1\u9001Stoken\u4E0D\u5B8C\u6574\uFF0C\u5EFA\u8BAE\u4F7F\u7528#\u626B\u7801\u767B\u5F55";
|
|
195
|
-
}
|
|
196
|
-
const stokenParams = {
|
|
197
|
-
stuid: stokenObj.stuid || stokenObj.ltuid,
|
|
198
|
-
stoken: stokenObj.stoken,
|
|
199
|
-
mid: stokenObj.mid
|
|
200
|
-
};
|
|
201
|
-
let updata = { Serv, cookie, message: "" };
|
|
202
|
-
if (!updata.cookie) {
|
|
203
|
-
for (const serv of Serv ? [Serv] : ["mihoyo" /* cn */, "hoyolab" /* os */]) {
|
|
204
|
-
updata = await UserInfo.refreshCookie(stokenParams, serv);
|
|
205
|
-
if (updata.cookie) break;
|
|
206
|
-
}
|
|
207
|
-
if (updata.message) {
|
|
208
|
-
return updata.message;
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
const Stoken = common_exports.ObjToStr(stokenParams, ";");
|
|
212
|
-
const userInfo = await UserInfo.create(userId);
|
|
213
|
-
await userInfo.saveUserInfo({
|
|
214
|
-
stuids: lodash.uniq([...userInfo.stuids, stokenParams.stuid])
|
|
215
|
-
});
|
|
216
|
-
await userInfo.saveMysAccountInfo(stokenParams.stuid, {
|
|
217
|
-
type: updata.Serv,
|
|
218
|
-
stoken: Stoken
|
|
219
|
-
});
|
|
220
|
-
logger.mark(`[${userId}] \u4FDD\u5B58Stoken\u6210\u529F [stuid: ${stokenParams.stuid}]`);
|
|
221
|
-
const sendMsg = [];
|
|
222
|
-
sendMsg.push(`\u7C73\u6E38\u793EID\uFF1A${stokenParams.stuid}
|
|
223
|
-
Stoken\u7ED1\u5B9A\u6210\u529F\uFF01`);
|
|
224
|
-
sendMsg.push(await bingCookie(userId, updata.cookie, updata.Serv));
|
|
225
|
-
return sendMsg.join("\n");
|
|
291
|
+
return false;
|
|
226
292
|
};
|
|
227
293
|
export {
|
|
294
|
+
BindCookieByMessage,
|
|
295
|
+
BindStokenByMessage,
|
|
228
296
|
MiHoYoLoginQRCode
|
|
229
297
|
};
|
package/lib/apps/MysDevice.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as node_karin from 'node-karin';
|
|
2
2
|
|
|
3
|
-
declare const
|
|
3
|
+
declare const BindMysDevice: node_karin.Command<keyof node_karin.MessageEventMap>;
|
|
4
4
|
|
|
5
|
-
export {
|
|
5
|
+
export { BindMysDevice };
|
package/lib/apps/MysDevice.js
CHANGED
|
@@ -1,24 +1,57 @@
|
|
|
1
1
|
import {
|
|
2
|
-
DeviceInfo,
|
|
3
2
|
UserInfo
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-X75DW4KI.js";
|
|
4
|
+
import {
|
|
5
|
+
DeviceInfo
|
|
6
|
+
} from "../chunk-3CNBOOKY.js";
|
|
7
|
+
import "../chunk-3BIQN6QA.js";
|
|
8
|
+
import "../chunk-G5W5WAY5.js";
|
|
9
|
+
import "../chunk-7VAWV6ZE.js";
|
|
10
|
+
import "../chunk-LJSDSOY6.js";
|
|
11
|
+
import "../chunk-CFS2WFOO.js";
|
|
12
|
+
import "../chunk-MWYDWDR4.js";
|
|
13
|
+
import "../chunk-FOAQZIZ2.js";
|
|
14
|
+
import "../chunk-IVZICDGW.js";
|
|
15
|
+
import "../chunk-XQWTJIT4.js";
|
|
16
|
+
import "../chunk-7SZX3RBZ.js";
|
|
17
|
+
import "../chunk-W4DBT7AD.js";
|
|
18
|
+
import "../chunk-Z5I6A73Y.js";
|
|
19
|
+
import "../chunk-7WESXE4X.js";
|
|
20
|
+
import "../chunk-KN5SHBVI.js";
|
|
21
|
+
import "../chunk-QMSYS77M.js";
|
|
22
|
+
import "../chunk-SEWEEPJN.js";
|
|
23
|
+
import "../chunk-5NA7ZPDS.js";
|
|
24
|
+
import "../chunk-G547WVGV.js";
|
|
25
|
+
import "../chunk-EMAUATE3.js";
|
|
26
|
+
import "../chunk-Y3J3J5B2.js";
|
|
27
|
+
import "../chunk-7KEG6SDX.js";
|
|
28
|
+
import "../chunk-FBWSEBAW.js";
|
|
29
|
+
import "../chunk-JVJQKRJ4.js";
|
|
30
|
+
import "../chunk-LYTNREAI.js";
|
|
31
|
+
import "../chunk-K5U2O3HH.js";
|
|
32
|
+
import "../chunk-I7XZONDN.js";
|
|
33
|
+
import "../chunk-SHW6FHIB.js";
|
|
34
|
+
import "../chunk-JRH4JC43.js";
|
|
35
|
+
import "../chunk-ARLTXJFJ.js";
|
|
36
|
+
import "../chunk-LG34FPBI.js";
|
|
37
|
+
import "../chunk-HVYNK5BN.js";
|
|
38
|
+
import "../chunk-2DHTKQ34.js";
|
|
39
|
+
import "../chunk-SHLPPEAY.js";
|
|
40
|
+
import "../chunk-7YZHHLS5.js";
|
|
41
|
+
import "../chunk-6PIXUPZ6.js";
|
|
9
42
|
import "../chunk-MLKGABMK.js";
|
|
10
43
|
|
|
11
44
|
// src/apps/MysDevice.ts
|
|
12
45
|
import karin from "node-karin";
|
|
13
|
-
var
|
|
14
|
-
/^#绑定(
|
|
46
|
+
var BindMysDevice = karin.command(
|
|
47
|
+
/^#绑定(米游社|mys)?设备$/,
|
|
15
48
|
async (e) => {
|
|
16
49
|
const userInfo = await UserInfo.create(e.userId);
|
|
17
|
-
const ltuidInfoList = userInfo.
|
|
50
|
+
const ltuidInfoList = userInfo.LtuidInfoList;
|
|
18
51
|
const cnLtuidInfoList = ltuidInfoList.filter((info) => info.type === "mihoyo" /* cn */);
|
|
19
52
|
if (cnLtuidInfoList.length === 0) {
|
|
20
53
|
if (ltuidInfoList.length === 0) {
|
|
21
|
-
e.reply("\u6682\u672A\u7ED1\u5B9A\u56FD\u670D\u7C73\u6E38\u793E\u8D26\u53F7\uFF0C\u8BF7\u5148\u201C#\
|
|
54
|
+
e.reply("\u6682\u672A\u7ED1\u5B9A\u56FD\u670D\u7C73\u6E38\u793E\u8D26\u53F7\uFF0C\u8BF7\u5148\u201C#\u7C73\u6E38\u793E\u7ED1\u5B9A\u201D\u8FDB\u884C\u7ED1\u5B9A\uFF01", { at: true });
|
|
22
55
|
} else {
|
|
23
56
|
e.reply("\u56FD\u9645\u670D\u6682\u4E0D\u9700\u8981\u7ED1\u5B9A\u8BBE\u5907\u3002", { at: true });
|
|
24
57
|
}
|
|
@@ -26,34 +59,43 @@ var BingMysDevice = karin.command(
|
|
|
26
59
|
}
|
|
27
60
|
e.reply("\u8BF7\u53D1\u9001\u8BBE\u5907\u4FE1\u606F(\u5EFA\u8BAE\u79C1\u804A\u53D1\u9001)\uFF0C\u6216\u8005\u53D1\u9001\u201C\u53D6\u6D88\u201D\u53D6\u6D88\u7ED1\u5B9A", { at: true });
|
|
28
61
|
const ctx = await karin.ctx(e);
|
|
29
|
-
if (/^#?取消(绑定)
|
|
62
|
+
if (/^#?取消(绑定)?/.test(ctx.msg)) {
|
|
30
63
|
e.reply("\u5DF2\u53D6\u6D88\u7ED1\u5B9A", { at: true });
|
|
31
64
|
return true;
|
|
32
65
|
}
|
|
33
66
|
const device = JSON.parse(ctx.msg);
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
deviceFp: device.device_fp
|
|
38
|
-
});
|
|
39
|
-
} else if (device.deviceName && device.deviceBoard && device.deviceModel && device.oaid && device.androidVersion && device.deviceFingerprint && device.deviceProduct) {
|
|
40
|
-
await DeviceInfo.create(userInfo, {
|
|
67
|
+
let deviceMD5 = "";
|
|
68
|
+
if (device.deviceName && device.deviceBoard && device.deviceModel && device.oaid && device.androidVersion && device.deviceFingerprint && device.deviceProduct) {
|
|
69
|
+
deviceMD5 = await DeviceInfo.create(e.userId, {
|
|
41
70
|
name: device.deviceName,
|
|
42
71
|
board: device.deviceBoard,
|
|
43
72
|
model: device.deviceModel,
|
|
44
73
|
oaid: device.oaid,
|
|
45
|
-
|
|
74
|
+
version: +device.androidVersion,
|
|
46
75
|
fingerprint: device.deviceFingerprint,
|
|
47
|
-
product: device.deviceProduct
|
|
76
|
+
product: device.deviceProduct,
|
|
77
|
+
deviceId: device.device_id || crypto.randomUUID(),
|
|
78
|
+
deviceFp: device.device_fp || ""
|
|
79
|
+
});
|
|
80
|
+
} else if (device.device_id && device.device_fp) {
|
|
81
|
+
deviceMD5 = await DeviceInfo.create(e.userId, {
|
|
82
|
+
deviceId: device.device_id,
|
|
83
|
+
deviceFp: device.device_fp
|
|
48
84
|
});
|
|
49
85
|
} else {
|
|
50
86
|
e.reply("\u8BBE\u5907\u4FE1\u606F\u4E0D\u5B8C\u6574\uFF0C\u8BF7\u63D0\u4F9B\u5B8C\u6574\u7684\u8BBE\u5907\u4FE1\u606F", { at: true });
|
|
51
87
|
return true;
|
|
52
88
|
}
|
|
53
|
-
|
|
54
|
-
|
|
89
|
+
await userInfo.saveUserInfo({
|
|
90
|
+
deviceList: userInfo.deviceList.add(deviceMD5, true)
|
|
91
|
+
});
|
|
92
|
+
return await ShowBindDeviceCmdFuc(e);
|
|
55
93
|
}
|
|
56
94
|
);
|
|
95
|
+
var ShowBindDeviceCmdFuc = async (e) => {
|
|
96
|
+
e.reply("\u8BBE\u5907\u7ED1\u5B9A\u6210\u529F", { at: true });
|
|
97
|
+
return true;
|
|
98
|
+
};
|
|
57
99
|
export {
|
|
58
|
-
|
|
100
|
+
BindMysDevice
|
|
59
101
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as node_karin from 'node-karin';
|
|
2
|
+
import { Message } from 'node-karin';
|
|
3
|
+
|
|
4
|
+
declare const BindUID: node_karin.Command<keyof node_karin.MessageEventMap>;
|
|
5
|
+
declare const UnbindUID: node_karin.Command<keyof node_karin.MessageEventMap>;
|
|
6
|
+
declare const ShowBindAccountCmdFunc: (e: Message) => Promise<boolean>;
|
|
7
|
+
declare const ShowBindAccount: node_karin.Command<keyof node_karin.MessageEventMap>;
|
|
8
|
+
declare const UnbindAccount: node_karin.Command<keyof node_karin.MessageEventMap>;
|
|
9
|
+
|
|
10
|
+
export { BindUID, ShowBindAccount, ShowBindAccountCmdFunc, UnbindAccount, UnbindUID };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BindUID,
|
|
3
|
+
ShowBindAccount,
|
|
4
|
+
ShowBindAccountCmdFunc,
|
|
5
|
+
UnbindAccount,
|
|
6
|
+
UnbindUID
|
|
7
|
+
} from "../chunk-JBGXPVO2.js";
|
|
8
|
+
import "../chunk-X75DW4KI.js";
|
|
9
|
+
import "../chunk-3CNBOOKY.js";
|
|
10
|
+
import "../chunk-3BIQN6QA.js";
|
|
11
|
+
import "../chunk-G5W5WAY5.js";
|
|
12
|
+
import "../chunk-7VAWV6ZE.js";
|
|
13
|
+
import "../chunk-LJSDSOY6.js";
|
|
14
|
+
import "../chunk-CFS2WFOO.js";
|
|
15
|
+
import "../chunk-MWYDWDR4.js";
|
|
16
|
+
import "../chunk-FOAQZIZ2.js";
|
|
17
|
+
import "../chunk-IVZICDGW.js";
|
|
18
|
+
import "../chunk-XQWTJIT4.js";
|
|
19
|
+
import "../chunk-7SZX3RBZ.js";
|
|
20
|
+
import "../chunk-W4DBT7AD.js";
|
|
21
|
+
import "../chunk-Z5I6A73Y.js";
|
|
22
|
+
import "../chunk-7WESXE4X.js";
|
|
23
|
+
import "../chunk-KN5SHBVI.js";
|
|
24
|
+
import "../chunk-QMSYS77M.js";
|
|
25
|
+
import "../chunk-SEWEEPJN.js";
|
|
26
|
+
import "../chunk-5NA7ZPDS.js";
|
|
27
|
+
import "../chunk-G547WVGV.js";
|
|
28
|
+
import "../chunk-EMAUATE3.js";
|
|
29
|
+
import "../chunk-Y3J3J5B2.js";
|
|
30
|
+
import "../chunk-7KEG6SDX.js";
|
|
31
|
+
import "../chunk-FBWSEBAW.js";
|
|
32
|
+
import "../chunk-JVJQKRJ4.js";
|
|
33
|
+
import "../chunk-LYTNREAI.js";
|
|
34
|
+
import "../chunk-K5U2O3HH.js";
|
|
35
|
+
import "../chunk-I7XZONDN.js";
|
|
36
|
+
import "../chunk-SHW6FHIB.js";
|
|
37
|
+
import "../chunk-JRH4JC43.js";
|
|
38
|
+
import "../chunk-ARLTXJFJ.js";
|
|
39
|
+
import "../chunk-LG34FPBI.js";
|
|
40
|
+
import "../chunk-HVYNK5BN.js";
|
|
41
|
+
import "../chunk-2DHTKQ34.js";
|
|
42
|
+
import "../chunk-SHLPPEAY.js";
|
|
43
|
+
import "../chunk-7YZHHLS5.js";
|
|
44
|
+
import "../chunk-6PIXUPZ6.js";
|
|
45
|
+
import "../chunk-MLKGABMK.js";
|
|
46
|
+
export {
|
|
47
|
+
BindUID,
|
|
48
|
+
ShowBindAccount,
|
|
49
|
+
ShowBindAccountCmdFunc,
|
|
50
|
+
UnbindAccount,
|
|
51
|
+
UnbindUID
|
|
52
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
declare class Config<C extends Record<string, any>> {
|
|
2
|
+
#private;
|
|
3
|
+
/**
|
|
4
|
+
* @param name 插件名称:配置名称
|
|
5
|
+
*/
|
|
6
|
+
constructor(name: `${string}:${string}`, ConfigPath: string, DefaultConfig: C, IgnoreConfig: Record<string, any>);
|
|
7
|
+
loadConfig(): C;
|
|
8
|
+
mergeWithDefaults(userConfig: Record<string, any>, defaultConfig: Record<string, any>, IgnoreConfig: Record<string, any>): C;
|
|
9
|
+
/**
|
|
10
|
+
* @description 获取配置路径对应的默认配置
|
|
11
|
+
*/
|
|
12
|
+
getDef<T>(path: string): T;
|
|
13
|
+
/**
|
|
14
|
+
* @description 获取配置路径对应的配置
|
|
15
|
+
*/
|
|
16
|
+
get<T>(path: string, isArray?: false, def?: T): T;
|
|
17
|
+
get<T>(path: string, isArray: true, def?: T[]): EnhancedArray<T>;
|
|
18
|
+
/**
|
|
19
|
+
* @param save 是否立即保存
|
|
20
|
+
*/
|
|
21
|
+
set<T>(path: string, value: T, save: boolean): void;
|
|
22
|
+
/**
|
|
23
|
+
* @description 立即保存配置
|
|
24
|
+
*/
|
|
25
|
+
save(): void;
|
|
26
|
+
watch(): this;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
declare class EnhancedArray<T> extends Array<T> {
|
|
30
|
+
#private;
|
|
31
|
+
constructor(cfg: Config<any>, items: T[], path: string);
|
|
32
|
+
/**
|
|
33
|
+
* @param element - string | number
|
|
34
|
+
* @returns
|
|
35
|
+
*/
|
|
36
|
+
has(element: T & (string | number)): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* @param isEqual 是否不添加重复元素
|
|
39
|
+
* @param save 是否立即保存
|
|
40
|
+
*/
|
|
41
|
+
add(element: T, isEqual: boolean, save: boolean): this;
|
|
42
|
+
/**
|
|
43
|
+
* @param isEqual 是否不添加重复元素
|
|
44
|
+
* @param save 是否立即保存
|
|
45
|
+
*/
|
|
46
|
+
addSome(elements: T[], isEqual: boolean, save: boolean): this;
|
|
47
|
+
/**
|
|
48
|
+
* @param predicate - 要删除的元素、删除条件函数或索引
|
|
49
|
+
* @param save - 是否立即保存
|
|
50
|
+
* @param isIndex - 当 predicate 为数字时,是否将其视为索引
|
|
51
|
+
*/
|
|
52
|
+
remove(predicate: T & number, save: boolean, isIndex: true): this;
|
|
53
|
+
remove(predicate: T | ((item: T) => boolean), save: boolean): this;
|
|
54
|
+
/**
|
|
55
|
+
* @param predicate - 要删除的元素数组
|
|
56
|
+
* @param save - 是否立即保存
|
|
57
|
+
*/
|
|
58
|
+
removeSome(elements: T[], save: boolean): this;
|
|
59
|
+
clear(): this;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export { Config as C, EnhancedArray as E };
|
|
File without changes
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// src/exports/mys/user/game.ts
|
|
2
|
+
var MysGame = new class MysGame2 {
|
|
3
|
+
#games = /* @__PURE__ */ new Map();
|
|
4
|
+
get num() {
|
|
5
|
+
return this.#games.size;
|
|
6
|
+
}
|
|
7
|
+
match(prefix) {
|
|
8
|
+
if (!prefix || this.#games.size === 0) return void 0;
|
|
9
|
+
for (const Game of this.#games.values()) {
|
|
10
|
+
if (Game.prefix.test(prefix)) return Game;
|
|
11
|
+
}
|
|
12
|
+
return void 0;
|
|
13
|
+
}
|
|
14
|
+
RegisterGame(Game) {
|
|
15
|
+
this.#games.set(Game.columnKey, Game);
|
|
16
|
+
}
|
|
17
|
+
async forEachGame(fn) {
|
|
18
|
+
if (this.num === 0) return;
|
|
19
|
+
for (const Game of this.#games.values()) {
|
|
20
|
+
if (await fn(Game) === "break") break;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}();
|
|
24
|
+
|
|
25
|
+
export {
|
|
26
|
+
MysGame
|
|
27
|
+
};
|