mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
Group fix
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -12,3 +12,4 @@ browser-messages.json
|
|||||||
package-lock.json
|
package-lock.json
|
||||||
package-lock.json
|
package-lock.json
|
||||||
decoded-ws.json
|
decoded-ws.json
|
||||||
|
auth_info2.json
|
||||||
|
|||||||
@@ -212,13 +212,14 @@ 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 creatorDesc = json[1]
|
||||||
const participants = json[2] ? json[2].filter (item => item[0] === 'participant') : []
|
const participants = json[2] ? json[2].filter (item => item[0] === 'participant') : []
|
||||||
const description = json[2] ? json[2].find (item => item[0] === 'description') : null
|
const description = json[2] ? json[2].find (item => item[0] === 'description') : null
|
||||||
return {
|
return {
|
||||||
id: jid,
|
id: jid,
|
||||||
owner: json[1].creator,
|
owner: creatorDesc?.creator,
|
||||||
creator: json[1].creator,
|
creator: creatorDesc?.creator,
|
||||||
creation: parseInt(json[1].create),
|
creation: parseInt(creatorDesc?.create),
|
||||||
subject: null,
|
subject: null,
|
||||||
desc: description ? description[2].toString('utf-8') : null,
|
desc: description ? description[2].toString('utf-8') : null,
|
||||||
participants: participants.map (item => ({ id: item[1].jid, isAdmin: item[1].type==='admin' }))
|
participants: participants.map (item => ({ id: item[1].jid, isAdmin: item[1].type==='admin' }))
|
||||||
|
|||||||
@@ -69,6 +69,15 @@ WAClientTest('Messages', (client) => {
|
|||||||
await createTimeout (2000)
|
await createTimeout (2000)
|
||||||
await client.clearMessage (messages[0].key)
|
await client.clearMessage (messages[0].key)
|
||||||
})
|
})
|
||||||
|
it ('should load convo', async () => {
|
||||||
|
const [chats] = await client.receiveChatsAndContacts ()
|
||||||
|
for (var i in chats) {
|
||||||
|
if (chats[i].jid.includes('@g.us')) {
|
||||||
|
console.log (chats[i].jid)
|
||||||
|
const data = await client.groupCreatorAndParticipants (chats[i].jid)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('Validate WhatsApp IDs', () => {
|
describe('Validate WhatsApp IDs', () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user