From 523bca933eb76f33a8f6d2e5327508bf1218d965 Mon Sep 17 00:00:00 2001 From: zhiyu1998 <542716863@qq.com> Date: Thu, 22 Aug 2024 12:24:54 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=A6=84=20reactor:=20=E9=87=8D=E6=9E=84`ti?= =?UTF-8?q?eba`=E8=A7=A3=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/tools.js | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/apps/tools.js b/apps/tools.js index b99cd72..fff1165 100644 --- a/apps/tools.js +++ b/apps/tools.js @@ -1918,21 +1918,31 @@ export class tools extends plugin { } e.reply(sendContent, true); const others = postList.slice(1); - const reply = others.map(item => { - if (item?.content?.[0]?.cdn_src !== undefined) { - return { - message: segment.image(item?.content?.[0]?.cdn_src), + const reply = others.flatMap(item => { + if (!item.content || item.content.length === 0) return []; + + return item.content.map(floor => { + const commonData = { nickname: e.sender.card || e.user_id, user_id: e.user_id, + }; + + if (floor?.cdn_src) { + return { + ...commonData, + message: segment.image(floor.cdn_src) + }; + } else if (floor?.text) { + return { + ...commonData, + message: { type: 'text', text: floor.text || '-' } + }; } - } else if (item?.content?.[0]?.text !== undefined) { - return { - message: { type: 'text', text: item?.content?.[0].text || '-'}, - nickname: e.sender.card || e.user_id, - user_id: e.user_id, - } - } + + return null; + }).filter(Boolean); // 过滤掉 null 的值 }); + e.reply(await Bot.makeForwardMsg(reply)); return true; }