fix: trim redundant quoted message metadata

This commit is contained in:
xmanrui 2026-09-03 03:11:14 +08:00
parent 559ea2c5a5
commit 149f435216
7 changed files with 677 additions and 251 deletions

View file

@ -1120,7 +1120,7 @@ test('Telegram maps one reply_to_message snapshot without expanding nested repli
authorId: '123456789',
authorName: 'Harness Bot',
content: '第一层原文',
attachments: [{ kind: 'image', name: 'quoted-photo.jpg' }],
attachments: [{ kind: 'image' }],
});
assert.doesNotMatch(JSON.stringify(replied.replyTo), /不应递归/);
@ -1140,6 +1140,22 @@ test('Telegram maps one reply_to_message snapshot without expanding nested repli
}, { botId: '123456789', username: 'HarnessBot' });
assert.deepEqual(documentReply.replyTo.attachments, [{ kind: 'file', name: 'brief.pdf' }]);
assert.equal(documentReply.replyTo.authorName, 'alice');
const stickerReply = normalizeTelegramUpdate({
update_id: 18,
message: {
message_id: 12,
chat: { id: 88, type: 'private' },
from: { id: 42, is_bot: false },
text: '这个贴纸是什么意思?',
reply_to_message: {
message_id: 6,
from: { id: 41, username: 'alice' },
sticker: { file_id: 'opaque-sticker-id', file_unique_id: 'opaque-unique-id' },
},
},
}, { botId: '123456789', username: 'HarnessBot' });
assert.deepEqual(stickerReply.replyTo.attachments, [{ kind: 'image' }]);
});
test('Telegram uses TextQuote and bounded history loading when reply_to_message omits text', async () => {