Merge pull request #442 from pk5ls20/feat/better-forward-msg

feat: better fake forwardMsg display
This commit is contained in:
手瓜一十雪 2024-10-20 08:14:18 +08:00 committed by GitHub
commit e818e79d20
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 3 deletions

View File

@ -363,6 +363,10 @@ export class PacketMultiMsgElement extends IPacketMsgElement<SendStructLongMsgEl
this.message = message ?? []; this.message = message ?? [];
} }
get isGroupMsg(): boolean {
return this.message.some(msg => msg.groupId !== undefined);
}
get JSON() { get JSON() {
const id = crypto.randomUUID(); const id = crypto.randomUUID();
return { return {
@ -387,7 +391,11 @@ export class PacketMultiMsgElement extends IPacketMsgElement<SendStructLongMsgEl
text: `${packetMsg.senderName}: ${packetMsg.msg.map(msg => msg.toPreview()).join('')}`, text: `${packetMsg.senderName}: ${packetMsg.msg.map(msg => msg.toPreview()).join('')}`,
})), })),
resid: this.resid, resid: this.resid,
source: "聊天记录", // TODO: source: this.isGroupMsg ? "群聊的聊天记录" :
this.message.length
? Array.from(new Set(this.message.map(msg => msg.senderName)))
.join('和') + '的聊天记录'
: '聊天记录',
summary: `查看${this.message.length}条转发消息`, summary: `查看${this.message.length}条转发消息`,
uniseq: id, uniseq: id,
} }

View File

@ -114,9 +114,7 @@ export class PacketPacker {
} }
} }
); );
this.logger.logDebug("packUploadForwardMsg LONGMSGRESULT!!!", this.toHexStr(longMsgResultData));
const payload = zlib.gzipSync(Buffer.from(longMsgResultData)); const payload = zlib.gzipSync(Buffer.from(longMsgResultData));
// this.logger.logDebug("packUploadForwardMsg PAYLOAD!!!", payload);
const req = new NapProtoMsg(SendLongMsgReq).encode( const req = new NapProtoMsg(SendLongMsgReq).encode(
{ {
info: { info: {