Skip to content
This repository has been archived by the owner on Nov 2, 2023. It is now read-only.

Commit

Permalink
feat: Support nested MultiMsg (#373)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmlgzs authored Jun 18, 2022
1 parent 7a96668 commit 8de6eb2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,8 @@ export class Client extends BaseClient {
return this.pickFriend(this.uin).getVideoUrl(fid, md5)
}
/** 获取转发消息 */
getForwardMsg(resid: string) {
return this.pickFriend(this.uin).getForwardMsg(resid)
getForwardMsg(resid: string, fileName?: string) {
return this.pickFriend(this.uin).getForwardMsg(resid, fileName)
}
/** 制作转发消息 */
makeForwardMsg(fake: Forwardable[], dm = false) {
Expand Down
10 changes: 9 additions & 1 deletion lib/internal/contactable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -487,10 +487,18 @@ export abstract class Contactable {
}

/** 下载并解析合并转发 */
async getForwardMsg(resid: string) {
async getForwardMsg(resid: string, fileName: string = "MultiMsg") {
const ret = []
const buf = await this._downloadMultiMsg(String(resid), 2)
let a = pb.decode(buf)[2]
if (!Array.isArray(a)) a = [a]
for (let b of a) {
const m_fileName = b[1].toString()
if (m_fileName === fileName) {
a = b
break
}
}
if (Array.isArray(a)) a = a[0]
a = a[2][1]
if (!Array.isArray(a)) a = [a]
Expand Down

0 comments on commit 8de6eb2

Please sign in to comment.