From 23d5147a142bd790adf891aa55107c272031cf76 Mon Sep 17 00:00:00 2001 From: "Pedro S. Lopez" Date: Sun, 15 Jan 2023 14:30:20 -0400 Subject: [PATCH 01/11] fix: compatibility with LegacyPhoneFeatures in latest WhatsApp Web version (#1930) * fix removed features on latest wweb version * errors --- src/util/Injected.js | 6 +++++- src/util/InterfaceController.js | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/util/Injected.js b/src/util/Injected.js index a0a7b12..e1f3871 100644 --- a/src/util/Injected.js +++ b/src/util/Injected.js @@ -13,7 +13,6 @@ exports.ExposeStore = (moduleRaidStr) => { window.Store.Cmd = window.mR.findModule('Cmd')[0].Cmd; window.Store.CryptoLib = window.mR.findModule('decryptE2EMedia')[0]; window.Store.DownloadManager = window.mR.findModule('downloadManager')[0].downloadManager; - window.Store.Features = window.mR.findModule('FEATURE_CHANGE_EVENT')[0].LegacyPhoneFeatures; window.Store.GroupMetadata = window.mR.findModule('GroupMetadata')[0].default.GroupMetadata; window.Store.Invite = window.mR.findModule('sendJoinGroupViaInvite')[0]; window.Store.InviteInfo = window.mR.findModule('sendQueryGroupInvite')[0]; @@ -87,6 +86,11 @@ exports.ExposeStore = (moduleRaidStr) => { } else { window.Store.MDBackend = true; } + + const _features = window.mR.findModule('FEATURE_CHANGE_EVENT')[0]; + if(_features) { + window.Store.Features = _features.LegacyPhoneFeatures; + } }; exports.LoadUtils = () => { diff --git a/src/util/InterfaceController.js b/src/util/InterfaceController.js index 8a878f8..a87959d 100644 --- a/src/util/InterfaceController.js +++ b/src/util/InterfaceController.js @@ -79,6 +79,7 @@ class InterfaceController { */ async getFeatures() { return await this.pupPage.evaluate(() => { + if(!window.Store.Features) throw new Error('This version of Whatsapp Web does not support features'); return window.Store.Features.F; }); } @@ -89,6 +90,7 @@ class InterfaceController { */ async checkFeatureStatus(feature) { return await this.pupPage.evaluate((feature) => { + if(!window.Store.Features) throw new Error('This version of Whatsapp Web does not support features'); return window.Store.Features.supportsFeature(feature); }, feature); } @@ -99,6 +101,7 @@ class InterfaceController { */ async enableFeatures(features) { await this.pupPage.evaluate((features) => { + if(!window.Store.Features) throw new Error('This version of Whatsapp Web does not support features'); for (const feature in features) { window.Store.Features.setFeature(features[feature], true); } @@ -111,6 +114,7 @@ class InterfaceController { */ async disableFeatures(features) { await this.pupPage.evaluate((features) => { + if(!window.Store.Features) throw new Error('This version of Whatsapp Web does not support features'); for (const feature in features) { window.Store.Features.setFeature(features[feature], false); } From 7dd8688f048faad658a6718a57f83488421735da Mon Sep 17 00:00:00 2001 From: Rajeh Taher Date: Sun, 15 Jan 2023 20:32:28 +0200 Subject: [PATCH 02/11] fix: Fix client-side message rendering issue when sending attachements through the library (#1905) --- src/util/Injected.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/util/Injected.js b/src/util/Injected.js index e1f3871..bc05602 100644 --- a/src/util/Injected.js +++ b/src/util/Injected.js @@ -271,6 +271,7 @@ exports.LoadUtils = () => { ...ephemeralFields, ...locationOptions, ...attOptions, + ...(Object.keys(attOptions).length > 0 ? attOptions.toJSON() : {}), ...quotedMsgOptions, ...vcardOptions, ...buttonOptions, From bd0e27a0d0bd387409bf74432240c129eb937ca0 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 15 Jan 2023 14:34:23 -0400 Subject: [PATCH 03/11] Update supported WhatsApp Web version to v2.2301.6 (#1869) Co-authored-by: pedroslopez --- README.md | 2 +- tools/version-checker/.version | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 242dc28..54c439b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![npm](https://img.shields.io/npm/v/whatsapp-web.js.svg)](https://www.npmjs.com/package/whatsapp-web.js) [![Depfu](https://badges.depfu.com/badges/4a65a0de96ece65fdf39e294e0c8dcba/overview.svg)](https://depfu.com/github/pedroslopez/whatsapp-web.js?project_id=9765) ![WhatsApp_Web 2.2245.9](https://img.shields.io/badge/WhatsApp_Web-2.2245.9-brightgreen.svg) [![Discord Chat](https://img.shields.io/discord/698610475432411196.svg?logo=discord)](https://discord.gg/H7DqQs4) +[![npm](https://img.shields.io/npm/v/whatsapp-web.js.svg)](https://www.npmjs.com/package/whatsapp-web.js) [![Depfu](https://badges.depfu.com/badges/4a65a0de96ece65fdf39e294e0c8dcba/overview.svg)](https://depfu.com/github/pedroslopez/whatsapp-web.js?project_id=9765) ![WhatsApp_Web 2.2301.6](https://img.shields.io/badge/WhatsApp_Web-2.2301.6-brightgreen.svg) [![Discord Chat](https://img.shields.io/discord/698610475432411196.svg?logo=discord)](https://discord.gg/H7DqQs4) # whatsapp-web.js A WhatsApp API client that connects through the WhatsApp Web browser app diff --git a/tools/version-checker/.version b/tools/version-checker/.version index 53ab36c..07e7880 100644 --- a/tools/version-checker/.version +++ b/tools/version-checker/.version @@ -1 +1 @@ -2.2245.9 \ No newline at end of file +2.2301.6 \ No newline at end of file From bd192993b7369feacd82ecef551eeaa61fea658d Mon Sep 17 00:00:00 2001 From: tofers Date: Sun, 15 Jan 2023 21:35:26 +0300 Subject: [PATCH 04/11] fix method downloadMedia when not found msg (#1852) Co-authored-by: Rajeh Taher --- src/structures/Message.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/structures/Message.js b/src/structures/Message.js index ee79c20..7ac5536 100644 --- a/src/structures/Message.js +++ b/src/structures/Message.js @@ -386,7 +386,9 @@ class Message extends Base { const result = await this.client.pupPage.evaluate(async (msgId) => { const msg = window.Store.Msg.get(msgId); - + if (!msg) { + return undefined; + } if (msg.mediaData.mediaStage != 'RESOLVED') { // try to resolve media await msg.downloadMedia({ From a525e2330a917981f1af00e1c582f56e6d20caea Mon Sep 17 00:00:00 2001 From: Azeem Haider Date: Sun, 15 Jan 2023 23:36:08 +0500 Subject: [PATCH 05/11] Adding missing CALL in events enum (#1899) --- index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.d.ts b/index.d.ts index 4da695e..6abef66 100644 --- a/index.d.ts +++ b/index.d.ts @@ -506,7 +506,8 @@ declare namespace WAWebJS { DISCONNECTED = 'disconnected', STATE_CHANGED = 'change_state', BATTERY_CHANGED = 'change_battery', - REMOTE_SESSION_SAVED = 'remote_session_saved' + REMOTE_SESSION_SAVED = 'remote_session_saved', + CALL = 'call' } /** Group notification types */ From d2479f397e482da097cfe0f0544f2ee981febc59 Mon Sep 17 00:00:00 2001 From: Pedro Lopez Date: Sun, 15 Jan 2023 14:38:46 -0400 Subject: [PATCH 06/11] chore: mark version v1.19.0 --- docs/Base.html | 6 ++-- docs/BaseAuthStrategy.html | 6 ++-- docs/BusinessContact.html | 6 ++-- docs/Buttons.html | 6 ++-- docs/Call.html | 30 +++++++++++++++++-- docs/Chat.html | 6 ++-- docs/Client.html | 6 ++-- docs/Client.js.html | 6 ++-- docs/ClientInfo.html | 6 ++-- docs/Contact.html | 6 ++-- docs/GroupChat.html | 6 ++-- docs/GroupNotification.html | 6 ++-- docs/InterfaceController.html | 6 ++-- docs/Label.html | 6 ++-- docs/LegacySessionAuth.html | 6 ++-- docs/List.html | 6 ++-- docs/LocalAuth.html | 6 ++-- docs/Location.html | 6 ++-- docs/Message.html | 6 ++-- docs/MessageMedia.html | 6 ++-- docs/NoAuth.html | 6 ++-- docs/Order.html | 6 ++-- docs/PrivateChat.html | 6 ++-- docs/PrivateContact.html | 6 ++-- docs/Product.html | 6 ++-- docs/Reaction.html | 6 ++-- docs/RemoteAuth.html | 6 ++-- docs/Util.html | 6 ++-- docs/authStrategies_BaseAuthStrategy.js.html | 6 ++-- docs/authStrategies_LegacySessionAuth.js.html | 6 ++-- docs/authStrategies_LocalAuth.js.html | 6 ++-- docs/authStrategies_NoAuth.js.html | 6 ++-- docs/authStrategies_RemoteAuth.js.html | 6 ++-- docs/global.html | 6 ++-- docs/index.html | 17 +++++++---- docs/structures_Base.js.html | 6 ++-- docs/structures_BusinessContact.js.html | 6 ++-- docs/structures_Buttons.js.html | 6 ++-- docs/structures_Call.js.html | 16 +++++++--- docs/structures_Chat.js.html | 6 ++-- docs/structures_ClientInfo.js.html | 6 ++-- docs/structures_Contact.js.html | 6 ++-- docs/structures_GroupChat.js.html | 6 ++-- docs/structures_GroupNotification.js.html | 6 ++-- docs/structures_Label.js.html | 6 ++-- docs/structures_List.js.html | 6 ++-- docs/structures_Location.js.html | 6 ++-- docs/structures_Message.js.html | 10 ++++--- docs/structures_MessageMedia.js.html | 6 ++-- docs/structures_Order.js.html | 6 ++-- docs/structures_Payment.js.html | 6 ++-- docs/structures_PrivateChat.js.html | 6 ++-- docs/structures_PrivateContact.js.html | 6 ++-- docs/structures_Product.js.html | 6 ++-- docs/structures_ProductMetadata.js.html | 6 ++-- docs/structures_Reaction.js.html | 6 ++-- docs/util_Constants.js.html | 8 ++--- docs/util_InterfaceController.js.html | 10 +++++-- docs/util_Util.js.html | 6 ++-- package.json | 2 +- 60 files changed, 227 insertions(+), 184 deletions(-) diff --git a/docs/Base.html b/docs/Base.html index 53e15f4..6d4df28 100644 --- a/docs/Base.html +++ b/docs/Base.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Class: Base + whatsapp-web.js 1.19.0 » Class: Base @@ -15,7 +15,7 @@ @@ -50,7 +50,7 @@
diff --git a/docs/BaseAuthStrategy.html b/docs/BaseAuthStrategy.html index 88de5bb..d73f022 100644 --- a/docs/BaseAuthStrategy.html +++ b/docs/BaseAuthStrategy.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Class: BaseAuthStrategy + whatsapp-web.js 1.19.0 » Class: BaseAuthStrategy @@ -15,7 +15,7 @@ @@ -50,7 +50,7 @@
diff --git a/docs/BusinessContact.html b/docs/BusinessContact.html index 3269010..fa8ffff 100644 --- a/docs/BusinessContact.html +++ b/docs/BusinessContact.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Class: BusinessContact + whatsapp-web.js 1.19.0 » Class: BusinessContact @@ -15,7 +15,7 @@ @@ -326,7 +326,7 @@
diff --git a/docs/Buttons.html b/docs/Buttons.html index f619730..aea4229 100644 --- a/docs/Buttons.html +++ b/docs/Buttons.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Class: Buttons + whatsapp-web.js 1.19.0 » Class: Buttons @@ -15,7 +15,7 @@ @@ -234,7 +234,7 @@ Returns: [{ buttonId:'customId',buttonText:{'displayText':&#
diff --git a/docs/Call.html b/docs/Call.html index 1f04939..532867a 100644 --- a/docs/Call.html +++ b/docs/Call.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Class: Call + whatsapp-web.js 1.19.0 » Class: Call @@ -15,7 +15,7 @@ @@ -78,6 +78,22 @@ +
+

Method

+
+
+
+
reject()
+
+
+
+
+
+
+
+
+
+

new Call()

@@ -135,6 +151,14 @@
+

Method

+
+
async
+

reject()

+

Reject the call

+
+
+
@@ -144,7 +168,7 @@
diff --git a/docs/Chat.html b/docs/Chat.html index 3efe708..7ef6426 100644 --- a/docs/Chat.html +++ b/docs/Chat.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Class: Chat + whatsapp-web.js 1.19.0 » Class: Chat @@ -15,7 +15,7 @@ @@ -497,7 +497,7 @@
diff --git a/docs/Client.html b/docs/Client.html index 60a7217..3d5be24 100644 --- a/docs/Client.html +++ b/docs/Client.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Class: Client + whatsapp-web.js 1.19.0 » Class: Client @@ -15,7 +15,7 @@ @@ -2486,7 +2486,7 @@
diff --git a/docs/Client.js.html b/docs/Client.js.html index 8a16378..17a955e 100644 --- a/docs/Client.js.html +++ b/docs/Client.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: Client.js + whatsapp-web.js 1.19.0 » Source: Client.js @@ -15,7 +15,7 @@ @@ -1224,7 +1224,7 @@ module.exports = Client;
diff --git a/docs/ClientInfo.html b/docs/ClientInfo.html index f9976b7..b6e3a0b 100644 --- a/docs/ClientInfo.html +++ b/docs/ClientInfo.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Class: ClientInfo + whatsapp-web.js 1.19.0 » Class: ClientInfo @@ -15,7 +15,7 @@ @@ -242,7 +242,7 @@
diff --git a/docs/Contact.html b/docs/Contact.html index 515e13b..3f0658d 100644 --- a/docs/Contact.html +++ b/docs/Contact.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Class: Contact + whatsapp-web.js 1.19.0 » Class: Contact @@ -15,7 +15,7 @@ @@ -293,7 +293,7 @@
diff --git a/docs/GroupChat.html b/docs/GroupChat.html index e00d4ea..2ae8fbc 100644 --- a/docs/GroupChat.html +++ b/docs/GroupChat.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Class: GroupChat + whatsapp-web.js 1.19.0 » Class: GroupChat @@ -15,7 +15,7 @@ @@ -941,7 +941,7 @@
diff --git a/docs/GroupNotification.html b/docs/GroupNotification.html index aa4a01c..eb482e8 100644 --- a/docs/GroupNotification.html +++ b/docs/GroupNotification.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Class: GroupNotification + whatsapp-web.js 1.19.0 » Class: GroupNotification @@ -15,7 +15,7 @@ @@ -233,7 +233,7 @@
diff --git a/docs/InterfaceController.html b/docs/InterfaceController.html index 8b97ada..33c243d 100644 --- a/docs/InterfaceController.html +++ b/docs/InterfaceController.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Class: InterfaceController + whatsapp-web.js 1.19.0 » Class: InterfaceController @@ -15,7 +15,7 @@ @@ -382,7 +382,7 @@
diff --git a/docs/Label.html b/docs/Label.html index 7a429f6..e7361d9 100644 --- a/docs/Label.html +++ b/docs/Label.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Class: Label + whatsapp-web.js 1.19.0 » Class: Label @@ -15,7 +15,7 @@ @@ -163,7 +163,7 @@
diff --git a/docs/LegacySessionAuth.html b/docs/LegacySessionAuth.html index 65dfb46..38af381 100644 --- a/docs/LegacySessionAuth.html +++ b/docs/LegacySessionAuth.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Class: LegacySessionAuth + whatsapp-web.js 1.19.0 » Class: LegacySessionAuth @@ -15,7 +15,7 @@ @@ -173,7 +173,7 @@
diff --git a/docs/List.html b/docs/List.html index 2033a98..22880df 100644 --- a/docs/List.html +++ b/docs/List.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Class: List + whatsapp-web.js 1.19.0 » Class: List @@ -15,7 +15,7 @@ @@ -256,7 +256,7 @@ Returns: [{'title':'sectionTitle','rows':[{'r
diff --git a/docs/LocalAuth.html b/docs/LocalAuth.html index 2b8c83e..65ecb37 100644 --- a/docs/LocalAuth.html +++ b/docs/LocalAuth.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Class: LocalAuth + whatsapp-web.js 1.19.0 » Class: LocalAuth @@ -15,7 +15,7 @@ @@ -120,7 +120,7 @@
diff --git a/docs/Location.html b/docs/Location.html index 7714777..67a7582 100644 --- a/docs/Location.html +++ b/docs/Location.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Class: Location + whatsapp-web.js 1.19.0 » Class: Location @@ -15,7 +15,7 @@ @@ -149,7 +149,7 @@
diff --git a/docs/Message.html b/docs/Message.html index d63f606..071506d 100644 --- a/docs/Message.html +++ b/docs/Message.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Class: Message + whatsapp-web.js 1.19.0 » Class: Message @@ -15,7 +15,7 @@ @@ -650,7 +650,7 @@
diff --git a/docs/MessageMedia.html b/docs/MessageMedia.html index 4213281..980a53f 100644 --- a/docs/MessageMedia.html +++ b/docs/MessageMedia.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Class: MessageMedia + whatsapp-web.js 1.19.0 » Class: MessageMedia @@ -15,7 +15,7 @@ @@ -364,7 +364,7 @@
diff --git a/docs/NoAuth.html b/docs/NoAuth.html index 178c61e..04b3c9f 100644 --- a/docs/NoAuth.html +++ b/docs/NoAuth.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Class: NoAuth + whatsapp-web.js 1.19.0 » Class: NoAuth @@ -15,7 +15,7 @@ @@ -51,7 +51,7 @@
diff --git a/docs/Order.html b/docs/Order.html index 7cc6429..d25e1f2 100644 --- a/docs/Order.html +++ b/docs/Order.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Class: Order + whatsapp-web.js 1.19.0 » Class: Order @@ -15,7 +15,7 @@ @@ -102,7 +102,7 @@
diff --git a/docs/PrivateChat.html b/docs/PrivateChat.html index 8317e50..abe558c 100644 --- a/docs/PrivateChat.html +++ b/docs/PrivateChat.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Class: PrivateChat + whatsapp-web.js 1.19.0 » Class: PrivateChat @@ -15,7 +15,7 @@ @@ -533,7 +533,7 @@
diff --git a/docs/PrivateContact.html b/docs/PrivateContact.html index 98c2ee2..8987daa 100644 --- a/docs/PrivateContact.html +++ b/docs/PrivateContact.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Class: PrivateContact + whatsapp-web.js 1.19.0 » Class: PrivateContact @@ -15,7 +15,7 @@ @@ -319,7 +319,7 @@
diff --git a/docs/Product.html b/docs/Product.html index 63989ae..896000f 100644 --- a/docs/Product.html +++ b/docs/Product.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Class: Product + whatsapp-web.js 1.19.0 » Class: Product @@ -15,7 +15,7 @@ @@ -127,7 +127,7 @@
diff --git a/docs/Reaction.html b/docs/Reaction.html index 2499d6e..6e7df36 100644 --- a/docs/Reaction.html +++ b/docs/Reaction.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Class: Reaction + whatsapp-web.js 1.19.0 » Class: Reaction @@ -15,7 +15,7 @@ @@ -144,7 +144,7 @@
diff --git a/docs/RemoteAuth.html b/docs/RemoteAuth.html index 6d0db6c..e37622a 100644 --- a/docs/RemoteAuth.html +++ b/docs/RemoteAuth.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Class: RemoteAuth + whatsapp-web.js 1.19.0 » Class: RemoteAuth @@ -15,7 +15,7 @@ @@ -148,7 +148,7 @@
diff --git a/docs/Util.html b/docs/Util.html index e612736..cba7d45 100644 --- a/docs/Util.html +++ b/docs/Util.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Class: Util + whatsapp-web.js 1.19.0 » Class: Util @@ -15,7 +15,7 @@ @@ -243,7 +243,7 @@
diff --git a/docs/authStrategies_BaseAuthStrategy.js.html b/docs/authStrategies_BaseAuthStrategy.js.html index b914c8f..4417f6b 100644 --- a/docs/authStrategies_BaseAuthStrategy.js.html +++ b/docs/authStrategies_BaseAuthStrategy.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: authStrategies/BaseAuthStrategy.js + whatsapp-web.js 1.19.0 » Source: authStrategies/BaseAuthStrategy.js @@ -15,7 +15,7 @@ @@ -65,7 +65,7 @@ module.exports = BaseAuthStrategy;
diff --git a/docs/authStrategies_LegacySessionAuth.js.html b/docs/authStrategies_LegacySessionAuth.js.html index d48570a..60dfe74 100644 --- a/docs/authStrategies_LegacySessionAuth.js.html +++ b/docs/authStrategies_LegacySessionAuth.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: authStrategies/LegacySessionAuth.js + whatsapp-web.js 1.19.0 » Source: authStrategies/LegacySessionAuth.js @@ -15,7 +15,7 @@ @@ -111,7 +111,7 @@ module.exports = LegacySessionAuth;
diff --git a/docs/authStrategies_LocalAuth.js.html b/docs/authStrategies_LocalAuth.js.html index ba4c6a6..c8aa59f 100644 --- a/docs/authStrategies_LocalAuth.js.html +++ b/docs/authStrategies_LocalAuth.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: authStrategies/LocalAuth.js + whatsapp-web.js 1.19.0 » Source: authStrategies/LocalAuth.js @@ -15,7 +15,7 @@ @@ -91,7 +91,7 @@ module.exports = LocalAuth;
diff --git a/docs/authStrategies_NoAuth.js.html b/docs/authStrategies_NoAuth.js.html index 3ad2384..ecd9625 100644 --- a/docs/authStrategies_NoAuth.js.html +++ b/docs/authStrategies_NoAuth.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: authStrategies/NoAuth.js + whatsapp-web.js 1.19.0 » Source: authStrategies/NoAuth.js @@ -15,7 +15,7 @@ @@ -50,7 +50,7 @@ module.exports = NoAuth;
diff --git a/docs/authStrategies_RemoteAuth.js.html b/docs/authStrategies_RemoteAuth.js.html index a9b865e..1d5b67f 100644 --- a/docs/authStrategies_RemoteAuth.js.html +++ b/docs/authStrategies_RemoteAuth.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: authStrategies/RemoteAuth.js + whatsapp-web.js 1.19.0 » Source: authStrategies/RemoteAuth.js @@ -15,7 +15,7 @@ @@ -243,7 +243,7 @@ module.exports = RemoteAuth;
diff --git a/docs/global.html b/docs/global.html index e098ab7..c88dfaa 100644 --- a/docs/global.html +++ b/docs/global.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Globals + whatsapp-web.js 1.19.0 » Globals @@ -15,7 +15,7 @@ @@ -2019,7 +2019,7 @@
diff --git a/docs/index.html b/docs/index.html index 875bafe..8687453 100644 --- a/docs/index.html +++ b/docs/index.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Home + whatsapp-web.js 1.19.0 » Home @@ -15,7 +15,7 @@ @@ -27,11 +27,11 @@
-

npm Depfu WhatsApp_Web 2.2245.9 Discord Chat

+

npm Depfu WhatsApp_Web 2.2301.6 Discord Chat

whatsapp-web.js

A WhatsApp API client that connects through the WhatsApp Web browser app

It uses Puppeteer to run a real instance of Whatsapp Web to avoid getting blocked.

@@ -197,7 +197,7 @@ client.initialize();

Disclaimer

This project is not affiliated, associated, authorized, endorsed by, or in any way officially connected with WhatsApp or any of its subsidiaries or its affiliates. The official WhatsApp website can be found at https://whatsapp.com. "WhatsApp" as well as related names, marks, emblems and images are registered trademarks of their respective owners.

@@ -498,6 +498,11 @@ client.initialize();
+
+ Call#reject() +
+
+
Call#timestamp
@@ -3276,7 +3281,7 @@ client.initialize();
diff --git a/docs/structures_Base.js.html b/docs/structures_Base.js.html index 3f8c6f8..66418ba 100644 --- a/docs/structures_Base.js.html +++ b/docs/structures_Base.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: structures/Base.js + whatsapp-web.js 1.19.0 » Source: structures/Base.js @@ -15,7 +15,7 @@ @@ -60,7 +60,7 @@ module.exports = Base;
diff --git a/docs/structures_BusinessContact.js.html b/docs/structures_BusinessContact.js.html index 1107174..0924cc2 100644 --- a/docs/structures_BusinessContact.js.html +++ b/docs/structures_BusinessContact.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: structures/BusinessContact.js + whatsapp-web.js 1.19.0 » Source: structures/BusinessContact.js @@ -15,7 +15,7 @@ @@ -59,7 +59,7 @@ module.exports = BusinessContact;
diff --git a/docs/structures_Buttons.js.html b/docs/structures_Buttons.js.html index 62185c1..9cbf169 100644 --- a/docs/structures_Buttons.js.html +++ b/docs/structures_Buttons.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: structures/Buttons.js + whatsapp-web.js 1.19.0 » Source: structures/Buttons.js @@ -15,7 +15,7 @@ @@ -120,7 +120,7 @@ module.exports = Buttons;
diff --git a/docs/structures_Call.js.html b/docs/structures_Call.js.html index b67cda9..2ceb625 100644 --- a/docs/structures_Call.js.html +++ b/docs/structures_Call.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: structures/Call.js + whatsapp-web.js 1.19.0 » Source: structures/Call.js @@ -15,7 +15,7 @@ @@ -93,7 +93,15 @@ class Call extends Base { return super._patch(data); } - + + /** + * Reject the call + */ + async reject() { + return this.client.pupPage.evaluate((peerJid, id) => { + return window.WWebJS.rejectCall(peerJid, id); + }, this.from, this.id); + } } module.exports = Call; @@ -106,7 +114,7 @@ module.exports = Call;
diff --git a/docs/structures_Chat.js.html b/docs/structures_Chat.js.html index e2f7f71..2cee8f8 100644 --- a/docs/structures_Chat.js.html +++ b/docs/structures_Chat.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: structures/Chat.js + whatsapp-web.js 1.19.0 » Source: structures/Chat.js @@ -15,7 +15,7 @@ @@ -299,7 +299,7 @@ module.exports = Chat;
diff --git a/docs/structures_ClientInfo.js.html b/docs/structures_ClientInfo.js.html index a538650..1055ab6 100644 --- a/docs/structures_ClientInfo.js.html +++ b/docs/structures_ClientInfo.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: structures/ClientInfo.js + whatsapp-web.js 1.19.0 » Source: structures/ClientInfo.js @@ -15,7 +15,7 @@ @@ -109,7 +109,7 @@ module.exports = ClientInfo;
diff --git a/docs/structures_Contact.js.html b/docs/structures_Contact.js.html index 7ad3563..4cbed82 100644 --- a/docs/structures_Contact.js.html +++ b/docs/structures_Contact.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: structures/Contact.js + whatsapp-web.js 1.19.0 » Source: structures/Contact.js @@ -15,7 +15,7 @@ @@ -245,7 +245,7 @@ module.exports = Contact;
diff --git a/docs/structures_GroupChat.js.html b/docs/structures_GroupChat.js.html index bf4daa9..af108d3 100644 --- a/docs/structures_GroupChat.js.html +++ b/docs/structures_GroupChat.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: structures/GroupChat.js + whatsapp-web.js 1.19.0 » Source: structures/GroupChat.js @@ -15,7 +15,7 @@ @@ -272,7 +272,7 @@ module.exports = GroupChat;
diff --git a/docs/structures_GroupNotification.js.html b/docs/structures_GroupNotification.js.html index c3e48c5..2f982a8 100644 --- a/docs/structures_GroupNotification.js.html +++ b/docs/structures_GroupNotification.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: structures/GroupNotification.js + whatsapp-web.js 1.19.0 » Source: structures/GroupNotification.js @@ -15,7 +15,7 @@ @@ -143,7 +143,7 @@ module.exports = GroupNotification;
diff --git a/docs/structures_Label.js.html b/docs/structures_Label.js.html index 750c011..4c94add 100644 --- a/docs/structures_Label.js.html +++ b/docs/structures_Label.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: structures/Label.js + whatsapp-web.js 1.19.0 » Source: structures/Label.js @@ -15,7 +15,7 @@ @@ -88,7 +88,7 @@ module.exports = Label;
diff --git a/docs/structures_List.js.html b/docs/structures_List.js.html index 61531b6..9c8c20a 100644 --- a/docs/structures_List.js.html +++ b/docs/structures_List.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: structures/List.js + whatsapp-web.js 1.19.0 » Source: structures/List.js @@ -15,7 +15,7 @@ @@ -118,7 +118,7 @@ module.exports = List;
diff --git a/docs/structures_Location.js.html b/docs/structures_Location.js.html index a161277..3fef82f 100644 --- a/docs/structures_Location.js.html +++ b/docs/structures_Location.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: structures/Location.js + whatsapp-web.js 1.19.0 » Source: structures/Location.js @@ -15,7 +15,7 @@ @@ -71,7 +71,7 @@ module.exports = Location;
diff --git a/docs/structures_Message.js.html b/docs/structures_Message.js.html index adc947b..e8dc635 100644 --- a/docs/structures_Message.js.html +++ b/docs/structures_Message.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: structures/Message.js + whatsapp-web.js 1.19.0 » Source: structures/Message.js @@ -15,7 +15,7 @@ @@ -417,7 +417,9 @@ class Message extends Base { const result = await this.client.pupPage.evaluate(async (msgId) => { const msg = window.Store.Msg.get(msgId); - + if (!msg) { + return undefined; + } if (msg.mediaData.mediaStage != 'RESOLVED') { // try to resolve media await msg.downloadMedia({ @@ -571,7 +573,7 @@ module.exports = Message;
diff --git a/docs/structures_MessageMedia.js.html b/docs/structures_MessageMedia.js.html index 7518e5a..0b220cd 100644 --- a/docs/structures_MessageMedia.js.html +++ b/docs/structures_MessageMedia.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: structures/MessageMedia.js + whatsapp-web.js 1.19.0 » Source: structures/MessageMedia.js @@ -15,7 +15,7 @@ @@ -150,7 +150,7 @@ module.exports = MessageMedia;
diff --git a/docs/structures_Order.js.html b/docs/structures_Order.js.html index 191f812..4971115 100644 --- a/docs/structures_Order.js.html +++ b/docs/structures_Order.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: structures/Order.js + whatsapp-web.js 1.19.0 » Source: structures/Order.js @@ -15,7 +15,7 @@ @@ -90,7 +90,7 @@ module.exports = Order;
diff --git a/docs/structures_Payment.js.html b/docs/structures_Payment.js.html index b118b40..9399cfd 100644 --- a/docs/structures_Payment.js.html +++ b/docs/structures_Payment.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: structures/Payment.js + whatsapp-web.js 1.19.0 » Source: structures/Payment.js @@ -15,7 +15,7 @@ @@ -118,7 +118,7 @@ module.exports = Payment;
diff --git a/docs/structures_PrivateChat.js.html b/docs/structures_PrivateChat.js.html index 72c40a2..cdba2e7 100644 --- a/docs/structures_PrivateChat.js.html +++ b/docs/structures_PrivateChat.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: structures/PrivateChat.js + whatsapp-web.js 1.19.0 » Source: structures/PrivateChat.js @@ -15,7 +15,7 @@ @@ -51,7 +51,7 @@ module.exports = PrivateChat;
diff --git a/docs/structures_PrivateContact.js.html b/docs/structures_PrivateContact.js.html index c072878..a9adad1 100644 --- a/docs/structures_PrivateContact.js.html +++ b/docs/structures_PrivateContact.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: structures/PrivateContact.js + whatsapp-web.js 1.19.0 » Source: structures/PrivateContact.js @@ -15,7 +15,7 @@ @@ -51,7 +51,7 @@ module.exports = PrivateContact;
diff --git a/docs/structures_Product.js.html b/docs/structures_Product.js.html index 202d07e..d5e4996 100644 --- a/docs/structures_Product.js.html +++ b/docs/structures_Product.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: structures/Product.js + whatsapp-web.js 1.19.0 » Source: structures/Product.js @@ -15,7 +15,7 @@ @@ -106,7 +106,7 @@ module.exports = Product;
diff --git a/docs/structures_ProductMetadata.js.html b/docs/structures_ProductMetadata.js.html index 730925a..5b035fd 100644 --- a/docs/structures_ProductMetadata.js.html +++ b/docs/structures_ProductMetadata.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: structures/ProductMetadata.js + whatsapp-web.js 1.19.0 » Source: structures/ProductMetadata.js @@ -15,7 +15,7 @@ @@ -63,7 +63,7 @@ module.exports = ProductMetadata;
diff --git a/docs/structures_Reaction.js.html b/docs/structures_Reaction.js.html index 2308bab..828d26c 100644 --- a/docs/structures_Reaction.js.html +++ b/docs/structures_Reaction.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: structures/Reaction.js + whatsapp-web.js 1.19.0 » Source: structures/Reaction.js @@ -15,7 +15,7 @@ @@ -107,7 +107,7 @@ module.exports = Reaction;
diff --git a/docs/util_Constants.js.html b/docs/util_Constants.js.html index ffc1ef9..d344f3c 100644 --- a/docs/util_Constants.js.html +++ b/docs/util_Constants.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: util/Constants.js + whatsapp-web.js 1.19.0 » Source: util/Constants.js @@ -15,7 +15,7 @@ @@ -82,7 +82,7 @@ exports.Events = { DISCONNECTED: 'disconnected', STATE_CHANGED: 'change_state', BATTERY_CHANGED: 'change_battery', - INCOMING_CALL: 'incoming_call', + INCOMING_CALL: 'call', REMOTE_SESSION_SAVED: 'remote_session_saved' }; @@ -200,7 +200,7 @@ exports.MessageAck = {
diff --git a/docs/util_InterfaceController.js.html b/docs/util_InterfaceController.js.html index 2d18f56..442064e 100644 --- a/docs/util_InterfaceController.js.html +++ b/docs/util_InterfaceController.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: util/InterfaceController.js + whatsapp-web.js 1.19.0 » Source: util/InterfaceController.js @@ -15,7 +15,7 @@ @@ -110,6 +110,7 @@ class InterfaceController { */ async getFeatures() { return await this.pupPage.evaluate(() => { + if(!window.Store.Features) throw new Error('This version of Whatsapp Web does not support features'); return window.Store.Features.F; }); } @@ -120,6 +121,7 @@ class InterfaceController { */ async checkFeatureStatus(feature) { return await this.pupPage.evaluate((feature) => { + if(!window.Store.Features) throw new Error('This version of Whatsapp Web does not support features'); return window.Store.Features.supportsFeature(feature); }, feature); } @@ -130,6 +132,7 @@ class InterfaceController { */ async enableFeatures(features) { await this.pupPage.evaluate((features) => { + if(!window.Store.Features) throw new Error('This version of Whatsapp Web does not support features'); for (const feature in features) { window.Store.Features.setFeature(features[feature], true); } @@ -142,6 +145,7 @@ class InterfaceController { */ async disableFeatures(features) { await this.pupPage.evaluate((features) => { + if(!window.Store.Features) throw new Error('This version of Whatsapp Web does not support features'); for (const feature in features) { window.Store.Features.setFeature(features[feature], false); } @@ -160,7 +164,7 @@ module.exports = InterfaceController;
diff --git a/docs/util_Util.js.html b/docs/util_Util.js.html index a35663a..60e966f 100644 --- a/docs/util_Util.js.html +++ b/docs/util_Util.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: util/Util.js + whatsapp-web.js 1.19.0 » Source: util/Util.js @@ -15,7 +15,7 @@ @@ -225,7 +225,7 @@ module.exports = Util;
diff --git a/package.json b/package.json index 450d31f..366aa7c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "whatsapp-web.js", - "version": "1.18.4", + "version": "1.19.0", "description": "Library for interacting with the WhatsApp Web API ", "main": "./index.js", "typings": "./index.d.ts", From e1917494bf44fa77a77b1156cb042b43f7d58adf Mon Sep 17 00:00:00 2001 From: "Pedro S. Lopez" Date: Sun, 15 Jan 2023 14:54:50 -0400 Subject: [PATCH 07/11] Revert "fix: Fix client-side message rendering issue when sending attachements through the library (#1905)" (#1932) This reverts commit 7dd8688f048faad658a6718a57f83488421735da. --- src/util/Injected.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/util/Injected.js b/src/util/Injected.js index bc05602..e1f3871 100644 --- a/src/util/Injected.js +++ b/src/util/Injected.js @@ -271,7 +271,6 @@ exports.LoadUtils = () => { ...ephemeralFields, ...locationOptions, ...attOptions, - ...(Object.keys(attOptions).length > 0 ? attOptions.toJSON() : {}), ...quotedMsgOptions, ...vcardOptions, ...buttonOptions, From 1e3374f0cd4fc5ba28b8611336f8ada36aa16be8 Mon Sep 17 00:00:00 2001 From: Pedro Lopez Date: Sun, 15 Jan 2023 14:55:28 -0400 Subject: [PATCH 08/11] chore: mark version v1.19.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 366aa7c..a396b2d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "whatsapp-web.js", - "version": "1.19.0", + "version": "1.19.1", "description": "Library for interacting with the WhatsApp Web API ", "main": "./index.js", "typings": "./index.d.ts", From 698305f66882f3ef8c37cdcf7ca0daee45dac9fb Mon Sep 17 00:00:00 2001 From: Pedro Lopez Date: Sun, 15 Jan 2023 14:56:00 -0400 Subject: [PATCH 09/11] update docs for 1.19.1 --- docs/Base.html | 4 ++-- docs/BaseAuthStrategy.html | 4 ++-- docs/BusinessContact.html | 4 ++-- docs/Buttons.html | 4 ++-- docs/Call.html | 4 ++-- docs/Chat.html | 4 ++-- docs/Client.html | 4 ++-- docs/Client.js.html | 4 ++-- docs/ClientInfo.html | 4 ++-- docs/Contact.html | 4 ++-- docs/GroupChat.html | 4 ++-- docs/GroupNotification.html | 4 ++-- docs/InterfaceController.html | 4 ++-- docs/Label.html | 4 ++-- docs/LegacySessionAuth.html | 4 ++-- docs/List.html | 4 ++-- docs/LocalAuth.html | 4 ++-- docs/Location.html | 4 ++-- docs/Message.html | 4 ++-- docs/MessageMedia.html | 4 ++-- docs/NoAuth.html | 4 ++-- docs/Order.html | 4 ++-- docs/PrivateChat.html | 4 ++-- docs/PrivateContact.html | 4 ++-- docs/Product.html | 4 ++-- docs/Reaction.html | 4 ++-- docs/RemoteAuth.html | 4 ++-- docs/Util.html | 4 ++-- docs/authStrategies_BaseAuthStrategy.js.html | 4 ++-- docs/authStrategies_LegacySessionAuth.js.html | 4 ++-- docs/authStrategies_LocalAuth.js.html | 4 ++-- docs/authStrategies_NoAuth.js.html | 4 ++-- docs/authStrategies_RemoteAuth.js.html | 4 ++-- docs/global.html | 4 ++-- docs/index.html | 6 +++--- docs/structures_Base.js.html | 4 ++-- docs/structures_BusinessContact.js.html | 4 ++-- docs/structures_Buttons.js.html | 4 ++-- docs/structures_Call.js.html | 4 ++-- docs/structures_Chat.js.html | 4 ++-- docs/structures_ClientInfo.js.html | 4 ++-- docs/structures_Contact.js.html | 4 ++-- docs/structures_GroupChat.js.html | 4 ++-- docs/structures_GroupNotification.js.html | 4 ++-- docs/structures_Label.js.html | 4 ++-- docs/structures_List.js.html | 4 ++-- docs/structures_Location.js.html | 4 ++-- docs/structures_Message.js.html | 4 ++-- docs/structures_MessageMedia.js.html | 4 ++-- docs/structures_Order.js.html | 4 ++-- docs/structures_Payment.js.html | 4 ++-- docs/structures_PrivateChat.js.html | 4 ++-- docs/structures_PrivateContact.js.html | 4 ++-- docs/structures_Product.js.html | 4 ++-- docs/structures_ProductMetadata.js.html | 4 ++-- docs/structures_Reaction.js.html | 4 ++-- docs/util_Constants.js.html | 4 ++-- docs/util_InterfaceController.js.html | 4 ++-- docs/util_Util.js.html | 4 ++-- 59 files changed, 119 insertions(+), 119 deletions(-) diff --git a/docs/Base.html b/docs/Base.html index 6d4df28..405ceda 100644 --- a/docs/Base.html +++ b/docs/Base.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Class: Base + whatsapp-web.js 1.19.1 » Class: Base @@ -15,7 +15,7 @@ diff --git a/docs/BaseAuthStrategy.html b/docs/BaseAuthStrategy.html index d73f022..7e45bbd 100644 --- a/docs/BaseAuthStrategy.html +++ b/docs/BaseAuthStrategy.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Class: BaseAuthStrategy + whatsapp-web.js 1.19.1 » Class: BaseAuthStrategy @@ -15,7 +15,7 @@ diff --git a/docs/BusinessContact.html b/docs/BusinessContact.html index fa8ffff..a009637 100644 --- a/docs/BusinessContact.html +++ b/docs/BusinessContact.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Class: BusinessContact + whatsapp-web.js 1.19.1 » Class: BusinessContact @@ -15,7 +15,7 @@ diff --git a/docs/Buttons.html b/docs/Buttons.html index aea4229..eda6387 100644 --- a/docs/Buttons.html +++ b/docs/Buttons.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Class: Buttons + whatsapp-web.js 1.19.1 » Class: Buttons @@ -15,7 +15,7 @@ diff --git a/docs/Call.html b/docs/Call.html index 532867a..5bf102c 100644 --- a/docs/Call.html +++ b/docs/Call.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Class: Call + whatsapp-web.js 1.19.1 » Class: Call @@ -15,7 +15,7 @@ diff --git a/docs/Chat.html b/docs/Chat.html index 7ef6426..58d67b0 100644 --- a/docs/Chat.html +++ b/docs/Chat.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Class: Chat + whatsapp-web.js 1.19.1 » Class: Chat @@ -15,7 +15,7 @@ diff --git a/docs/Client.html b/docs/Client.html index 3d5be24..de09c4a 100644 --- a/docs/Client.html +++ b/docs/Client.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Class: Client + whatsapp-web.js 1.19.1 » Class: Client @@ -15,7 +15,7 @@ diff --git a/docs/Client.js.html b/docs/Client.js.html index 17a955e..e3e7bb4 100644 --- a/docs/Client.js.html +++ b/docs/Client.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: Client.js + whatsapp-web.js 1.19.1 » Source: Client.js @@ -15,7 +15,7 @@ diff --git a/docs/ClientInfo.html b/docs/ClientInfo.html index b6e3a0b..2653b0c 100644 --- a/docs/ClientInfo.html +++ b/docs/ClientInfo.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Class: ClientInfo + whatsapp-web.js 1.19.1 » Class: ClientInfo @@ -15,7 +15,7 @@ diff --git a/docs/Contact.html b/docs/Contact.html index 3f0658d..3144b3a 100644 --- a/docs/Contact.html +++ b/docs/Contact.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Class: Contact + whatsapp-web.js 1.19.1 » Class: Contact @@ -15,7 +15,7 @@ diff --git a/docs/GroupChat.html b/docs/GroupChat.html index 2ae8fbc..9cabfa2 100644 --- a/docs/GroupChat.html +++ b/docs/GroupChat.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Class: GroupChat + whatsapp-web.js 1.19.1 » Class: GroupChat @@ -15,7 +15,7 @@ diff --git a/docs/GroupNotification.html b/docs/GroupNotification.html index eb482e8..419bcf9 100644 --- a/docs/GroupNotification.html +++ b/docs/GroupNotification.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Class: GroupNotification + whatsapp-web.js 1.19.1 » Class: GroupNotification @@ -15,7 +15,7 @@ diff --git a/docs/InterfaceController.html b/docs/InterfaceController.html index 33c243d..2d73cf8 100644 --- a/docs/InterfaceController.html +++ b/docs/InterfaceController.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Class: InterfaceController + whatsapp-web.js 1.19.1 » Class: InterfaceController @@ -15,7 +15,7 @@ diff --git a/docs/Label.html b/docs/Label.html index e7361d9..578779f 100644 --- a/docs/Label.html +++ b/docs/Label.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Class: Label + whatsapp-web.js 1.19.1 » Class: Label @@ -15,7 +15,7 @@ diff --git a/docs/LegacySessionAuth.html b/docs/LegacySessionAuth.html index 38af381..833f2c4 100644 --- a/docs/LegacySessionAuth.html +++ b/docs/LegacySessionAuth.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Class: LegacySessionAuth + whatsapp-web.js 1.19.1 » Class: LegacySessionAuth @@ -15,7 +15,7 @@ diff --git a/docs/List.html b/docs/List.html index 22880df..ead1c22 100644 --- a/docs/List.html +++ b/docs/List.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Class: List + whatsapp-web.js 1.19.1 » Class: List @@ -15,7 +15,7 @@ diff --git a/docs/LocalAuth.html b/docs/LocalAuth.html index 65ecb37..54cb42a 100644 --- a/docs/LocalAuth.html +++ b/docs/LocalAuth.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Class: LocalAuth + whatsapp-web.js 1.19.1 » Class: LocalAuth @@ -15,7 +15,7 @@ diff --git a/docs/Location.html b/docs/Location.html index 67a7582..fd1926c 100644 --- a/docs/Location.html +++ b/docs/Location.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Class: Location + whatsapp-web.js 1.19.1 » Class: Location @@ -15,7 +15,7 @@ diff --git a/docs/Message.html b/docs/Message.html index 071506d..1782545 100644 --- a/docs/Message.html +++ b/docs/Message.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Class: Message + whatsapp-web.js 1.19.1 » Class: Message @@ -15,7 +15,7 @@ diff --git a/docs/MessageMedia.html b/docs/MessageMedia.html index 980a53f..33359d3 100644 --- a/docs/MessageMedia.html +++ b/docs/MessageMedia.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Class: MessageMedia + whatsapp-web.js 1.19.1 » Class: MessageMedia @@ -15,7 +15,7 @@ diff --git a/docs/NoAuth.html b/docs/NoAuth.html index 04b3c9f..119126a 100644 --- a/docs/NoAuth.html +++ b/docs/NoAuth.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Class: NoAuth + whatsapp-web.js 1.19.1 » Class: NoAuth @@ -15,7 +15,7 @@ diff --git a/docs/Order.html b/docs/Order.html index d25e1f2..ea747c4 100644 --- a/docs/Order.html +++ b/docs/Order.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Class: Order + whatsapp-web.js 1.19.1 » Class: Order @@ -15,7 +15,7 @@ diff --git a/docs/PrivateChat.html b/docs/PrivateChat.html index abe558c..f38ad1e 100644 --- a/docs/PrivateChat.html +++ b/docs/PrivateChat.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Class: PrivateChat + whatsapp-web.js 1.19.1 » Class: PrivateChat @@ -15,7 +15,7 @@ diff --git a/docs/PrivateContact.html b/docs/PrivateContact.html index 8987daa..3473ea0 100644 --- a/docs/PrivateContact.html +++ b/docs/PrivateContact.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Class: PrivateContact + whatsapp-web.js 1.19.1 » Class: PrivateContact @@ -15,7 +15,7 @@ diff --git a/docs/Product.html b/docs/Product.html index 896000f..457f833 100644 --- a/docs/Product.html +++ b/docs/Product.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Class: Product + whatsapp-web.js 1.19.1 » Class: Product @@ -15,7 +15,7 @@ diff --git a/docs/Reaction.html b/docs/Reaction.html index 6e7df36..0517004 100644 --- a/docs/Reaction.html +++ b/docs/Reaction.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Class: Reaction + whatsapp-web.js 1.19.1 » Class: Reaction @@ -15,7 +15,7 @@ diff --git a/docs/RemoteAuth.html b/docs/RemoteAuth.html index e37622a..5f1baa7 100644 --- a/docs/RemoteAuth.html +++ b/docs/RemoteAuth.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Class: RemoteAuth + whatsapp-web.js 1.19.1 » Class: RemoteAuth @@ -15,7 +15,7 @@ diff --git a/docs/Util.html b/docs/Util.html index cba7d45..5083b76 100644 --- a/docs/Util.html +++ b/docs/Util.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Class: Util + whatsapp-web.js 1.19.1 » Class: Util @@ -15,7 +15,7 @@ diff --git a/docs/authStrategies_BaseAuthStrategy.js.html b/docs/authStrategies_BaseAuthStrategy.js.html index 4417f6b..2db9523 100644 --- a/docs/authStrategies_BaseAuthStrategy.js.html +++ b/docs/authStrategies_BaseAuthStrategy.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: authStrategies/BaseAuthStrategy.js + whatsapp-web.js 1.19.1 » Source: authStrategies/BaseAuthStrategy.js @@ -15,7 +15,7 @@ diff --git a/docs/authStrategies_LegacySessionAuth.js.html b/docs/authStrategies_LegacySessionAuth.js.html index 60dfe74..ed0343d 100644 --- a/docs/authStrategies_LegacySessionAuth.js.html +++ b/docs/authStrategies_LegacySessionAuth.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: authStrategies/LegacySessionAuth.js + whatsapp-web.js 1.19.1 » Source: authStrategies/LegacySessionAuth.js @@ -15,7 +15,7 @@ diff --git a/docs/authStrategies_LocalAuth.js.html b/docs/authStrategies_LocalAuth.js.html index c8aa59f..6320366 100644 --- a/docs/authStrategies_LocalAuth.js.html +++ b/docs/authStrategies_LocalAuth.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: authStrategies/LocalAuth.js + whatsapp-web.js 1.19.1 » Source: authStrategies/LocalAuth.js @@ -15,7 +15,7 @@ diff --git a/docs/authStrategies_NoAuth.js.html b/docs/authStrategies_NoAuth.js.html index ecd9625..1be866f 100644 --- a/docs/authStrategies_NoAuth.js.html +++ b/docs/authStrategies_NoAuth.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: authStrategies/NoAuth.js + whatsapp-web.js 1.19.1 » Source: authStrategies/NoAuth.js @@ -15,7 +15,7 @@ diff --git a/docs/authStrategies_RemoteAuth.js.html b/docs/authStrategies_RemoteAuth.js.html index 1d5b67f..f7f48d2 100644 --- a/docs/authStrategies_RemoteAuth.js.html +++ b/docs/authStrategies_RemoteAuth.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: authStrategies/RemoteAuth.js + whatsapp-web.js 1.19.1 » Source: authStrategies/RemoteAuth.js @@ -15,7 +15,7 @@ diff --git a/docs/global.html b/docs/global.html index c88dfaa..f599dc7 100644 --- a/docs/global.html +++ b/docs/global.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Globals + whatsapp-web.js 1.19.1 » Globals @@ -15,7 +15,7 @@ diff --git a/docs/index.html b/docs/index.html index 8687453..7b3457e 100644 --- a/docs/index.html +++ b/docs/index.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Home + whatsapp-web.js 1.19.1 » Home @@ -15,7 +15,7 @@ @@ -27,7 +27,7 @@
diff --git a/docs/structures_Base.js.html b/docs/structures_Base.js.html index 66418ba..4e70ed7 100644 --- a/docs/structures_Base.js.html +++ b/docs/structures_Base.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: structures/Base.js + whatsapp-web.js 1.19.1 » Source: structures/Base.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_BusinessContact.js.html b/docs/structures_BusinessContact.js.html index 0924cc2..e7600cd 100644 --- a/docs/structures_BusinessContact.js.html +++ b/docs/structures_BusinessContact.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: structures/BusinessContact.js + whatsapp-web.js 1.19.1 » Source: structures/BusinessContact.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Buttons.js.html b/docs/structures_Buttons.js.html index 9cbf169..3a79b8d 100644 --- a/docs/structures_Buttons.js.html +++ b/docs/structures_Buttons.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: structures/Buttons.js + whatsapp-web.js 1.19.1 » Source: structures/Buttons.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Call.js.html b/docs/structures_Call.js.html index 2ceb625..2c64c0a 100644 --- a/docs/structures_Call.js.html +++ b/docs/structures_Call.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: structures/Call.js + whatsapp-web.js 1.19.1 » Source: structures/Call.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Chat.js.html b/docs/structures_Chat.js.html index 2cee8f8..0fab4cb 100644 --- a/docs/structures_Chat.js.html +++ b/docs/structures_Chat.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: structures/Chat.js + whatsapp-web.js 1.19.1 » Source: structures/Chat.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_ClientInfo.js.html b/docs/structures_ClientInfo.js.html index 1055ab6..4c205c7 100644 --- a/docs/structures_ClientInfo.js.html +++ b/docs/structures_ClientInfo.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: structures/ClientInfo.js + whatsapp-web.js 1.19.1 » Source: structures/ClientInfo.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Contact.js.html b/docs/structures_Contact.js.html index 4cbed82..2da1245 100644 --- a/docs/structures_Contact.js.html +++ b/docs/structures_Contact.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: structures/Contact.js + whatsapp-web.js 1.19.1 » Source: structures/Contact.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_GroupChat.js.html b/docs/structures_GroupChat.js.html index af108d3..7635f2e 100644 --- a/docs/structures_GroupChat.js.html +++ b/docs/structures_GroupChat.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: structures/GroupChat.js + whatsapp-web.js 1.19.1 » Source: structures/GroupChat.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_GroupNotification.js.html b/docs/structures_GroupNotification.js.html index 2f982a8..882f1cd 100644 --- a/docs/structures_GroupNotification.js.html +++ b/docs/structures_GroupNotification.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: structures/GroupNotification.js + whatsapp-web.js 1.19.1 » Source: structures/GroupNotification.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Label.js.html b/docs/structures_Label.js.html index 4c94add..84fe4a5 100644 --- a/docs/structures_Label.js.html +++ b/docs/structures_Label.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: structures/Label.js + whatsapp-web.js 1.19.1 » Source: structures/Label.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_List.js.html b/docs/structures_List.js.html index 9c8c20a..5b90208 100644 --- a/docs/structures_List.js.html +++ b/docs/structures_List.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: structures/List.js + whatsapp-web.js 1.19.1 » Source: structures/List.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Location.js.html b/docs/structures_Location.js.html index 3fef82f..5d66947 100644 --- a/docs/structures_Location.js.html +++ b/docs/structures_Location.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: structures/Location.js + whatsapp-web.js 1.19.1 » Source: structures/Location.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Message.js.html b/docs/structures_Message.js.html index e8dc635..0c4d051 100644 --- a/docs/structures_Message.js.html +++ b/docs/structures_Message.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: structures/Message.js + whatsapp-web.js 1.19.1 » Source: structures/Message.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_MessageMedia.js.html b/docs/structures_MessageMedia.js.html index 0b220cd..499f7cf 100644 --- a/docs/structures_MessageMedia.js.html +++ b/docs/structures_MessageMedia.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: structures/MessageMedia.js + whatsapp-web.js 1.19.1 » Source: structures/MessageMedia.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Order.js.html b/docs/structures_Order.js.html index 4971115..9ad5d7e 100644 --- a/docs/structures_Order.js.html +++ b/docs/structures_Order.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: structures/Order.js + whatsapp-web.js 1.19.1 » Source: structures/Order.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Payment.js.html b/docs/structures_Payment.js.html index 9399cfd..e934dd1 100644 --- a/docs/structures_Payment.js.html +++ b/docs/structures_Payment.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: structures/Payment.js + whatsapp-web.js 1.19.1 » Source: structures/Payment.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_PrivateChat.js.html b/docs/structures_PrivateChat.js.html index cdba2e7..b7af145 100644 --- a/docs/structures_PrivateChat.js.html +++ b/docs/structures_PrivateChat.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: structures/PrivateChat.js + whatsapp-web.js 1.19.1 » Source: structures/PrivateChat.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_PrivateContact.js.html b/docs/structures_PrivateContact.js.html index a9adad1..7aec0d9 100644 --- a/docs/structures_PrivateContact.js.html +++ b/docs/structures_PrivateContact.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: structures/PrivateContact.js + whatsapp-web.js 1.19.1 » Source: structures/PrivateContact.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Product.js.html b/docs/structures_Product.js.html index d5e4996..9e78871 100644 --- a/docs/structures_Product.js.html +++ b/docs/structures_Product.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: structures/Product.js + whatsapp-web.js 1.19.1 » Source: structures/Product.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_ProductMetadata.js.html b/docs/structures_ProductMetadata.js.html index 5b035fd..ba7f554 100644 --- a/docs/structures_ProductMetadata.js.html +++ b/docs/structures_ProductMetadata.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: structures/ProductMetadata.js + whatsapp-web.js 1.19.1 » Source: structures/ProductMetadata.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Reaction.js.html b/docs/structures_Reaction.js.html index 828d26c..6b47024 100644 --- a/docs/structures_Reaction.js.html +++ b/docs/structures_Reaction.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: structures/Reaction.js + whatsapp-web.js 1.19.1 » Source: structures/Reaction.js @@ -15,7 +15,7 @@ diff --git a/docs/util_Constants.js.html b/docs/util_Constants.js.html index d344f3c..12a26d5 100644 --- a/docs/util_Constants.js.html +++ b/docs/util_Constants.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: util/Constants.js + whatsapp-web.js 1.19.1 » Source: util/Constants.js @@ -15,7 +15,7 @@ diff --git a/docs/util_InterfaceController.js.html b/docs/util_InterfaceController.js.html index 442064e..02b7dc3 100644 --- a/docs/util_InterfaceController.js.html +++ b/docs/util_InterfaceController.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: util/InterfaceController.js + whatsapp-web.js 1.19.1 » Source: util/InterfaceController.js @@ -15,7 +15,7 @@ diff --git a/docs/util_Util.js.html b/docs/util_Util.js.html index 60e966f..5f19a8f 100644 --- a/docs/util_Util.js.html +++ b/docs/util_Util.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: util/Util.js + whatsapp-web.js 1.19.1 » Source: util/Util.js @@ -15,7 +15,7 @@ From 70f2391d51c6684dc22b84d7518b9ea9482ab83e Mon Sep 17 00:00:00 2001 From: "Pedro S. Lopez" Date: Sun, 15 Jan 2023 17:59:20 -0400 Subject: [PATCH 10/11] fix group methods (#1934) * fix: create group * fix set group subject, description, properties; exit group * fix participant methods * fix return type * fix invite methods --- src/Client.js | 18 +++++----- src/structures/GroupChat.js | 70 ++++++++++++++++++++++++------------- src/util/Injected.js | 12 +++---- 3 files changed, 60 insertions(+), 40 deletions(-) diff --git a/src/Client.js b/src/Client.js index d3c9bb4..7a09d7a 100644 --- a/src/Client.js +++ b/src/Client.js @@ -774,7 +774,7 @@ class Client extends EventEmitter { */ async getInviteInfo(inviteCode) { return await this.pupPage.evaluate(inviteCode => { - return window.Store.InviteInfo.sendQueryGroupInvite(inviteCode); + return window.Store.InviteInfo.queryGroupInvite(inviteCode); }, inviteCode); } @@ -784,11 +784,11 @@ class Client extends EventEmitter { * @returns {Promise} Id of the joined Chat */ async acceptInvite(inviteCode) { - const chatId = await this.pupPage.evaluate(async inviteCode => { - return await window.Store.Invite.sendJoinGroupViaInvite(inviteCode); + const res = await this.pupPage.evaluate(async inviteCode => { + return await window.Store.Invite.joinGroupViaInvite(inviteCode); }, inviteCode); - return chatId._serialized; + return res.gid._serialized; } /** @@ -1095,19 +1095,17 @@ class Client extends EventEmitter { const createRes = await this.pupPage.evaluate(async (name, participantIds) => { const participantWIDs = participantIds.map(p => window.Store.WidFactory.createWid(p)); - const id = window.Store.MsgKey.newId(); - const res = await window.Store.GroupUtils.sendCreateGroup(name, participantWIDs, undefined, id); - return res; + return await window.Store.GroupUtils.createGroup(name, participantWIDs, 0); }, name, participants); const missingParticipants = createRes.participants.reduce(((missing, c) => { - const id = Object.keys(c)[0]; - const statusCode = c[id].code; + const id = c.wid._serialized; + const statusCode = c.error ? c.error.toString() : '200'; if (statusCode != 200) return Object.assign(missing, { [id]: statusCode }); return missing; }), {}); - return { gid: createRes.gid, missingParticipants }; + return { gid: createRes.wid, missingParticipants }; } /** diff --git a/src/structures/GroupChat.js b/src/structures/GroupChat.js index c11f5a9..0be6b62 100644 --- a/src/structures/GroupChat.js +++ b/src/structures/GroupChat.js @@ -59,10 +59,15 @@ class GroupChat extends Chat { * @returns {Promise} */ async addParticipants(participantIds) { - return await this.client.pupPage.evaluate((chatId, participantIds) => { + return await this.client.pupPage.evaluate(async (chatId, participantIds) => { const chatWid = window.Store.WidFactory.createWid(chatId); - const participantWids = participantIds.map(p => window.Store.WidFactory.createWid(p)); - return window.Store.GroupParticipants.sendAddParticipants(chatWid, participantWids); + const chat = await window.Store.Chat.find(chatWid); + const participants = await Promise.all(participantIds.map(async p => { + const wid = window.Store.WidFactory.createWid(p); + return await window.Store.Contact.get(wid); + })); + await window.Store.GroupParticipants.addParticipants(chat, participants); + return { status: 200 }; }, this.id._serialized, participantIds); } @@ -72,10 +77,14 @@ class GroupChat extends Chat { * @returns {Promise} */ async removeParticipants(participantIds) { - return await this.client.pupPage.evaluate((chatId, participantIds) => { + return await this.client.pupPage.evaluate(async (chatId, participantIds) => { const chatWid = window.Store.WidFactory.createWid(chatId); - const participantWids = participantIds.map(p => window.Store.WidFactory.createWid(p)); - return window.Store.GroupParticipants.sendRemoveParticipants(chatWid, participantWids); + const chat = await window.Store.Chat.find(chatWid); + const participants = participantIds.map(p => { + return chat.groupMetadata.participants.get(p); + }).filter(p => Boolean(p)); + await window.Store.GroupParticipants.removeParticipants(chat, participants); + return { status: 200 }; }, this.id._serialized, participantIds); } @@ -85,10 +94,14 @@ class GroupChat extends Chat { * @returns {Promise<{ status: number }>} Object with status code indicating if the operation was successful */ async promoteParticipants(participantIds) { - return await this.client.pupPage.evaluate((chatId, participantIds) => { + return await this.client.pupPage.evaluate(async (chatId, participantIds) => { const chatWid = window.Store.WidFactory.createWid(chatId); - const participantWids = participantIds.map(p => window.Store.WidFactory.createWid(p)); - return window.Store.GroupParticipants.sendPromoteParticipants(chatWid, participantWids); + const chat = await window.Store.Chat.find(chatWid); + const participants = participantIds.map(p => { + return chat.groupMetadata.participants.get(p); + }).filter(p => Boolean(p)); + await window.Store.GroupParticipants.promoteParticipants(chat, participants); + return { status: 200 }; }, this.id._serialized, participantIds); } @@ -98,10 +111,14 @@ class GroupChat extends Chat { * @returns {Promise<{ status: number }>} Object with status code indicating if the operation was successful */ async demoteParticipants(participantIds) { - return await this.client.pupPage.evaluate((chatId, participantIds) => { + return await this.client.pupPage.evaluate(async (chatId, participantIds) => { const chatWid = window.Store.WidFactory.createWid(chatId); - const participantWids = participantIds.map(p => window.Store.WidFactory.createWid(p)); - return window.Store.GroupParticipants.sendDemoteParticipants(chatWid, participantWids); + const chat = await window.Store.Chat.find(chatWid); + const participants = participantIds.map(p => { + return chat.groupMetadata.participants.get(p); + }).filter(p => Boolean(p)); + await window.Store.GroupParticipants.demoteParticipants(chat, participants); + return { status: 200 }; }, this.id._serialized, participantIds); } @@ -114,7 +131,8 @@ class GroupChat extends Chat { const success = await this.client.pupPage.evaluate(async (chatId, subject) => { const chatWid = window.Store.WidFactory.createWid(chatId); try { - return await window.Store.GroupUtils.sendSetGroupSubject(chatWid, subject); + await window.Store.GroupUtils.setGroupSubject(chatWid, subject); + return true; } catch (err) { if(err.name === 'ServerStatusCodeError') return false; throw err; @@ -136,7 +154,8 @@ class GroupChat extends Chat { const chatWid = window.Store.WidFactory.createWid(chatId); let descId = window.Store.GroupMetadata.get(chatWid).descId; try { - return await window.Store.GroupUtils.sendSetGroupDescription(chatWid, description, window.Store.MsgKey.newId(), descId); + await window.Store.GroupUtils.setGroupDescription(chatWid, description, window.Store.MsgKey.newId(), descId); + return true; } catch (err) { if(err.name === 'ServerStatusCodeError') return false; throw err; @@ -157,7 +176,8 @@ class GroupChat extends Chat { const success = await this.client.pupPage.evaluate(async (chatId, adminsOnly) => { const chatWid = window.Store.WidFactory.createWid(chatId); try { - return await window.Store.GroupUtils.sendSetGroupProperty(chatWid, 'announcement', adminsOnly ? 1 : 0); + await window.Store.GroupUtils.setGroupProperty(chatWid, 'announcement', adminsOnly ? 1 : 0); + return true; } catch (err) { if(err.name === 'ServerStatusCodeError') return false; throw err; @@ -179,7 +199,8 @@ class GroupChat extends Chat { const success = await this.client.pupPage.evaluate(async (chatId, adminsOnly) => { const chatWid = window.Store.WidFactory.createWid(chatId); try { - return await window.Store.GroupUtils.sendSetGroupProperty(chatWid, 'restrict', adminsOnly ? 1 : 0); + await window.Store.GroupUtils.setGroupProperty(chatWid, 'restrict', adminsOnly ? 1 : 0); + return true; } catch (err) { if(err.name === 'ServerStatusCodeError') return false; throw err; @@ -197,12 +218,12 @@ class GroupChat extends Chat { * @returns {Promise} Group's invite code */ async getInviteCode() { - const code = await this.client.pupPage.evaluate(async chatId => { + const codeRes = await this.client.pupPage.evaluate(async chatId => { const chatWid = window.Store.WidFactory.createWid(chatId); - return window.Store.Invite.sendQueryGroupInviteCode(chatWid); + return window.Store.Invite.queryGroupInviteCode(chatWid); }, this.id._serialized); - return code; + return codeRes.code; } /** @@ -210,12 +231,12 @@ class GroupChat extends Chat { * @returns {Promise} New invite code */ async revokeInvite() { - const code = await this.client.pupPage.evaluate(chatId => { + const codeRes = await this.client.pupPage.evaluate(chatId => { const chatWid = window.Store.WidFactory.createWid(chatId); - return window.Store.Invite.sendRevokeGroupInviteCode(chatWid); + return window.Store.Invite.resetGroupInviteCode(chatWid); }, this.id._serialized); - return code; + return codeRes.code; } /** @@ -223,9 +244,10 @@ class GroupChat extends Chat { * @returns {Promise} */ async leave() { - await this.client.pupPage.evaluate(chatId => { + await this.client.pupPage.evaluate(async chatId => { const chatWid = window.Store.WidFactory.createWid(chatId); - return window.Store.GroupUtils.sendExitGroup(chatWid); + const chat = await window.Store.Chat.find(chatWid); + return window.Store.GroupUtils.sendExitGroup(chat); }, this.id._serialized); } diff --git a/src/util/Injected.js b/src/util/Injected.js index e1f3871..7acc145 100644 --- a/src/util/Injected.js +++ b/src/util/Injected.js @@ -14,8 +14,8 @@ exports.ExposeStore = (moduleRaidStr) => { window.Store.CryptoLib = window.mR.findModule('decryptE2EMedia')[0]; window.Store.DownloadManager = window.mR.findModule('downloadManager')[0].downloadManager; window.Store.GroupMetadata = window.mR.findModule('GroupMetadata')[0].default.GroupMetadata; - window.Store.Invite = window.mR.findModule('sendJoinGroupViaInvite')[0]; - window.Store.InviteInfo = window.mR.findModule('sendQueryGroupInvite')[0]; + window.Store.Invite = window.mR.findModule('resetGroupInviteCode')[0]; + window.Store.InviteInfo = window.mR.findModule('queryGroupInvite')[0]; window.Store.Label = window.mR.findModule('LabelCollection')[0].LabelCollection; window.Store.MediaPrep = window.mR.findModule('MediaPrep')[0]; window.Store.MediaObject = window.mR.findModule('getOrCreateMediaObject')[0]; @@ -41,7 +41,7 @@ exports.ExposeStore = (moduleRaidStr) => { window.Store.ProfilePic = window.mR.findModule('profilePicResync')[0]; window.Store.PresenceUtils = window.mR.findModule('sendPresenceAvailable')[0]; window.Store.ChatState = window.mR.findModule('sendChatStateComposing')[0]; - window.Store.GroupParticipants = window.mR.findModule('sendPromoteParticipants')[0]; + window.Store.GroupParticipants = window.mR.findModule('promoteParticipants')[1]; window.Store.JoinInviteV4 = window.mR.findModule('sendJoinGroupViaInviteV4')[0]; window.Store.findCommonGroups = window.mR.findModule('findCommonGroups')[0].findCommonGroups; window.Store.StatusUtils = window.mR.findModule('setMyStatus')[0]; @@ -60,9 +60,9 @@ exports.ExposeStore = (moduleRaidStr) => { }; window.Store.GroupUtils = { - ...window.mR.findModule('sendCreateGroup')[0], - ...window.mR.findModule('sendSetGroupSubject')[0], - ...window.mR.findModule('markExited')[0] + ...window.mR.findModule('createGroup')[0], + ...window.mR.findModule('setGroupDescription')[0], + ...window.mR.findModule('sendExitGroup')[0] }; if (!window.Store.Chat._find) { From 6cead95f3c08403a0ad5c49e3a2508e3fb45dc14 Mon Sep 17 00:00:00 2001 From: Pedro Lopez Date: Sun, 15 Jan 2023 18:00:25 -0400 Subject: [PATCH 11/11] chore: mark version v1.19.2 --- docs/Base.html | 4 +- docs/BaseAuthStrategy.html | 4 +- docs/BusinessContact.html | 4 +- docs/Buttons.html | 4 +- docs/Call.html | 4 +- docs/Chat.html | 4 +- docs/Client.html | 4 +- docs/Client.js.html | 22 +++--- docs/ClientInfo.html | 4 +- docs/Contact.html | 4 +- docs/GroupChat.html | 4 +- docs/GroupNotification.html | 4 +- docs/InterfaceController.html | 4 +- docs/Label.html | 4 +- docs/LegacySessionAuth.html | 4 +- docs/List.html | 4 +- docs/LocalAuth.html | 4 +- docs/Location.html | 4 +- docs/Message.html | 4 +- docs/MessageMedia.html | 4 +- docs/NoAuth.html | 4 +- docs/Order.html | 4 +- docs/PrivateChat.html | 4 +- docs/PrivateContact.html | 4 +- docs/Product.html | 4 +- docs/Reaction.html | 4 +- docs/RemoteAuth.html | 4 +- docs/Util.html | 4 +- docs/authStrategies_BaseAuthStrategy.js.html | 4 +- docs/authStrategies_LegacySessionAuth.js.html | 4 +- docs/authStrategies_LocalAuth.js.html | 4 +- docs/authStrategies_NoAuth.js.html | 4 +- docs/authStrategies_RemoteAuth.js.html | 4 +- docs/global.html | 4 +- docs/index.html | 6 +- docs/structures_Base.js.html | 4 +- docs/structures_BusinessContact.js.html | 4 +- docs/structures_Buttons.js.html | 4 +- docs/structures_Call.js.html | 4 +- docs/structures_Chat.js.html | 4 +- docs/structures_ClientInfo.js.html | 4 +- docs/structures_Contact.js.html | 4 +- docs/structures_GroupChat.js.html | 74 ++++++++++++------- docs/structures_GroupNotification.js.html | 4 +- docs/structures_Label.js.html | 4 +- docs/structures_List.js.html | 4 +- docs/structures_Location.js.html | 4 +- docs/structures_Message.js.html | 4 +- docs/structures_MessageMedia.js.html | 4 +- docs/structures_Order.js.html | 4 +- docs/structures_Payment.js.html | 4 +- docs/structures_PrivateChat.js.html | 4 +- docs/structures_PrivateContact.js.html | 4 +- docs/structures_Product.js.html | 4 +- docs/structures_ProductMetadata.js.html | 4 +- docs/structures_Reaction.js.html | 4 +- docs/util_Constants.js.html | 4 +- docs/util_InterfaceController.js.html | 4 +- docs/util_Util.js.html | 4 +- package.json | 2 +- 60 files changed, 174 insertions(+), 154 deletions(-) diff --git a/docs/Base.html b/docs/Base.html index 405ceda..f24dffd 100644 --- a/docs/Base.html +++ b/docs/Base.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Class: Base + whatsapp-web.js 1.19.2 » Class: Base @@ -15,7 +15,7 @@ diff --git a/docs/BaseAuthStrategy.html b/docs/BaseAuthStrategy.html index 7e45bbd..734f02d 100644 --- a/docs/BaseAuthStrategy.html +++ b/docs/BaseAuthStrategy.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Class: BaseAuthStrategy + whatsapp-web.js 1.19.2 » Class: BaseAuthStrategy @@ -15,7 +15,7 @@ diff --git a/docs/BusinessContact.html b/docs/BusinessContact.html index a009637..66a9d74 100644 --- a/docs/BusinessContact.html +++ b/docs/BusinessContact.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Class: BusinessContact + whatsapp-web.js 1.19.2 » Class: BusinessContact @@ -15,7 +15,7 @@ diff --git a/docs/Buttons.html b/docs/Buttons.html index eda6387..5d57a0e 100644 --- a/docs/Buttons.html +++ b/docs/Buttons.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Class: Buttons + whatsapp-web.js 1.19.2 » Class: Buttons @@ -15,7 +15,7 @@ diff --git a/docs/Call.html b/docs/Call.html index 5bf102c..3c190bf 100644 --- a/docs/Call.html +++ b/docs/Call.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Class: Call + whatsapp-web.js 1.19.2 » Class: Call @@ -15,7 +15,7 @@ diff --git a/docs/Chat.html b/docs/Chat.html index 58d67b0..4cf6276 100644 --- a/docs/Chat.html +++ b/docs/Chat.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Class: Chat + whatsapp-web.js 1.19.2 » Class: Chat @@ -15,7 +15,7 @@ diff --git a/docs/Client.html b/docs/Client.html index de09c4a..cd112dd 100644 --- a/docs/Client.html +++ b/docs/Client.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Class: Client + whatsapp-web.js 1.19.2 » Class: Client @@ -15,7 +15,7 @@ diff --git a/docs/Client.js.html b/docs/Client.js.html index e3e7bb4..c5f6c31 100644 --- a/docs/Client.js.html +++ b/docs/Client.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: Client.js + whatsapp-web.js 1.19.2 » Source: Client.js @@ -15,7 +15,7 @@ @@ -805,7 +805,7 @@ class Client extends EventEmitter { */ async getInviteInfo(inviteCode) { return await this.pupPage.evaluate(inviteCode => { - return window.Store.InviteInfo.sendQueryGroupInvite(inviteCode); + return window.Store.InviteInfo.queryGroupInvite(inviteCode); }, inviteCode); } @@ -815,11 +815,11 @@ class Client extends EventEmitter { * @returns {Promise&lt;string>} Id of the joined Chat */ async acceptInvite(inviteCode) { - const chatId = await this.pupPage.evaluate(async inviteCode => { - return await window.Store.Invite.sendJoinGroupViaInvite(inviteCode); + const res = await this.pupPage.evaluate(async inviteCode => { + return await window.Store.Invite.joinGroupViaInvite(inviteCode); }, inviteCode); - return chatId._serialized; + return res.gid._serialized; } /** @@ -1126,19 +1126,17 @@ class Client extends EventEmitter { const createRes = await this.pupPage.evaluate(async (name, participantIds) => { const participantWIDs = participantIds.map(p => window.Store.WidFactory.createWid(p)); - const id = window.Store.MsgKey.newId(); - const res = await window.Store.GroupUtils.sendCreateGroup(name, participantWIDs, undefined, id); - return res; + return await window.Store.GroupUtils.createGroup(name, participantWIDs, 0); }, name, participants); const missingParticipants = createRes.participants.reduce(((missing, c) => { - const id = Object.keys(c)[0]; - const statusCode = c[id].code; + const id = c.wid._serialized; + const statusCode = c.error ? c.error.toString() : '200'; if (statusCode != 200) return Object.assign(missing, { [id]: statusCode }); return missing; }), {}); - return { gid: createRes.gid, missingParticipants }; + return { gid: createRes.wid, missingParticipants }; } /** diff --git a/docs/ClientInfo.html b/docs/ClientInfo.html index 2653b0c..35c3a48 100644 --- a/docs/ClientInfo.html +++ b/docs/ClientInfo.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Class: ClientInfo + whatsapp-web.js 1.19.2 » Class: ClientInfo @@ -15,7 +15,7 @@ diff --git a/docs/Contact.html b/docs/Contact.html index 3144b3a..7a35f05 100644 --- a/docs/Contact.html +++ b/docs/Contact.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Class: Contact + whatsapp-web.js 1.19.2 » Class: Contact @@ -15,7 +15,7 @@ diff --git a/docs/GroupChat.html b/docs/GroupChat.html index 9cabfa2..2f7ed97 100644 --- a/docs/GroupChat.html +++ b/docs/GroupChat.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Class: GroupChat + whatsapp-web.js 1.19.2 » Class: GroupChat @@ -15,7 +15,7 @@ diff --git a/docs/GroupNotification.html b/docs/GroupNotification.html index 419bcf9..08fcd34 100644 --- a/docs/GroupNotification.html +++ b/docs/GroupNotification.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Class: GroupNotification + whatsapp-web.js 1.19.2 » Class: GroupNotification @@ -15,7 +15,7 @@ diff --git a/docs/InterfaceController.html b/docs/InterfaceController.html index 2d73cf8..92e11fb 100644 --- a/docs/InterfaceController.html +++ b/docs/InterfaceController.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Class: InterfaceController + whatsapp-web.js 1.19.2 » Class: InterfaceController @@ -15,7 +15,7 @@ diff --git a/docs/Label.html b/docs/Label.html index 578779f..e3e3900 100644 --- a/docs/Label.html +++ b/docs/Label.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Class: Label + whatsapp-web.js 1.19.2 » Class: Label @@ -15,7 +15,7 @@ diff --git a/docs/LegacySessionAuth.html b/docs/LegacySessionAuth.html index 833f2c4..4331e89 100644 --- a/docs/LegacySessionAuth.html +++ b/docs/LegacySessionAuth.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Class: LegacySessionAuth + whatsapp-web.js 1.19.2 » Class: LegacySessionAuth @@ -15,7 +15,7 @@ diff --git a/docs/List.html b/docs/List.html index ead1c22..6d6c2be 100644 --- a/docs/List.html +++ b/docs/List.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Class: List + whatsapp-web.js 1.19.2 » Class: List @@ -15,7 +15,7 @@ diff --git a/docs/LocalAuth.html b/docs/LocalAuth.html index 54cb42a..5b844cc 100644 --- a/docs/LocalAuth.html +++ b/docs/LocalAuth.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Class: LocalAuth + whatsapp-web.js 1.19.2 » Class: LocalAuth @@ -15,7 +15,7 @@ diff --git a/docs/Location.html b/docs/Location.html index fd1926c..f8acb1c 100644 --- a/docs/Location.html +++ b/docs/Location.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Class: Location + whatsapp-web.js 1.19.2 » Class: Location @@ -15,7 +15,7 @@ diff --git a/docs/Message.html b/docs/Message.html index 1782545..fda9225 100644 --- a/docs/Message.html +++ b/docs/Message.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Class: Message + whatsapp-web.js 1.19.2 » Class: Message @@ -15,7 +15,7 @@ diff --git a/docs/MessageMedia.html b/docs/MessageMedia.html index 33359d3..c7c0ba3 100644 --- a/docs/MessageMedia.html +++ b/docs/MessageMedia.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Class: MessageMedia + whatsapp-web.js 1.19.2 » Class: MessageMedia @@ -15,7 +15,7 @@ diff --git a/docs/NoAuth.html b/docs/NoAuth.html index 119126a..90edbd3 100644 --- a/docs/NoAuth.html +++ b/docs/NoAuth.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Class: NoAuth + whatsapp-web.js 1.19.2 » Class: NoAuth @@ -15,7 +15,7 @@ diff --git a/docs/Order.html b/docs/Order.html index ea747c4..0f3c164 100644 --- a/docs/Order.html +++ b/docs/Order.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Class: Order + whatsapp-web.js 1.19.2 » Class: Order @@ -15,7 +15,7 @@ diff --git a/docs/PrivateChat.html b/docs/PrivateChat.html index f38ad1e..46b71c2 100644 --- a/docs/PrivateChat.html +++ b/docs/PrivateChat.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Class: PrivateChat + whatsapp-web.js 1.19.2 » Class: PrivateChat @@ -15,7 +15,7 @@ diff --git a/docs/PrivateContact.html b/docs/PrivateContact.html index 3473ea0..5b30b0b 100644 --- a/docs/PrivateContact.html +++ b/docs/PrivateContact.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Class: PrivateContact + whatsapp-web.js 1.19.2 » Class: PrivateContact @@ -15,7 +15,7 @@ diff --git a/docs/Product.html b/docs/Product.html index 457f833..aca2fa6 100644 --- a/docs/Product.html +++ b/docs/Product.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Class: Product + whatsapp-web.js 1.19.2 » Class: Product @@ -15,7 +15,7 @@ diff --git a/docs/Reaction.html b/docs/Reaction.html index 0517004..09d99cb 100644 --- a/docs/Reaction.html +++ b/docs/Reaction.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Class: Reaction + whatsapp-web.js 1.19.2 » Class: Reaction @@ -15,7 +15,7 @@ diff --git a/docs/RemoteAuth.html b/docs/RemoteAuth.html index 5f1baa7..6c881ec 100644 --- a/docs/RemoteAuth.html +++ b/docs/RemoteAuth.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Class: RemoteAuth + whatsapp-web.js 1.19.2 » Class: RemoteAuth @@ -15,7 +15,7 @@ diff --git a/docs/Util.html b/docs/Util.html index 5083b76..5600fa0 100644 --- a/docs/Util.html +++ b/docs/Util.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Class: Util + whatsapp-web.js 1.19.2 » Class: Util @@ -15,7 +15,7 @@ diff --git a/docs/authStrategies_BaseAuthStrategy.js.html b/docs/authStrategies_BaseAuthStrategy.js.html index 2db9523..386a4d4 100644 --- a/docs/authStrategies_BaseAuthStrategy.js.html +++ b/docs/authStrategies_BaseAuthStrategy.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: authStrategies/BaseAuthStrategy.js + whatsapp-web.js 1.19.2 » Source: authStrategies/BaseAuthStrategy.js @@ -15,7 +15,7 @@ diff --git a/docs/authStrategies_LegacySessionAuth.js.html b/docs/authStrategies_LegacySessionAuth.js.html index ed0343d..3cd7411 100644 --- a/docs/authStrategies_LegacySessionAuth.js.html +++ b/docs/authStrategies_LegacySessionAuth.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: authStrategies/LegacySessionAuth.js + whatsapp-web.js 1.19.2 » Source: authStrategies/LegacySessionAuth.js @@ -15,7 +15,7 @@ diff --git a/docs/authStrategies_LocalAuth.js.html b/docs/authStrategies_LocalAuth.js.html index 6320366..9fa3e14 100644 --- a/docs/authStrategies_LocalAuth.js.html +++ b/docs/authStrategies_LocalAuth.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: authStrategies/LocalAuth.js + whatsapp-web.js 1.19.2 » Source: authStrategies/LocalAuth.js @@ -15,7 +15,7 @@ diff --git a/docs/authStrategies_NoAuth.js.html b/docs/authStrategies_NoAuth.js.html index 1be866f..b953e64 100644 --- a/docs/authStrategies_NoAuth.js.html +++ b/docs/authStrategies_NoAuth.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: authStrategies/NoAuth.js + whatsapp-web.js 1.19.2 » Source: authStrategies/NoAuth.js @@ -15,7 +15,7 @@ diff --git a/docs/authStrategies_RemoteAuth.js.html b/docs/authStrategies_RemoteAuth.js.html index f7f48d2..54530aa 100644 --- a/docs/authStrategies_RemoteAuth.js.html +++ b/docs/authStrategies_RemoteAuth.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: authStrategies/RemoteAuth.js + whatsapp-web.js 1.19.2 » Source: authStrategies/RemoteAuth.js @@ -15,7 +15,7 @@ diff --git a/docs/global.html b/docs/global.html index f599dc7..db11868 100644 --- a/docs/global.html +++ b/docs/global.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Globals + whatsapp-web.js 1.19.2 » Globals @@ -15,7 +15,7 @@ diff --git a/docs/index.html b/docs/index.html index 7b3457e..7ea7f5f 100644 --- a/docs/index.html +++ b/docs/index.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Home + whatsapp-web.js 1.19.2 » Home @@ -15,7 +15,7 @@ @@ -27,7 +27,7 @@
diff --git a/docs/structures_Base.js.html b/docs/structures_Base.js.html index 4e70ed7..e9fe853 100644 --- a/docs/structures_Base.js.html +++ b/docs/structures_Base.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: structures/Base.js + whatsapp-web.js 1.19.2 » Source: structures/Base.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_BusinessContact.js.html b/docs/structures_BusinessContact.js.html index e7600cd..8599931 100644 --- a/docs/structures_BusinessContact.js.html +++ b/docs/structures_BusinessContact.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: structures/BusinessContact.js + whatsapp-web.js 1.19.2 » Source: structures/BusinessContact.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Buttons.js.html b/docs/structures_Buttons.js.html index 3a79b8d..81e9157 100644 --- a/docs/structures_Buttons.js.html +++ b/docs/structures_Buttons.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: structures/Buttons.js + whatsapp-web.js 1.19.2 » Source: structures/Buttons.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Call.js.html b/docs/structures_Call.js.html index 2c64c0a..1ada572 100644 --- a/docs/structures_Call.js.html +++ b/docs/structures_Call.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: structures/Call.js + whatsapp-web.js 1.19.2 » Source: structures/Call.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Chat.js.html b/docs/structures_Chat.js.html index 0fab4cb..59f32bb 100644 --- a/docs/structures_Chat.js.html +++ b/docs/structures_Chat.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: structures/Chat.js + whatsapp-web.js 1.19.2 » Source: structures/Chat.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_ClientInfo.js.html b/docs/structures_ClientInfo.js.html index 4c205c7..8645f82 100644 --- a/docs/structures_ClientInfo.js.html +++ b/docs/structures_ClientInfo.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: structures/ClientInfo.js + whatsapp-web.js 1.19.2 » Source: structures/ClientInfo.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Contact.js.html b/docs/structures_Contact.js.html index 2da1245..b220a2d 100644 --- a/docs/structures_Contact.js.html +++ b/docs/structures_Contact.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: structures/Contact.js + whatsapp-web.js 1.19.2 » Source: structures/Contact.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_GroupChat.js.html b/docs/structures_GroupChat.js.html index 7635f2e..fd3b90c 100644 --- a/docs/structures_GroupChat.js.html +++ b/docs/structures_GroupChat.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: structures/GroupChat.js + whatsapp-web.js 1.19.2 » Source: structures/GroupChat.js @@ -15,7 +15,7 @@ @@ -90,10 +90,15 @@ class GroupChat extends Chat { * @returns {Promise&lt;Object>} */ async addParticipants(participantIds) { - return await this.client.pupPage.evaluate((chatId, participantIds) => { + return await this.client.pupPage.evaluate(async (chatId, participantIds) => { const chatWid = window.Store.WidFactory.createWid(chatId); - const participantWids = participantIds.map(p => window.Store.WidFactory.createWid(p)); - return window.Store.GroupParticipants.sendAddParticipants(chatWid, participantWids); + const chat = await window.Store.Chat.find(chatWid); + const participants = await Promise.all(participantIds.map(async p => { + const wid = window.Store.WidFactory.createWid(p); + return await window.Store.Contact.get(wid); + })); + await window.Store.GroupParticipants.addParticipants(chat, participants); + return { status: 200 }; }, this.id._serialized, participantIds); } @@ -103,10 +108,14 @@ class GroupChat extends Chat { * @returns {Promise&lt;Object>} */ async removeParticipants(participantIds) { - return await this.client.pupPage.evaluate((chatId, participantIds) => { + return await this.client.pupPage.evaluate(async (chatId, participantIds) => { const chatWid = window.Store.WidFactory.createWid(chatId); - const participantWids = participantIds.map(p => window.Store.WidFactory.createWid(p)); - return window.Store.GroupParticipants.sendRemoveParticipants(chatWid, participantWids); + const chat = await window.Store.Chat.find(chatWid); + const participants = participantIds.map(p => { + return chat.groupMetadata.participants.get(p); + }).filter(p => Boolean(p)); + await window.Store.GroupParticipants.removeParticipants(chat, participants); + return { status: 200 }; }, this.id._serialized, participantIds); } @@ -116,10 +125,14 @@ class GroupChat extends Chat { * @returns {Promise&lt;{ status: number }>} Object with status code indicating if the operation was successful */ async promoteParticipants(participantIds) { - return await this.client.pupPage.evaluate((chatId, participantIds) => { + return await this.client.pupPage.evaluate(async (chatId, participantIds) => { const chatWid = window.Store.WidFactory.createWid(chatId); - const participantWids = participantIds.map(p => window.Store.WidFactory.createWid(p)); - return window.Store.GroupParticipants.sendPromoteParticipants(chatWid, participantWids); + const chat = await window.Store.Chat.find(chatWid); + const participants = participantIds.map(p => { + return chat.groupMetadata.participants.get(p); + }).filter(p => Boolean(p)); + await window.Store.GroupParticipants.promoteParticipants(chat, participants); + return { status: 200 }; }, this.id._serialized, participantIds); } @@ -129,10 +142,14 @@ class GroupChat extends Chat { * @returns {Promise&lt;{ status: number }>} Object with status code indicating if the operation was successful */ async demoteParticipants(participantIds) { - return await this.client.pupPage.evaluate((chatId, participantIds) => { + return await this.client.pupPage.evaluate(async (chatId, participantIds) => { const chatWid = window.Store.WidFactory.createWid(chatId); - const participantWids = participantIds.map(p => window.Store.WidFactory.createWid(p)); - return window.Store.GroupParticipants.sendDemoteParticipants(chatWid, participantWids); + const chat = await window.Store.Chat.find(chatWid); + const participants = participantIds.map(p => { + return chat.groupMetadata.participants.get(p); + }).filter(p => Boolean(p)); + await window.Store.GroupParticipants.demoteParticipants(chat, participants); + return { status: 200 }; }, this.id._serialized, participantIds); } @@ -145,7 +162,8 @@ class GroupChat extends Chat { const success = await this.client.pupPage.evaluate(async (chatId, subject) => { const chatWid = window.Store.WidFactory.createWid(chatId); try { - return await window.Store.GroupUtils.sendSetGroupSubject(chatWid, subject); + await window.Store.GroupUtils.setGroupSubject(chatWid, subject); + return true; } catch (err) { if(err.name === 'ServerStatusCodeError') return false; throw err; @@ -167,7 +185,8 @@ class GroupChat extends Chat { const chatWid = window.Store.WidFactory.createWid(chatId); let descId = window.Store.GroupMetadata.get(chatWid).descId; try { - return await window.Store.GroupUtils.sendSetGroupDescription(chatWid, description, window.Store.MsgKey.newId(), descId); + await window.Store.GroupUtils.setGroupDescription(chatWid, description, window.Store.MsgKey.newId(), descId); + return true; } catch (err) { if(err.name === 'ServerStatusCodeError') return false; throw err; @@ -188,7 +207,8 @@ class GroupChat extends Chat { const success = await this.client.pupPage.evaluate(async (chatId, adminsOnly) => { const chatWid = window.Store.WidFactory.createWid(chatId); try { - return await window.Store.GroupUtils.sendSetGroupProperty(chatWid, 'announcement', adminsOnly ? 1 : 0); + await window.Store.GroupUtils.setGroupProperty(chatWid, 'announcement', adminsOnly ? 1 : 0); + return true; } catch (err) { if(err.name === 'ServerStatusCodeError') return false; throw err; @@ -210,7 +230,8 @@ class GroupChat extends Chat { const success = await this.client.pupPage.evaluate(async (chatId, adminsOnly) => { const chatWid = window.Store.WidFactory.createWid(chatId); try { - return await window.Store.GroupUtils.sendSetGroupProperty(chatWid, 'restrict', adminsOnly ? 1 : 0); + await window.Store.GroupUtils.setGroupProperty(chatWid, 'restrict', adminsOnly ? 1 : 0); + return true; } catch (err) { if(err.name === 'ServerStatusCodeError') return false; throw err; @@ -228,12 +249,12 @@ class GroupChat extends Chat { * @returns {Promise&lt;string>} Group's invite code */ async getInviteCode() { - const code = await this.client.pupPage.evaluate(async chatId => { + const codeRes = await this.client.pupPage.evaluate(async chatId => { const chatWid = window.Store.WidFactory.createWid(chatId); - return window.Store.Invite.sendQueryGroupInviteCode(chatWid); + return window.Store.Invite.queryGroupInviteCode(chatWid); }, this.id._serialized); - return code; + return codeRes.code; } /** @@ -241,12 +262,12 @@ class GroupChat extends Chat { * @returns {Promise&lt;string>} New invite code */ async revokeInvite() { - const code = await this.client.pupPage.evaluate(chatId => { + const codeRes = await this.client.pupPage.evaluate(chatId => { const chatWid = window.Store.WidFactory.createWid(chatId); - return window.Store.Invite.sendRevokeGroupInviteCode(chatWid); + return window.Store.Invite.resetGroupInviteCode(chatWid); }, this.id._serialized); - return code; + return codeRes.code; } /** @@ -254,9 +275,10 @@ class GroupChat extends Chat { * @returns {Promise} */ async leave() { - await this.client.pupPage.evaluate(chatId => { + await this.client.pupPage.evaluate(async chatId => { const chatWid = window.Store.WidFactory.createWid(chatId); - return window.Store.GroupUtils.sendExitGroup(chatWid); + const chat = await window.Store.Chat.find(chatWid); + return window.Store.GroupUtils.sendExitGroup(chat); }, this.id._serialized); } diff --git a/docs/structures_GroupNotification.js.html b/docs/structures_GroupNotification.js.html index 882f1cd..907cdba 100644 --- a/docs/structures_GroupNotification.js.html +++ b/docs/structures_GroupNotification.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: structures/GroupNotification.js + whatsapp-web.js 1.19.2 » Source: structures/GroupNotification.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Label.js.html b/docs/structures_Label.js.html index 84fe4a5..9bdcc3f 100644 --- a/docs/structures_Label.js.html +++ b/docs/structures_Label.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: structures/Label.js + whatsapp-web.js 1.19.2 » Source: structures/Label.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_List.js.html b/docs/structures_List.js.html index 5b90208..c50fa7e 100644 --- a/docs/structures_List.js.html +++ b/docs/structures_List.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: structures/List.js + whatsapp-web.js 1.19.2 » Source: structures/List.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Location.js.html b/docs/structures_Location.js.html index 5d66947..2c81b9d 100644 --- a/docs/structures_Location.js.html +++ b/docs/structures_Location.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: structures/Location.js + whatsapp-web.js 1.19.2 » Source: structures/Location.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Message.js.html b/docs/structures_Message.js.html index 0c4d051..0d8eb4f 100644 --- a/docs/structures_Message.js.html +++ b/docs/structures_Message.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: structures/Message.js + whatsapp-web.js 1.19.2 » Source: structures/Message.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_MessageMedia.js.html b/docs/structures_MessageMedia.js.html index 499f7cf..4dc3d5a 100644 --- a/docs/structures_MessageMedia.js.html +++ b/docs/structures_MessageMedia.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: structures/MessageMedia.js + whatsapp-web.js 1.19.2 » Source: structures/MessageMedia.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Order.js.html b/docs/structures_Order.js.html index 9ad5d7e..fd44444 100644 --- a/docs/structures_Order.js.html +++ b/docs/structures_Order.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: structures/Order.js + whatsapp-web.js 1.19.2 » Source: structures/Order.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Payment.js.html b/docs/structures_Payment.js.html index e934dd1..ef6c307 100644 --- a/docs/structures_Payment.js.html +++ b/docs/structures_Payment.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: structures/Payment.js + whatsapp-web.js 1.19.2 » Source: structures/Payment.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_PrivateChat.js.html b/docs/structures_PrivateChat.js.html index b7af145..d95fc6e 100644 --- a/docs/structures_PrivateChat.js.html +++ b/docs/structures_PrivateChat.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: structures/PrivateChat.js + whatsapp-web.js 1.19.2 » Source: structures/PrivateChat.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_PrivateContact.js.html b/docs/structures_PrivateContact.js.html index 7aec0d9..13abf4a 100644 --- a/docs/structures_PrivateContact.js.html +++ b/docs/structures_PrivateContact.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: structures/PrivateContact.js + whatsapp-web.js 1.19.2 » Source: structures/PrivateContact.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Product.js.html b/docs/structures_Product.js.html index 9e78871..1591885 100644 --- a/docs/structures_Product.js.html +++ b/docs/structures_Product.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: structures/Product.js + whatsapp-web.js 1.19.2 » Source: structures/Product.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_ProductMetadata.js.html b/docs/structures_ProductMetadata.js.html index ba7f554..ac7fca6 100644 --- a/docs/structures_ProductMetadata.js.html +++ b/docs/structures_ProductMetadata.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: structures/ProductMetadata.js + whatsapp-web.js 1.19.2 » Source: structures/ProductMetadata.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Reaction.js.html b/docs/structures_Reaction.js.html index 6b47024..0eb2f2c 100644 --- a/docs/structures_Reaction.js.html +++ b/docs/structures_Reaction.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: structures/Reaction.js + whatsapp-web.js 1.19.2 » Source: structures/Reaction.js @@ -15,7 +15,7 @@ diff --git a/docs/util_Constants.js.html b/docs/util_Constants.js.html index 12a26d5..c5ca2aa 100644 --- a/docs/util_Constants.js.html +++ b/docs/util_Constants.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: util/Constants.js + whatsapp-web.js 1.19.2 » Source: util/Constants.js @@ -15,7 +15,7 @@ diff --git a/docs/util_InterfaceController.js.html b/docs/util_InterfaceController.js.html index 02b7dc3..4de61c7 100644 --- a/docs/util_InterfaceController.js.html +++ b/docs/util_InterfaceController.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: util/InterfaceController.js + whatsapp-web.js 1.19.2 » Source: util/InterfaceController.js @@ -15,7 +15,7 @@ diff --git a/docs/util_Util.js.html b/docs/util_Util.js.html index 5f19a8f..ca4ad46 100644 --- a/docs/util_Util.js.html +++ b/docs/util_Util.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: util/Util.js + whatsapp-web.js 1.19.2 » Source: util/Util.js @@ -15,7 +15,7 @@ diff --git a/package.json b/package.json index a396b2d..40d37e3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "whatsapp-web.js", - "version": "1.19.1", + "version": "1.19.2", "description": "Library for interacting with the WhatsApp Web API ", "main": "./index.js", "typings": "./index.d.ts",