Group description fix

This commit is contained in:
Adhiraj
2020-07-12 21:27:39 +05:30
parent 1307d97930
commit fe43125456
3 changed files with 7 additions and 2 deletions

View File

@@ -212,13 +212,16 @@ export default class WhatsAppWebBase extends WAConnection {
const query = ['query', {type: 'group', jid: jid, epoch: this.msgCount.toString()}, null]
const response = await this.queryExpecting200(query, [WAMetric.group, WAFlag.ignore])
const json = response[2][0]
const participants = json[2] ? json[2].filter (item => item[0] === 'participant') : []
const description = json[2] ? json[2].find (item => item[0] === 'description') : null
return {
id: jid,
owner: json[1].creator,
creator: json[1].creator,
creation: parseInt(json[1].create),
subject: null,
participants: json[2] ? json[2].map (item => ({ id: item[1].jid, isAdmin: item[1].type==='admin' })) : []
desc: description ? description[2].toString('utf-8') : null,
participants: participants.map (item => ({ id: item[1].jid, isAdmin: item[1].type==='admin' }))
} as WAGroupMetadata
}
/**

View File

@@ -26,7 +26,7 @@ export default class WhatsAppWebMessages extends WhatsAppWebBase {
const info: MessageInfo = {reads: [], deliveries: []}
if (response) {
console.log (response)
//console.log (response)
const reads = response.filter (node => node[0] === 'read')
if (reads[0]) {
info.reads = reads[0][2].map (item => item[1])

View File

@@ -50,6 +50,8 @@ export interface WAGroupMetadata {
owner: string
subject: string
creation: number
desc?: string
descOwner?: string
participants: [{ id: string; isAdmin: boolean; isSuperAdmin: boolean }]
}
export interface WAGroupModification {