From 6972cbf2453d23dc280fd0f65b8261308cdf2b4c Mon Sep 17 00:00:00 2001 From: lanyi Date: Mon, 4 Jan 2021 05:26:37 +0100 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E4=BA=86=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E5=9B=9E=E5=A4=8D=E7=9A=84=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/index.ts b/index.ts index aa9ebc9..29dd613 100644 --- a/index.ts +++ b/index.ts @@ -127,13 +127,14 @@ async function app() { } } + let isQuote = false let quote: StoredMessage | undefined let atMeCounter = 0 const processed = msg.messageChain.filter(x => { // 处理 @ if (x.type === 'At') { // 避免转发回复时的 @ - if (quote && x.target === botQQ) { + if ((quote || isQuote) && x.target === botQQ) { return atMeCounter++ === 0 } return true @@ -142,6 +143,7 @@ async function app() { if (x.type !== 'Quote') { return true } + isQuote = true quote = stored.translate(x.id) || quote return false }).map(x => { @@ -150,8 +152,8 @@ async function app() { return x } - if (x.target === botQQ) { - x = { ...x, target: quote?.author || botQQ } + if (x.target === botQQ && quote) { + x = { ...x, target: quote.author } } // 转发的消息不应该继续 @ 人,因为人可能并不在被转发的群 @@ -176,7 +178,7 @@ async function app() { processed.splice(1, 0, { type: 'Plain', text: '' }) } const firstPlain = processed[1] as Plain - firstPlain.text = `${authorName}:` + firstPlain.text + firstPlain.text = `【${authorName}】` + firstPlain.text } try {