wechaty-web-panel 1.6.65 → 1.6.66

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,5 +1,8 @@
1
1
  ## 更新日志
2
2
 
3
+ ### V1.6.66(2024-10-25)
4
+ 1、修复发送消息问题
5
+
3
6
  ### V1.6.62(2024-08-27)
4
7
  1、修复群消息总结CozeV3 渠道无法使用
5
8
 
@@ -14,6 +14,7 @@ const configDb_js_1 = require("../db/configDb.js");
14
14
  const puppet_type_js_1 = require("../const/puppet-type.js");
15
15
  const dayjs_1 = __importDefault(require("dayjs"));
16
16
  const chatHistory_js_1 = require("../db/chatHistory.js");
17
+ const puppetDb_js_1 = require("../db/puppetDb.js");
17
18
  async function formatContent(text) {
18
19
  text = text.replaceAll('\\n', '\n');
19
20
  const isWin = await (0, puppet_type_js_1.isWindowsPlatform)();
@@ -300,9 +301,17 @@ async function roomSay(room, contact, msg) {
300
301
  else if (msg.type === 8 && msg.url && msg.voiceLength) {
301
302
  const fileBox = file_box_1.FileBox.fromUrl(msg.url);
302
303
  fileBox.mimeType = "audio/silk";
303
- fileBox.metadata = {
304
- voiceLength: msg.voiceLength,
305
- };
304
+ const puppetInfo = await (0, puppetDb_js_1.getPuppetInfo)();
305
+ if (puppetInfo.puppetType === 'PuppetService') {
306
+ fileBox.metadata = {
307
+ duration: msg.voiceLength / 1000,
308
+ };
309
+ }
310
+ else {
311
+ fileBox.metadata = {
312
+ voiceLength: msg.voiceLength,
313
+ };
314
+ }
306
315
  await room.say(fileBox);
307
316
  }
308
317
  }
@@ -377,9 +386,17 @@ async function contactSay(contact, msg, isRoom = false) {
377
386
  else if (msg.type === 8 && msg.url && msg.voiceLength) {
378
387
  const fileBox = file_box_1.FileBox.fromUrl(msg.url);
379
388
  fileBox.mimeType = "audio/silk";
380
- fileBox.metadata = {
381
- voiceLength: msg.voiceLength,
382
- };
389
+ const puppetInfo = await (0, puppetDb_js_1.getPuppetInfo)();
390
+ if (puppetInfo.puppetType === 'PuppetService') {
391
+ fileBox.metadata = {
392
+ duration: msg.voiceLength / 1000,
393
+ };
394
+ }
395
+ else {
396
+ fileBox.metadata = {
397
+ voiceLength: msg.voiceLength,
398
+ };
399
+ }
383
400
  await contact.say(fileBox);
384
401
  }
385
402
  }
@@ -23,6 +23,7 @@ export namespace PUPPET_MAP {
23
23
  const PuppetOICQ: string;
24
24
  const PuppetLark: string;
25
25
  const PuppetService: string;
26
+ const PuppetMatrix: string;
26
27
  }
27
28
  export const WRAP_REPLACE_PUPPET: string[];
28
29
  export const SEND_APP_MSG_PUPPET: string[];
@@ -28,6 +28,7 @@ exports.PUPPET_MAP = {
28
28
  // https://github.com/wechaty/puppet-lark
29
29
  'PuppetLark': '飞书协议',
30
30
  'PuppetService': '企微协议',
31
+ 'PuppetMatrix': 'ipad协议',
31
32
  };
32
33
  // 需要处理换行的puppet 主要是 windows 平台下需要把\n 换成\r\n
33
34
  exports.WRAP_REPLACE_PUPPET = [
@@ -6,7 +6,7 @@ exports.packageJson = void 0;
6
6
  */
7
7
  exports.packageJson = {
8
8
  "name": "wechaty-web-panel",
9
- "version": "1.6.65",
9
+ "version": "1.6.66",
10
10
  "description": "智能微秘书插件",
11
11
  "exports": {
12
12
  ".": {
@@ -8,6 +8,7 @@ import { allConfig } from '../db/configDb.js';
8
8
  import { getPuppetEol, isWindowsPlatform } from "../const/puppet-type.js";
9
9
  import dayjs from "dayjs";
10
10
  import { addHistory } from "../db/chatHistory.js";
11
+ import { getPuppetInfo } from "../db/puppetDb.js";
11
12
  async function formatContent(text) {
12
13
  text = text.replaceAll('\\n', '\n');
13
14
  const isWin = await isWindowsPlatform();
@@ -286,9 +287,17 @@ async function roomSay(room, contact, msg) {
286
287
  else if (msg.type === 8 && msg.url && msg.voiceLength) {
287
288
  const fileBox = FileBox.fromUrl(msg.url);
288
289
  fileBox.mimeType = "audio/silk";
289
- fileBox.metadata = {
290
- voiceLength: msg.voiceLength,
291
- };
290
+ const puppetInfo = await getPuppetInfo();
291
+ if (puppetInfo.puppetType === 'PuppetService') {
292
+ fileBox.metadata = {
293
+ duration: msg.voiceLength / 1000,
294
+ };
295
+ }
296
+ else {
297
+ fileBox.metadata = {
298
+ voiceLength: msg.voiceLength,
299
+ };
300
+ }
292
301
  await room.say(fileBox);
293
302
  }
294
303
  }
@@ -362,9 +371,17 @@ async function contactSay(contact, msg, isRoom = false) {
362
371
  else if (msg.type === 8 && msg.url && msg.voiceLength) {
363
372
  const fileBox = FileBox.fromUrl(msg.url);
364
373
  fileBox.mimeType = "audio/silk";
365
- fileBox.metadata = {
366
- voiceLength: msg.voiceLength,
367
- };
374
+ const puppetInfo = await getPuppetInfo();
375
+ if (puppetInfo.puppetType === 'PuppetService') {
376
+ fileBox.metadata = {
377
+ duration: msg.voiceLength / 1000,
378
+ };
379
+ }
380
+ else {
381
+ fileBox.metadata = {
382
+ voiceLength: msg.voiceLength,
383
+ };
384
+ }
368
385
  await contact.say(fileBox);
369
386
  }
370
387
  }
@@ -23,6 +23,7 @@ export namespace PUPPET_MAP {
23
23
  const PuppetOICQ: string;
24
24
  const PuppetLark: string;
25
25
  const PuppetService: string;
26
+ const PuppetMatrix: string;
26
27
  }
27
28
  export const WRAP_REPLACE_PUPPET: string[];
28
29
  export const SEND_APP_MSG_PUPPET: string[];
@@ -25,6 +25,7 @@ export const PUPPET_MAP = {
25
25
  // https://github.com/wechaty/puppet-lark
26
26
  'PuppetLark': '飞书协议',
27
27
  'PuppetService': '企微协议',
28
+ 'PuppetMatrix': 'ipad协议',
28
29
  };
29
30
  // 需要处理换行的puppet 主要是 windows 平台下需要把\n 换成\r\n
30
31
  export const WRAP_REPLACE_PUPPET = [
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export const packageJson = {
5
5
  "name": "wechaty-web-panel",
6
- "version": "1.6.65",
6
+ "version": "1.6.66",
7
7
  "description": "智能微秘书插件",
8
8
  "exports": {
9
9
  ".": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wechaty-web-panel",
3
- "version": "1.6.65",
3
+ "version": "1.6.66",
4
4
  "description": "智能微秘书插件",
5
5
  "exports": {
6
6
  ".": {