mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
Group description fix
This commit is contained in:
@@ -212,13 +212,16 @@ export default class WhatsAppWebBase extends WAConnection {
|
|||||||
const query = ['query', {type: 'group', jid: jid, epoch: this.msgCount.toString()}, null]
|
const query = ['query', {type: 'group', jid: jid, epoch: this.msgCount.toString()}, null]
|
||||||
const response = await this.queryExpecting200(query, [WAMetric.group, WAFlag.ignore])
|
const response = await this.queryExpecting200(query, [WAMetric.group, WAFlag.ignore])
|
||||||
const json = response[2][0]
|
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 {
|
return {
|
||||||
id: jid,
|
id: jid,
|
||||||
owner: json[1].creator,
|
owner: json[1].creator,
|
||||||
creator: json[1].creator,
|
creator: json[1].creator,
|
||||||
creation: parseInt(json[1].create),
|
creation: parseInt(json[1].create),
|
||||||
subject: null,
|
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
|
} as WAGroupMetadata
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ export default class WhatsAppWebMessages extends WhatsAppWebBase {
|
|||||||
|
|
||||||
const info: MessageInfo = {reads: [], deliveries: []}
|
const info: MessageInfo = {reads: [], deliveries: []}
|
||||||
if (response) {
|
if (response) {
|
||||||
console.log (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])
|
||||||
|
|||||||
@@ -50,6 +50,8 @@ export interface WAGroupMetadata {
|
|||||||
owner: string
|
owner: string
|
||||||
subject: string
|
subject: string
|
||||||
creation: number
|
creation: number
|
||||||
|
desc?: string
|
||||||
|
descOwner?: string
|
||||||
participants: [{ id: string; isAdmin: boolean; isSuperAdmin: boolean }]
|
participants: [{ id: string; isAdmin: boolean; isSuperAdmin: boolean }]
|
||||||
}
|
}
|
||||||
export interface WAGroupModification {
|
export interface WAGroupModification {
|
||||||
|
|||||||
Reference in New Issue
Block a user