diff --git a/.gitignore b/.gitignore index d21e9c0..be4a59c 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ browser-messages.json package-lock.json package-lock.json decoded-ws.json +auth_info2.json diff --git a/src/WAClient/Base.ts b/src/WAClient/Base.ts index 362f388..4b3fe81 100644 --- a/src/WAClient/Base.ts +++ b/src/WAClient/Base.ts @@ -212,13 +212,14 @@ 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 creatorDesc = json[1] 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), + owner: creatorDesc?.creator, + creator: creatorDesc?.creator, + creation: parseInt(creatorDesc?.create), subject: null, desc: description ? description[2].toString('utf-8') : null, participants: participants.map (item => ({ id: item[1].jid, isAdmin: item[1].type==='admin' })) diff --git a/src/WAClient/Tests.ts b/src/WAClient/Tests.ts index 4060baa..57bc3a1 100644 --- a/src/WAClient/Tests.ts +++ b/src/WAClient/Tests.ts @@ -69,6 +69,15 @@ WAClientTest('Messages', (client) => { await createTimeout (2000) 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', () => {