feat: 支持 tg 跨聊天回复和部分回复

This commit is contained in:
Clansty 2024-05-10 21:26:33 +08:00
parent 6b913beb8f
commit da207af74f
1 changed files with 5 additions and 4 deletions

View File

@ -705,10 +705,11 @@ export default class ForwardService {
// 处理回复 // 处理回复
let source: Quotable; let source: Quotable;
if (message.replyToMsgId) { if (message.replyToMsgId || message.replyTo) {
markdownCompatible = false; markdownCompatible = false;
try { try {
const quote = await db.message.findFirst({ console.log(message.replyTo)
const quote = message.replyToMsgId && await db.message.findFirst({
where: { where: {
tgChatId: Number(pair.tg.id), tgChatId: Number(pair.tg.id),
tgMsgId: message.replyToMsgId, tgMsgId: message.replyToMsgId,
@ -717,7 +718,7 @@ export default class ForwardService {
}); });
if (quote) { if (quote) {
source = { source = {
message: quote.brief || ' ', message: message.replyTo?.quoteText || quote.brief || ' ',
seq: quote.seq, seq: quote.seq,
rand: Number(quote.rand), rand: Number(quote.rand),
user_id: Number(quote.qqSenderId), user_id: Number(quote.qqSenderId),
@ -726,7 +727,7 @@ export default class ForwardService {
} }
else { else {
source = { source = {
message: '回复消息找不到', message: message.replyTo?.quoteText || '回复消息找不到',
seq: 1, seq: 1,
time: Math.floor(new Date().getTime() / 1000), time: Math.floor(new Date().getTime() / 1000),
rand: 1, rand: 1,