Skip to content

Commit

Permalink
fix: 转发多条消息没有发送者名字和头像
Browse files Browse the repository at this point in the history
  • Loading branch information
clansty committed Aug 12, 2024
1 parent 556b6ce commit e9415eb
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 57 deletions.
2 changes: 1 addition & 1 deletion main/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"elysia": "^1.1.5",
"esbuild": "^0.23.0",
"eviltransform": "^0.2.2",
"file-type": "^19.4.0",
"file-type": "^19.3.0",
"fluent-ffmpeg": "^2.1.3",
"image-size": "^1.1.1",
"lodash": "^4.17.21",
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"pnpm": {
"patchedDependencies": {
"[email protected]": "patches/[email protected]",
"@icqqjs/[email protected]": "patches/@[email protected].4.patch"
"@icqqjs/[email protected]": "patches/@[email protected].5.patch"
}
},
"packageManager": "pnpm@9.4.0+sha512.f549b8a52c9d2b8536762f99c0722205efc5af913e77835dbccc3b0b0b2ca9e7dc8022b78062c17291c48e88749c70ce88eb5a74f1fa8c4bf5e18bb46c8bd83a"
"packageManager": "pnpm@9.6.0+sha512.38dc6fba8dba35b39340b9700112c2fe1e12f10b17134715a4aa98ccf7bb035e76fd981cf0bb384dfa98f8d6af5481c2bef2f4266a24bfa20c34eb7147ce0b5e"
}
32 changes: 32 additions & 0 deletions patches/@[email protected] → patches/@[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,35 @@ index 27a659a3290fadd990a1a980918515a6ded4978f..e1bbe1470f302c30e7adea92f433a6e3
this.elems.unshift({
45: {
1: [source.seq],
diff --git a/lib/message/message.d.ts b/lib/message/message.d.ts
index c4bdd4cde3de14d515ea55364bf6c5ba315a8281..0e1ef5aa876d8e4913dc7d41756c617080dd9ced 100644
--- a/lib/message/message.d.ts
+++ b/lib/message/message.d.ts
@@ -203,6 +203,7 @@ export declare class ForwardMessage implements Forwardable {
/** 消息内容 */
message: MessageElem[];
raw_message: string;
+ avatar?: string;
/** 反序列化一条转发消息 */
static deserialize(serialized: Buffer): ForwardMessage;
constructor(proto: pb.Proto);
diff --git a/lib/message/message.js b/lib/message/message.js
index dcf0238de649da2c866b354a32884d0e8389ddd4..fee8ffe09e34aa3a3d7870a0d65bc793feeb29f8 100644
--- a/lib/message/message.js
+++ b/lib/message/message.js
@@ -367,12 +367,13 @@ class ForwardMessage {
this.proto = proto;
this.proto = proto;
const head = proto[1];
- this.time = head[6] || 0;
+ this.time = head[6] || proto[2]?.[6] || 0;
this.seq = head[5];
this.user_id = head[1] || 0;
- this.nickname = head[14]?.toString() || head[9]?.[4]?.toString() || "";
+ this.nickname = head[14]?.toString() || head[9]?.[4]?.toString() || head[8]?.[4]?.toString() || "";
this.group_id = head[9]?.[1];
this.parsed = (0, parser_1.parse)(proto[3][1]);
+ this.avatar = head[20]?.[5]?.toString() || proto[2]?.[15]?.[5]?.toString();
this.message = this.parsed.message;
this.raw_message = this.parsed.brief;
(0, common_1.lock)(this, "proto");
78 changes: 24 additions & 54 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e9415eb

Please sign in to comment.