koishi-plugin-best-cave 2.3.13 → 2.3.14

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 +18 -1
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -435,7 +435,24 @@ async function processMessageElements(sourceElements, newId, session, config, lo
435
435
  if (!node.message || !Array.isArray(node.message)) continue;
436
436
  const userId = node.sender?.user_id;
437
437
  const userName = node.sender?.nickname;
438
- const contentElements = await transform(import_koishi.h.normalize(node.message));
438
+ const elementsToProcess = node.message.map((segment) => {
439
+ const { type: type2, data } = segment;
440
+ const attrs = { ...data };
441
+ if (type2 === "text" && typeof data.text !== "undefined") {
442
+ attrs.content = data.text;
443
+ delete attrs.text;
444
+ }
445
+ if (type2 === "at" && typeof data.qq !== "undefined") {
446
+ attrs.id = data.qq;
447
+ delete attrs.qq;
448
+ }
449
+ if (["image", "video", "audio"].includes(type2) && typeof data.url !== "undefined") {
450
+ attrs.src = data.url;
451
+ delete attrs.url;
452
+ }
453
+ return (0, import_koishi.h)(type2, attrs);
454
+ });
455
+ const contentElements = await transform(elementsToProcess);
439
456
  if (contentElements.length > 0) {
440
457
  forwardNodes.push({ userId, userName, elements: contentElements });
441
458
  }
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.13",
4
+ "version": "2.3.14",
5
5
  "contributors": [
6
6
  "Yis_Rime <yis_rime@outlook.com>"
7
7
  ],