完善了判断回复的逻辑
This commit is contained in:
parent
8ec16eb16e
commit
6972cbf245
10
index.ts
10
index.ts
@ -127,13 +127,14 @@ async function app() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let isQuote = false
|
||||||
let quote: StoredMessage | undefined
|
let quote: StoredMessage | undefined
|
||||||
let atMeCounter = 0
|
let atMeCounter = 0
|
||||||
const processed = msg.messageChain.filter(x => {
|
const processed = msg.messageChain.filter(x => {
|
||||||
// 处理 @
|
// 处理 @
|
||||||
if (x.type === 'At') {
|
if (x.type === 'At') {
|
||||||
// 避免转发回复时的 @
|
// 避免转发回复时的 @
|
||||||
if (quote && x.target === botQQ) {
|
if ((quote || isQuote) && x.target === botQQ) {
|
||||||
return atMeCounter++ === 0
|
return atMeCounter++ === 0
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
@ -142,6 +143,7 @@ async function app() {
|
|||||||
if (x.type !== 'Quote') {
|
if (x.type !== 'Quote') {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
isQuote = true
|
||||||
quote = stored.translate(x.id) || quote
|
quote = stored.translate(x.id) || quote
|
||||||
return false
|
return false
|
||||||
}).map(x => {
|
}).map(x => {
|
||||||
@ -150,8 +152,8 @@ async function app() {
|
|||||||
return x
|
return x
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x.target === botQQ) {
|
if (x.target === botQQ && quote) {
|
||||||
x = { ...x, target: quote?.author || botQQ }
|
x = { ...x, target: quote.author }
|
||||||
}
|
}
|
||||||
|
|
||||||
// 转发的消息不应该继续 @ 人,因为人可能并不在被转发的群
|
// 转发的消息不应该继续 @ 人,因为人可能并不在被转发的群
|
||||||
@ -176,7 +178,7 @@ async function app() {
|
|||||||
processed.splice(1, 0, { type: 'Plain', text: '' })
|
processed.splice(1, 0, { type: 'Plain', text: '' })
|
||||||
}
|
}
|
||||||
const firstPlain = processed[1] as Plain
|
const firstPlain = processed[1] as Plain
|
||||||
firstPlain.text = `${authorName}:` + firstPlain.text
|
firstPlain.text = `【${authorName}】` + firstPlain.text
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user