This commit is contained in:
Adhiraj
2020-07-12 20:29:39 +05:30
parent e0ea9c8fa5
commit 1307d97930

View File

@@ -22,16 +22,17 @@ export default class WhatsAppWebMessages extends WhatsAppWebBase {
/** Get the message info, who has read it, who its been delivered to */
async messageInfo (jid: string, messageID: string) {
const query = ['query', {type: 'message_info', index: messageID, jid: jid, epoch: this.msgCount.toString()}, null]
const response = (await this.queryExpecting200 (query, [22, WAFlag.ignore]))[2] as WANode[]
const response = (await this.queryExpecting200 (query, [22, WAFlag.ignore]))[2]
const info: MessageInfo = {reads: [], deliveries: []}
if (response) {
console.log (response)
const reads = response.filter (node => node[0] === 'read')
if (reads[0]) {
info.reads = reads[0][2].map (item => item[1])
}
const deliveries = response.filter (node => node[0] === 'delivery')
if (reads[0]) {
if (deliveries[0]) {
info.deliveries = deliveries[0][2].map (item => item[1])
}
}