wechaty-web-panel 1.6.44 → 1.6.46

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/CHANGELOG.md CHANGED
@@ -1,4 +1,7 @@
1
1
  ## 更新日志
2
+ ### V1.6.46(2024-03-31)
3
+ 1、优化回调细节
4
+ 2、优化文件提取规则
2
5
 
3
6
  ### V1.6.44(2024-03-11)
4
7
  1、修复引用原文没有生效
@@ -116,6 +116,7 @@ async function updateContactInfo(that, noCache = false) {
116
116
  res.push(obj);
117
117
  }
118
118
  await updateFriendInfo(res, 80);
119
+ console.log(`更新群列表完毕,共获取到${realContact.length}个好友信息`);
119
120
  }
120
121
  catch (e) {
121
122
  console.log('e', e);
@@ -162,6 +163,7 @@ async function updateRoomInfo(that, noCache = false) {
162
163
  res.push(obj);
163
164
  }
164
165
  await updateRoomsInfo(res, 80);
166
+ console.log(`更新群列表完毕,共获取到${roomList.length}个群聊`);
165
167
  }
166
168
  catch (e) {
167
169
  console.log('e', e);
@@ -502,10 +502,12 @@ exports.delHtmlTag = delHtmlTag;
502
502
  * @returns {*[]}
503
503
  */
504
504
  function extractImageLinks(text) {
505
- const httpRegex = /(http:\/\/\S+\.(?:jpg|png|gif|webp|jpeg|mp4|doc|docx|xls|xlsx|ppt|pptx|avi|zip|wav|rar))/g;
506
- const httpsRegex = /(https:\/\/\S+\.(?:jpg|png|gif|webp|jpeg|mp4|doc|docx|xls|xlsx|ppt|pptx|avi|zip|wav|rar))/g;
505
+ const httpRegex = /(http:\/\/\S+\.(?:jpg|png|gif|webp|jpeg|mp4|doc|docx|xls|xlsx|ppt|pptx|avi|zip|wav|rar|pdf|txt|log))/g;
506
+ const httpsRegex = /(https:\/\/\S+\.(?:jpg|png|gif|webp|jpeg|mp4|doc|docx|xls|xlsx|ppt|pptx|avi|zip|wav|rar|pdf|txt|log))/g;
507
507
  const mdRegexHttps = /!\[[^\]]*\]\((https?:\/\/\S+)\)/g;
508
508
  const mdRegexHttp = /!\[[^\]]*\]\((http?:\/\/\S+)\)/g;
509
+ const fileRegexHttp = /\[[^\]]*\]\((http?:\/\/\S+)\)/g;
510
+ const filesRegexHttp = /\[[^\]]*\]\((https?:\/\/\S+)\)/g;
509
511
  let imageLinks = [];
510
512
  let match;
511
513
  while ((match = httpRegex.exec(text)) !== null) {
@@ -514,7 +516,7 @@ function extractImageLinks(text) {
514
516
  while ((match = httpsRegex.exec(text)) !== null) {
515
517
  imageLinks.push(match[0]);
516
518
  }
517
- while ((match = mdRegexHttp.exec(text)) !== null || (match = mdRegexHttps.exec(text)) !== null) {
519
+ while ((match = mdRegexHttp.exec(text)) !== null || (match = mdRegexHttps.exec(text)) !== null || (match = fileRegexHttp.exec(text)) !== null || (match = filesRegexHttp.exec(text)) !== null) {
518
520
  imageLinks.push(match[1]);
519
521
  }
520
522
  imageLinks = Array.from(new Set(imageLinks));
@@ -6,7 +6,7 @@ exports.packageJson = void 0;
6
6
  */
7
7
  exports.packageJson = {
8
8
  "name": "wechaty-web-panel",
9
- "version": "1.6.44",
9
+ "version": "1.6.46",
10
10
  "description": "智能微秘书插件",
11
11
  "exports": {
12
12
  ".": {
@@ -45,11 +45,12 @@ service.interceptors.response.use((response) => {
45
45
  return Promise.resolve(result);
46
46
  }
47
47
  }
48
- const res = [{ type: 1, content: '回调接口网络错误:' + response.status }];
48
+ console.log(`回调接口网络错误:${response.status}`);
49
+ const res = [{ type: 1, content: '' }];
49
50
  return Promise.resolve(res);
50
51
  }, (err) => {
51
- console.log('err', err);
52
- const res = [{ type: 1, content: '网络错误,请稍后重试' }];
52
+ console.log('回调接口网络错误:', err);
53
+ const res = [{ type: 1, content: '' }];
53
54
  return Promise.resolve(res);
54
55
  });
55
56
  /**
@@ -364,7 +364,7 @@ async function customChat({ msg, name, id, config, isMention, room, roomId, room
364
364
  if (keyword || !finalConfig?.keywords.length) {
365
365
  msg = keyword ? msg.replace(keyword, '') : msg;
366
366
  if (finalConfig.limitNum > 0 && finalConfig.limitNum <= finalConfig.usedNum) {
367
- return [{ type: 1, content: finalConfig.rechargeTip || '聊天次数已用完,请联系管理员充值' }];
367
+ return [{ type: 1, content: finalConfig.rechargeTip || '' }];
368
368
  }
369
369
  const msgArr = await (0, dispatch_js_1.dispatchBot)({
370
370
  botType: finalConfig.robotType,
@@ -1,7 +1,3 @@
1
- declare namespace _default {
2
- export { dispatchAsync };
3
- }
4
- export default _default;
5
1
  /**
6
2
  * model: 1 一对多 2 多对一 3 多对多
7
3
  * @param that wechaty实例
@@ -238,7 +238,7 @@ const unidirectionalMapper = async (message, one) => {
238
238
  20: 'CallRecord', // Call Record (voice and video, maybe group?)
239
239
  };
240
240
  const type = typeMap[message.type()];
241
- messageList.unshift(`${prefix}: ${type}`);
241
+ // messageList.unshift(`${prefix}: ${type}`)
242
242
  }
243
243
  break;
244
244
  }
@@ -458,7 +458,4 @@ async function dispatchAsync(that, msg, list) {
458
458
  }
459
459
  }
460
460
  exports.dispatchAsync = dispatchAsync;
461
- exports.default = {
462
- dispatchAsync,
463
- };
464
461
  //# sourceMappingURL=room-async-service.js.map
@@ -108,6 +108,7 @@ async function updateContactInfo(that, noCache = false) {
108
108
  res.push(obj);
109
109
  }
110
110
  await updateFriendInfo(res, 80);
111
+ console.log(`更新群列表完毕,共获取到${realContact.length}个好友信息`);
111
112
  }
112
113
  catch (e) {
113
114
  console.log('e', e);
@@ -153,6 +154,7 @@ async function updateRoomInfo(that, noCache = false) {
153
154
  res.push(obj);
154
155
  }
155
156
  await updateRoomsInfo(res, 80);
157
+ console.log(`更新群列表完毕,共获取到${roomList.length}个群聊`);
156
158
  }
157
159
  catch (e) {
158
160
  console.log('e', e);
@@ -451,10 +451,12 @@ export function delHtmlTag(str) {
451
451
  * @returns {*[]}
452
452
  */
453
453
  export function extractImageLinks(text) {
454
- const httpRegex = /(http:\/\/\S+\.(?:jpg|png|gif|webp|jpeg|mp4|doc|docx|xls|xlsx|ppt|pptx|avi|zip|wav|rar))/g;
455
- const httpsRegex = /(https:\/\/\S+\.(?:jpg|png|gif|webp|jpeg|mp4|doc|docx|xls|xlsx|ppt|pptx|avi|zip|wav|rar))/g;
454
+ const httpRegex = /(http:\/\/\S+\.(?:jpg|png|gif|webp|jpeg|mp4|doc|docx|xls|xlsx|ppt|pptx|avi|zip|wav|rar|pdf|txt|log))/g;
455
+ const httpsRegex = /(https:\/\/\S+\.(?:jpg|png|gif|webp|jpeg|mp4|doc|docx|xls|xlsx|ppt|pptx|avi|zip|wav|rar|pdf|txt|log))/g;
456
456
  const mdRegexHttps = /!\[[^\]]*\]\((https?:\/\/\S+)\)/g;
457
457
  const mdRegexHttp = /!\[[^\]]*\]\((http?:\/\/\S+)\)/g;
458
+ const fileRegexHttp = /\[[^\]]*\]\((http?:\/\/\S+)\)/g;
459
+ const filesRegexHttp = /\[[^\]]*\]\((https?:\/\/\S+)\)/g;
458
460
  let imageLinks = [];
459
461
  let match;
460
462
  while ((match = httpRegex.exec(text)) !== null) {
@@ -463,7 +465,7 @@ export function extractImageLinks(text) {
463
465
  while ((match = httpsRegex.exec(text)) !== null) {
464
466
  imageLinks.push(match[0]);
465
467
  }
466
- while ((match = mdRegexHttp.exec(text)) !== null || (match = mdRegexHttps.exec(text)) !== null) {
468
+ while ((match = mdRegexHttp.exec(text)) !== null || (match = mdRegexHttps.exec(text)) !== null || (match = fileRegexHttp.exec(text)) !== null || (match = filesRegexHttp.exec(text)) !== null) {
467
469
  imageLinks.push(match[1]);
468
470
  }
469
471
  imageLinks = Array.from(new Set(imageLinks));
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export const packageJson = {
5
5
  "name": "wechaty-web-panel",
6
- "version": "1.6.44",
6
+ "version": "1.6.46",
7
7
  "description": "智能微秘书插件",
8
8
  "exports": {
9
9
  ".": {
@@ -38,11 +38,12 @@ service.interceptors.response.use((response) => {
38
38
  return Promise.resolve(result);
39
39
  }
40
40
  }
41
- const res = [{ type: 1, content: '回调接口网络错误:' + response.status }];
41
+ console.log(`回调接口网络错误:${response.status}`);
42
+ const res = [{ type: 1, content: '' }];
42
43
  return Promise.resolve(res);
43
44
  }, (err) => {
44
- console.log('err', err);
45
- const res = [{ type: 1, content: '网络错误,请稍后重试' }];
45
+ console.log('回调接口网络错误:', err);
46
+ const res = [{ type: 1, content: '' }];
46
47
  return Promise.resolve(res);
47
48
  });
48
49
  /**
@@ -347,7 +347,7 @@ async function customChat({ msg, name, id, config, isMention, room, roomId, room
347
347
  if (keyword || !finalConfig?.keywords.length) {
348
348
  msg = keyword ? msg.replace(keyword, '') : msg;
349
349
  if (finalConfig.limitNum > 0 && finalConfig.limitNum <= finalConfig.usedNum) {
350
- return [{ type: 1, content: finalConfig.rechargeTip || '聊天次数已用完,请联系管理员充值' }];
350
+ return [{ type: 1, content: finalConfig.rechargeTip || '' }];
351
351
  }
352
352
  const msgArr = await dispatchBot({
353
353
  botType: finalConfig.robotType,
@@ -1,7 +1,3 @@
1
- declare namespace _default {
2
- export { dispatchAsync };
3
- }
4
- export default _default;
5
1
  /**
6
2
  * model: 1 一对多 2 多对一 3 多对多
7
3
  * @param that wechaty实例
@@ -232,7 +232,7 @@ const unidirectionalMapper = async (message, one) => {
232
232
  20: 'CallRecord', // Call Record (voice and video, maybe group?)
233
233
  };
234
234
  const type = typeMap[message.type()];
235
- messageList.unshift(`${prefix}: ${type}`);
235
+ // messageList.unshift(`${prefix}: ${type}`)
236
236
  }
237
237
  break;
238
238
  }
@@ -452,7 +452,4 @@ async function dispatchAsync(that, msg, list) {
452
452
  }
453
453
  }
454
454
  export { dispatchAsync };
455
- export default {
456
- dispatchAsync,
457
- };
458
455
  //# sourceMappingURL=room-async-service.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wechaty-web-panel",
3
- "version": "1.6.44",
3
+ "version": "1.6.46",
4
4
  "description": "智能微秘书插件",
5
5
  "exports": {
6
6
  ".": {