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.
- package/dist/action/common.js +12 -10
- package/dist/index.js +3 -3
- package/package.json +1 -1
package/dist/action/common.js
CHANGED
|
@@ -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
|
-
|
|
140
|
-
|
|
139
|
+
const fileBuffer = yield content.toBuffer();
|
|
140
|
+
const fileBlob = new Blob([fileBuffer], { type: 'application/octet-stream' });
|
|
141
141
|
// 创建 FormData
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
const
|
|
146
|
-
const
|
|
147
|
-
|
|
148
|
-
|
|
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[
|
|
197
|
-
const qrLink = decodeURIComponent(match[
|
|
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
|
});
|