From f4cbac0a25fabb9cddc3d6d3268139c5f730414d Mon Sep 17 00:00:00 2001 From: SalimTerryLi Date: Wed, 14 Sep 2022 23:20:17 +0800 Subject: [PATCH] =?UTF-8?q?message/message.ts:=20=E8=A7=A3=E6=9E=90?= =?UTF-8?q?=E8=BD=AC=E5=8F=91=E6=B6=88=E6=81=AF=E4=B8=AD=E7=9A=84=E5=BC=95?= =?UTF-8?q?=E7=94=A8=E5=9B=9E=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/message/message.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/message/message.ts b/lib/message/message.ts index 690f315a..f1152af8 100644 --- a/lib/message/message.ts +++ b/lib/message/message.ts @@ -371,6 +371,7 @@ export class ForwardMessage implements Forwardable { time: number message: MessageElem[] raw_message: string + source?: Quotable /** 反序列化一条转发消息 */ static deserialize(serialized: Buffer) { @@ -387,6 +388,16 @@ export class ForwardMessage implements Forwardable { this.parsed = parse(proto[3][1]) this.message = this.parsed.message this.raw_message = this.parsed.brief + if (this.parsed.quotation) { + const q = this.parsed.quotation + this.source = { + user_id: q[2], + time: q[3], + seq: q[1]?.[0] || q[1], + rand: uuid2rand(q[8]?.[3] || 0), + message: parse(Array.isArray(q[5]) ? q[5] : [q[5]]).brief, + } + } lock(this, "proto") lock(this, "parsed") }