koishi-plugin-best-cave 2.3.4 → 2.3.6

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.
Files changed (2) hide show
  1. package/lib/index.js +15 -3
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -423,9 +423,21 @@ async function processMessageElements(sourceElements, newId, session) {
423
423
  result.push({ type: "text", content: el.attrs.content.trim() });
424
424
  } else if (type === "at" && el.attrs.id) {
425
425
  result.push({ type: "at", content: el.attrs.id });
426
- } else if (type === "forward" && el.children?.length) {
427
- const transformedChildren = await transform(el.children);
428
- result.push({ type: "forward", content: JSON.stringify(transformedChildren) });
426
+ } else if (type === "forward") {
427
+ const childrenToProcess = [...el.children || []];
428
+ if (Array.isArray(el.attrs.content)) {
429
+ for (const rawMessage of el.attrs.content) {
430
+ if (rawMessage && rawMessage.message) {
431
+ childrenToProcess.push(...import_koishi.h.normalize(rawMessage.message));
432
+ }
433
+ }
434
+ }
435
+ if (childrenToProcess.length > 0) {
436
+ const transformedChildren = await transform(childrenToProcess);
437
+ if (transformedChildren.length > 0) {
438
+ result.push({ type: "forward", content: JSON.stringify(transformedChildren) });
439
+ }
440
+ }
429
441
  } else if (["image", "video", "audio", "file"].includes(type) && el.attrs.src) {
430
442
  let fileIdentifier = el.attrs.src;
431
443
  if (fileIdentifier.startsWith("http")) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-best-cave",
3
3
  "description": "功能强大、高度可定制的回声洞。支持丰富的媒体类型、内容查重、人工审核、用户昵称、数据迁移以及本地/S3 双重文件存储后端。",
4
- "version": "2.3.4",
4
+ "version": "2.3.6",
5
5
  "contributors": [
6
6
  "Yis_Rime <yis_rime@outlook.com>"
7
7
  ],