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 +3 -0
- package/dist/cjs/src/common/index.js +23 -6
- package/dist/cjs/src/const/puppet-type.d.ts +1 -0
- package/dist/cjs/src/const/puppet-type.js +1 -0
- package/dist/cjs/src/package-json.js +1 -1
- package/dist/esm/src/common/index.js +23 -6
- package/dist/esm/src/const/puppet-type.d.ts +1 -0
- package/dist/esm/src/const/puppet-type.js +1 -0
- package/dist/esm/src/package-json.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -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
|
-
|
|
304
|
-
|
|
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
|
-
|
|
381
|
-
|
|
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
|
}
|
|
@@ -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
|
-
|
|
290
|
-
|
|
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
|
-
|
|
366
|
-
|
|
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
|
}
|