fix:Fix the issue where quoting a message in replies was ineffective

Previous behavior:
Replies visually displayed a quote block, but the quoted content was blank or invalid, and clicking to jump to the original message also failed.

Fixed behavior:
The quote now correctly references the original message, displaying its actual content and enabling a functional jump to the quoted message.
This commit is contained in:
venti1112 committed 2026-05-06 15:53:11 +08:00
1 parent 4a92292e49
commit de7533ca81
8 files changed
+407 -27

No files matched your search

+18 -1
View File
@@ -7,6 +7,7 @@ import type { JsonValue, JsonObject } from './types';
export interface ParseMessageOptions {
resolveReplySequence?: (replyMessageId: number) => number | null;
resolveReplyMeta?: (replyMessageId: number) => { senderUin: number; time: number; random: number } | null;
musicSignUrl?: string;
}
@@ -102,7 +103,23 @@ async function segmentToElement(type: string, data: Record<string, unknown>, opt
if (options?.resolveReplySequence) {
const resolved = options.resolveReplySequence(id);
if (typeof resolved === 'number' && resolved > 0) {
return { type: 'reply', replySeq: resolved };
const element: MessageElement = {
type: 'reply',
replySeq: resolved,
replyMessageId: id // Keep the original messageId for logging
};
// Try to get additional meta info for better reply display
if (options?.resolveReplyMeta) {
const meta = options.resolveReplyMeta(id);
if (meta) {
element.replySenderUin = meta.senderUin;
element.replyTime = meta.time;
element.replyRandom = meta.random;
}
}
return element;
}
}