koishi-plugin-best-cave 2.3.4 → 2.3.5
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/lib/index.js +15 -3
- 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"
|
|
427
|
-
const
|
|
428
|
-
|
|
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.parse(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")) {
|