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

feat: Support nested MultiMsg #373

Merged
merged 2 commits into from
Jun 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -480,10 +480,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