wx2tg-puppet 2.0.4 → 2.0.6

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.js CHANGED
@@ -37,7 +37,7 @@ const WEVIDEO_1 = require("./core/WEVIDEO");
37
37
  Object.defineProperty(exports, "WeVideo", { enumerable: true, get: function () { return WEVIDEO_1.WeVideo; } });
38
38
  const URLLINK_1 = require("./core/URLLINK");
39
39
  Object.defineProperty(exports, "UrlLink", { enumerable: true, get: function () { return URLLINK_1.UrlLink; } });
40
- const MessageType_1 = require("./type/MessageType");
40
+ const MessageType_1 = require("./types/MessageType");
41
41
  const Friendship_1 = require("./core/Friendship");
42
42
  const UserApi_1 = require("./api/UserApi");
43
43
  const ContactEntity_1 = require("./entities/ContactEntity");
@@ -59,6 +59,8 @@ class WxBot extends events_1.EventEmitter {
59
59
  qrcode(style) {
60
60
  return __awaiter(this, void 0, void 0, function* () {
61
61
  const config = yield config_service_1.configService.get();
62
+ if (!config)
63
+ return null;
62
64
  const res = yield UserApi_1.userApi.GetQRCode({
63
65
  "Style": style || 8,
64
66
  "Wxid": config === null || config === void 0 ? void 0 : config.wxid
@@ -84,7 +86,6 @@ class WxBot extends events_1.EventEmitter {
84
86
  response = yield LoginApi_1.loginApi.LoginGetQRCar({
85
87
  "DeviceID": (config === null || config === void 0 ? void 0 : config.deviceId) || "",
86
88
  "DeviceName": (config === null || config === void 0 ? void 0 : config.DeviceName) || "",
87
- "OSModel": "",
88
89
  "Proxy": {
89
90
  "ProxyIp": "",
90
91
  "ProxyPassword": "",
@@ -96,7 +97,6 @@ class WxBot extends events_1.EventEmitter {
96
97
  response = yield LoginApi_1.loginApi.LoginGetQRMac({
97
98
  "DeviceID": (config === null || config === void 0 ? void 0 : config.deviceId) || "",
98
99
  "DeviceName": (config === null || config === void 0 ? void 0 : config.DeviceName) || "",
99
- "OSModel": "",
100
100
  "Proxy": {
101
101
  "ProxyIp": "",
102
102
  "ProxyPassword": "",
@@ -108,7 +108,6 @@ class WxBot extends events_1.EventEmitter {
108
108
  response = yield LoginApi_1.loginApi.LoginGetQRPad({
109
109
  "DeviceID": (config === null || config === void 0 ? void 0 : config.deviceId) || "",
110
110
  "DeviceName": (config === null || config === void 0 ? void 0 : config.DeviceName) || "",
111
- "OSModel": "",
112
111
  "Proxy": {
113
112
  "ProxyIp": "",
114
113
  "ProxyPassword": "",
@@ -120,7 +119,17 @@ class WxBot extends events_1.EventEmitter {
120
119
  response = yield LoginApi_1.loginApi.LoginGetQRWin({
121
120
  "DeviceID": (config === null || config === void 0 ? void 0 : config.deviceId) || "",
122
121
  "DeviceName": (config === null || config === void 0 ? void 0 : config.DeviceName) || "",
123
- "OSModel": "",
122
+ "Proxy": {
123
+ "ProxyIp": "",
124
+ "ProxyPassword": "",
125
+ "ProxyUser": ""
126
+ }
127
+ });
128
+ break;
129
+ case 'ipadX':
130
+ response = yield LoginApi_1.loginApi.LoginGetQRx({
131
+ "DeviceID": (config === null || config === void 0 ? void 0 : config.deviceId) || "",
132
+ "DeviceName": (config === null || config === void 0 ? void 0 : config.DeviceName) || "",
124
133
  "Proxy": {
125
134
  "ProxyIp": "",
126
135
  "ProxyPassword": "",
@@ -133,7 +142,6 @@ class WxBot extends events_1.EventEmitter {
133
142
  response = yield LoginApi_1.loginApi.LoginGetQR({
134
143
  "DeviceID": (config === null || config === void 0 ? void 0 : config.deviceId) || "",
135
144
  "DeviceName": (config === null || config === void 0 ? void 0 : config.DeviceName) || "",
136
- "OSModel": "",
137
145
  "Proxy": {
138
146
  "ProxyIp": "",
139
147
  "ProxyPassword": "",
@@ -284,7 +292,7 @@ class WxBot extends events_1.EventEmitter {
284
292
  this.msgInterval = setInterval(() => __awaiter(this, void 0, void 0, function* () {
285
293
  var _a;
286
294
  const resp = yield MsgApi_1.msgApi.Sync({
287
- "wxid": userName,
295
+ "Wxid": userName,
288
296
  "Scene": 0,
289
297
  "Synckey": ""
290
298
  });
@@ -407,7 +415,11 @@ class WxBot extends events_1.EventEmitter {
407
415
  this.clearAllIntervals(); // 确保清理所有定时器
408
416
  const config = yield config_service_1.configService.get();
409
417
  if (config && config.wxid) {
410
- const resp = yield MsgApi_1.msgApi.Sync(config.wxid);
418
+ const resp = yield MsgApi_1.msgApi.Sync({
419
+ "Wxid": config.wxid,
420
+ "Scene": 0,
421
+ "Synckey": ""
422
+ });
411
423
  if (resp.data.Code === 0) {
412
424
  yield this.loginSuccess(config.wxid);
413
425
  }
@@ -0,0 +1,14 @@
1
+ export interface ApiResponse {
2
+ /** 状态码 */
3
+ Code: number;
4
+ /** 是否成功 */
5
+ Success: boolean;
6
+ /** 响应消息 */
7
+ Message: string;
8
+ /** 响应数据 */
9
+ Data: any;
10
+ /** 62数据(可选) */
11
+ Data62?: string;
12
+ /** 设备ID(可选) */
13
+ DeviceId?: string;
14
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,29 @@
1
+ export declare const MessageType: {
2
+ Unknown: string;
3
+ FileStart: string;
4
+ File: string;
5
+ Voice: string;
6
+ Contact: string;
7
+ Emoji: string;
8
+ Image: string;
9
+ Text: string;
10
+ Video: string;
11
+ Url: string;
12
+ RoomInvitation: string;
13
+ MiniApp: string;
14
+ AppMsg: string;
15
+ Link: string;
16
+ AddFriend: string;
17
+ Quote: string;
18
+ Transfer: string;
19
+ RedPacket: string;
20
+ VideoAccount: string;
21
+ Revoke: string;
22
+ Pat: string;
23
+ Location: string;
24
+ FunctionMsg: string;
25
+ NewMonmentTimeline: string;
26
+ ChatHistroy: string;
27
+ Voip: string;
28
+ RealTimeLocation: string;
29
+ };
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MessageType = void 0;
4
+ exports.MessageType = {
5
+ Unknown: 'unknown', // 未知类型
6
+ FileStart: 'file_start', // 文件开始
7
+ File: 'file', // 文件发送结束
8
+ Voice: 'voice', // 语音
9
+ Contact: 'contact', // 名片
10
+ Emoji: 'emoji', // 表情
11
+ Image: 'image', // 图片
12
+ Text: 'text', // 文本
13
+ Video: 'video', // 视频
14
+ Url: 'link', // 链接
15
+ RoomInvitation: 'room_invitation', // 群邀请
16
+ MiniApp: 'mini_app', // 小程序消息
17
+ AppMsg: 'app_msg', // app消息
18
+ Link: 'link', // 公众号链接
19
+ AddFriend: 'add_friend', // 添加好友通知
20
+ Quote: 'quote', // 引用消息
21
+ Transfer: 'transfer', //转账
22
+ RedPacket: 'red_packet', //红包
23
+ VideoAccount: 'video_account', // 视频号消息
24
+ Revoke: 'revoke', // 撤回消息
25
+ Pat: 'pat', // 拍一拍
26
+ Location: 'location', // 位置消息
27
+ FunctionMsg: 'function_msg', // 微信团队消息
28
+ NewMonmentTimeline: 'new_monment_timeline', // 朋友圈更新
29
+ ChatHistroy: 'chat_histroy', // 聊天记录
30
+ Voip: 'voip', // voip消息
31
+ RealTimeLocation: 'real_time_location', // 实时位置共享
32
+ };
@@ -1,2 +1,2 @@
1
- export declare const axiosInstance: Axios.AxiosInstance;
1
+ export declare const axiosInstance: import("axios").AxiosInstance;
2
2
  export declare function setBaseUrl(baseUrl: string): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wx2tg-puppet",
3
- "version": "2.0.4",
3
+ "version": "2.0.6",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [
@@ -23,7 +23,6 @@
23
23
  "license": "ISC",
24
24
  "description": "微信机器人核心库,可作为依赖被其他项目引入。",
25
25
  "devDependencies": {
26
- "@types/axios": "^0.9.36",
27
26
  "@types/json-bigint": "^1.0.4",
28
27
  "@types/qrcode-terminal": "^0.12.2",
29
28
  "ts-node": "^10.9.2",