Skip to content

Commit

Permalink
细节优化
Browse files Browse the repository at this point in the history
  • Loading branch information
TimeRainStarSky committed Feb 4, 2024
1 parent 90dcf6a commit 1851d54
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,17 @@ const adapter = new class ICQQAdapter {
this.version = config.package.dependencies.icqq.replace("^", "v")
}

async uploadVideo(id, file) {
const group = Bot[id].pickGroup(Math.ceil(Math.random()*10**9))
const video = await group.uploadVideo({ file })
const proto = Bot[id].icqq.core.pb.decode(Buffer.from(video.file.replace("protobuf://", ""), "base64"))
return group.getVideoUrl(proto[1], proto[2])
}

async uploadRecord(id, file) {
const group = Bot[id].pickGroup(Math.ceil(Math.random()*10**9))
const record = await group.uploadPtt({ file })
const proto = Bot[id].icqq.core.pb.decodePb(Buffer.from(record.file.replace("protobuf://", ""), "base64"))
const proto = Bot[id].icqq.core.pb.decode(Buffer.from(record.file.replace("protobuf://", ""), "base64"))
return group.getPttUrl(proto[3])
}

Expand Down Expand Up @@ -499,6 +506,7 @@ const adapter = new class ICQQAdapter {
},
uploadImage: file => this.uploadImage(id, file),
uploadRecord: file => this.uploadRecord(id, file),
uploadVideo: file => this.uploadVideo(id, file),
}, {
get: (target, prop, receiver) => this.getBot(id, target, prop, receiver),
})
Expand Down

0 comments on commit 1851d54

Please sign in to comment.