From 441a3a6d6c9acdcc567422eb986590a228b29737 Mon Sep 17 00:00:00 2001 From: BenyFilho <168232825+BenyFilho@users.noreply.github.com> Date: Wed, 26 Mar 2025 01:56:32 -0300 Subject: [PATCH] Fix Group getInviteCode (#3492) * Update Store.js add new require to fix getInviteCode method * Update GroupChat.js adjusting method getInviteCode --- src/structures/GroupChat.js | 10 ++++++---- src/util/Injected/Store.js | 3 ++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/structures/GroupChat.js b/src/structures/GroupChat.js index 04de9bd..862f5b4 100644 --- a/src/structures/GroupChat.js +++ b/src/structures/GroupChat.js @@ -381,9 +381,9 @@ class GroupChat extends Chat { const codeRes = await this.client.pupPage.evaluate(async chatId => { const chatWid = window.Store.WidFactory.createWid(chatId); try { - return window.compareWwebVersions(window.Debug.VERSION, '>=', '2.3000.0') - ? await window.Store.GroupInvite.queryGroupInviteCode(chatWid, true) - : await window.Store.GroupInvite.queryGroupInviteCode(chatWid); + return window.compareWwebVersions(window.Debug.VERSION, '>=', '2.3000.1020730154') + ? await window.Store.GroupInvite.fetchMexGroupInviteCode(chatId) + : await window.Store.GroupInvite.queryGroupInviteCode(chatWid, true); } catch (err) { if(err.name === 'ServerStatusCodeError') return undefined; @@ -391,7 +391,9 @@ class GroupChat extends Chat { } }, this.id._serialized); - return codeRes?.code; + return codeRes?.code + ? codeRes?.code + : codeRes; } /** diff --git a/src/util/Injected/Store.js b/src/util/Injected/Store.js index 2da5871..c428c82 100644 --- a/src/util/Injected/Store.js +++ b/src/util/Injected/Store.js @@ -122,7 +122,8 @@ exports.ExposeStore = () => { }; window.Store.GroupInvite = { ...window.require('WAWebGroupInviteJob'), - ...window.require('WAWebGroupQueryJob') + ...window.require('WAWebGroupQueryJob'), + ...window.require('WAWebMexFetchGroupInviteCodeJob') }; window.Store.GroupInviteV4 = { ...window.require('WAWebGroupInviteV4Job'),