wx2tg-puppet 2.2.3 → 2.2.5
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/dist/index.d.ts +1 -0
- package/dist/index.js +22 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -61,6 +61,7 @@ export declare class WxBot extends EventEmitter {
|
|
|
61
61
|
clearCache(): Promise<void>;
|
|
62
62
|
login(): Promise<void>;
|
|
63
63
|
start(): Promise<void>;
|
|
64
|
+
loginTwice(): Promise<boolean>;
|
|
64
65
|
static get Contact(): typeof Contact;
|
|
65
66
|
get Contact(): typeof Contact;
|
|
66
67
|
static get Room(): typeof Room;
|
package/dist/index.js
CHANGED
|
@@ -462,6 +462,7 @@ class WxBot extends events_1.EventEmitter {
|
|
|
462
462
|
if (data.Code !== 0) {
|
|
463
463
|
// Code不为0,增加失败计数
|
|
464
464
|
this.syncFailureCount++;
|
|
465
|
+
yield new Promise(resolve => setTimeout(resolve, 2000));
|
|
465
466
|
if (this.syncFailureCount >= 10) {
|
|
466
467
|
// 连续失败10次,退出登录
|
|
467
468
|
this.syncFailureCount = 0; // 重置计数器
|
|
@@ -660,6 +661,27 @@ class WxBot extends events_1.EventEmitter {
|
|
|
660
661
|
}
|
|
661
662
|
});
|
|
662
663
|
}
|
|
664
|
+
loginTwice() {
|
|
665
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
666
|
+
const config = yield config_service_1.configService.get();
|
|
667
|
+
if (!config) {
|
|
668
|
+
return false;
|
|
669
|
+
}
|
|
670
|
+
const resp = yield MsgApi_1.msgApi.Sync({
|
|
671
|
+
"Wxid": config === null || config === void 0 ? void 0 : config.wxid,
|
|
672
|
+
"Scene": 0,
|
|
673
|
+
"Synckey": ""
|
|
674
|
+
});
|
|
675
|
+
yield LoginApi_1.loginApi.LoginTwiceAutoAuth(config === null || config === void 0 ? void 0 : config.wxid);
|
|
676
|
+
if (yield this.checkSyncLoginStatus(resp.data, config === null || config === void 0 ? void 0 : config.wxid)) {
|
|
677
|
+
yield this.loginSuccess(config.wxid);
|
|
678
|
+
return true;
|
|
679
|
+
}
|
|
680
|
+
else {
|
|
681
|
+
return false;
|
|
682
|
+
}
|
|
683
|
+
});
|
|
684
|
+
}
|
|
663
685
|
static get Contact() {
|
|
664
686
|
return Contact_1.Contact;
|
|
665
687
|
}
|