wx2tg-puppet 2.1.4 → 2.1.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.
@@ -1,4 +1,4 @@
1
1
  import { ResponseMsg } from "../core/Message";
2
- export declare const say: (content: any, toWxid: string, ats: any) => Promise<import("axios").AxiosResponse<import("../types/ApiResponse").ApiResponse, any> | ResponseMsg | null | undefined>;
2
+ export declare const say: (content: any, toWxid: string, ats: any) => Promise<ResponseMsg | null | undefined>;
3
3
  export declare const quote: (obj: any, toWxid: string) => Promise<ResponseMsg | null>;
4
4
  export declare const revoke: (content: any) => Promise<import("axios").AxiosResponse<import("../types/ApiResponse").ApiResponse, any>>;
@@ -128,7 +128,7 @@ const say = (content, toWxid, ats) => __awaiter(void 0, void 0, void 0, function
128
128
  if (imgRes.data.Code !== 0) {
129
129
  throw new Error(`上传图片失败: ${imgRes.data.Message}`);
130
130
  }
131
- return imgRes;
131
+ return new Message_1.ResponseMsg(imgRes.data.Data);
132
132
  case 'other':
133
133
  // 直接从 FileBox 获取文件内容
134
134
  const fileBuffer = yield content.toBuffer();
@@ -185,7 +185,7 @@ const say = (content, toWxid, ats) => __awaiter(void 0, void 0, void 0, function
185
185
  if (res.data.Code !== 0) {
186
186
  throw new Error(`发送视频失败: ${res.data.Message}`);
187
187
  }
188
- return new Message_1.ResponseMsg(res.data.Data.List[0]);
188
+ return new Message_1.ResponseMsg(res.data.Data);
189
189
  }
190
190
  else if (content instanceof VOICE_1.Voice) {
191
191
  const res = yield MsgApi_1.msgApi.SendVoice({
@@ -198,7 +198,7 @@ const say = (content, toWxid, ats) => __awaiter(void 0, void 0, void 0, function
198
198
  if (res.data.Code !== 0) {
199
199
  throw new Error(`发送语音失败: ${res.data.Message}`);
200
200
  }
201
- return new Message_1.ResponseMsg(res.data.Data.List[0]);
201
+ return new Message_1.ResponseMsg(res.data.Data);
202
202
  }
203
203
  // }else if(content instanceof MiniApp){
204
204
  // return SendMiniApp({
@@ -38,7 +38,7 @@ export declare class Contact {
38
38
  /**
39
39
  * Send text, Contact, or file to contact, return the message which the bot sent (only puppet-padplus supported).
40
40
  */
41
- say(content: any): Promise<import("axios").AxiosResponse<import("../types/ApiResponse").ApiResponse, any> | ResponseMsg | null | undefined>;
41
+ say(content: any): Promise<ResponseMsg | null | undefined>;
42
42
  quoteSay(text: string, replyMsgId: string, fromId: string, content: string): Promise<ResponseMsg | null>;
43
43
  /**
44
44
  * Check if contact is self
@@ -79,7 +79,7 @@ export declare class Message {
79
79
  * Reply a text, media file, or contact message to the sender.
80
80
  * Returns the message which the bot sent (only puppet-padplus supported).
81
81
  */
82
- say(text: string): Promise<Axios.AxiosResponse<import("../types/ApiResponse").ApiResponse, any> | ResponseMsg | null | undefined>;
82
+ say(text: string): Promise<ResponseMsg | null | undefined>;
83
83
  quoteSay(text: string, replyMsgId: string, fromId: string, content: string): Promise<ResponseMsg | null>;
84
84
  /**
85
85
  * Get the type from the message.
@@ -106,6 +106,9 @@ class Message {
106
106
  let obj = Message.getXmlToJson(msg.Content);
107
107
  msg.Content = obj.msg.appmsg.title;
108
108
  this.refer = obj.msg.appmsg.refermsg;
109
+ if (this.refer.type !== 1 && this.refer.type !== 49) {
110
+ this.refer.content = '图片/文件/其他消息';
111
+ }
109
112
  }
110
113
  }
111
114
  /**
@@ -610,9 +613,9 @@ Message.Type = MessageType_1.MessageType;
610
613
  class ResponseMsg {
611
614
  constructor(obj) {
612
615
  var _a, _b;
613
- this.newMsgId = (obj.NewMsgId || obj.newMsgId) + '';
614
- this.msgId = (obj.ClientMsgid || obj.clientMsgId) ? (obj.ClientMsgid || obj.clientMsgId) + '' : '';
615
- this.createTime = obj.Createtime || obj.createTime;
616
+ this.newMsgId = (obj.NewMsgId || obj.newMsgId || obj.Newmsgid) + '';
617
+ this.msgId = (obj.ClientMsgid || obj.clientMsgId || obj.ClientMsgId || obj.Msgid || obj.msgId) ? (obj.ClientMsgid || obj.clientMsgId || obj.ClientMsgId || obj.Msgid || obj.msgId) + '' : '';
618
+ this.createTime = obj.Createtime || obj.createTime || obj.CreateTime;
616
619
  this.toWxid = ((_a = obj.ToUsetName) === null || _a === void 0 ? void 0 : _a.string) || ((_b = obj.ToUserName) === null || _b === void 0 ? void 0 : _b.string) || obj.toUserName;
617
620
  }
618
621
  revoke() {
@@ -43,7 +43,7 @@ export declare class Room {
43
43
  * Send text, media file, contact card, or text with mention @mention contact inside Room.
44
44
  * Returns the message which the bot sent (only puppet-padplus supported).
45
45
  */
46
- say(content: any, ats: string | Contact | Contact[] | null): Promise<import("axios").AxiosResponse<import("../types/ApiResponse").ApiResponse, any> | import("./Message").ResponseMsg | null | undefined>;
46
+ say(content: any, ats: string | Contact | Contact[] | null): Promise<import("./Message").ResponseMsg | null | undefined>;
47
47
  quoteSay(text: string, replyMsgId: string, fromId: string, content: string): Promise<import("./Message").ResponseMsg | null>;
48
48
  /**
49
49
  * Add contact in a room
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wx2tg-puppet",
3
- "version": "2.1.4",
3
+ "version": "2.1.6",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [