wx2tg-puppet 3.0.0 → 3.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.
@@ -136,17 +136,19 @@ const say = (content, toWxid, ats) => __awaiter(void 0, void 0, void 0, function
136
136
  return new Message_1.ResponseMsg(imgRes.data.Data);
137
137
  case 'other':
138
138
  // 直接从 FileBox 获取文件内容
139
- // const fileBuffer = await content.toBuffer();
140
- // const fileBlob = new Blob([fileBuffer], { type: 'application/octet-stream' });
139
+ const fileBuffer = yield content.toBuffer();
140
+ const fileBlob = new Blob([fileBuffer], { type: 'application/octet-stream' });
141
141
  // 创建 FormData
142
- // const formData = new FormData();
143
- // formData.append('wxid', config?.wxid || '');
144
- // formData.append('file', fileBlob, fileName);
145
- const fileBase64 = yield content.toBase64();
146
- const res = yield ToolsApi_1.toolsApi.UploadAppAttachApi({
147
- "Wxid": config === null || config === void 0 ? void 0 : config.wxid,
148
- "fileData": fileBase64
149
- });
142
+ const formData = new FormData();
143
+ formData.append('wxid', (config === null || config === void 0 ? void 0 : config.wxid) || '');
144
+ formData.append('file', fileBlob, fileName);
145
+ const res = yield ToolsApi_1.toolsApi.UploadFileBinary(formData);
146
+ // const fileBase64 = await content.toBase64()
147
+ //
148
+ // const res = await toolsApi.UploadAppAttachApi({
149
+ // "Wxid": config?.wxid,
150
+ // "fileData": fileBase64
151
+ // })
150
152
  if (res.data.Code !== 0) {
151
153
  throw new Error(`上传文件失败: ${res.data.Message}`);
152
154
  }
package/dist/index.js CHANGED
@@ -192,9 +192,9 @@ class WxBot extends events_1.EventEmitter {
192
192
  }
193
193
  const data = response.data;
194
194
  this.uuid = data.Data.Uuid;
195
- const match = data.Data.QrUrl.match(/[?&]url=([^&]+)/);
196
- if (match && match[1]) {
197
- const qrLink = decodeURIComponent(match[1]);
195
+ const match = data.Data.QrUrl.match(/[?&](url|data)=([^&]+)/);
196
+ if (match && match[2]) {
197
+ const qrLink = decodeURIComponent(match[2]);
198
198
  this.emit('scan', {
199
199
  content: qrLink
200
200
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wx2tg-puppet",
3
- "version": "3.0.0",
3
+ "version": "3.0.2",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [