mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
Info fix
This commit is contained in:
@@ -22,16 +22,17 @@ export default class WhatsAppWebMessages extends WhatsAppWebBase {
|
|||||||
/** Get the message info, who has read it, who its been delivered to */
|
/** Get the message info, who has read it, who its been delivered to */
|
||||||
async messageInfo (jid: string, messageID: string) {
|
async messageInfo (jid: string, messageID: string) {
|
||||||
const query = ['query', {type: 'message_info', index: messageID, jid: jid, epoch: this.msgCount.toString()}, null]
|
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: []}
|
const info: MessageInfo = {reads: [], deliveries: []}
|
||||||
if (response) {
|
if (response) {
|
||||||
|
console.log (response)
|
||||||
const reads = response.filter (node => node[0] === 'read')
|
const reads = response.filter (node => node[0] === 'read')
|
||||||
if (reads[0]) {
|
if (reads[0]) {
|
||||||
info.reads = reads[0][2].map (item => item[1])
|
info.reads = reads[0][2].map (item => item[1])
|
||||||
}
|
}
|
||||||
const deliveries = response.filter (node => node[0] === 'delivery')
|
const deliveries = response.filter (node => node[0] === 'delivery')
|
||||||
if (reads[0]) {
|
if (deliveries[0]) {
|
||||||
info.deliveries = deliveries[0][2].map (item => item[1])
|
info.deliveries = deliveries[0][2].map (item => item[1])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user