From 7e9c9881d1460c2763db7b394429511ee74149ce Mon Sep 17 00:00:00 2001 From: Adhiraj Date: Sun, 12 Jul 2020 14:13:33 +0530 Subject: [PATCH] Group fixes --- src/WAClient/Base.ts | 5 +++-- src/WAClient/Tests.ts | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/WAClient/Base.ts b/src/WAClient/Base.ts index 7835ada..ead9c21 100644 --- a/src/WAClient/Base.ts +++ b/src/WAClient/Base.ts @@ -209,8 +209,9 @@ export default class WhatsAppWebBase extends WAConnection { groupMetadata = (jid: string) => this.queryExpecting200(['query', 'GroupMetadata', jid]) as Promise /** Get the metadata (works after you've left the group also) */ groupCreatorAndParticipants = async (jid: string) => { - const response = await this.queryExpecting200(['query', {type: 'group', jid: jid, epoch: '5'}, null], [WAMetric.group, WAFlag.ignore]) - const json = response[2] + 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] return { id: jid, owner: json[1].creator, diff --git a/src/WAClient/Tests.ts b/src/WAClient/Tests.ts index 4060baa..cc7ca49 100644 --- a/src/WAClient/Tests.ts +++ b/src/WAClient/Tests.ts @@ -171,8 +171,8 @@ WAClientTest('Groups', (client) => { await client.groupRemove(gid, [testJid]) }) it('should leave the group', async () => { - await client.groupLeave(gid) - await client.groupCreatorAndParticipants (gid) + // await client.groupLeave(gid) + await client.groupCreatorAndParticipants ('919324993767-1593506879@g.us') }) it('should archive the group', async () => { await client.archiveChat(gid)