Compare commits

...

176 Commits

Author SHA1 Message Date
alechkos
f23ab82565 feat: added contact_changed event (#2027) 2023-04-01 19:30:12 +00:00
Wictor Nogueira
f44555713d Feat: Add chat_removed and chat_archived events (#1778)
* Add chat_removed and chat_archived events

* Make eslint happy

---------

Co-authored-by: Rajeh Taher <rajeh@reforward.dev>
Co-authored-by: Aliyss Snow <33941859+Aliyss@users.noreply.github.com>
2023-04-01 19:19:11 +00:00
alechkos
9f15499592 feat: added group_admin_changed event (#2018)
* docs: updated

* added group-admin-change event

* minor changes

* added usage example

* minor changes: code docs updated
2023-04-01 16:40:47 +00:00
Rajeh Taher
ac7df25075 Fix media renders (#1981)
* Fixed

* Update src/util/Injected.js

---------

Co-authored-by: tuyuribr <45042245+tuyuribr@users.noreply.github.com>
2023-04-01 17:09:28 +03:00
tofers
812ff0ddfc lastMessage in chat (#1606)
* lastMessage in chat

* lastMessage info

* Update src/util/Injected.js

Co-authored-by: Rajeh Taher <rajeh@reforward.dev>

* fix  serialize msg

* markup

---------

Co-authored-by: tofers <tofers90>
Co-authored-by: Rajeh Taher <rajeh@reforward.dev>
2023-04-01 17:07:39 +03:00
tofers
780005a81a feat: load reactions in message (#1897)
* msg find reactions

* reaction list

* return hasReaction  only true or false

---------

Co-authored-by: Rajeh Taher <rajeh@reforward.dev>
2023-04-01 17:03:21 +03:00
Vinicius Tavares
c44af204a1 Add the 'unread_count' event. Listen to changes on Chat.unreadCount (#2059)
* Initial commit

* Update index.d.ts

* The functions was returning a 'brief' chat data. With this, it will return full Chat model..

* Eslint suggested fixex

---------

Co-authored-by: tuyuribr <45042245+tuyuribr@users.noreply.github.com>
Co-authored-by: Rajeh Taher <rajeh@reforward.dev>
2023-04-01 16:59:57 +03:00
Wictor Nogueira
dc16bbbdac Feat: change profile/group picture (#1916)
* feat: pfp

* Make eslint happy

* Fix typo

* Fix missing comma

* Update src/util/Injected.js

* ESLint

* Update src/util/Injected.js

* mfw purp breaks indentation

---------

Co-authored-by: Rajeh Taher <rajeh@reforward.dev>
2023-04-01 04:21:09 +03:00
Mohammed Khan
4846625119 fixed version id number (#2087) 2023-03-29 03:50:23 +00:00
Pedro Lopez
ea6c130edd chore: mark version v1.19.5 2023-03-18 18:17:59 -04:00
Macley Sousa
1854656648 fix: send media (#2074) 2023-03-18 18:12:39 -04:00
Italo Castro
109fbce8db Fix Message.js (#2080)
Fixes https://github.com/pedroslopez/whatsapp-web.js/issues/2078
2023-03-18 18:11:38 -04:00
Pedro Lopez
6f2ad1773e chore: mark version v1.19.4 2023-02-11 15:27:30 -08:00
github-actions[bot]
313bd085b3 Update supported WhatsApp Web version to v2.2306.7 (#1954)
Co-authored-by: pedroslopez <pedroslopez@users.noreply.github.com>
2023-02-11 15:26:28 -08:00
tofers
1294170a25 Fix mute chat (#1982)
* fix function set mute chat

* chat mute new object
2023-02-11 15:25:54 -08:00
Pedro Lopez
617e0b89d5 merge fix 2023-02-11 15:22:30 -08:00
tofers
842a342f72 Fixing the queryWidExists function (#1989)
* Update Injected.js

fix function queryWidExists

* Update Injected.js

support WA old version 2.2305.7

---------

Co-authored-by: Pedro S. Lopez <pedroslopez@me.com>
2023-02-11 15:20:21 -08:00
Pedro Lopez
e8d4874b26 fix getNumberId 2023-02-11 15:18:06 -08:00
Michal Serlui
f1607752dd try to fix queryWidExists (#1987) 2023-02-10 11:06:20 -03:00
Pedro Lopez
97283c84c7 chore: mark version v1.19.3 2023-01-28 00:35:27 -04:00
WWebJS Bot
23cea1bac0 1.20.0-alpha.0 2023-01-26 21:54:22 +00:00
Michal Serlui
c208c8936a Fix: message.getInfo (#1953)
window.Store.MessageInfo.sendQueryMsgInfo now needs msg.id instead of msg
2023-01-26 23:52:39 +02:00
Pedro Lopez
6cead95f3c chore: mark version v1.19.2 2023-01-15 18:00:25 -04:00
Pedro S. Lopez
70f2391d51 fix group methods (#1934)
* fix: create group

* fix set group subject, description, properties; exit group

* fix participant methods

* fix return type

* fix invite methods
2023-01-15 17:59:20 -04:00
Pedro Lopez
698305f668 update docs for 1.19.1 2023-01-15 14:56:00 -04:00
Pedro Lopez
1e3374f0cd chore: mark version v1.19.1 2023-01-15 14:55:28 -04:00
Pedro S. Lopez
e1917494bf Revert "fix: Fix client-side message rendering issue when sending attachements through the library (#1905)" (#1932)
This reverts commit 7dd8688f04.
2023-01-15 14:54:50 -04:00
Pedro Lopez
d2479f397e chore: mark version v1.19.0 2023-01-15 14:38:46 -04:00
Azeem Haider
a525e2330a Adding missing CALL in events enum (#1899) 2023-01-15 14:36:08 -04:00
tofers
bd192993b7 fix method downloadMedia when not found msg (#1852)
Co-authored-by: Rajeh Taher <rajeh@reforward.dev>
2023-01-15 14:35:26 -04:00
github-actions[bot]
bd0e27a0d0 Update supported WhatsApp Web version to v2.2301.6 (#1869)
Co-authored-by: pedroslopez <pedroslopez@users.noreply.github.com>
2023-01-15 14:34:23 -04:00
Rajeh Taher
7dd8688f04 fix: Fix client-side message rendering issue when sending attachements through the library (#1905) 2023-01-15 14:32:28 -04:00
Pedro S. Lopez
23d5147a14 fix: compatibility with LegacyPhoneFeatures in latest WhatsApp Web version (#1930)
* fix removed features on latest wweb version

* errors
2023-01-15 14:30:20 -04:00
Pedro S. Lopez
8655badc0f Create FUNDING.yml (#1901)
* Create FUNDING.yml

* Update README.md
2023-01-04 17:15:35 -04:00
Rajeh Taher
a7b77e15ed fix: Fix call event listener name + Added Call example (#1886)
* fix: bugfix + example

* relocate global variable
2022-12-23 12:10:09 -03:00
Rajeh Taher
288a572af6 feat: Implement Call Rejection + Introduction of Socket API (#1882)
* Initial stage

* ESLint

* eslint is annoying

* fix: distinguish Wap from Socket's Wap
2022-12-22 16:02:49 -03:00
Pedro Lopez
6fe1017bd3 chore: mark version v1.18.4 2022-11-26 05:27:37 -04:00
github-actions[bot]
a15f1b8428 Update supported WhatsApp Web version to v2.2245.9 (#1764)
Co-authored-by: pedroslopez <pedroslopez@users.noreply.github.com>
2022-11-26 05:26:46 -04:00
Pedro S. Lopez
dc91562f3c fix: star/unstar messages (#1843) 2022-11-26 05:12:54 -04:00
Pedro S. Lopez
db55d869f8 fix: delete messages for everyone (#1842) 2022-11-26 04:44:35 -04:00
Pedro S. Lopez
d9f9c28276 fix: get quoted msg (#1841) 2022-11-26 04:38:29 -04:00
Pedro Lopez
a60f5ebf40 chore: mark version v1.18.3 2022-11-13 21:12:55 -05:00
WWebJS Bot
e8bae22b03 1.18.3-alpha.0 2022-11-13 17:54:03 +00:00
Felipe Martins
82120f0446 Fix GroupMetadata module (#1789)
* Fix GroupMetadata module

* Update src/util/Injected.js

Co-authored-by: Felipe Martins <felipe.dev@virtuamax.com.br>
Co-authored-by: Rajeh Taher <rajeh@reforward.dev>
2022-11-13 12:36:06 +01:00
Pedro Lopez
6f7c5c2dd9 chore: mark version v1.18.2 2022-10-26 23:32:56 -04:00
Pedro S. Lopez
9981723505 fix: message replies compatible with WhatsApp Web v2.2241.6 (#1765)
* fix message replies

* fix up some tests
2022-10-26 23:32:06 -04:00
Pedro Lopez
7bb7f13f07 bump supported version 2022-10-26 22:45:05 -04:00
Pedro Lopez
7d672078cd chore: mark version v1.18.1 2022-10-26 22:44:05 -04:00
Pedro S. Lopez
088ec32b7b Support for WhatsApp Web 2.2241.6 (#1762)
* proposed fix

* Fixes

* Add condition for older versions of WA

* fix for old node version support

* fix: default to mdbackend = true

Co-authored-by: purpshell <rajeh@reforward.dev>
2022-10-26 22:43:19 -04:00
Pedro Lopez
ef3eadc6e5 chore: mark version 1.18.0 2022-10-21 00:25:57 -04:00
github-actions[bot]
ab87fecfd9 Update supported WhatsApp Web version to v2.2240.7 (#1592)
Co-authored-by: pedroslopez <pedroslopez@users.noreply.github.com>
2022-10-21 00:22:56 -04:00
Pedro S. Lopez
36aa37f1ac fix: set ephemeral fields and get links from messages (#1752)
* fix setting ephemeral fields

* fix missing links method
2022-10-21 00:12:02 -04:00
tuyuribr
45972fb47e Create pull_request_template (#1632)
Any Ideas on how to improve this template?


https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/creating-a-pull-request-template-for-your-repository

Co-authored-by: Rajeh Taher <rajeh@reforward.dev>
Co-authored-by: Aliyss Snow <33941859+Aliyss@users.noreply.github.com>
2022-10-10 22:45:48 +02:00
stefanfuchs
55f75b8f69 fix: typescript compilation (#1693)
Co-authored-by: Rajeh Taher <rajeh@reforward.dev>
2022-10-04 14:24:03 +02:00
blox
b1e0fce504 Allow the deletion of others' messages (#1688) 2022-09-18 16:33:43 -03:00
༺ LᴇG̸ᴇɴD ༻
62623347e8 [Update] - adding catch block on promise for windows error (#1659) 2022-08-18 20:26:46 +03:00
Shir Serlui
705d4d31fd Use getCommonGroups not contact (#1623) 2022-08-18 13:20:30 -03:00
WWebJS Bot
bd4df4cf75 1.18.0-alpha.1 2022-08-15 07:54:39 +00:00
Pedro S. Lopez
7fe3574730 fix(release): try setting PAT to push to main 2022-08-15 03:53:57 -04:00
Pedro Lopez
09a81d0e1e v1.18.0-alpha.0 2022-08-15 03:47:51 -04:00
Pedro S. Lopez
c09a22c533 fix(publish): exit if pushing to github failed 2022-08-15 03:42:06 -04:00
Pedro S. Lopez
bb09bb74e7 fix(publish): add git user 2022-08-15 03:32:40 -04:00
Pedro Lopez
694a52bf26 fix(publish): ouput, remove message 2022-08-15 03:22:43 -04:00
Pedro Lopez
c459eca799 add release action 2022-08-15 02:52:17 -04:00
Roi Greenberg
b74246d69a Add "fromMe" option to fetchMessages (#1444) 2022-08-14 12:30:14 -03:00
Yuri
ab7ee0eb4f Fixing remote auth optional depencies error (#1640)
Co-authored-by: Rajeh Taher <rajeh@reforward.dev>
2022-08-10 19:46:43 +03:00
jurajmatus
537e843a49 Async buffer->BASE64 conversion (#1481)
* Async buffer->BASE64 conversion

* ESLint fixes
2022-08-10 16:31:04 +00:00
༺ LᴇG̸ᴇɴD ༻
76f7a6e279 feat: RemoteAuth Strategy (#1450)
* index.js

* [authReady] - new BaseAuthStrategy function

* [RemoteAuth] - new Class RemoteAuth added

* Eslint Fixes

* Eslint Fixes

* Added types for RemoteAuth (mostly assumed types from PR message and src/authStrategies/RemoteAuth.js)

* [dependency updates] - added unzipper & archiver

* [Types] - Fixing typescript declarations

* Renaming Base Class Hook

* auth hook rename on client

* [Error Handling] - Delegate responsability to end users

* [Refactor] - deletemetadata code refactor

* [Refactor] - backupSyncIntervalMs renamed

* [Refactor] - Minor improvement on deleteMetadata

* [Refactor] - backupSyncIntervalMs rename on index.d.ts

* [Update] - Fix for Ubuntu crahsing on extractSession

* [Update] - Delegate responsability to stores of making sure the previous session is deleted strictly only after the new one is saved

* [Update] - Improve file paths handling & naming (reduce assumptions between RemoteAuth and stores)

* [Update] - Adding new event <REMOTE_SESSION_SAVED> on Constants.js

* [Update] - Adding new authHooks <destroy> & <disconnect>

* [Update] - Adding <destroy> & <disconnect> hooks on Client.js

* [Update] - Adding new features to index.d.ts

* [RemoteAuth] - New Features added to RemoteAuth Class

* [dependency updates] - added fs-extra

* [Cross Platform] - Windows is now compatible with RemoteAuth

* [optionalDependencies] - moved archiver, fs-extra & unzipper to optional dependencies on package.json

* [optionalDependencies] - adding validation for when optional dependencies are missing

* [Update] - Node Deprecation warining for rmdir changed for rm instead

Co-authored-by: h110m <nichtwitzig228@gmail.com>
2022-08-10 13:03:07 +02:00
Wictor Nogueira
f2ec77f969 Feat: add message_reaction event (#1619)
* Add 'message_reaction' event
2022-08-09 16:09:16 -03:00
Jeremy Andes
fd368361df Fix: Cannot read properties of undefined (reading 'id') (#1604)
This change fix `react` evaluation:

```
Error: Evaluation failed: TypeError: Cannot read properties of undefined (reading 'id')
    at Object.<anonymous> (https://web.whatsapp.com/bootstrap_main.44dc3fdf06d9bb8b053d.js:2:103021)
    at Generator.next (<anonymous>)
    at t (https://web.whatsapp.com/vendor1~bootstrap_qr.5922e52928d864c0918c.js:2:66483)
    at s (https://web.whatsapp.com/vendor1~bootstrap_qr.5922e52928d864c0918c.js:2:66694)
    at https://web.whatsapp.com/vendor1~bootstrap_qr.5922e52928d864c0918c.js:2:66753
    at Y (https://web.whatsapp.com/bootstrap_qr.f74b98c729dd38392a5f.js:37:128505)
    at new y (https://web.whatsapp.com/bootstrap_qr.f74b98c729dd38392a5f.js:37:121072)
    at Object.<anonymous> (https://web.whatsapp.com/vendor1~bootstrap_qr.5922e52928d864c0918c.js:2:66634)
    at Object.k (https://web.whatsapp.com/bootstrap_main.44dc3fdf06d9bb8b053d.js:2:105511)
    at Object.t.sendReactionToMsg (https://web.whatsapp.com/bootstrap_main.44dc3fdf06d9bb8b053d.js:2:102647)
    at ExecutionContext._evaluateInternal (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:221:19)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async ExecutionContext.evaluate (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:110:16)
    at async Message.react (/app/node_modules/whatsapp-web.js/src/structures/Message.js:344:9)
```

Co-authored-by: Rajeh Taher <rajeh@reforward.dev>
2022-08-09 15:30:56 +00:00
Rajeh Taher
bd553f75d3 feat: Adding file size by bytes to MessageMedia (#1273)
* Update index.d.ts

* Update Message.js

* Update Message.js

* Update MessageMedia.js

* Update MessageMedia.js
2022-08-09 15:29:59 +00:00
tonbotfy
c5c705a553 feat: [Updated] Loading screen listener with percent and message (#1563)
* last update

* eslint fix

* headless fix

* Update index.d.ts

Co-authored-by: stefanfuchs <stefan1234@gmail.com>

* Update index.d.ts - Add 'LOADING_SCREEN' type to Enum

Co-authored-by: stefanfuchs <stefan1234@gmail.com>
Co-authored-by: Rajeh Taher <rajeh@reforward.dev>
2022-08-09 15:27:35 +00:00
Yehuda Eisenberg
6e047cb9be Update User agent (#1470)
I encountered errors because of this (it says that the chrome version needs to be updated)

Co-authored-by: Rajeh Taher <rajeh@reforward.dev>
2022-08-09 15:26:45 +00:00
Ruvian S
56343497e9 fix: star Error: Evaluation failed: TypeError: msg.chat.sendStarMsgs is not a function (#1598)
Co-authored-by: Rajeh Taher <rajeh@reforward.dev>
2022-08-09 15:25:53 +00:00
Nowbie S
6a4fca0a77 updating forward documentation. (#1624)
* updating forward documentation.

* Update Message.js

* Update index.d.ts

* Update docs/Message.html

Co-authored-by: Rajeh Taher <rajeh@reforward.dev>
2022-08-09 18:24:43 +03:00
github-actions[bot]
e91077a615 Update supported WhatsApp Web version to v2.2224.8 (#1532)
Co-authored-by: pedroslopez <pedroslopez@users.noreply.github.com>
2022-07-10 02:24:57 -04:00
Pedro Lopez
0e5bd9f38e chore: mark version v1.17.1 2022-07-10 02:22:20 -04:00
Thomas
75d3c635f0 Add missing deviceType property in Message interface (#1510)
Co-authored-by: Rajeh Taher <rajeh@reforward.dev>
2022-07-10 02:15:11 -04:00
Keenan Yafiq
8497a3d7e5 Add "React to message" in README (#1534)
* Add "React message" in Supported features list

* Update README.md

Co-authored-by: Pedro S. Lopez <pedroslopez@me.com>
2022-07-10 02:14:16 -04:00
Maksim
e7025ceca1 Fix TS declaration for Promise of new "react" method (#1561)
Without explicit delaration of void <T> for Promise running tsc causing the error:

```
node_modules/whatsapp-web.js/index.d.ts:707:38 - error TS2314: Generic type 'Promise<T>' requires 1 type argument(s).
```
2022-07-10 02:11:34 -04:00
Caio Agiani
b8b41920e3 chore(client): adjust typo (#1565) 2022-07-10 02:10:53 -04:00
༺ LᴇG̸ᴇɴD ༻
73e4b3b6e0 fix: getNumberId Error: Evaluation failed: TypeError: e.isLid is not a function (#1571) 2022-07-10 02:07:57 -04:00
Pedro Lopez
af431df1c9 chore: mark version v1.17.0 2022-06-21 01:36:19 -04:00
Alon Schwartzblat
61c0a6be56 Reaction feature added. (#1400)
* Fix get order.

* Fix types.

* Add set picture for profile and for groups.

* Fix bug.

* Fix

* Fix types

* Fix eslint

* Add send reaction feature.

* Add send reaction feature.

* Add set picture for profile and for groups.

* Add send reaction feature.

* Add send reaction feature.

* Add send reaction feature.

* Add send reaction feature.

* Add send reaction feature.

* Add send reaction feature.

* Update src/structures/Reaction.js

Co-authored-by: Noah van der Aa <ndvdaa@gmail.com>

* Bug fixes.

* Bug fixes.

* Bug fixes.

* Fix

* Fix

* Fix example

* Fix conflict

* Fix conflict

* Fix conflict

* Fix conflict

* Fix conflict

* Fix conflict

* move implementation to message model

Co-authored-by: Noah van der Aa <ndvdaa@gmail.com>
Co-authored-by: Pedro Lopez <pedroslopez@me.com>
2022-06-21 00:46:07 -04:00
Pedro S. Lopez
a0b18fb685 fix: set user agent as a launch arg for usage in serviceworker (#1518) 2022-06-21 00:01:59 -04:00
jurajmatus
98ff761cfb fix: fetchMessages infinite loop when there are no messages in the chat (#1480)
* Fix of fetchMessages

* Node 12 compatibility
2022-06-14 00:22:53 -04:00
Pedro Lopez
c0ef9223ed chore: mark version 1.16.7 2022-06-09 23:57:17 -04:00
github-actions[bot]
294e5027b0 Update supported WhatsApp Web version to v2.2220.8 (#1416)
Co-authored-by: pedroslopez <pedroslopez@users.noreply.github.com>
2022-06-09 23:47:17 -04:00
Shir Serlui
ebc56bc280 fix: correctly get models and fetchMessages in WhatsApp Web v2.2220.8
* Fix models is undefined

* Feat models is undefined

* Feat models is undefined

* Fix loadEarlierMsgs

* use `getModelsArray()` to get models

* fix: correctly loadEarlierMsgs with ConversationMsgs module

Co-authored-by: Pedro Lopez <pedroslopez@me.com>
2022-06-09 23:41:25 -04:00
Pedro Lopez
b16e1cdf83 chore: mark version 1.16.6 2022-04-21 17:58:08 -04:00
github-actions[bot]
a24294ec61 Update supported WhatsApp Web version to v2.2212.8 (#1381)
Co-authored-by: pedroslopez <pedroslopez@users.noreply.github.com>
2022-04-21 17:32:42 -04:00
Pedro Lopez
374983b9a6 fix: find old features module 2022-04-21 17:18:47 -04:00
Rajeh Taher
5e2e9dd139 Fix: Cannot read properties of undefined (reading 'features') // original: (#1407) (#1410)
* Fix: Cannot read properties of undefined (reading 'features') (#1407)

* Fix: Cannot read properties of undefined (reading 'features')

Find MD backend without features

* Fix for tests

* Update Client.js

* Update LegacySessionAuth.js

Co-authored-by: Shir Serlui <70711723+shirser121@users.noreply.github.com>
2022-04-21 17:15:00 -04:00
Pedro Lopez
3a2acf71c2 chore: mark version v1.16.5 2022-03-28 23:47:16 -04:00
Pedro Lopez
f32f3c71ba fix: get groupnotification chat
close #1329
2022-03-28 23:44:04 -04:00
github-actions[bot]
017dd4b783 Update supported WhatsApp Web version to v2.2210.9 (#1340)
Co-authored-by: pedroslopez <pedroslopez@users.noreply.github.com>
2022-03-28 23:28:09 -04:00
Ahmed Fouzan
fa9f6610d7 fix(typings): Add ConnectOptions typings (#1354)
* Add ConnectOptions typings

* simplify type

Co-authored-by: Pedro S. Lopez <pedroslopez@me.com>
2022-03-28 23:22:51 -04:00
༺ LᴇG̸ᴇɴD ༻
e9104b390d Fix: Cannot read properties of undefined (reading 'getProfilePicFull') (#1362)
* Fix for issue#1356 - Cannot read properties of undefined reading getProfilePicFull

* use cross-compatible profilePicFind function

Co-authored-by: Joaquin Touris <joaquin@192.168.1.6>
Co-authored-by: Pedro Lopez <pedroslopez@me.com>
2022-03-28 23:17:55 -04:00
ogxing
a23c285f3c fix: group chat create (#1319) 2022-03-28 22:56:07 -04:00
github-actions[bot]
281aec40ad Update supported WhatsApp Web version to v2.2208.7 (#1287)
Co-authored-by: pedroslopez <pedroslopez@users.noreply.github.com>
Co-authored-by: Pedro S. Lopez <pedroslopez@me.com>
2022-03-09 18:32:04 -04:00
Pedro Lopez
2e4890d113 chore: mark version v1.16.4 2022-03-09 18:26:05 -04:00
Pedro Lopez
0bd8eb9d96 chore: mark version v1.16.4-alpha.0 2022-03-09 00:57:36 -04:00
Pedro S. Lopez
2718c1328c fix compatibility issues with WhatsApp Web 2.2208.7 (#1311)
* fix compatiblity issues with v2.2208.7

* remove expclusive test
2022-03-09 00:54:57 -04:00
Pedro Lopez
24f8b4622b chore: mark version v1.16.3 2022-03-06 23:30:20 -04:00
Pedro Lopez
9ab9c48f7b fix(typings): LegacySessionAuth restartOnAuthFail 2022-03-06 01:35:58 -04:00
༺ LᴇG̸ᴇɴD ༻
b96607338a getProfilePicture Fix => Evaluation failed: Error: Comms::sendIq called before startComms (#1264)
* Fix: Evaluation failed: Error: Comms::sendIq called before startComms

* [Requested Changes] - Only call Wap if we're not on MD & vice-versa

Co-authored-by: Joaquin Touris <joaquin@192.168.1.5>
2022-03-05 16:24:40 +02:00
Pedro S. Lopez
ea2cc81d47 add feature request form template 2022-03-05 02:30:49 -04:00
Clifford Fajardo
56644f4f03 add github ISSUE_TEMPLATE files (#1195)
* add github ISSUE_TEMPLATE files

* Update .github/ISSUE_TEMPLATE/config.yml

* Update .github/ISSUE_TEMPLATE/bug_report.yml

Co-authored-by: Rajeh Taher <rajeh@reforward.dev>

* apply updates per feedback that was given

* Update bug_report.yml

* Update bug_report.yml

* Update bug_report.yml

* Update bug_report.yml

* Update bug_report.yml

* Update bug_report.yml

Co-authored-by: clifford <cfajardo@linkedin.com>
Co-authored-by: Rajeh Taher <rajeh@reforward.dev>
Co-authored-by: Pedro S. Lopez <pedroslopez@me.com>
2022-03-05 02:26:49 -04:00
Pedro Lopez
fcb78a1cd4 chore: mark version v1.16.2 2022-03-01 23:23:26 -04:00
Fábio Dias
f88bd274be fix(LocalAuth): logout method (#1267)
The logout method was trying to use a function call passing the "dataDir" as the "this" reference
2022-03-01 23:15:08 -04:00
Alon Schwartzblat
c45fae5c15 Fix get order. (#1274)
* Fix get order.

* Fix types.
2022-03-01 23:08:27 -04:00
Pedro Lopez
1b75d0d243 fix(LocalAuth): only throw user-supplied userDataDir error if path is different
fix #1261
2022-03-01 22:25:22 -04:00
Filipe
cc78e9863d add typings for LocalAuth attributes (#1262) 2022-02-28 23:00:21 -04:00
inceabdullah
fc205ff530 fix: Cannot destructure property 'session' of 'undefined' as it is undefined. (#1259) 2022-02-28 22:59:54 -04:00
Pedro Lopez
6ab98a5365 chore: mark version v1.16.1 2022-02-28 00:51:59 -04:00
Pedro Lopez
3c24df085a add back deprecated info.me 2022-02-28 00:51:28 -04:00
Pedro Lopez
979e97ea42 chore: mark version v1.16.0 2022-02-27 23:30:03 -04:00
Pedro Lopez
1f4328c7a3 fix tests 2022-02-27 23:29:09 -04:00
Pedro Lopez
6691d25282 fix: message.getInfo() works for both MD and non-MD 2022-02-27 23:28:57 -04:00
Pedro S. Lopez
12d9735b73 Update README.md 2022-02-27 22:58:39 -04:00
SuperChang
ab5167c4ad fix: ChangeParticipantsPermissions typo in index.d.ts (#1206)
Co-authored-by: Pedro S. Lopez <pedroslopez@me.com>
2022-02-27 22:34:12 -04:00
YaronD
52c8336236 Added message duration in seconds (#1230)
Co-authored-by: Pedro S. Lopez <pedroslopez@me.com>
2022-02-27 22:30:47 -04:00
Pedro Lopez
9fe91692cf update tests to work with authStrategies 2022-02-27 22:18:54 -04:00
Pedro S. Lopez
f6de161c7d Auth Strategies (#1257)
* auth strategies

* default to no auth

* rename base auth strategy

* rename base strategy cont.

* refactor auth strategy methods and LocalAuth

* activate old session options even if is falsy value

* move restartOnAuthFail to LegacyAuthStrategy option

* add link to guide item

* update example/shell

* types
2022-02-27 22:02:49 -04:00
Rajeh Taher
0d55d40885 feat: Multi-device support (#889)
* 🚑 Added ready selector for multi-device

* SendMessage fix

* File management system and some fixes

* cleanup

* cleanup again

* eslint

* critical fix for reloading the same session

* Checking for valid folder name (regex)

* ESLint hotfix (regex escapes)

* Typings cleanup

* cleanup listener

* Multi-device Branch merge (#888)

* Duplicate

* qr fix and allow non-beta users to connect

* urgent: selector fix

* urgent: qr timeout fix

* fix

* Updated type so no TS error when sending list/buttons

* Update index.d.ts

* fix QueryExist for Multidevice (#928)

* creates isRegisteredUserBeta

* fix QueryExist

* fix Error: GROUP_JID: invalid jid type: Not an instance of WID issue (#926)

* fix Error: GROUP_JID: invalid jid type: Not an instance of WID issue

* clean code

* Cleanup

* Fix for update chrome error

* ESLint fix

* :red_light: fix for RMDIR

* Update README.md

* Update README.md

* fix: getProfilePicUrl fix by victormga (#941)

* fix: MD presence available/unavailable (#942)

* delete session when appropriate & fix for SW

* ignore QR timeout errors

* Presence and ChatState updates working for MD+Non-MD

* shell uses new session storage

* lint fix

* support session.json-based auth for non-md

* md fix

* md fix

* fix shell clientId

* remove exclusive mocha test

* make linkPreview default to false

* remove ignored errors on getQuotedMessage

* fix: dont modify existing this.options.puppeteer object

* tests work with new dir auth

* remove exclusive test

* fixes and tests for group creation and participant functions

* remove unused function

* wip fix group settings functions

* isRegisteredUser && getNumberId hotFix (#955)

* isRegisteredUser && getNumberId hotFix

A fix for client.isRegisteredUser and client.getNumberId. Use for reference or if you are stuck with MD and NEEDS this function. Problably Whatsapp will break this in a couple weeks

* fix for non-md

Co-authored-by: Rajeh Taher <rajeh@reforward.dev>

* Fix WA 2.2146.9 MD +  victormga branch (#991)

* qrcode now uses observers instead of timeout

* automatic auth/qrcode detection

* Fix WA 2.2146.9 MD

Got from github:victormga/whatsapp-web.js#multidevice maybe it's behind pedro branch

Co-authored-by: victormga <victor_mga@hotmail.com>

* fix

* fix*

* getnumberid to multidevice (#1027)

* getNumberId to main

 isRegisteredUser && getNumberId hotFix #955 To main

* Update Client.js

Co-authored-by: tuyuribr <45042245+tuyuribr@users.noreply.github.com>

* Update Client.js

* Message.raw() (#1005)

* Message.raw()

* i just noticed

* Update index.d.ts

* Update index.d.ts

* Update Message.js

* Get rid of sharp now!!!!!!!! (#1045)

* commit 1

* finally, gotten rid of sharp

* pckg.json

* service worker fix & disableMessage option

* typings

* Update example.js

* clear session system

* Update Client.js

* Update Client.js

* Fix accepting group private invite (#1094)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* [MD] Add getCommonGroups with specific user. (#1097)

* Add getCommonGroups with specific user.

* Fix

* Fix

* Fix

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* Fix getCommonGroups. (#1122)

* Fix of Unexpected identifier async destroy() (#1123)

* Fix of Unexpected identifier async destroy()

* Fix made in #1107

* Temporary fix for "Sticker" module

* some really quick changes

* Update Injected.js

* Update Injected.js

* Update index.d.ts

* fix: getNumberId Solved (#1142)

* getNumberId Solved

* isRegisteredUser Solved

* formmated

* Apply suggestions from code review

* Update src/util/Injected.js

Co-authored-by: Rajeh Taher <rajeh@reforward.dev>

* Fix: "Chrome user data dir was not found ..."

fixes the error caused by puppeteer.

* Update Client.js (#1154)

* fix: getNumberId and isRegisteredUser (#1159)

* fix: getNumberId and isRegisteredUser

* Apply suggestions from code review

Co-authored-by: Rajeh Taher <rajeh@reforward.dev>

* Update client.js

* Update Injected.js

* Update Client.js

* Update index.d.ts

* Update Client.js

* Update Client.js

* fix lint indentation

* fix auth_failure event for non-md, tests

* fix setting group subject

* fix finding Label module

* set remember-me after clearing localStorage

* fix: send messages to groups correctly on MD, use new ID format

* fix setting / getting contact status

* fix msg.getInfo, add message tests

* fix group settings functions

* fix set group description, handle errors in setSubject

* fix group invite functions

* fix leaving group

* bring back phone info for non-md users

* remove unused option, update typings

* add back jsdoc for qr event

* fix setting sticker metadata, clean up sticker functions

* rawData is a get only property

* fix and simplify getNumberId/isRegisteredUser

* fix getInviteInfo

* setDisplayName returns bool, not yet implemented for md

* fix: stream module (#1241)

* linkPreview has no effect on MD, return default to true

* fix: del linkPreview option on md

* cleanup, types and docs updates

* update readmes / test notes

* remove DS_Store

* DS_Store in gitignore

* test stability (timeouts/sleeps)

Co-authored-by: Rajeh Taher <rajeh@reforward.tk>
Co-authored-by: Gustavo B <52040719+Gugabit@users.noreply.github.com>
Co-authored-by: Maikel Ortega Hernández <maikeloh@gmail.com>
Co-authored-by: victormga <victor_mga@hotmail.com>
Co-authored-by: Pedro Lopez <pedroslopez@me.com>
Co-authored-by: tuyuribr <45042245+tuyuribr@users.noreply.github.com>
Co-authored-by: gon <68490103+nekiak@users.noreply.github.com>
Co-authored-by: Alon Schwartzblat <63599777+Schwartzblat@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Šebestíček <44745014+SebestikCZ@users.noreply.github.com>
Co-authored-by: Emmanuel Anaya Luna <38712443+KeruMx@users.noreply.github.com>
Co-authored-by: L337C0D3R <51872799+L337C0D3R@users.noreply.github.com>
Co-authored-by: Reni Delonzek <renidelonzek@gmail.com>
2022-02-27 18:51:08 -04:00
Pedro Lopez
8ef37b68ae chore: mark version v1.15.8 2022-02-25 17:45:33 -04:00
github-actions[bot]
bd5cfdc936 Update supported WhatsApp Web version to v2.2206.5 (#1247)
Co-authored-by: pedroslopez <pedroslopez@users.noreply.github.com>
2022-02-25 17:43:30 -04:00
༺ LᴇG̸ᴇɴD ༻
f0e49efcf9 [Main Branch]: Fix Cannot read properties of undefined (reading 'Socket') (#1249)
Co-authored-by: Joaquin Touris <joaquin@192.168.1.5>
2022-02-25 17:11:28 -04:00
Pedro Lopez
5d83b45ed4 chore: mark version v1.15.7 2022-02-19 15:48:03 -04:00
github-actions[bot]
e29354fca3 Update supported WhatsApp Web version to v2.2204.13 (#1210)
Co-authored-by: pedroslopez <pedroslopez@users.noreply.github.com>
2022-02-19 15:45:21 -04:00
Shir Serlui
66283da903 Fix message.delete(true) (#1211)
* Fix message.delete(true)

* Fix for tests
2022-02-19 15:31:23 -04:00
Tomas Melone
d7f7889b0f fix: Remove duplicate identifier (#1205) 2022-02-19 15:18:34 -04:00
Pedro Lopez
11955e9f03 chore: mark version v1.15.6 2022-02-08 22:38:33 -04:00
Md. Fahim Bin Amin
444abc2c76 added the Code of Conduct, closing #1156 (#1176) 2022-02-08 22:34:33 -04:00
Pedro S. Lopez
20f3bc7a8b fix: dont cause redirect loop due to session restore (#1181)
* fix: dont cause redirect loop due to session restore

* back to `state` in docs

* use referer to determine first injection

* bring bzck disconnect on nav

* revert some changes
2022-02-08 22:33:20 -04:00
Pedro Lopez
93c8a2b05e chore: mark version v1.15.5 2022-02-06 22:20:08 -04:00
Pedro S. Lopez
70ca073f38 fix: send messages properly when disappearing mode is on (#1174)
* fix: send messages properly when dissappearing mode is on

* add `isEphemeral` to message model
2022-02-06 21:48:55 -04:00
Shir Serlui
7e36cceaf0 extra options can override other options when sending message (#1103)
* Fix the option to use special options

When we want to use some extra function we need to pass it into the options object, but because it inserted in the first line, the auto options reset some options (like 'type').
This is minor change that can help to add functionallity

* Update Injected.js

Put the special options in the end

* Update Injected.js

Fix , mistake

* only `extra` options can override everything else

Co-authored-by: Pedro Lopez <pedroslopez@me.com>
2022-02-06 21:00:10 -04:00
Noam Zaks
303ea3ab6b fix types and docs for Buttons class (#1070)
* fix: typing of buttons class

* fix remaining types

Co-authored-by: Pedro Lopez <pedroslopez@me.com>
2022-02-07 00:56:57 +00:00
Pedro Lopez
4aae8b0f32 fix: sort before splicing when fetching messages 2022-02-06 20:03:59 -04:00
Pedro Lopez
64803c2ba6 update typings for fetchMessages changes 2022-02-06 19:30:13 -04:00
Azeem Haider
aa9e19a19e fetchMessages gets currently available messages by default (#1015)
* get chat default messages fix #1014

* fixing format

* Update src/structures/Chat.js

Co-authored-by: Pedro S. Lopez <pedroslopez@me.com>

Co-authored-by: Pedro S. Lopez <pedroslopez@me.com>
2022-02-06 19:27:38 -04:00
Pedro S. Lopez
7631400de1 add back the pull_request trigger on lint 2022-02-06 19:16:57 -04:00
Pedro Lopez
d7478de68a fix: emit message events after ciphertext is decrypted
fixes #924
fixes #1041
2022-02-06 18:54:10 -04:00
Pedro Lopez
a9b2a1aab8 remove duplicated message type 2022-02-06 16:30:44 -04:00
Pedro Lopez
3b4632201d fix: add missing message types 2022-02-06 16:26:25 -04:00
Pedro Lopez
2200390d4c disable eslint warning on intentionally skipped test 2022-02-05 23:36:05 -04:00
dependabot[bot]
b1f7ff01bc chore(deps-dev): bump sinon from 12.0.1 to 13.0.1 (#1160)
Bumps [sinon](https://github.com/sinonjs/sinon) from 12.0.1 to 13.0.1.
- [Release notes](https://github.com/sinonjs/sinon/releases)
- [Changelog](https://github.com/sinonjs/sinon/blob/master/docs/changelog.md)
- [Commits](https://github.com/sinonjs/sinon/compare/v12.0.1...v13.0.1)

---
updated-dependencies:
- dependency-name: sinon
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-02-05 23:35:04 -04:00
dependabot[bot]
21d565154a chore(deps-dev): bump dotenv from 10.0.0 to 16.0.0 (#1171)
Bumps [dotenv](https://github.com/motdotla/dotenv) from 10.0.0 to 16.0.0.
- [Release notes](https://github.com/motdotla/dotenv/releases)
- [Changelog](https://github.com/motdotla/dotenv/blob/master/CHANGELOG.md)
- [Commits](https://github.com/motdotla/dotenv/compare/v10.0.0...v16.0.0)

---
updated-dependencies:
- dependency-name: dotenv
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-02-05 23:32:53 -04:00
dependabot[bot]
09cbee0e65 chore(deps-dev): bump eslint-plugin-mocha from 9.0.0 to 10.0.3 (#1087)
Bumps [eslint-plugin-mocha](https://github.com/lo1tuma/eslint-plugin-mocha) from 9.0.0 to 10.0.3.
- [Release notes](https://github.com/lo1tuma/eslint-plugin-mocha/releases)
- [Changelog](https://github.com/lo1tuma/eslint-plugin-mocha/blob/master/CHANGELOG.md)
- [Commits](https://github.com/lo1tuma/eslint-plugin-mocha/compare/9.0.0...10.0.3)

---
updated-dependencies:
- dependency-name: eslint-plugin-mocha
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-02-05 23:32:30 -04:00
github-actions[bot]
fa9f5aba38 Update supported WhatsApp Web version to v2.2202.12 (#1152)
Co-authored-by: pedroslopez <pedroslopez@users.noreply.github.com>
2022-02-05 23:17:11 -04:00
Pedro S. Lopez
c859ac39ce fix: dont crash when calling .destroy() while waiting for qr scan (#1172)
fixes #739
fixes #951
2022-02-05 23:05:01 -04:00
Pedro S. Lopez
221d29736a remove unnecessary pull_request trigger for lint 2022-02-05 23:04:47 -04:00
Igor Nunes
078933f061 fix(typings): add MessageTypes BUTTONS_RESPONSE (#1032)
fixes #1104
2022-02-05 22:11:53 -04:00
Pedro S. Lopez
f149516d0d chore(tests): add Chat model tests (#784)
* add search and status tests

* reset to previous status in test

* move version to its own test

* add tests for Chat model

* keep hooks at the top

* run tests recursively in default script
2022-02-05 22:05:42 -04:00
Pedro S. Lopez
2f1c894a34 add tests for takeoverOnConflict (#1170)
* add tests

* fix module test, remove unused CryptoLib
2022-02-05 20:04:00 -04:00
Pedro S. Lopez
32e47d818a fix: only emit disconnected event on navigation when state is PAIRING (#1169) 2022-02-05 18:19:02 -04:00
Zulfikar
20aee44c3b fix getLabels error (#1049)
Co-authored-by: Rajeh Taher <rajeh@reforward.dev>
2022-02-05 16:41:27 -04:00
Shir Serlui
bb2ef88e0a fix: message.delete() can revoke for everyone (#1107)
Change msg.canRevoke to msg._canRevoke according to WhatsApp code change
2022-02-05 15:52:04 -04:00
tuyuribr
6878598a5d fix: await promise when setting user agent (#1113)
Some of my devices were bugging out because the setUserAgent didn't had an await, after this everything was working fine (try loading the wwebjs in a broken microSd ahhaha).

We need some testing but on my limited testing everything is working

Co-authored-by: Rajeh Taher <rajeh@reforward.dev>
2022-02-05 15:42:25 -04:00
Pedro Lopez
4e6a00dffe chore: mark version v1.15.4 2022-01-25 20:49:07 -04:00
Pedro Lopez
b93c7b4b76 fix invalid jsdoc 2022-01-25 20:48:44 -04:00
Pedro Lopez
a37ff69692 fix: restore node 12 support 2022-01-25 20:40:50 -04:00
github-actions[bot]
3705d1fea9 Update supported WhatsApp Web version to v2.2202.8 (#1084)
Co-authored-by: pedroslopez <pedroslopez@users.noreply.github.com>
Co-authored-by: Pedro S. Lopez <pedroslopez@me.com>
2022-01-25 20:16:08 -04:00
Pedro S. Lopez
7950aae5d1 fix: find Store in v2.2202.8 (#1130)
Co-authored-by: Rajeh Taher <rajeh@reforward.dev>
2022-01-25 20:15:19 -04:00
Pedro Lopez
bdff59fb44 fix: remove problematic import 2022-01-25 19:45:57 -04:00
Wictor Nogueira
d05803074a update MessageMedia.fromUrl (#811)
* fix MessageMedia.fromUrl docs

* use content-type as fallback

* set filename based on url

* fix empty filename

* wrap expression in parentheses

* hotfix

* JSDoc fix

* fix for jsdog

* eslint gets retirement home

Co-authored-by: Rajeh Taher <rajeh@reforward.dev>
Co-authored-by: Aliyss Snow <33941859+Aliyss@users.noreply.github.com>
2022-01-21 23:57:15 +01:00
Rajeh Taher
d86c39de3c fix: Fix inactivity issue (#946)
* Fixed Remember me issue

* Update Client.js
2021-12-16 15:25:35 +00:00
shirser121
46ba9c5e9a Add isGif to message._patch (#963)
* Update Message.js

Add isGif to the message data

* add typings

Co-authored-by: Rajeh Taher <rajeh@reforward.dev>
Co-authored-by: Pedro Lopez <pedroslopez@me.com>
2021-12-12 21:57:11 -04:00
Pedro Lopez
d7a493e68a fix: use correct @types/node-fetch ver, use working node-fetch ver from puppeteer, add test 2021-12-12 21:28:38 -04:00
dependabot[bot]
da95d927b9 chore(deps): bump puppeteer from 10.4.0 to 13.0.0 (#1057)
Bumps [puppeteer](https://github.com/puppeteer/puppeteer) from 10.4.0 to 13.0.0.
- [Release notes](https://github.com/puppeteer/puppeteer/releases)
- [Changelog](https://github.com/puppeteer/puppeteer/blob/main/CHANGELOG.md)
- [Commits](https://github.com/puppeteer/puppeteer/compare/v10.4.0...v13.0.0)

---
updated-dependencies:
- dependency-name: puppeteer
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-12-12 21:09:56 -04:00
dependabot[bot]
92bc5e62ab chore(deps-dev): bump eslint from 7.32.0 to 8.4.1 (#1038)
Bumps [eslint](https://github.com/eslint/eslint) from 7.32.0 to 8.4.1.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v7.32.0...v8.4.1)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-12-12 19:47:11 -04:00
dependabot[bot]
73a3e28a4b chore(deps-dev): bump @types/node-fetch from 2.5.12 to 3.0.3 (#911)
Bumps [@types/node-fetch](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node-fetch) from 2.5.12 to 3.0.3.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node-fetch)

---
updated-dependencies:
- dependency-name: "@types/node-fetch"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-12-12 19:46:30 -04:00
dependabot[bot]
4f376fc2fa chore(deps-dev): bump sinon from 11.1.2 to 12.0.1 (#1024)
Bumps [sinon](https://github.com/sinonjs/sinon) from 11.1.2 to 12.0.1.
- [Release notes](https://github.com/sinonjs/sinon/releases)
- [Changelog](https://github.com/sinonjs/sinon/blob/master/docs/changelog.md)
- [Commits](https://github.com/sinonjs/sinon/compare/v11.1.2...v12.0.1)

---
updated-dependencies:
- dependency-name: sinon
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-12-12 19:41:08 -04:00
dependabot[bot]
a20c8ef8f8 chore(deps): bump mime from 2.6.0 to 3.0.0 (#1023)
Bumps [mime](https://github.com/broofa/mime) from 2.6.0 to 3.0.0.
- [Release notes](https://github.com/broofa/mime/releases)
- [Changelog](https://github.com/broofa/mime/blob/master/CHANGELOG.md)
- [Commits](https://github.com/broofa/mime/compare/v2.6.0...v3.0.0)

---
updated-dependencies:
- dependency-name: mime
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-12-12 19:38:33 -04:00
tuyuribr
2052e0479d Fix: multiple list sections (#1004)
* Fix multiple list sections

* singleQuotes

* Update src/structures/List.js

Co-authored-by: Rajeh Taher <rajeh@reforward.dev>
2021-12-10 20:47:07 +01:00
108 changed files with 7142 additions and 1657 deletions

View File

@@ -1,2 +1,3 @@
WWEBJS_TEST_SESSION_PATH=test_session.json WWEBJS_TEST_REMOTE_ID=XXXXXXXXXX@c.us
WWEBJS_TEST_REMOTE_ID=XXXXXXXXXX@c.us WWEBJS_TEST_CLIENT_ID=authenticated
WWEBJS_TEST_MD=1

3
.github/FUNDING.yml vendored Normal file
View File

@@ -0,0 +1,3 @@
github: [pedroslopez, PurpShell]
ko_fi: pedroslopez
custom: ["paypal.me/psla", "buymeacoff.ee/pedroslopez"]

View File

@@ -1,41 +0,0 @@
---
name: Bug report
about: Is something not working as intended? Report it here.
title: ''
assignees: ''
---
### Bug description
A clear and concise description of what the bug is.
### Reproduction steps
Steps to reproduce the behavior:
1.
2.
3.
...
### Expected behavior
A clear and concise description of what you expected to happen.
### Relevant code
If applicable, add code snippets to help explain your problem.
### Environment (please complete the following information):
**WhatsApp**
- Account type [Standard / Business]:
- Device OS [iOS / Android]:
- WhatsApp Web version [run `await client.getWWebVersion()`]:
**Library**
- Browser [Chrome / Chromium]:
- NodeJS version (`node -v`):
- npm or yarn version (`npm -v`):
- whatsapp-web.js version:
**Other**
- Operating system (the one running node) [Linux / MacOS / Windows]:
- Operating system version (ex. Windows 10):
### Additional context
Add any other context about the problem here.

105
.github/ISSUE_TEMPLATE/bug_report.yml vendored Normal file
View File

@@ -0,0 +1,105 @@
name: '🐛 Bug report'
description: Create a report to help us improve
labels: bug
body:
- type: markdown
attributes:
value: |
Thank you for reporting an issue :pray:.
This issue tracker is for reporting bugs found in [`whatsapp-web.js`](https://github.com/pedroslopez/whatsapp-web.js).
If you have a question about how to achieve something and are struggling, please post a question in our [Discord server](https://discord.gg/wyKybbF) instead.
Before submitting a new bug/issue, please check the links below to see if there is a solution or question posted there already:
- `whatsapp-web.js` [Issues tab](https://github.com/pedroslopez/whatsapp-web.js/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc)
- `whatsapp-web.js` [closed Issues tab](https://github.com/pedroslopez/whatsapp-web.js/issues?q=is%3Aissue+sort%3Aupdated-desc+is%3Aclosed)
The more information you fill in, the better the community can help you.
- type: checkboxes
attributes:
label: Is there an existing issue for this?
description: Please search to see if an issue already exists for the bug you encountered.
options:
- label: I have searched the existing issues
required: true
- type: textarea
id: description
attributes:
label: Describe the bug
description: Provide a clear and concise description of the challenge you are running into.
validations:
required: true
- type: textarea
id: expected
attributes:
label: Expected behavior
description: Provide a clear and concise description of what you expected to happen.
placeholder: |
As a user, I expected ___ behavior but I am seeing ___
validations:
required: true
- type: textarea
id: steps
attributes:
label: Steps to Reproduce the Bug or Issue
description: Describe the steps we have to take to reproduce the behavior.
placeholder: |
1. Do X
2. Do Y
3. Do Z
4. See error
validations:
required: true
- type: textarea
id: relevant_code
attributes:
label: Relevant Code
description: If applicable, add code snippets to help explain your problem.
validations:
required: false
- type: dropdown
id: browser_type
attributes:
label: Browser Type
description: What web browser are you using?
options:
- Chromium
- Google Chrome
- Other (please write in Additional Context)
validations:
required: true
- type: dropdown
id: whatsapp_type
attributes:
label: WhatsApp Account Type
options:
- Standard
- WhatsApp Business
validations:
required: true
- type: dropdown
id: multidevice
attributes:
label: Does your WhatsApp account have multidevice enabled?
options:
- Yes, I am using Multi Device
- No, I am not using Multi Device
validations:
required: true
- type: textarea
attributes:
label: Environment
description: |
- OS: [e.g. Mac, Windows, Linux, Docker + Ubuntu 18, etc]
- Phone OS: [e.g. Android, iOS]
- whatsapp-web.js version [e.g. 1.2.3]
- WhatsApp Web version [run `await client.getWWebVersion()`]:
- Node.js Version [e.g. 1.2.3]
validations:
required: true
- type: textarea
id: additional
attributes:
label: Additional context
description: Add any other context about the problem here.

View File

@@ -1,20 +0,0 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

View File

@@ -0,0 +1,42 @@
name: 🚀 Feature request
description: Suggest an idea for this project
labels: enhancement
body:
- type: checkboxes
attributes:
label: Is there an existing issue for this?
description: Please search to see if an issue related to this feature request already exists.
options:
- label: I have searched the existing issues
required: true
- type: textarea
attributes:
label: Is your feature request related to a problem? Please describe.
description: A concise description of the problem you are facing or the motivetion behind this feature request.
placeholder: I faced a problem due to ...
validations:
required: false
- type: textarea
attributes:
label: Describe the solution you'd like.
description: A concise description of the solution for the issue.
validations:
required: true
- type: textarea
attributes:
label: Describe an alternate solution.
description: Is there any other approach to solve the problem?
validations:
required: false
- type: textarea
attributes:
label: Additional context
description: |
Links? Screenshots? References? Anything that will give us more context about what you would like to see!
validations:
required: false

41
.github/pull_request_template.md vendored Normal file
View File

@@ -0,0 +1,41 @@
# PR Details
<!--- Provide a general summary of your changes in the Title above -->
## Description
<!--- Describe your changes in detail -->
## Related Issue
<!--- Optional --->
<!--- If there is an issue link it here: -->
## Motivation and Context
<!--- Optional --->
<!--- Why is this change required? What problem does it solve? -->
## How Has This Been Tested
<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, and the tests you ran to -->
## Types of changes
<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
- [ ] Dependency change
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
## Checklist
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
- [ ] My code follows the code style of this project.
- [ ] I have updated the documentation accordingly (index.d.ts).

32
.github/workflows/release.yml vendored Normal file
View File

@@ -0,0 +1,32 @@
name: release
on:
workflow_dispatch:
inputs:
release_type:
description: "`alpha`, `alpha-minor`, `alpha-major` release?"
required: true
default: "alpha"
jobs:
release:
runs-on: ubuntu-latest
if: ${{ github.repository == 'pedroslopez/whatsapp-web.js' }}
steps:
- uses: actions/checkout@v2
with:
token: ${{ secrets.RELEASE_GITHUB_TOKEN }}
- run: git config --global user.email "hello@wwebjs.dev"
- run: git config --global user.name "WWebJS Bot"
- name: Bump version and publish to NPM
id: publish
run: ./tools/publish ${{ github.event.inputs.release_type }}
env:
NPM_TOKEN: ${{ secrets.RELEASE_NPM_TOKEN }}
- name: Create GitHub Release
id: create_release
uses: ncipollo/release-action@v1
with:
prerelease: ${{ steps.publish.outputs.PRERELEASE }}
generateReleaseNotes: true
tag: v${{ steps.publish.outputs.NEW_VERSION }}

6
.gitignore vendored
View File

@@ -64,8 +64,10 @@ typings/
# next.js build output # next.js build output
.next .next
# macOS Thumbnails # macOS
._* ._*
.DS_Store
# Test sessions # Test sessions
*session.json *session.json
.wwebjs_auth/

View File

@@ -12,6 +12,8 @@ yarn-debug.log*
yarn-error.log* yarn-error.log*
*session.json *session.json
.wwebjs_auth/
.env .env
tools/ tools/
tests/ tests/

133
CODE_OF_CONDUCT.md Normal file
View File

@@ -0,0 +1,133 @@
# Contributor Covenant Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our
community include:
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community
Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.
Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
[pedroslopez@me.com](mailto:pedroslopez@me.com).
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series
of actions.
**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.
### 3. Temporary Ban
**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within
the community.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
[https://www.contributor-covenant.org/version/2/0/code_of_conduct.html][v2.0].
Community Impact Guidelines were inspired by
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
For answers to common questions about this code of conduct, see the FAQ at
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available
at [https://www.contributor-covenant.org/translations][translations].
[homepage]: https://www.contributor-covenant.org
[v2.0]: https://www.contributor-covenant.org/version/2/0/code_of_conduct.html
[Mozilla CoC]: https://github.com/mozilla/diversity
[FAQ]: https://www.contributor-covenant.org/faq
[translations]: https://www.contributor-covenant.org/translations

View File

@@ -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.2147.14](https://img.shields.io/badge/WhatsApp_Web-2.2147.14-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.2306.7](https://img.shields.io/badge/WhatsApp_Web-2.2306.7-brightgreen.svg) [![Discord Chat](https://img.shields.io/discord/698610475432411196.svg?logo=discord)](https://discord.gg/H7DqQs4)
# whatsapp-web.js # whatsapp-web.js
A WhatsApp API client that connects through the WhatsApp Web browser app A WhatsApp API client that connects through the WhatsApp Web browser app
@@ -47,43 +47,14 @@ client.initialize();
Take a look at [example.js](https://github.com/pedroslopez/whatsapp-web.js/blob/master/example.js) for another example with more use cases. Take a look at [example.js](https://github.com/pedroslopez/whatsapp-web.js/blob/master/example.js) for another example with more use cases.
## Remote Access For more information on saving and restoring sessions, check out the available [Authentication Strategies](https://wwebjs.dev/guide/authentication.html).
You could also connect to any previously existing browser instance:
```js
const client = new Client({
puppeteer: {
browserWSEndpoint: `ws://localhost:3000`
}
});
```
### Docker
1) Installing a browser using browserless:
```
docker run \
--rm \
-p 3000:3000 \
-e "MAX_CONCURRENT_SESSIONS=1" \
browserless/chrome:latest
```
Reference: https://docs.browserless.io/docs/docker-quickstart.html
### Remote Debugging
2) Running a browser with websocket remote debugging enabled:
> chrome.exe --remote-debugging-port=9222
After that check the following webpage and check http://127.0.0.1:9220/json and get the **webSocketDebuggerUrl**
## Supported features ## Supported features
| Feature | Status | | Feature | Status |
| ------------- | ------------- | | ------------- | ------------- |
| Multi Device | ✅ |
| Send messages | ✅ | | Send messages | ✅ |
| Receive messages | ✅ | | Receive messages | ✅ |
| Send media (images/audio/documents) | ✅ | | Send media (images/audio/documents) | ✅ |
@@ -109,6 +80,7 @@ After that check the following webpage and check http://127.0.0.1:9220/json and
| Get contact info | ✅ | | Get contact info | ✅ |
| Get profile pictures | ✅ | | Get profile pictures | ✅ |
| Set user status message | ✅ | | Set user status message | ✅ |
| React to messages | ✅ |
Something missing? Make an issue and let us know! Something missing? Make an issue and let us know!
@@ -116,11 +88,13 @@ Something missing? Make an issue and let us know!
Pull requests are welcome! If you see something you'd like to add, please do. For drastic changes, please open an issue first. Pull requests are welcome! If you see something you'd like to add, please do. For drastic changes, please open an issue first.
## Donating ## Supporting the project
You can support the maintainer of this project through the link below You can support the maintainer of this project through the links below
[![Support via PayPal](https://cdn.rawgit.com/twolfson/paypal-github-button/1.0.0/dist/button.svg)](https://www.paypal.me/psla/) - [Support via GitHub Sponsors](https://github.com/sponsors/pedroslopez)
- [Support via PayPal](https://www.paypal.me/psla/)
- [Sign up for DigitalOcean](https://m.do.co/c/73f906a36ed4) and get $200 in credit when you sign up (Referral)
## Disclaimer ## Disclaimer

View File

@@ -4,7 +4,7 @@
<head> <head>
<meta name="generator" content="JSDoc 3.6.7"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.15.3 &raquo; Class: Base</title> <title>whatsapp-web.js 1.19.5 &raquo; Class: Base</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar"> <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container"> <div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content"> <div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -50,7 +50,7 @@
<footer id="jsdoc-footer" class="jsdoc-footer"> <footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container"> <div id="jsdoc-footer-container">
<p> <p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on December 7, 2021. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -0,0 +1,65 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.19.5 &raquo; Class: BaseAuthStrategy</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
<link href="css/baseline.css" rel="stylesheet">
</head>
<body onload="prettyPrint()">
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div>
</div>
</nav>
<div id="jsdoc-body-container">
<div id="jsdoc-content">
<div id="jsdoc-content-container">
<div id="jsdoc-main" role="main">
<header class="page-header">
<div class="symbol-detail-labels"><span class="label label-kind">class</span></div>
<h1><small></small><span class="symbol-name">BaseAuthStrategy</span></h1>
<p class="source-link">Source: <a href="authStrategies_BaseAuthStrategy.js.html#source-line-6">authStrategies/<wbr>BaseAuthStrategy.<wbr>js:6</a></p>
<div class="symbol-classdesc">
<p>Base class which all authentication strategies extend</p>
</div>
<dl class="dl-compact">
</dl>
</header>
<section id="summary">
</section>
<section>
<h2 id="BaseAuthStrategy">new&nbsp;<span class="symbol-name">BaseAuthStrategy</span><span class="signature"><span class="signature-params">()</span></span></h2>
<dl class="dl-compact">
</dl>
</section>
<section>
</section>
</div>
</div>
<nav id="jsdoc-toc-nav" role="navigation"></nav>
</div>
</div>
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p>
</div>
</footer>
<script src="scripts/jquery.min.js"></script>
<script src="scripts/tree.jquery.js"></script>
<script src="scripts/prettify.js"></script>
<script src="scripts/jsdoc-toc.js"></script>
<script src="scripts/linenumber.js"></script>
<script src="scripts/scrollanchor.js"></script>
</body>
</html>

View File

@@ -4,7 +4,7 @@
<head> <head>
<meta name="generator" content="JSDoc 3.6.7"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.15.3 &raquo; Class: BusinessContact</title> <title>whatsapp-web.js 1.19.5 &raquo; Class: BusinessContact</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar"> <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container"> <div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content"> <div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -111,19 +111,22 @@
</div> </div>
<div class="summary-column"> <div class="summary-column">
<dl class="dl-summary-callout"> <dl class="dl-summary-callout">
<dt><a href="BusinessContact.html#getCommonGroups">getCommonGroups()</a></dt>
<dd>
</dd>
<dt><a href="BusinessContact.html#getCountryCode">getCountryCode()</a></dt> <dt><a href="BusinessContact.html#getCountryCode">getCountryCode()</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="BusinessContact.html#getFormattedNumber">getFormattedNumber()</a></dt> <dt><a href="BusinessContact.html#getFormattedNumber">getFormattedNumber()</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="BusinessContact.html#getProfilePicUrl">getProfilePicUrl()</a></dt>
<dd>
</dd>
</dl> </dl>
</div> </div>
<div class="summary-column"> <div class="summary-column">
<dl class="dl-summary-callout"> <dl class="dl-summary-callout">
<dt><a href="BusinessContact.html#getProfilePicUrl">getProfilePicUrl()</a></dt>
<dd>
</dd>
<dt><a href="BusinessContact.html#unblock">unblock()</a></dt> <dt><a href="BusinessContact.html#unblock">unblock()</a></dt>
<dd> <dd>
</dd> </dd>
@@ -269,6 +272,15 @@
<dd></dd> <dd></dd>
</dl> </dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div> <div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="getCommonGroups"><span class="symbol-name">getCommonGroups</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing Array of WAWebJS.ChatId</span></span></h3>
<p>Gets the Contact's common groups with you. Returns empty array if you don't have any common group.</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Contact.html#getCommonGroups">Contact#getCommonGroups</a></dd>
<dt>Returns</dt>
<dd></dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="getCountryCode"><span class="symbol-name">getCountryCode</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing string</span></span></h3> <h3 id="getCountryCode"><span class="symbol-name">getCountryCode</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing string</span></span></h3>
<p>Returns the contact's countrycode, (1541859685@c.us) =&gt; (1)</p> <p>Returns the contact's countrycode, (1541859685@c.us) =&gt; (1)</p>
<dl class="dl-compact"> <dl class="dl-compact">
@@ -314,7 +326,7 @@
<footer id="jsdoc-footer" class="jsdoc-footer"> <footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container"> <div id="jsdoc-footer-container">
<p> <p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on December 7, 2021. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -4,7 +4,7 @@
<head> <head>
<meta name="generator" content="JSDoc 3.6.7"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.15.3 &raquo; Class: Buttons</title> <title>whatsapp-web.js 1.19.5 &raquo; Class: Buttons</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar"> <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container"> <div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content"> <div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -26,7 +26,7 @@
<header class="page-header"> <header class="page-header">
<div class="symbol-detail-labels"><span class="label label-kind">class</span></div> <div class="symbol-detail-labels"><span class="label label-kind">class</span></div>
<h1><small></small><span class="symbol-name">Buttons</span></h1> <h1><small></small><span class="symbol-name">Buttons</span></h1>
<p class="source-link">Source: <a href="structures_Buttons.js.html#source-line-9">structures/<wbr>Buttons.<wbr>js:9</a></p> <p class="source-link">Source: <a href="structures_Buttons.js.html#source-line-23">structures/<wbr>Buttons.<wbr>js:23</a></p>
<div class="symbol-classdesc"> <div class="symbol-classdesc">
<p>Message type buttons</p> <p>Message type buttons</p>
</div> </div>
@@ -116,6 +116,7 @@
<p>&nbsp;</p> <p>&nbsp;</p>
</td> </td>
<td> <td>
<p>See <a href="global.html#ButtonSpec"><code>ButtonSpec</code></a></p>
</td> </td>
</tr> </tr>
<tr> <tr>
@@ -161,7 +162,7 @@
<dl class="dl-compact"> <dl class="dl-compact">
</dl> </dl>
<h3 id="buttons"><span class="symbol-name">buttons</span><small class="property-type"> <h3 id="buttons"><span class="symbol-name">buttons</span><small class="property-type">
&nbsp;Array of Array of string</small></h3> &nbsp;Array of <a href="global.html#FormattedButtonSpec">FormattedButtonSpec</a></small></h3>
<p>buttons of message</p> <p>buttons of message</p>
<dl class="dl-compact"> <dl class="dl-compact">
</dl> </dl>
@@ -178,7 +179,7 @@
</section> </section>
<h2>Method</h2> <h2>Method</h2>
<section> <section>
<h3 id="_format"><span class="symbol-name">_format</span><span class="signature"><span class="signature-params">(buttons)</span>&nbsp;&rarr; <span class="signature-returns"> Array of Array of string</span></span></h3> <h3 id="_format"><span class="symbol-name">_format</span><span class="signature"><span class="signature-params">(buttons)</span>&nbsp;&rarr; <span class="signature-returns"> Array of <a href="global.html#FormattedButtonSpec">FormattedButtonSpec</a></span></span></h3>
<p>Creates button array from simple array</p> <p>Creates button array from simple array</p>
<section> <section>
<h4> <h4>
@@ -206,7 +207,7 @@ Returns: [{ buttonId:&#x27;customId&#x27;,buttonText:{&#x27;displayText&#x27;:&#
<p>buttons</p> <p>buttons</p>
</td> </td>
<td> <td>
<p>Array of Array of string</p> <p>Array of <a href="global.html#ButtonSpec">ButtonSpec</a></p>
</td> </td>
<td> <td>
<p>&nbsp;</p> <p>&nbsp;</p>
@@ -220,7 +221,7 @@ Returns: [{ buttonId:&#x27;customId&#x27;,buttonText:{&#x27;displayText&#x27;:&#
<dl class="dl-compact"> <dl class="dl-compact">
<dt>Returns</dt> <dt>Returns</dt>
<dd> <dd>
<p><code>Array of Array of string</code> </p> <p><code>Array of <a href="global.html#FormattedButtonSpec">FormattedButtonSpec</a></code> </p>
</dd> </dd>
</dl> </dl>
</section> </section>
@@ -233,7 +234,7 @@ Returns: [{ buttonId:&#x27;customId&#x27;,buttonText:{&#x27;displayText&#x27;:&#
<footer id="jsdoc-footer" class="jsdoc-footer"> <footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container"> <div id="jsdoc-footer-container">
<p> <p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on December 7, 2021. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -4,7 +4,7 @@
<head> <head>
<meta name="generator" content="JSDoc 3.6.7"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.15.3 &raquo; Class: Call</title> <title>whatsapp-web.js 1.19.5 &raquo; Class: Call</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar"> <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container"> <div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content"> <div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -78,6 +78,22 @@
</div> </div>
</div> </div>
</div> </div>
<div class="summary-callout">
<h2 class="summary-callout-heading">Method</h2>
<div class="summary-content">
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="Call.html#reject">reject()</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
</div>
<div class="summary-column">
</div>
</div>
</div>
</section> </section>
<section> <section>
<h2 id="Call">new&nbsp;<span class="symbol-name">Call</span><span class="signature"><span class="signature-params">()</span></span></h2> <h2 id="Call">new&nbsp;<span class="symbol-name">Call</span><span class="signature"><span class="signature-params">()</span></span></h2>
@@ -135,6 +151,14 @@
<dl class="dl-compact"> <dl class="dl-compact">
</dl> </dl>
</section> </section>
<h2>Method</h2>
<section>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="reject"><span class="symbol-name">reject</span><span class="signature"><span class="signature-params">()</span></span></h3>
<p>Reject the call</p>
<dl class="dl-compact">
</dl>
</section>
</section> </section>
</div> </div>
</div> </div>
@@ -144,7 +168,7 @@
<footer id="jsdoc-footer" class="jsdoc-footer"> <footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container"> <div id="jsdoc-footer-container">
<p> <p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on December 7, 2021. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -4,7 +4,7 @@
<head> <head>
<meta name="generator" content="JSDoc 3.6.7"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.15.3 &raquo; Class: Chat</title> <title>whatsapp-web.js 1.19.5 &raquo; Class: Chat</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar"> <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container"> <div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content"> <div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -176,7 +176,7 @@
<dl class="dl-compact"> <dl class="dl-compact">
</dl> </dl>
<h3 id="isMuted"><span class="symbol-name">isMuted</span><small class="property-type"> <h3 id="isMuted"><span class="symbol-name">isMuted</span><small class="property-type">
&nbsp;number</small></h3> &nbsp;boolean</small></h3>
<p>Indicates if the chat is muted or not</p> <p>Indicates if the chat is muted or not</p>
<dl class="dl-compact"> <dl class="dl-compact">
</dl> </dl>
@@ -224,7 +224,8 @@
<dl class="dl-compact"> <dl class="dl-compact">
<dt>Returns</dt> <dt>Returns</dt>
<dd> <dd>
<p><code>Promise containing Boolean</code> <p>result</p> <p><code>Promise containing Boolean</code> 
<p>result</p>
</p> </p>
</dd> </dd>
</dl> </dl>
@@ -239,7 +240,8 @@
<dl class="dl-compact"> <dl class="dl-compact">
<dt>Returns</dt> <dt>Returns</dt>
<dd> <dd>
<p><code>Promise containing Boolean</code> <p>result</p> <p><code>Promise containing Boolean</code> 
<p>result</p>
</p> </p>
</dd> </dd>
</dl> </dl>
@@ -269,7 +271,7 @@
<p>&nbsp;</p> <p>&nbsp;</p>
</td> </td>
<td> <td>
<p>Options for searching messages. Right now only limit is supported.</p> <p>Options for searching messages. Right now only limit and fromMe is supported.</p>
<p>Values in <code>searchOptions</code> have the following properties:</p> <p>Values in <code>searchOptions</code> have the following properties:</p>
<table class="jsdoc-details-table"> <table class="jsdoc-details-table">
<thead> <thead>
@@ -292,8 +294,21 @@
<p>Yes</p> <p>Yes</p>
</td> </td>
<td> <td>
<p>The amount of messages to return. Note that the actual number of returned messages may be smaller if there aren't enough messages in the conversation. Set this to Infinity to load all messages.</p> <p>The amount of messages to return. If no limit is specified, the available messages will be returned. Note that the actual number of returned messages may be smaller if there aren't enough messages in the conversation. Set this to Infinity to load all messages.</p>
<p>Defaults to <code>50</code>.</p> </td>
</tr>
<tr>
<td>
<p>fromMe</p>
</td>
<td>
<p>Boolean</p>
</td>
<td>
<p>Yes</p>
</td>
<td>
<p>Return only messages from the bot number or vise versa. To get all messages, leave the option undefined.</p>
</td> </td>
</tr> </tr>
</tbody> </tbody>
@@ -373,7 +388,8 @@
<dl class="dl-compact"> <dl class="dl-compact">
<dt>Returns</dt> <dt>Returns</dt>
<dd> <dd>
<p><code>Promise containing boolean</code> <p>New pin state. Could be false if the max number of pinned chats was reached.</p> <p><code>Promise containing boolean</code> 
<p>New pin state. Could be false if the max number of pinned chats was reached.</p>
</p> </p>
</dd> </dd>
</dl> </dl>
@@ -424,7 +440,8 @@
<dl class="dl-compact"> <dl class="dl-compact">
<dt>Returns</dt> <dt>Returns</dt>
<dd> <dd>
<p><code>Promise containing <a href="Message.html">Message</a></code> <p>Message that was just sent</p> <p><code>Promise containing <a href="Message.html">Message</a></code> 
<p>Message that was just sent</p>
</p> </p>
</dd> </dd>
</dl> </dl>
@@ -434,7 +451,8 @@
<dl class="dl-compact"> <dl class="dl-compact">
<dt>Returns</dt> <dt>Returns</dt>
<dd> <dd>
<p><code>Promise containing Boolean</code> <p>result</p> <p><code>Promise containing Boolean</code> 
<p>result</p>
</p> </p>
</dd> </dd>
</dl> </dl>
@@ -464,7 +482,8 @@
<dl class="dl-compact"> <dl class="dl-compact">
<dt>Returns</dt> <dt>Returns</dt>
<dd> <dd>
<p><code>Promise containing boolean</code> <p>New pin state</p> <p><code>Promise containing boolean</code> 
<p>New pin state</p>
</p> </p>
</dd> </dd>
</dl> </dl>
@@ -478,7 +497,7 @@
<footer id="jsdoc-footer" class="jsdoc-footer"> <footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container"> <div id="jsdoc-footer-container">
<p> <p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on December 7, 2021. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -4,7 +4,7 @@
<head> <head>
<meta name="generator" content="JSDoc 3.6.7"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.15.3 &raquo; Class: Client</title> <title>whatsapp-web.js 1.19.5 &raquo; Class: Client</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar"> <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container"> <div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content"> <div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -26,7 +26,7 @@
<header class="page-header"> <header class="page-header">
<div class="symbol-detail-labels"><span class="label label-kind">class</span></div> <div class="symbol-detail-labels"><span class="label label-kind">class</span></div>
<h1><small></small><span class="symbol-name">Client</span></h1> <h1><small></small><span class="symbol-name">Client</span></h1>
<p class="source-link">Source: <a href="Client.js.html#source-line-53">Client.<wbr>js:53</a></p> <p class="source-link">Source: <a href="Client.js.html#source-line-49">Client.<wbr>js:49</a></p>
<div class="symbol-classdesc"> <div class="symbol-classdesc">
<p>Starting point for interacting with the WhatsApp Web API</p> <p>Starting point for interacting with the WhatsApp Web API</p>
</div> </div>
@@ -55,7 +55,7 @@
<div class="summary-content"> <div class="summary-content">
<div class="summary-column"> <div class="summary-column">
<dl class="dl-summary-callout"> <dl class="dl-summary-callout">
<dt><a href="Client.html#acceptGroupV4Invite">acceptGroupV4Invite(inviteV4)</a></dt> <dt><a href="Client.html#acceptGroupV4Invite">acceptGroupV4Invite(inviteInfo)</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Client.html#acceptInvite">acceptInvite(inviteCode)</a></dt> <dt><a href="Client.html#acceptInvite">acceptInvite(inviteCode)</a></dt>
@@ -85,19 +85,22 @@
<dt><a href="Client.html#getChatsByLabelId">getChatsByLabelId(labelId)</a></dt> <dt><a href="Client.html#getChatsByLabelId">getChatsByLabelId(labelId)</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Client.html#getCommonGroups">getCommonGroups(contactId)</a></dt>
<dd>
</dd>
<dt><a href="Client.html#getContactById">getContactById(contactId)</a></dt> <dt><a href="Client.html#getContactById">getContactById(contactId)</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Client.html#getContacts">getContacts()</a></dt> <dt><a href="Client.html#getContacts">getContacts()</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Client.html#getCountryCode">getCountryCode(number)</a></dt>
<dd>
</dd>
</dl> </dl>
</div> </div>
<div class="summary-column"> <div class="summary-column">
<dl class="dl-summary-callout"> <dl class="dl-summary-callout">
<dt><a href="Client.html#getCountryCode">getCountryCode(number)</a></dt>
<dd>
</dd>
<dt><a href="Client.html#getFormattedNumber">getFormattedNumber(number)</a></dt> <dt><a href="Client.html#getFormattedNumber">getFormattedNumber(number)</a></dt>
<dd> <dd>
</dd> </dd>
@@ -134,13 +137,13 @@
<dt><a href="Client.html#markChatUnread">markChatUnread(chatId)</a></dt> <dt><a href="Client.html#markChatUnread">markChatUnread(chatId)</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Client.html#muteChat">muteChat(chatId, unmuteDate)</a></dt>
<dd>
</dd>
</dl> </dl>
</div> </div>
<div class="summary-column"> <div class="summary-column">
<dl class="dl-summary-callout"> <dl class="dl-summary-callout">
<dt><a href="Client.html#muteChat">muteChat(chatId, unmuteDate)</a></dt>
<dd>
</dd>
<dt><a href="Client.html#pinChat">pinChat()</a></dt> <dt><a href="Client.html#pinChat">pinChat()</a></dt>
<dd> <dd>
</dd> </dd>
@@ -156,6 +159,9 @@
<dt><a href="Client.html#sendPresenceAvailable">sendPresenceAvailable()</a></dt> <dt><a href="Client.html#sendPresenceAvailable">sendPresenceAvailable()</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Client.html#sendPresenceUnavailable">sendPresenceUnavailable()</a></dt>
<dd>
</dd>
<dt><a href="Client.html#sendSeen">sendSeen(chatId)</a></dt> <dt><a href="Client.html#sendSeen">sendSeen(chatId)</a></dt>
<dd> <dd>
</dd> </dd>
@@ -230,6 +236,9 @@
<dt><a href="Client.html#event:message_create">message_create</a></dt> <dt><a href="Client.html#event:message_create">message_create</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Client.html#event:message_reaction">message_reaction</a></dt>
<dd>
</dd>
<dt><a href="Client.html#event:message_revoke_everyone">message_revoke_everyone</a></dt> <dt><a href="Client.html#event:message_revoke_everyone">message_revoke_everyone</a></dt>
<dd> <dd>
</dd> </dd>
@@ -284,6 +293,20 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr>
<td>
<p>authStrategy</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Determines how to save and restore sessions. Will use LegacySessionAuth if options.session is set. Otherwise, NoAuth will be used.</p>
</td>
</tr>
<tr> <tr>
<td> <td>
<p>authTimeoutMs</p> <p>authTimeoutMs</p>
@@ -312,34 +335,6 @@
<p>Puppeteer launch options. View docs here: https://github.com/puppeteer/puppeteer/</p> <p>Puppeteer launch options. View docs here: https://github.com/puppeteer/puppeteer/</p>
</td> </td>
</tr> </tr>
<tr>
<td>
<p>qrRefreshIntervalMs</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Refresh interval for qr code (how much time to wait before checking if the qr code has changed)</p>
</td>
</tr>
<tr>
<td>
<p>qrTimeoutMs</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Timeout for qr code selector in puppeteer</p>
</td>
</tr>
<tr> <tr>
<td> <td>
<p>qrMaxRetries</p> <p>qrMaxRetries</p>
@@ -365,7 +360,7 @@
<p>&nbsp;</p> <p>&nbsp;</p>
</td> </td>
<td> <td>
<p>Restart client with a new session (i.e. use null 'session' var) if authentication fails</p> <p>@deprecated This option should be set directly on the LegacySessionAuth.</p>
</td> </td>
</tr> </tr>
<tr> <tr>
@@ -379,59 +374,7 @@
<p>&nbsp;</p> <p>&nbsp;</p>
</td> </td>
<td> <td>
<p>Whatsapp session to restore. If not set, will start a new session</p> <p>@deprecated Only here for backwards-compatibility. You should move to using LocalAuth, or set the authStrategy to LegacySessionAuth explicitly.</p>
</td>
</tr>
<tr>
<td>
<p>session.WABrowserId</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>session.WASecretBundle</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>session.WAToken1</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>session.WAToken2</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td> </td>
</tr> </tr>
<tr> <tr>
@@ -530,7 +473,6 @@
<dd><a href="Client.html#event:group_update">Client#event:group_update</a></dd> <dd><a href="Client.html#event:group_update">Client#event:group_update</a></dd>
<dd><a href="Client.html#event:disconnected">Client#event:disconnected</a></dd> <dd><a href="Client.html#event:disconnected">Client#event:disconnected</a></dd>
<dd><a href="Client.html#event:change_state">Client#event:change_state</a></dd> <dd><a href="Client.html#event:change_state">Client#event:change_state</a></dd>
<dd><a href="Client.html#event:change_battery">Client#event:change_battery</a></dd>
</dl> </dl>
</section> </section>
<section> <section>
@@ -545,7 +487,7 @@
<h2>Methods</h2> <h2>Methods</h2>
<section> <section>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div> <div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="acceptGroupV4Invite"><span class="symbol-name">acceptGroupV4Invite</span><span class="signature"><span class="signature-params">(inviteV4)</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing Object</span></span></h3> <h3 id="acceptGroupV4Invite"><span class="symbol-name">acceptGroupV4Invite</span><span class="signature"><span class="signature-params">(inviteInfo)</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing Object</span></span></h3>
<p>Accepts a private invitation to join a group</p> <p>Accepts a private invitation to join a group</p>
<section> <section>
<h4>Parameter</h4> <h4>Parameter</h4>
@@ -561,7 +503,7 @@
<tbody> <tbody>
<tr> <tr>
<td> <td>
<p>inviteV4</p> <p>inviteInfo</p>
</td> </td>
<td> <td>
<p>object</p> <p>object</p>
@@ -617,7 +559,8 @@
<dl class="dl-compact"> <dl class="dl-compact">
<dt>Returns</dt> <dt>Returns</dt>
<dd> <dd>
<p><code>Promise containing string</code> <p>Id of the joined Chat</p> <p><code>Promise containing string</code> 
<p>Id of the joined Chat</p>
</p> </p>
</dd> </dd>
</dl> </dl>
@@ -679,15 +622,18 @@
<dl class="dl-compact"> <dl class="dl-compact">
<dt>Returns</dt> <dt>Returns</dt>
<dd> <dd>
<p><code>Object</code> <p>createRes</p> <p><code>Object</code> 
<p>createRes</p>
</p> </p>
</dd> </dd>
<dd> <dd>
<p><code>string</code> <p>createRes.gid - ID for the group that was just created</p> <p><code>string</code> 
<p>createRes.gid - ID for the group that was just created</p>
</p> </p>
</dd> </dd>
<dd> <dd>
<p><code>Object with string properties</code> <p>createRes.missingParticipants - participants that were not added to the group. Keys represent the ID for participant that was not added and its value is a status code that represents the reason why participant could not be added. This is usually 403 if the user's privacy settings don't allow you to add them to groups.</p> <p><code>Object with string properties</code> 
<p>createRes.missingParticipants - participants that were not added to the group. Keys represent the ID for participant that was not added and its value is a status code that represents the reason why participant could not be added. This is usually 403 if the user's privacy settings don't allow you to add them to groups.</p>
</p> </p>
</dd> </dd>
</dl> </dl>
@@ -826,6 +772,44 @@
</dd> </dd>
</dl> </dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div> <div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="getCommonGroups"><span class="symbol-name">getCommonGroups</span><span class="signature"><span class="signature-params">(contactId)</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing Array of WAWebJS.ChatId</span></span></h3>
<p>Gets the Contact's common groups with you. Returns empty array if you don't have any common group.</p>
<section>
<h4>Parameter</h4>
<table class="jsdoc-details-table">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Optional</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<p>contactId</p>
</td>
<td>
<p>string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>the whatsapp user's ID (_serialized format)</p>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code>Promise containing Array of WAWebJS.ChatId</code> </p>
</dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="getContactById"><span class="symbol-name">getContactById</span><span class="signature"><span class="signature-params">(contactId)</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing <a href="Contact.html">Contact</a></span></span></h3> <h3 id="getContactById"><span class="symbol-name">getContactById</span><span class="signature"><span class="signature-params">(contactId)</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing <a href="Contact.html">Contact</a></span></span></h3>
<p>Get contact instance by ID</p> <p>Get contact instance by ID</p>
<section> <section>
@@ -981,7 +965,8 @@
<dl class="dl-compact"> <dl class="dl-compact">
<dt>Returns</dt> <dt>Returns</dt>
<dd> <dd>
<p><code>Promise containing object</code> <p>Invite information</p> <p><code>Promise containing object</code> 
<p>Invite information</p>
</p> </p>
</dd> </dd>
</dl> </dl>
@@ -1263,7 +1248,8 @@
<dl class="dl-compact"> <dl class="dl-compact">
<dt>Returns</dt> <dt>Returns</dt>
<dd> <dd>
<p><code>Promise containing boolean</code> <p>New pin state. Could be false if the max number of pinned chats was reached.</p> <p><code>Promise containing boolean</code> 
<p>New pin state. Could be false if the max number of pinned chats was reached.</p>
</p> </p>
</dd> </dd>
</dl> </dl>
@@ -1435,7 +1421,8 @@
<dl class="dl-compact"> <dl class="dl-compact">
<dt>Returns</dt> <dt>Returns</dt>
<dd> <dd>
<p><code>Promise containing <a href="Message.html">Message</a></code> <p>Message that was just sent</p> <p><code>Promise containing <a href="Message.html">Message</a></code> 
<p>Message that was just sent</p>
</p> </p>
</dd> </dd>
</dl> </dl>
@@ -1445,6 +1432,11 @@
<dl class="dl-compact"> <dl class="dl-compact">
</dl> </dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div> <div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="sendPresenceUnavailable"><span class="symbol-name">sendPresenceUnavailable</span><span class="signature"><span class="signature-params">()</span></span></h3>
<p>Marks the client as unavailable</p>
<dl class="dl-compact">
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="sendSeen"><span class="symbol-name">sendSeen</span><span class="signature"><span class="signature-params">(chatId)</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing boolean</span></span></h3> <h3 id="sendSeen"><span class="symbol-name">sendSeen</span><span class="signature"><span class="signature-params">(chatId)</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing boolean</span></span></h3>
<p>Mark as seen for the Chat</p> <p>Mark as seen for the Chat</p>
<section> <section>
@@ -1478,12 +1470,13 @@
<dl class="dl-compact"> <dl class="dl-compact">
<dt>Returns</dt> <dt>Returns</dt>
<dd> <dd>
<p><code>Promise containing boolean</code> <p>result</p> <p><code>Promise containing boolean</code> 
<p>result</p>
</p> </p>
</dd> </dd>
</dl> </dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div> <div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="setDisplayName"><span class="symbol-name">setDisplayName</span><span class="signature"><span class="signature-params">(displayName)</span></span></h3> <h3 id="setDisplayName"><span class="symbol-name">setDisplayName</span><span class="signature"><span class="signature-params">(displayName)</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing Boolean</span></span></h3>
<p>Sets the current user's display name. <p>Sets the current user's display name.
This is the name shown to WhatsApp users that have not added you as a contact beside your number in groups and in your profile.</p> This is the name shown to WhatsApp users that have not added you as a contact beside your number in groups and in your profile.</p>
<section> <section>
@@ -1516,6 +1509,10 @@
</table> </table>
</section> </section>
<dl class="dl-compact"> <dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code>Promise containing Boolean</code> </p>
</dd>
</dl> </dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div> <div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="setStatus"><span class="symbol-name">setStatus</span><span class="signature"><span class="signature-params">(status)</span></span></h3> <h3 id="setStatus"><span class="symbol-name">setStatus</span><span class="signature"><span class="signature-params">(status)</span></span></h3>
@@ -1600,7 +1597,8 @@
<dl class="dl-compact"> <dl class="dl-compact">
<dt>Returns</dt> <dt>Returns</dt>
<dd> <dd>
<p><code>Promise containing boolean</code> <p>New pin state</p> <p><code>Promise containing boolean</code> 
<p>New pin state</p>
</p> </p>
</dd> </dd>
</dl> </dl>
@@ -1641,104 +1639,10 @@
</dl> </dl>
<h3 id="event:authenticated"><span class="symbol-name">authenticated</span></h3> <h3 id="event:authenticated"><span class="symbol-name">authenticated</span></h3>
<p>Emitted when authentication is successful</p> <p>Emitted when authentication is successful</p>
<section>
<h4>Parameters</h4>
<table class="jsdoc-details-table">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Optional</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<p>session</p>
</td>
<td>
<p>object</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Object containing session information. Can be used to restore the session.</p>
<p>Values in <code>session</code> have the following properties:</p>
<table class="jsdoc-details-table">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Optional</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<p>WABrowserId</p>
</td>
<td>
<p>string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>WASecretBundle</p>
</td>
<td>
<p>string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>WAToken1</p>
</td>
<td>
<p>string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>WAToken2</p>
</td>
<td>
<p>string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact"> <dl class="dl-compact">
</dl> </dl>
<h3 id="event:change_battery"><span class="symbol-name">change_battery</span></h3> <h3 id="event:change_battery"><span class="symbol-name">change_battery</span></h3>
<p>Emitted when the battery percentage for the attached device changes</p> <p>Emitted when the battery percentage for the attached device changes. Will not be sent if using multi-device.</p>
<section> <section>
<h4>Parameters</h4> <h4>Parameters</h4>
<table class="jsdoc-details-table"> <table class="jsdoc-details-table">
@@ -1809,6 +1713,8 @@
</table> </table>
</section> </section>
<dl class="dl-compact"> <dl class="dl-compact">
<dt>Deprecated</dt>
<dd></dd>
</dl> </dl>
<h3 id="event:change_state"><span class="symbol-name">change_state</span></h3> <h3 id="event:change_state"><span class="symbol-name">change_state</span></h3>
<p>Emitted when the connection state changes</p> <p>Emitted when the connection state changes</p>
@@ -2278,6 +2184,179 @@
</section> </section>
<dl class="dl-compact"> <dl class="dl-compact">
</dl> </dl>
<h3 id="event:message_reaction"><span class="symbol-name">message_reaction</span></h3>
<p>Emitted when a reaction is sent, received, updated or removed</p>
<section>
<h4>Parameters</h4>
<table class="jsdoc-details-table">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Optional</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<p>reaction</p>
</td>
<td>
<p>object</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Values in <code>reaction</code> have the following properties:</p>
<table class="jsdoc-details-table">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Optional</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<p>id</p>
</td>
<td>
<p>object</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Reaction id</p>
</td>
</tr>
<tr>
<td>
<p>orphan</p>
</td>
<td>
<p>number</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Orphan</p>
</td>
</tr>
<tr>
<td>
<p>orphanReason</p>
</td>
<td>
<p>string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Orphan reason</p>
<p>Value can be null.</p>
</td>
</tr>
<tr>
<td>
<p>timestamp</p>
</td>
<td>
<p>number</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Timestamp</p>
</td>
</tr>
<tr>
<td>
<p>reaction</p>
</td>
<td>
<p>string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Reaction</p>
</td>
</tr>
<tr>
<td>
<p>read</p>
</td>
<td>
<p>boolean</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Read</p>
</td>
</tr>
<tr>
<td>
<p>msgId</p>
</td>
<td>
<p>object</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Parent message id</p>
</td>
</tr>
<tr>
<td>
<p>senderId</p>
</td>
<td>
<p>string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Sender id</p>
</td>
</tr>
<tr>
<td>
<p>ack</p>
</td>
<td>
<p>number</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Ack</p>
<p>Value can be null.</p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
</dl>
<h3 id="event:message_revoke_everyone"><span class="symbol-name">message_revoke_everyone</span></h3> <h3 id="event:message_revoke_everyone"><span class="symbol-name">message_revoke_everyone</span></h3>
<p>Emitted when a message is deleted for everyone in the chat.</p> <p>Emitted when a message is deleted for everyone in the chat.</p>
<section> <section>
@@ -2361,7 +2440,7 @@
<dl class="dl-compact"> <dl class="dl-compact">
</dl> </dl>
<h3 id="event:qr"><span class="symbol-name">qr</span></h3> <h3 id="event:qr"><span class="symbol-name">qr</span></h3>
<p>Emitted when the QR code is received</p> <p>Emitted when a QR code is received</p>
<section> <section>
<h4>Parameter</h4> <h4>Parameter</h4>
<table class="jsdoc-details-table"> <table class="jsdoc-details-table">
@@ -2407,7 +2486,7 @@
<footer id="jsdoc-footer" class="jsdoc-footer"> <footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container"> <div id="jsdoc-footer-container">
<p> <p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on December 7, 2021. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -4,7 +4,7 @@
<head> <head>
<meta name="generator" content="JSDoc 3.6.7"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.15.3 &raquo; Source: Client.js</title> <title>whatsapp-web.js 1.19.5 &raquo; Source: Client.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar"> <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container"> <div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content"> <div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -34,7 +34,6 @@
const EventEmitter &#x3D; require(&#x27;events&#x27;); const EventEmitter &#x3D; require(&#x27;events&#x27;);
const puppeteer &#x3D; require(&#x27;puppeteer&#x27;); const puppeteer &#x3D; require(&#x27;puppeteer&#x27;);
const moduleRaid &#x3D; require(&#x27;@pedroslopez/moduleraid/moduleraid&#x27;); const moduleRaid &#x3D; require(&#x27;@pedroslopez/moduleraid/moduleraid&#x27;);
const jsQR &#x3D; require(&#x27;jsqr&#x27;);
const Util &#x3D; require(&#x27;./util/Util&#x27;); const Util &#x3D; require(&#x27;./util/Util&#x27;);
const InterfaceController &#x3D; require(&#x27;./util/InterfaceController&#x27;); const InterfaceController &#x3D; require(&#x27;./util/InterfaceController&#x27;);
@@ -42,22 +41,20 @@ const { WhatsWebURL, DefaultOptions, Events, WAState } &#x3D; require(&#x27;./ut
const { ExposeStore, LoadUtils } &#x3D; require(&#x27;./util/Injected&#x27;); const { ExposeStore, LoadUtils } &#x3D; require(&#x27;./util/Injected&#x27;);
const ChatFactory &#x3D; require(&#x27;./factories/ChatFactory&#x27;); const ChatFactory &#x3D; require(&#x27;./factories/ChatFactory&#x27;);
const ContactFactory &#x3D; require(&#x27;./factories/ContactFactory&#x27;); const ContactFactory &#x3D; require(&#x27;./factories/ContactFactory&#x27;);
const { ClientInfo, Message, MessageMedia, Contact, Location, GroupNotification , Label, Call, Buttons, List} &#x3D; require(&#x27;./structures&#x27;); const { ClientInfo, Message, MessageMedia, Contact, Location, GroupNotification, Label, Call, Buttons, List, Reaction } &#x3D; require(&#x27;./structures&#x27;);
const LegacySessionAuth &#x3D; require(&#x27;./authStrategies/LegacySessionAuth&#x27;);
const NoAuth &#x3D; require(&#x27;./authStrategies/NoAuth&#x27;);
/** /**
* Starting point for interacting with the WhatsApp Web API * Starting point for interacting with the WhatsApp Web API
* @extends {EventEmitter} * @extends {EventEmitter}
* @param {object} options - Client options * @param {object} options - Client options
* @param {AuthStrategy} options.authStrategy - Determines how to save and restore sessions. Will use LegacySessionAuth if options.session is set. Otherwise, NoAuth will be used.
* @param {number} options.authTimeoutMs - Timeout for authentication selector in puppeteer * @param {number} options.authTimeoutMs - Timeout for authentication selector in puppeteer
* @param {object} options.puppeteer - Puppeteer launch options. View docs here: https://github.com/puppeteer/puppeteer/ * @param {object} options.puppeteer - Puppeteer launch options. View docs here: https://github.com/puppeteer/puppeteer/
* @param {number} options.qrRefreshIntervalMs - Refresh interval for qr code (how much time to wait before checking if the qr code has changed)
* @param {number} options.qrTimeoutMs - Timeout for qr code selector in puppeteer
* @param {number} options.qrMaxRetries - How many times should the qrcode be refreshed before giving up * @param {number} options.qrMaxRetries - How many times should the qrcode be refreshed before giving up
* @param {string} options.restartOnAuthFail - Restart client with a new session (i.e. use null &#x27;session&#x27; var) if authentication fails * @param {string} options.restartOnAuthFail - @deprecated This option should be set directly on the LegacySessionAuth.
* @param {object} options.session - Whatsapp session to restore. If not set, will start a new session * @param {object} options.session - @deprecated Only here for backwards-compatibility. You should move to using LocalAuth, or set the authStrategy to LegacySessionAuth explicitly.
* @param {string} options.session.WABrowserId
* @param {string} options.session.WASecretBundle
* @param {string} options.session.WAToken1
* @param {string} options.session.WAToken2
* @param {number} options.takeoverOnConflict - If another whatsapp web session is detected (another browser), take over the session in the current browser * @param {number} options.takeoverOnConflict - If another whatsapp web session is detected (another browser), take over the session in the current browser
* @param {number} options.takeoverTimeoutMs - How much time to wait before taking over the session * @param {number} options.takeoverTimeoutMs - How much time to wait before taking over the session
* @param {string} options.userAgent - User agent to use in puppeteer * @param {string} options.userAgent - User agent to use in puppeteer
@@ -79,13 +76,33 @@ const { ClientInfo, Message, MessageMedia, Contact, Location, GroupNotification
* @fires Client#group_update * @fires Client#group_update
* @fires Client#disconnected * @fires Client#disconnected
* @fires Client#change_state * @fires Client#change_state
* @fires Client#change_battery
*/ */
class Client extends EventEmitter { class Client extends EventEmitter {
constructor(options &#x3D; {}) { constructor(options &#x3D; {}) {
super(); super();
this.options &#x3D; Util.mergeDefault(DefaultOptions, options); this.options &#x3D; Util.mergeDefault(DefaultOptions, options);
if(!this.options.authStrategy) {
if(Object.prototype.hasOwnProperty.call(this.options, &#x27;session&#x27;)) {
process.emitWarning(
&#x27;options.session is deprecated and will be removed in a future release due to incompatibility with multi-device. &#x27; +
&#x27;Use the LocalAuth authStrategy, don\&#x27;t pass in a session as an option, or suppress this warning by using the LegacySessionAuth strategy explicitly (see https://wwebjs.dev/guide/authentication.html#legacysessionauth-strategy).&#x27;,
&#x27;DeprecationWarning&#x27;
);
this.authStrategy &#x3D; new LegacySessionAuth({
session: this.options.session,
restartOnAuthFail: this.options.restartOnAuthFail
});
} else {
this.authStrategy &#x3D; new NoAuth();
}
} else {
this.authStrategy &#x3D; this.options.authStrategy;
}
this.authStrategy.setup(this);
this.pupBrowser &#x3D; null; this.pupBrowser &#x3D; null;
this.pupPage &#x3D; null; this.pupPage &#x3D; null;
@@ -98,90 +115,131 @@ class Client extends EventEmitter {
*/ */
async initialize() { async initialize() {
let [browser, page] &#x3D; [null, null]; let [browser, page] &#x3D; [null, null];
if(this.options.puppeteer &amp;amp;&amp;amp; this.options.puppeteer.browserWSEndpoint) { await this.authStrategy.beforeBrowserInitialized();
browser &#x3D; await puppeteer.connect(this.options.puppeteer);
const puppeteerOpts &#x3D; this.options.puppeteer;
if (puppeteerOpts &amp;amp;&amp;amp; puppeteerOpts.browserWSEndpoint) {
browser &#x3D; await puppeteer.connect(puppeteerOpts);
page &#x3D; await browser.newPage(); page &#x3D; await browser.newPage();
} else { } else {
browser &#x3D; await puppeteer.launch(this.options.puppeteer); const browserArgs &#x3D; [...(puppeteerOpts.args || [])];
if(!browserArgs.find(arg &#x3D;&gt; arg.includes(&#x27;--user-agent&#x27;))) {
browserArgs.push(&#x60;--user-agent&#x3D;${this.options.userAgent}&#x60;);
}
browser &#x3D; await puppeteer.launch({...puppeteerOpts, args: browserArgs});
page &#x3D; (await browser.pages())[0]; page &#x3D; (await browser.pages())[0];
} }
page.setUserAgent(this.options.userAgent); await page.setUserAgent(this.options.userAgent);
if (this.options.bypassCSP) await page.setBypassCSP(true);
this.pupBrowser &#x3D; browser; this.pupBrowser &#x3D; browser;
this.pupPage &#x3D; page; this.pupPage &#x3D; page;
if (this.options.session) { await this.authStrategy.afterBrowserInitialized();
await page.evaluateOnNewDocument(
session &#x3D;&gt; {
localStorage.clear();
localStorage.setItem(&#x27;WABrowserId&#x27;, session.WABrowserId);
localStorage.setItem(&#x27;WASecretBundle&#x27;, session.WASecretBundle);
localStorage.setItem(&#x27;WAToken1&#x27;, session.WAToken1);
localStorage.setItem(&#x27;WAToken2&#x27;, session.WAToken2);
}, this.options.session);
}
if(this.options.bypassCSP) {
await page.setBypassCSP(true);
}
await page.goto(WhatsWebURL, { await page.goto(WhatsWebURL, {
waitUntil: &#x27;load&#x27;, waitUntil: &#x27;load&#x27;,
timeout: 0, timeout: 0,
referer: &#x27;https://whatsapp.com/&#x27;
}); });
const KEEP_PHONE_CONNECTED_IMG_SELECTOR &#x3D; &#x27;[data-icon&#x3D;&quot;intro-md-beta-logo-dark&quot;], [data-icon&#x3D;&quot;intro-md-beta-logo-light&quot;], [data-asset-intro-image-light&#x3D;&quot;true&quot;], [data-asset-intro-image-dark&#x3D;&quot;true&quot;]&#x27;; await page.evaluate(&#x60;function getElementByXpath(path) {
return document.evaluate(path, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
}&#x60;);
if (this.options.session) { let lastPercent &#x3D; null,
// Check if session restore was successfull lastPercentMessage &#x3D; null;
try {
await page.waitForSelector(KEEP_PHONE_CONNECTED_IMG_SELECTOR, { timeout: this.options.authTimeoutMs }); await page.exposeFunction(&#x27;loadingScreen&#x27;, async (percent, message) &#x3D;&gt; {
} catch (err) { if (lastPercent !&#x3D;&#x3D; percent || lastPercentMessage !&#x3D;&#x3D; message) {
if (err.name &#x3D;&#x3D;&#x3D; &#x27;TimeoutError&#x27;) { this.emit(Events.LOADING_SCREEN, percent, message);
/** lastPercent &#x3D; percent;
* Emitted when there has been an error while trying to restore an existing session lastPercentMessage &#x3D; message;
* @event Client#auth_failure }
* @param {string} message });
*/
this.emit(Events.AUTHENTICATION_FAILURE, &#x27;Unable to log in. Are the session details valid?&#x27;); await page.evaluate(
browser.close(); async function (selectors) {
if (this.options.restartOnAuthFail) { var observer &#x3D; new MutationObserver(function () {
// session restore failed so try again but without session to force new authentication let progressBar &#x3D; window.getElementByXpath(
this.options.session &#x3D; null; selectors.PROGRESS
this.initialize(); );
let progressMessage &#x3D; window.getElementByXpath(
selectors.PROGRESS_MESSAGE
);
if (progressBar) {
window.loadingScreen(
progressBar.value,
progressMessage.innerText
);
} }
return; });
}
throw err; observer.observe(document, {
attributes: true,
childList: true,
characterData: true,
subtree: true,
});
},
{
PROGRESS: &#x27;//*[@id&#x3D;\&#x27;app\&#x27;]/div/div/div[2]/progress&#x27;,
PROGRESS_MESSAGE: &#x27;//*[@id&#x3D;\&#x27;app\&#x27;]/div/div/div[3]&#x27;,
}
);
const INTRO_IMG_SELECTOR &#x3D; &#x27;[data-testid&#x3D;&quot;intro-md-beta-logo-dark&quot;], [data-testid&#x3D;&quot;intro-md-beta-logo-light&quot;], [data-asset-intro-image-light&#x3D;&quot;true&quot;], [data-asset-intro-image-dark&#x3D;&quot;true&quot;]&#x27;;
const INTRO_QRCODE_SELECTOR &#x3D; &#x27;div[data-ref] canvas&#x27;;
// Checks which selector appears first
const needAuthentication &#x3D; await Promise.race([
new Promise(resolve &#x3D;&gt; {
page.waitForSelector(INTRO_IMG_SELECTOR, { timeout: this.options.authTimeoutMs })
.then(() &#x3D;&gt; resolve(false))
.catch((err) &#x3D;&gt; resolve(err));
}),
new Promise(resolve &#x3D;&gt; {
page.waitForSelector(INTRO_QRCODE_SELECTOR, { timeout: this.options.authTimeoutMs })
.then(() &#x3D;&gt; resolve(true))
.catch((err) &#x3D;&gt; resolve(err));
})
]);
// Checks if an error occurred on the first found selector. The second will be discarded and ignored by .race;
if (needAuthentication instanceof Error) throw needAuthentication;
// Scan-qrcode selector was found. Needs authentication
if (needAuthentication) {
const { failed, failureEventPayload, restart } &#x3D; await this.authStrategy.onAuthenticationNeeded();
if(failed) {
/**
* Emitted when there has been an error while trying to restore an existing session
* @event Client#auth_failure
* @param {string} message
*/
this.emit(Events.AUTHENTICATION_FAILURE, failureEventPayload);
await this.destroy();
if (restart) {
// session restore failed so try again but without session to force new authentication
return this.initialize();
}
return;
} }
} else { const QR_CONTAINER &#x3D; &#x27;div[data-ref]&#x27;;
const QR_RETRY_BUTTON &#x3D; &#x27;div[data-ref] &gt; span &gt; button&#x27;;
let qrRetries &#x3D; 0; let qrRetries &#x3D; 0;
await page.exposeFunction(&#x27;qrChanged&#x27;, async (qr) &#x3D;&gt; {
const getQrCode &#x3D; async () &#x3D;&gt; {
// Check if retry button is present
var QR_RETRY_SELECTOR &#x3D; &#x27;div[data-ref] &gt; span &gt; button&#x27;;
var qrRetry &#x3D; await page.$(QR_RETRY_SELECTOR);
if (qrRetry) {
await qrRetry.click();
}
// Wait for QR Code
const QR_CANVAS_SELECTOR &#x3D; &#x27;canvas&#x27;;
await page.waitForSelector(QR_CANVAS_SELECTOR, { timeout: this.options.qrTimeoutMs });
const qrImgData &#x3D; await page.$eval(QR_CANVAS_SELECTOR, canvas &#x3D;&gt; [].slice.call(canvas.getContext(&#x27;2d&#x27;).getImageData(0, 0, 264, 264).data));
const qr &#x3D; jsQR(qrImgData, 264, 264).data;
/** /**
* Emitted when the QR code is received * Emitted when a QR code is received
* @event Client#qr * @event Client#qr
* @param {string} qr QR Code * @param {string} qr QR Code
*/ */
this.emit(Events.QR_RECEIVED, qr); this.emit(Events.QR_RECEIVED, qr);
if (this.options.qrMaxRetries &gt; 0) { if (this.options.qrMaxRetries &gt; 0) {
qrRetries++; qrRetries++;
if (qrRetries &gt; this.options.qrMaxRetries) { if (qrRetries &gt; this.options.qrMaxRetries) {
@@ -189,53 +247,74 @@ class Client extends EventEmitter {
await this.destroy(); await this.destroy();
} }
} }
}; });
getQrCode();
this._qrRefreshInterval &#x3D; setInterval(getQrCode, this.options.qrRefreshIntervalMs); await page.evaluate(function (selectors) {
const qr_container &#x3D; document.querySelector(selectors.QR_CONTAINER);
window.qrChanged(qr_container.dataset.ref);
const obs &#x3D; new MutationObserver((muts) &#x3D;&gt; {
muts.forEach(mut &#x3D;&gt; {
// Listens to qr token change
if (mut.type &#x3D;&#x3D;&#x3D; &#x27;attributes&#x27; &amp;amp;&amp;amp; mut.attributeName &#x3D;&#x3D;&#x3D; &#x27;data-ref&#x27;) {
window.qrChanged(mut.target.dataset.ref);
} else
// Listens to retry button, when found, click it
if (mut.type &#x3D;&#x3D;&#x3D; &#x27;childList&#x27;) {
const retry_button &#x3D; document.querySelector(selectors.QR_RETRY_BUTTON);
if (retry_button) retry_button.click();
}
});
});
obs.observe(qr_container.parentElement, {
subtree: true,
childList: true,
attributes: true,
attributeFilter: [&#x27;data-ref&#x27;],
});
}, {
QR_CONTAINER,
QR_RETRY_BUTTON
});
// Wait for code scan // Wait for code scan
await page.waitForSelector(KEEP_PHONE_CONNECTED_IMG_SELECTOR, { timeout: 0 }); try {
clearInterval(this._qrRefreshInterval); await page.waitForSelector(INTRO_IMG_SELECTOR, { timeout: 0 });
this._qrRefreshInterval &#x3D; undefined; } catch(error) {
if (
error.name &#x3D;&#x3D;&#x3D; &#x27;ProtocolError&#x27; &amp;amp;&amp;amp;
error.message &amp;amp;&amp;amp;
error.message.match(/Target closed/)
) {
// something has called .destroy() while waiting
return;
}
throw error;
}
} }
await page.evaluate(ExposeStore, moduleRaid.toString()); await page.evaluate(ExposeStore, moduleRaid.toString());
const authEventPayload &#x3D; await this.authStrategy.getAuthEventPayload();
// Get session tokens
const localStorage &#x3D; JSON.parse(await page.evaluate(() &#x3D;&gt; {
return JSON.stringify(window.localStorage);
}));
const session &#x3D; {
WABrowserId: localStorage.WABrowserId,
WASecretBundle: localStorage.WASecretBundle,
WAToken1: localStorage.WAToken1,
WAToken2: localStorage.WAToken2
};
/** /**
* Emitted when authentication is successful * Emitted when authentication is successful
* @event Client#authenticated * @event Client#authenticated
* @param {object} session Object containing session information. Can be used to restore the session.
* @param {string} session.WABrowserId
* @param {string} session.WASecretBundle
* @param {string} session.WAToken1
* @param {string} session.WAToken2
*/ */
this.emit(Events.AUTHENTICATED, session); this.emit(Events.AUTHENTICATED, authEventPayload);
// Check window.Store Injection // Check window.Store Injection
await page.waitForFunction(&#x27;window.Store !&#x3D; undefined&#x27;); await page.waitForFunction(&#x27;window.Store !&#x3D; undefined&#x27;);
const isMD &#x3D; await page.evaluate(() &#x3D;&gt; { await page.evaluate(async () &#x3D;&gt; {
return window.Store.Features.features.MD_BACKEND; // safely unregister service workers
const registrations &#x3D; await navigator.serviceWorker.getRegistrations();
for (let registration of registrations) {
registration.unregister();
}
}); });
if(isMD) {
throw new Error(&#x27;Multi-device is not yet supported by whatsapp-web.js. Please check out https://github.com/pedroslopez/whatsapp-web.js/pull/889 to follow the progress.&#x27;);
}
//Load util functions (serializers, helper functions) //Load util functions (serializers, helper functions)
await page.evaluate(LoadUtils); await page.evaluate(LoadUtils);
@@ -245,7 +324,7 @@ class Client extends EventEmitter {
* @type {ClientInfo} * @type {ClientInfo}
*/ */
this.info &#x3D; new ClientInfo(this, await page.evaluate(() &#x3D;&gt; { this.info &#x3D; new ClientInfo(this, await page.evaluate(() &#x3D;&gt; {
return window.Store.Conn.serialize(); return { ...window.Store.Conn.serialize(), wid: window.Store.User.getMeUser() };
})); }));
// Add InterfaceController // Add InterfaceController
@@ -253,8 +332,6 @@ class Client extends EventEmitter {
// Register events // Register events
await page.exposeFunction(&#x27;onAddMessageEvent&#x27;, msg &#x3D;&gt; { await page.exposeFunction(&#x27;onAddMessageEvent&#x27;, msg &#x3D;&gt; {
if (!msg.isNewMsg) return;
if (msg.type &#x3D;&#x3D;&#x3D; &#x27;gp2&#x27;) { if (msg.type &#x3D;&#x3D;&#x3D; &#x27;gp2&#x27;) {
const notification &#x3D; new GroupNotification(this, msg); const notification &#x3D; new GroupNotification(this, msg);
if (msg.subtype &#x3D;&#x3D;&#x3D; &#x27;add&#x27; || msg.subtype &#x3D;&#x3D;&#x3D; &#x27;invite&#x27;) { if (msg.subtype &#x3D;&#x3D;&#x3D; &#x27;add&#x27; || msg.subtype &#x3D;&#x3D;&#x3D; &#x27;invite&#x27;) {
@@ -373,7 +450,7 @@ class Client extends EventEmitter {
this.emit(Events.MEDIA_UPLOADED, message); this.emit(Events.MEDIA_UPLOADED, message);
}); });
await page.exposeFunction(&#x27;onAppStateChangedEvent&#x27;, (state) &#x3D;&gt; { await page.exposeFunction(&#x27;onAppStateChangedEvent&#x27;, async (state) &#x3D;&gt; {
/** /**
* Emitted when the connection state changes * Emitted when the connection state changes
@@ -400,6 +477,7 @@ class Client extends EventEmitter {
* @event Client#disconnected * @event Client#disconnected
* @param {WAState|&quot;NAVIGATION&quot;} reason reason that caused the disconnect * @param {WAState|&quot;NAVIGATION&quot;} reason reason that caused the disconnect
*/ */
await this.authStrategy.disconnect();
this.emit(Events.DISCONNECTED, state); this.emit(Events.DISCONNECTED, state);
this.destroy(); this.destroy();
} }
@@ -411,11 +489,12 @@ class Client extends EventEmitter {
if (battery &#x3D;&#x3D;&#x3D; undefined) return; if (battery &#x3D;&#x3D;&#x3D; undefined) return;
/** /**
* Emitted when the battery percentage for the attached device changes * Emitted when the battery percentage for the attached device changes. Will not be sent if using multi-device.
* @event Client#change_battery * @event Client#change_battery
* @param {object} batteryInfo * @param {object} batteryInfo
* @param {number} batteryInfo.battery - The current battery percentage * @param {number} batteryInfo.battery - The current battery percentage
* @param {boolean} batteryInfo.plugged - Indicates if the phone is plugged in (true) or not (false) * @param {boolean} batteryInfo.plugged - Indicates if the phone is plugged in (true) or not (false)
* @deprecated
*/ */
this.emit(Events.BATTERY_CHANGED, { battery, plugged }); this.emit(Events.BATTERY_CHANGED, { battery, plugged });
}); });
@@ -434,20 +513,66 @@ class Client extends EventEmitter {
* @param {boolean} call.webClientShouldHandle - If Waweb should handle * @param {boolean} call.webClientShouldHandle - If Waweb should handle
* @param {object} call.participants - Participants * @param {object} call.participants - Participants
*/ */
const cll &#x3D; new Call(this,call); const cll &#x3D; new Call(this, call);
this.emit(Events.INCOMING_CALL, cll); this.emit(Events.INCOMING_CALL, cll);
}); });
await page.exposeFunction(&#x27;onReaction&#x27;, (reactions) &#x3D;&gt; {
for (const reaction of reactions) {
/**
* Emitted when a reaction is sent, received, updated or removed
* @event Client#message_reaction
* @param {object} reaction
* @param {object} reaction.id - Reaction id
* @param {number} reaction.orphan - Orphan
* @param {?string} reaction.orphanReason - Orphan reason
* @param {number} reaction.timestamp - Timestamp
* @param {string} reaction.reaction - Reaction
* @param {boolean} reaction.read - Read
* @param {object} reaction.msgId - Parent message id
* @param {string} reaction.senderId - Sender id
* @param {?number} reaction.ack - Ack
*/
this.emit(Events.MESSAGE_REACTION, new Reaction(this, reaction));
}
});
await page.evaluate(() &#x3D;&gt; { await page.evaluate(() &#x3D;&gt; {
window.Store.Msg.on(&#x27;add&#x27;, (msg) &#x3D;&gt; { if (msg.isNewMsg) window.onAddMessageEvent(window.WWebJS.getMessageModel(msg)); });
window.Store.Msg.on(&#x27;change&#x27;, (msg) &#x3D;&gt; { window.onChangeMessageEvent(window.WWebJS.getMessageModel(msg)); }); window.Store.Msg.on(&#x27;change&#x27;, (msg) &#x3D;&gt; { window.onChangeMessageEvent(window.WWebJS.getMessageModel(msg)); });
window.Store.Msg.on(&#x27;change:type&#x27;, (msg) &#x3D;&gt; { window.onChangeMessageTypeEvent(window.WWebJS.getMessageModel(msg)); }); window.Store.Msg.on(&#x27;change:type&#x27;, (msg) &#x3D;&gt; { window.onChangeMessageTypeEvent(window.WWebJS.getMessageModel(msg)); });
window.Store.Msg.on(&#x27;change:ack&#x27;, (msg,ack) &#x3D;&gt; { window.onMessageAckEvent(window.WWebJS.getMessageModel(msg), ack); }); window.Store.Msg.on(&#x27;change:ack&#x27;, (msg, ack) &#x3D;&gt; { window.onMessageAckEvent(window.WWebJS.getMessageModel(msg), ack); });
window.Store.Msg.on(&#x27;change:isUnsentMedia&#x27;, (msg, unsent) &#x3D;&gt; { if (msg.id.fromMe &amp;amp;&amp;amp; !unsent) window.onMessageMediaUploadedEvent(window.WWebJS.getMessageModel(msg)); }); window.Store.Msg.on(&#x27;change:isUnsentMedia&#x27;, (msg, unsent) &#x3D;&gt; { if (msg.id.fromMe &amp;amp;&amp;amp; !unsent) window.onMessageMediaUploadedEvent(window.WWebJS.getMessageModel(msg)); });
window.Store.Msg.on(&#x27;remove&#x27;, (msg) &#x3D;&gt; { if (msg.isNewMsg) window.onRemoveMessageEvent(window.WWebJS.getMessageModel(msg)); }); window.Store.Msg.on(&#x27;remove&#x27;, (msg) &#x3D;&gt; { if (msg.isNewMsg) window.onRemoveMessageEvent(window.WWebJS.getMessageModel(msg)); });
window.Store.AppState.on(&#x27;change:state&#x27;, (_AppState, state) &#x3D;&gt; { window.onAppStateChangedEvent(state); }); window.Store.AppState.on(&#x27;change:state&#x27;, (_AppState, state) &#x3D;&gt; { window.onAppStateChangedEvent(state); });
window.Store.Conn.on(&#x27;change:battery&#x27;, (state) &#x3D;&gt; { window.onBatteryStateChangedEvent(state); }); window.Store.Conn.on(&#x27;change:battery&#x27;, (state) &#x3D;&gt; { window.onBatteryStateChangedEvent(state); });
window.Store.Call.on(&#x27;add&#x27;, (call) &#x3D;&gt; { window.onIncomingCall(call); }); window.Store.Call.on(&#x27;add&#x27;, (call) &#x3D;&gt; { window.onIncomingCall(call); });
window.Store.Msg.on(&#x27;add&#x27;, (msg) &#x3D;&gt; {
if (msg.isNewMsg) {
if(msg.type &#x3D;&#x3D;&#x3D; &#x27;ciphertext&#x27;) {
// defer message event until ciphertext is resolved (type changed)
msg.once(&#x27;change:type&#x27;, (_msg) &#x3D;&gt; window.onAddMessageEvent(window.WWebJS.getMessageModel(_msg)));
} else {
window.onAddMessageEvent(window.WWebJS.getMessageModel(msg));
}
}
});
{
const module &#x3D; window.Store.createOrUpdateReactionsModule;
const ogMethod &#x3D; module.createOrUpdateReactions;
module.createOrUpdateReactions &#x3D; ((...args) &#x3D;&gt; {
window.onReaction(args[0].map(reaction &#x3D;&gt; {
const msgKey &#x3D; window.Store.MsgKey.fromString(reaction.msgKey);
const parentMsgKey &#x3D; window.Store.MsgKey.fromString(reaction.parentMsgKey);
const timestamp &#x3D; reaction.timestamp / 1000;
return {...reaction, msgKey, parentMsgKey, timestamp };
}));
return ogMethod(...args);
}).bind(module);
}
}); });
/** /**
@@ -455,12 +580,16 @@ class Client extends EventEmitter {
* @event Client#ready * @event Client#ready
*/ */
this.emit(Events.READY); this.emit(Events.READY);
this.authStrategy.afterAuthReady();
// Disconnect when navigating away // Disconnect when navigating away when in PAIRING state (detect logout)
// Because WhatsApp Web now reloads when logging out from the device, this also covers that case
this.pupPage.on(&#x27;framenavigated&#x27;, async () &#x3D;&gt; { this.pupPage.on(&#x27;framenavigated&#x27;, async () &#x3D;&gt; {
this.emit(Events.DISCONNECTED, &#x27;NAVIGATION&#x27;); const appState &#x3D; await this.getState();
await this.destroy(); if(!appState || appState &#x3D;&#x3D;&#x3D; WAState.PAIRING) {
await this.authStrategy.disconnect();
this.emit(Events.DISCONNECTED, &#x27;NAVIGATION&#x27;);
await this.destroy();
}
}); });
} }
@@ -468,19 +597,19 @@ class Client extends EventEmitter {
* Closes the client * Closes the client
*/ */
async destroy() { async destroy() {
if (this._qrRefreshInterval) {
clearInterval(this._qrRefreshInterval);
}
await this.pupBrowser.close(); await this.pupBrowser.close();
await this.authStrategy.destroy();
} }
/** /**
* Logs out the client, closing the current session * Logs out the client, closing the current session
*/ */
async logout() { async logout() {
return await this.pupPage.evaluate(() &#x3D;&gt; { await this.pupPage.evaluate(() &#x3D;&gt; {
return window.Store.AppState.logout(); return window.Store.AppState.logout();
}); });
await this.authStrategy.logout();
} }
/** /**
@@ -510,7 +639,7 @@ class Client extends EventEmitter {
/** /**
* Message options. * Message options.
* @typedef {Object} MessageSendOptions * @typedef {Object} MessageSendOptions
* @property {boolean} [linkPreview&#x3D;true] - Show links preview * @property {boolean} [linkPreview&#x3D;true] - Show links preview. Has no effect on multi-device accounts.
* @property {boolean} [sendAudioAsVoice&#x3D;false] - Send audio as voice message * @property {boolean} [sendAudioAsVoice&#x3D;false] - Send audio as voice message
* @property {boolean} [sendVideoAsGif&#x3D;false] - Send video as gif * @property {boolean} [sendVideoAsGif&#x3D;false] - Send video as gif
* @property {boolean} [sendMediaAsSticker&#x3D;false] - Send media as a sticker * @property {boolean} [sendMediaAsSticker&#x3D;false] - Send media as a sticker
@@ -545,7 +674,7 @@ class Client extends EventEmitter {
quotedMessageId: options.quotedMessageId, quotedMessageId: options.quotedMessageId,
parseVCards: options.parseVCards &#x3D;&#x3D;&#x3D; false ? false : true, parseVCards: options.parseVCards &#x3D;&#x3D;&#x3D; false ? false : true,
mentionedJidList: Array.isArray(options.mentions) ? options.mentions.map(contact &#x3D;&gt; contact.id._serialized) : [], mentionedJidList: Array.isArray(options.mentions) ? options.mentions.map(contact &#x3D;&gt; contact.id._serialized) : [],
...options.extra extraOptions: options.extra
}; };
const sendSeen &#x3D; typeof options.sendSeen &#x3D;&#x3D;&#x3D; &#x27;undefined&#x27; ? true : options.sendSeen; const sendSeen &#x3D; typeof options.sendSeen &#x3D;&#x3D;&#x3D; &#x27;undefined&#x27; ? true : options.sendSeen;
@@ -560,34 +689,36 @@ class Client extends EventEmitter {
} else if (content instanceof Location) { } else if (content instanceof Location) {
internalOptions.location &#x3D; content; internalOptions.location &#x3D; content;
content &#x3D; &#x27;&#x27;; content &#x3D; &#x27;&#x27;;
} else if(content instanceof Contact) { } else if (content instanceof Contact) {
internalOptions.contactCard &#x3D; content.id._serialized; internalOptions.contactCard &#x3D; content.id._serialized;
content &#x3D; &#x27;&#x27;; content &#x3D; &#x27;&#x27;;
} else if(Array.isArray(content) &amp;amp;&amp;amp; content.length &gt; 0 &amp;amp;&amp;amp; content[0] instanceof Contact) { } else if (Array.isArray(content) &amp;amp;&amp;amp; content.length &gt; 0 &amp;amp;&amp;amp; content[0] instanceof Contact) {
internalOptions.contactCardList &#x3D; content.map(contact &#x3D;&gt; contact.id._serialized); internalOptions.contactCardList &#x3D; content.map(contact &#x3D;&gt; contact.id._serialized);
content &#x3D; &#x27;&#x27;; content &#x3D; &#x27;&#x27;;
} else if(content instanceof Buttons){ } else if (content instanceof Buttons) {
if(content.type !&#x3D;&#x3D; &#x27;chat&#x27;){internalOptions.attachment &#x3D; content.body;} if (content.type !&#x3D;&#x3D; &#x27;chat&#x27;) { internalOptions.attachment &#x3D; content.body; }
internalOptions.buttons &#x3D; content; internalOptions.buttons &#x3D; content;
content &#x3D; &#x27;&#x27;; content &#x3D; &#x27;&#x27;;
} else if(content instanceof List){ } else if (content instanceof List) {
internalOptions.list &#x3D; content; internalOptions.list &#x3D; content;
content &#x3D; &#x27;&#x27;; content &#x3D; &#x27;&#x27;;
} }
if (internalOptions.sendMediaAsSticker &amp;amp;&amp;amp; internalOptions.attachment) { if (internalOptions.sendMediaAsSticker &amp;amp;&amp;amp; internalOptions.attachment) {
internalOptions.attachment &#x3D; internalOptions.attachment &#x3D; await Util.formatToWebpSticker(
await Util.formatToWebpSticker(internalOptions.attachment, { internalOptions.attachment, {
name: options.stickerName, name: options.stickerName,
author: options.stickerAuthor, author: options.stickerAuthor,
categories: options.stickerCategories categories: options.stickerCategories
}); }, this.pupPage
);
} }
const newMessage &#x3D; await this.pupPage.evaluate(async (chatId, message, options, sendSeen) &#x3D;&gt; { const newMessage &#x3D; await this.pupPage.evaluate(async (chatId, message, options, sendSeen) &#x3D;&gt; {
const chatWid &#x3D; window.Store.WidFactory.createWid(chatId); const chatWid &#x3D; window.Store.WidFactory.createWid(chatId);
const chat &#x3D; await window.Store.Chat.find(chatWid); const chat &#x3D; await window.Store.Chat.find(chatWid);
if (sendSeen) { if (sendSeen) {
window.WWebJS.sendSeen(chatId); window.WWebJS.sendSeen(chatId);
} }
@@ -674,7 +805,7 @@ class Client extends EventEmitter {
*/ */
async getInviteInfo(inviteCode) { async getInviteInfo(inviteCode) {
return await this.pupPage.evaluate(inviteCode &#x3D;&gt; { return await this.pupPage.evaluate(inviteCode &#x3D;&gt; {
return window.Store.Wap.groupInviteInfo(inviteCode); return window.Store.InviteInfo.queryGroupInvite(inviteCode);
}, inviteCode); }, inviteCode);
} }
@@ -684,34 +815,34 @@ class Client extends EventEmitter {
* @returns {Promise&amp;lt;string&gt;} Id of the joined Chat * @returns {Promise&amp;lt;string&gt;} Id of the joined Chat
*/ */
async acceptInvite(inviteCode) { async acceptInvite(inviteCode) {
const chatId &#x3D; await this.pupPage.evaluate(async inviteCode &#x3D;&gt; { const res &#x3D; await this.pupPage.evaluate(async inviteCode &#x3D;&gt; {
return await window.Store.Invite.sendJoinGroupViaInvite(inviteCode); return await window.Store.Invite.joinGroupViaInvite(inviteCode);
}, inviteCode); }, inviteCode);
return chatId._serialized; return res.gid._serialized;
} }
/** /**
* Accepts a private invitation to join a group * Accepts a private invitation to join a group
* @param {object} inviteV4 Invite V4 Info * @param {object} inviteInfo Invite V4 Info
* @returns {Promise&amp;lt;Object&gt;} * @returns {Promise&amp;lt;Object&gt;}
*/ */
async acceptGroupV4Invite(inviteInfo) { async acceptGroupV4Invite(inviteInfo) {
if(!inviteInfo.inviteCode) throw &#x27;Invalid invite code, try passing the message.inviteV4 object&#x27;; if (!inviteInfo.inviteCode) throw &#x27;Invalid invite code, try passing the message.inviteV4 object&#x27;;
if (inviteInfo.inviteCodeExp &#x3D;&#x3D; 0) throw &#x27;Expired invite code&#x27;; if (inviteInfo.inviteCodeExp &#x3D;&#x3D; 0) throw &#x27;Expired invite code&#x27;;
return await this.pupPage.evaluate(async inviteInfo &#x3D;&gt; { return this.pupPage.evaluate(async inviteInfo &#x3D;&gt; {
let { groupId, fromId, inviteCode, inviteCodeExp, toId } &#x3D; inviteInfo; let { groupId, fromId, inviteCode, inviteCodeExp } &#x3D; inviteInfo;
return await window.Store.Wap.acceptGroupV4Invite(groupId, fromId, inviteCode, String(inviteCodeExp), toId); return await window.Store.JoinInviteV4.sendJoinGroupViaInviteV4(inviteCode, String(inviteCodeExp), groupId, fromId);
}, inviteInfo); }, inviteInfo);
} }
/** /**
* Sets the current user&#x27;s status message * Sets the current user&#x27;s status message
* @param {string} status New status message * @param {string} status New status message
*/ */
async setStatus(status) { async setStatus(status) {
await this.pupPage.evaluate(async status &#x3D;&gt; { await this.pupPage.evaluate(async status &#x3D;&gt; {
return await window.Store.Wap.sendSetStatus(status); return await window.Store.StatusUtils.setMyStatus(status);
}, status); }, status);
} }
@@ -719,19 +850,31 @@ class Client extends EventEmitter {
* Sets the current user&#x27;s display name. * Sets the current user&#x27;s display name.
* This is the name shown to WhatsApp users that have not added you as a contact beside your number in groups and in your profile. * This is the name shown to WhatsApp users that have not added you as a contact beside your number in groups and in your profile.
* @param {string} displayName New display name * @param {string} displayName New display name
* @returns {Promise&amp;lt;Boolean&gt;}
*/ */
async setDisplayName(displayName) { async setDisplayName(displayName) {
await this.pupPage.evaluate(async displayName &#x3D;&gt; { const couldSet &#x3D; await this.pupPage.evaluate(async displayName &#x3D;&gt; {
return await window.Store.Wap.setPushname(displayName); if(!window.Store.Conn.canSetMyPushname()) return false;
}, displayName);
}
if(window.Store.MDBackend) {
// TODO
return false;
} else {
const res &#x3D; await window.Store.Wap.setPushname(displayName);
return !res.status || res.status &#x3D;&#x3D;&#x3D; 200;
}
}, displayName);
return couldSet;
}
/** /**
* Gets the current connection state for the client * Gets the current connection state for the client
* @returns {WAState} * @returns {WAState}
*/ */
async getState() { async getState() {
return await this.pupPage.evaluate(() &#x3D;&gt; { return await this.pupPage.evaluate(() &#x3D;&gt; {
if(!window.Store) return null;
return window.Store.AppState.state; return window.Store.AppState.state;
}); });
} }
@@ -741,7 +884,16 @@ class Client extends EventEmitter {
*/ */
async sendPresenceAvailable() { async sendPresenceAvailable() {
return await this.pupPage.evaluate(() &#x3D;&gt; { return await this.pupPage.evaluate(() &#x3D;&gt; {
return window.Store.Wap.sendPresenceAvailable(); return window.Store.PresenceUtils.sendPresenceAvailable();
});
}
/**
* Marks the client as unavailable
*/
async sendPresenceUnavailable() {
return await this.pupPage.evaluate(() &#x3D;&gt; {
return window.Store.PresenceUtils.sendPresenceUnavailable();
}); });
} }
@@ -753,7 +905,7 @@ class Client extends EventEmitter {
return await this.pupPage.evaluate(async chatId &#x3D;&gt; { return await this.pupPage.evaluate(async chatId &#x3D;&gt; {
let chat &#x3D; await window.Store.Chat.get(chatId); let chat &#x3D; await window.Store.Chat.get(chatId);
await window.Store.Cmd.archiveChat(chat, true); await window.Store.Cmd.archiveChat(chat, true);
return chat.archive; return true;
}, chatId); }, chatId);
} }
@@ -765,7 +917,7 @@ class Client extends EventEmitter {
return await this.pupPage.evaluate(async chatId &#x3D;&gt; { return await this.pupPage.evaluate(async chatId &#x3D;&gt; {
let chat &#x3D; await window.Store.Chat.get(chatId); let chat &#x3D; await window.Store.Chat.get(chatId);
await window.Store.Cmd.archiveChat(chat, false); await window.Store.Cmd.archiveChat(chat, false);
return chat.archive; return false;
}, chatId); }, chatId);
} }
@@ -780,8 +932,9 @@ class Client extends EventEmitter {
return true; return true;
} }
const MAX_PIN_COUNT &#x3D; 3; const MAX_PIN_COUNT &#x3D; 3;
if (window.Store.Chat.models.length &gt; MAX_PIN_COUNT) { const chatModels &#x3D; window.Store.Chat.getModelsArray();
let maxPinned &#x3D; window.Store.Chat.models[MAX_PIN_COUNT - 1].pin; if (chatModels.length &gt; MAX_PIN_COUNT) {
let maxPinned &#x3D; chatModels[MAX_PIN_COUNT - 1].pin;
if (maxPinned) { if (maxPinned) {
return false; return false;
} }
@@ -815,7 +968,7 @@ class Client extends EventEmitter {
unmuteDate &#x3D; unmuteDate ? unmuteDate.getTime() / 1000 : -1; unmuteDate &#x3D; unmuteDate ? unmuteDate.getTime() / 1000 : -1;
await this.pupPage.evaluate(async (chatId, timestamp) &#x3D;&gt; { await this.pupPage.evaluate(async (chatId, timestamp) &#x3D;&gt; {
let chat &#x3D; await window.Store.Chat.get(chatId); let chat &#x3D; await window.Store.Chat.get(chatId);
await chat.mute.mute(timestamp, !0); await chat.mute.mute({expiration: timestamp, sendDevice:!0});
}, chatId, unmuteDate || -1); }, chatId, unmuteDate || -1);
} }
@@ -847,13 +1000,49 @@ class Client extends EventEmitter {
* @returns {Promise&amp;lt;string&gt;} * @returns {Promise&amp;lt;string&gt;}
*/ */
async getProfilePicUrl(contactId) { async getProfilePicUrl(contactId) {
const profilePic &#x3D; await this.pupPage.evaluate((contactId) &#x3D;&gt; { const profilePic &#x3D; await this.pupPage.evaluate(async contactId &#x3D;&gt; {
return window.Store.Wap.profilePicFind(contactId); try {
const chatWid &#x3D; window.Store.WidFactory.createWid(contactId);
return await window.Store.ProfilePic.profilePicFind(chatWid);
} catch (err) {
if(err.name &#x3D;&#x3D;&#x3D; &#x27;ServerStatusCodeError&#x27;) return undefined;
throw err;
}
}, contactId); }, contactId);
return profilePic ? profilePic.eurl : undefined; return profilePic ? profilePic.eurl : undefined;
} }
/**
* Gets the Contact&#x27;s common groups with you. Returns empty array if you don&#x27;t have any common group.
* @param {string} contactId the whatsapp user&#x27;s ID (_serialized format)
* @returns {Promise&amp;lt;WAWebJS.ChatId[]&gt;}
*/
async getCommonGroups(contactId) {
const commonGroups &#x3D; await this.pupPage.evaluate(async (contactId) &#x3D;&gt; {
let contact &#x3D; window.Store.Contact.get(contactId);
if (!contact) {
const wid &#x3D; window.Store.WidFactory.createUserWid(contactId);
const chatConstructor &#x3D; window.Store.Contact.getModelsArray().find(c&#x3D;&gt;!c.isGroup).constructor;
contact &#x3D; new chatConstructor({id: wid});
}
if (contact.commonGroups) {
return contact.commonGroups.serialize();
}
const status &#x3D; await window.Store.findCommonGroups(contact);
if (status) {
return contact.commonGroups.serialize();
}
return [];
}, contactId);
const chats &#x3D; [];
for (const group of commonGroups) {
chats.push(group.id);
}
return chats;
}
/** /**
* Force reset of connection state for the client * Force reset of connection state for the client
*/ */
@@ -869,10 +1058,7 @@ class Client extends EventEmitter {
* @returns {Promise&amp;lt;Boolean&gt;} * @returns {Promise&amp;lt;Boolean&gt;}
*/ */
async isRegisteredUser(id) { async isRegisteredUser(id) {
return await this.pupPage.evaluate(async (id) &#x3D;&gt; { return Boolean(await this.getNumberId(id));
let result &#x3D; await window.Store.Wap.queryExist(id);
return result.jid !&#x3D;&#x3D; undefined;
}, id);
} }
/** /**
@@ -882,14 +1068,16 @@ class Client extends EventEmitter {
* @returns {Promise&amp;lt;Object|null&gt;} * @returns {Promise&amp;lt;Object|null&gt;}
*/ */
async getNumberId(number) { async getNumberId(number) {
if (!number.endsWith(&#x27;@c.us&#x27;)) number +&#x3D; &#x27;@c.us&#x27;; if (!number.endsWith(&#x27;@c.us&#x27;)) {
try { number +&#x3D; &#x27;@c.us&#x27;;
return await this.pupPage.evaluate(async numberId &#x3D;&gt; {
return window.WWebJS.getNumberId(numberId);
}, number);
} catch(_) {
return null;
} }
return await this.pupPage.evaluate(async number &#x3D;&gt; {
const wid &#x3D; window.Store.WidFactory.createWid(number);
const result &#x3D; await window.Store.QueryExist(wid);
if (!result || result.wid &#x3D;&#x3D;&#x3D; undefined) return null;
return result.wid;
}, number);
} }
/** /**
@@ -898,14 +1086,14 @@ class Client extends EventEmitter {
* @returns {Promise&amp;lt;string&gt;} * @returns {Promise&amp;lt;string&gt;}
*/ */
async getFormattedNumber(number) { async getFormattedNumber(number) {
if(!number.endsWith(&#x27;@s.whatsapp.net&#x27;)) number &#x3D; number.replace(&#x27;c.us&#x27;, &#x27;s.whatsapp.net&#x27;); if (!number.endsWith(&#x27;@s.whatsapp.net&#x27;)) number &#x3D; number.replace(&#x27;c.us&#x27;, &#x27;s.whatsapp.net&#x27;);
if(!number.includes(&#x27;@s.whatsapp.net&#x27;)) number &#x3D; &#x60;${number}@s.whatsapp.net&#x60;; if (!number.includes(&#x27;@s.whatsapp.net&#x27;)) number &#x3D; &#x60;${number}@s.whatsapp.net&#x60;;
return await this.pupPage.evaluate(async numberId &#x3D;&gt; { return await this.pupPage.evaluate(async numberId &#x3D;&gt; {
return window.Store.NumberInfo.formattedPhoneNumber(numberId); return window.Store.NumberInfo.formattedPhoneNumber(numberId);
}, number); }, number);
} }
/** /**
* Get the country code of a WhatsApp ID. * Get the country code of a WhatsApp ID.
* @param {string} number Number or ID * @param {string} number Number or ID
@@ -918,7 +1106,7 @@ class Client extends EventEmitter {
return window.Store.NumberInfo.findCC(numberId); return window.Store.NumberInfo.findCC(numberId);
}, number); }, number);
} }
/** /**
* Create a new group * Create a new group
* @param {string} name group title * @param {string} name group title
@@ -937,23 +1125,18 @@ class Client extends EventEmitter {
} }
const createRes &#x3D; await this.pupPage.evaluate(async (name, participantIds) &#x3D;&gt; { const createRes &#x3D; await this.pupPage.evaluate(async (name, participantIds) &#x3D;&gt; {
const res &#x3D; await window.Store.Wap.createGroup(name, participantIds); const participantWIDs &#x3D; participantIds.map(p &#x3D;&gt; window.Store.WidFactory.createWid(p));
console.log(res); return await window.Store.GroupUtils.createGroup(name, participantWIDs, 0);
if (!res.status &#x3D;&#x3D;&#x3D; 200) {
throw &#x27;An error occurred while creating the group!&#x27;;
}
return res;
}, name, participants); }, name, participants);
const missingParticipants &#x3D; createRes.participants.reduce(((missing, c) &#x3D;&gt; { const missingParticipants &#x3D; createRes.participants.reduce(((missing, c) &#x3D;&gt; {
const id &#x3D; Object.keys(c)[0]; const id &#x3D; c.wid._serialized;
const statusCode &#x3D; c[id].code; const statusCode &#x3D; c.error ? c.error.toString() : &#x27;200&#x27;;
if (statusCode !&#x3D; 200) return Object.assign(missing, { [id]: statusCode }); if (statusCode !&#x3D; 200) return Object.assign(missing, { [id]: statusCode });
return missing; return missing;
}), {}); }), {});
return { gid: createRes.gid, missingParticipants }; return { gid: createRes.wid, missingParticipants };
} }
/** /**
@@ -963,9 +1146,9 @@ class Client extends EventEmitter {
async getLabels() { async getLabels() {
const labels &#x3D; await this.pupPage.evaluate(async () &#x3D;&gt; { const labels &#x3D; await this.pupPage.evaluate(async () &#x3D;&gt; {
return window.WWebJS.getLabels(); return window.WWebJS.getLabels();
}); });
return labels.map(data &#x3D;&gt; new Label(this , data)); return labels.map(data &#x3D;&gt; new Label(this, data));
} }
/** /**
@@ -976,7 +1159,7 @@ class Client extends EventEmitter {
async getLabelById(labelId) { async getLabelById(labelId) {
const label &#x3D; await this.pupPage.evaluate(async (labelId) &#x3D;&gt; { const label &#x3D; await this.pupPage.evaluate(async (labelId) &#x3D;&gt; {
return window.WWebJS.getLabel(labelId); return window.WWebJS.getLabel(labelId);
}, labelId); }, labelId);
return new Label(this, label); return new Label(this, label);
} }
@@ -986,12 +1169,12 @@ class Client extends EventEmitter {
* @param {string} chatId * @param {string} chatId
* @returns {Promise&amp;lt;Array&amp;lt;Label&gt;&gt;} * @returns {Promise&amp;lt;Array&amp;lt;Label&gt;&gt;}
*/ */
async getChatLabels(chatId){ async getChatLabels(chatId) {
const labels &#x3D; await this.pupPage.evaluate(async (chatId) &#x3D;&gt; { const labels &#x3D; await this.pupPage.evaluate(async (chatId) &#x3D;&gt; {
return window.WWebJS.getChatLabels(chatId); return window.WWebJS.getChatLabels(chatId);
}, chatId); }, chatId);
return labels.map(data &#x3D;&gt; new Label(this, data)); return labels.map(data &#x3D;&gt; new Label(this, data));
} }
/** /**
@@ -999,16 +1182,16 @@ class Client extends EventEmitter {
* @param {string} labelId * @param {string} labelId
* @returns {Promise&amp;lt;Array&amp;lt;Chat&gt;&gt;} * @returns {Promise&amp;lt;Array&amp;lt;Chat&gt;&gt;}
*/ */
async getChatsByLabelId(labelId){ async getChatsByLabelId(labelId) {
const chatIds &#x3D; await this.pupPage.evaluate(async (labelId) &#x3D;&gt; { const chatIds &#x3D; await this.pupPage.evaluate(async (labelId) &#x3D;&gt; {
const label &#x3D; window.Store.Label.get(labelId); const label &#x3D; window.Store.Label.get(labelId);
const labelItems &#x3D; label.labelItemCollection.models; const labelItems &#x3D; label.labelItemCollection.getModelsArray();
return labelItems.reduce((result, item) &#x3D;&gt; { return labelItems.reduce((result, item) &#x3D;&gt; {
if(item.parentType &#x3D;&#x3D;&#x3D; &#x27;Chat&#x27;){ if (item.parentType &#x3D;&#x3D;&#x3D; &#x27;Chat&#x27;) {
result.push(item.parentId); result.push(item.parentId);
} }
return result; return result;
},[]); }, []);
}, labelId); }, labelId);
return Promise.all(chatIds.map(id &#x3D;&gt; this.getChatById(id))); return Promise.all(chatIds.map(id &#x3D;&gt; this.getChatById(id)));
@@ -1020,8 +1203,8 @@ class Client extends EventEmitter {
*/ */
async getBlockedContacts() { async getBlockedContacts() {
const blockedContacts &#x3D; await this.pupPage.evaluate(() &#x3D;&gt; { const blockedContacts &#x3D; await this.pupPage.evaluate(() &#x3D;&gt; {
let chatIds &#x3D; window.Store.Blocklist.models.map(a &#x3D;&gt; a.id._serialized); let chatIds &#x3D; window.Store.Blocklist.getModelsArray().map(a &#x3D;&gt; a.id._serialized);
return Promise.all(chatIds.map(id &#x3D;&gt; window.WWebJS.getContact(id))); return Promise.all(chatIds.map(id &#x3D;&gt; window.WWebJS.getContact(id)));
}); });
return blockedContacts.map(contact &#x3D;&gt; ContactFactory.create(this.client, contact)); return blockedContacts.map(contact &#x3D;&gt; ContactFactory.create(this.client, contact));
@@ -1039,7 +1222,7 @@ module.exports &#x3D; Client;
<footer id="jsdoc-footer" class="jsdoc-footer"> <footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container"> <div id="jsdoc-footer-container">
<p> <p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on December 7, 2021. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -4,7 +4,7 @@
<head> <head>
<meta name="generator" content="JSDoc 3.6.7"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.15.3 &raquo; Class: ClientInfo</title> <title>whatsapp-web.js 1.19.5 &raquo; Class: ClientInfo</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar"> <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container"> <div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content"> <div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -101,7 +101,7 @@
</dl> </dl>
<h3 id="phone"><span class="symbol-name">phone</span><small class="property-type"> <h3 id="phone"><span class="symbol-name">phone</span><small class="property-type">
&nbsp;object</small></h3> &nbsp;object</small></h3>
<p>Information about the phone this client is connected to</p> <p>Information about the phone this client is connected to. Not available in multi-device.</p>
<section> <section>
<h4>Properties</h4> <h4>Properties</h4>
<table class="jsdoc-details-table"> <table class="jsdoc-details-table">
@@ -188,10 +188,12 @@
</table> </table>
</section> </section>
<dl class="dl-compact"> <dl class="dl-compact">
<dt>Deprecated</dt>
<dd></dd>
</dl> </dl>
<h3 id="platform"><span class="symbol-name">platform</span><small class="property-type"> <h3 id="platform"><span class="symbol-name">platform</span><small class="property-type">
&nbsp;string</small></h3> &nbsp;string</small></h3>
<p>Platform the phone is running on</p> <p>Platform WhatsApp is running on</p>
<dl class="dl-compact"> <dl class="dl-compact">
</dl> </dl>
<h3 id="pushname"><span class="symbol-name">pushname</span><small class="property-type"> <h3 id="pushname"><span class="symbol-name">pushname</span><small class="property-type">
@@ -211,17 +213,22 @@
<h3 id="getBatteryStatus"><span class="symbol-name">getBatteryStatus</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> (object, number, or boolean)</span></span></h3> <h3 id="getBatteryStatus"><span class="symbol-name">getBatteryStatus</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> (object, number, or boolean)</span></span></h3>
<p>Get current battery percentage and charging status for the attached device</p> <p>Get current battery percentage and charging status for the attached device</p>
<dl class="dl-compact"> <dl class="dl-compact">
<dt>Deprecated</dt>
<dd></dd>
<dt>Returns</dt> <dt>Returns</dt>
<dd> <dd>
<p><code>object</code> <p>batteryStatus</p> <p><code>object</code> 
<p>batteryStatus</p>
</p> </p>
</dd> </dd>
<dd> <dd>
<p><code>number</code> <p>batteryStatus.battery - The current battery percentage</p> <p><code>number</code> 
<p>batteryStatus.battery - The current battery percentage</p>
</p> </p>
</dd> </dd>
<dd> <dd>
<p><code>boolean</code> <p>batteryStatus.plugged - Indicates if the phone is plugged in (true) or not (false)</p> <p><code>boolean</code> 
<p>batteryStatus.plugged - Indicates if the phone is plugged in (true) or not (false)</p>
</p> </p>
</dd> </dd>
</dl> </dl>
@@ -235,7 +242,7 @@
<footer id="jsdoc-footer" class="jsdoc-footer"> <footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container"> <div id="jsdoc-footer-container">
<p> <p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on December 7, 2021. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -4,7 +4,7 @@
<head> <head>
<meta name="generator" content="JSDoc 3.6.7"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.15.3 &raquo; Class: Contact</title> <title>whatsapp-web.js 1.19.5 &raquo; Class: Contact</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar"> <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container"> <div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content"> <div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -108,19 +108,22 @@
</div> </div>
<div class="summary-column"> <div class="summary-column">
<dl class="dl-summary-callout"> <dl class="dl-summary-callout">
<dt><a href="Contact.html#getCommonGroups">getCommonGroups()</a></dt>
<dd>
</dd>
<dt><a href="Contact.html#getCountryCode">getCountryCode()</a></dt> <dt><a href="Contact.html#getCountryCode">getCountryCode()</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Contact.html#getFormattedNumber">getFormattedNumber()</a></dt> <dt><a href="Contact.html#getFormattedNumber">getFormattedNumber()</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Contact.html#getProfilePicUrl">getProfilePicUrl()</a></dt>
<dd>
</dd>
</dl> </dl>
</div> </div>
<div class="summary-column"> <div class="summary-column">
<dl class="dl-summary-callout"> <dl class="dl-summary-callout">
<dt><a href="Contact.html#getProfilePicUrl">getProfilePicUrl()</a></dt>
<dd>
</dd>
<dt><a href="Contact.html#unblock">unblock()</a></dt> <dt><a href="Contact.html#unblock">unblock()</a></dt>
<dd> <dd>
</dd> </dd>
@@ -236,6 +239,15 @@
</dd> </dd>
</dl> </dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div> <div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="getCommonGroups"><span class="symbol-name">getCommonGroups</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing Array of WAWebJS.ChatId</span></span></h3>
<p>Gets the Contact's common groups with you. Returns empty array if you don't have any common group.</p>
<dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code>Promise containing Array of WAWebJS.ChatId</code> </p>
</dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="getCountryCode"><span class="symbol-name">getCountryCode</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing string</span></span></h3> <h3 id="getCountryCode"><span class="symbol-name">getCountryCode</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing string</span></span></h3>
<p>Returns the contact's countrycode, (1541859685@c.us) =&gt; (1)</p> <p>Returns the contact's countrycode, (1541859685@c.us) =&gt; (1)</p>
<dl class="dl-compact"> <dl class="dl-compact">
@@ -281,7 +293,7 @@
<footer id="jsdoc-footer" class="jsdoc-footer"> <footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container"> <div id="jsdoc-footer-container">
<p> <p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on December 7, 2021. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -4,7 +4,7 @@
<head> <head>
<meta name="generator" content="JSDoc 3.6.7"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.15.3 &raquo; Class: GroupChat</title> <title>whatsapp-web.js 1.19.5 &raquo; Class: GroupChat</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar"> <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container"> <div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content"> <div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -405,7 +405,8 @@
<dl class="dl-compact"> <dl class="dl-compact">
<dt>Returns</dt> <dt>Returns</dt>
<dd> <dd>
<p><code>Promise containing {status: number}</code> <p>Object with status code indicating if the operation was successful</p> <p><code>Promise containing {status: number}</code> 
<p>Object with status code indicating if the operation was successful</p>
</p> </p>
</dd> </dd>
</dl> </dl>
@@ -435,7 +436,7 @@
<p>&nbsp;</p> <p>&nbsp;</p>
</td> </td>
<td> <td>
<p>Options for searching messages. Right now only limit is supported.</p> <p>Options for searching messages. Right now only limit and fromMe is supported.</p>
<p>Values in <code>searchOptions</code> have the following properties:</p> <p>Values in <code>searchOptions</code> have the following properties:</p>
<table class="jsdoc-details-table"> <table class="jsdoc-details-table">
<thead> <thead>
@@ -458,8 +459,21 @@
<p>Yes</p> <p>Yes</p>
</td> </td>
<td> <td>
<p>The amount of messages to return. Note that the actual number of returned messages may be smaller if there aren't enough messages in the conversation. Set this to Infinity to load all messages.</p> <p>The amount of messages to return. If no limit is specified, the available messages will be returned. Note that the actual number of returned messages may be smaller if there aren't enough messages in the conversation. Set this to Infinity to load all messages.</p>
<p>Defaults to <code>50</code>.</p> </td>
</tr>
<tr>
<td>
<p>fromMe</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Yes</p>
</td>
<td>
<p>Return only messages from the bot number or vise versa. To get all messages, leave the option undefined.</p>
</td> </td>
</tr> </tr>
</tbody> </tbody>
@@ -490,7 +504,8 @@
<dl class="dl-compact"> <dl class="dl-compact">
<dt>Returns</dt> <dt>Returns</dt>
<dd> <dd>
<p><code>Promise containing string</code> <p>Group's invite code</p> <p><code>Promise containing string</code> 
<p>Group's invite code</p>
</p> </p>
</dd> </dd>
</dl> </dl>
@@ -601,7 +616,8 @@
<dl class="dl-compact"> <dl class="dl-compact">
<dt>Returns</dt> <dt>Returns</dt>
<dd> <dd>
<p><code>Promise containing {status: number}</code> <p>Object with status code indicating if the operation was successful</p> <p><code>Promise containing {status: number}</code> 
<p>Object with status code indicating if the operation was successful</p>
</p> </p>
</dd> </dd>
</dl> </dl>
@@ -643,12 +659,14 @@
</dd> </dd>
</dl> </dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div> <div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="revokeInvite"><span class="symbol-name">revokeInvite</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise</span></span></h3> <h3 id="revokeInvite"><span class="symbol-name">revokeInvite</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing string</span></span></h3>
<p>Invalidates the current group invite code and generates a new one</p> <p>Invalidates the current group invite code and generates a new one</p>
<dl class="dl-compact"> <dl class="dl-compact">
<dt>Returns</dt> <dt>Returns</dt>
<dd> <dd>
<p><code>Promise</code> </p> <p><code>Promise containing string</code> 
<p>New invite code</p>
</p>
</dd> </dd>
</dl> </dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div> <div class="symbol-detail-labels"><span class="label label-async">async</span></div>
@@ -729,7 +747,7 @@
<dd><a href="Chat.html#sendStateTyping">Chat#sendStateTyping</a></dd> <dd><a href="Chat.html#sendStateTyping">Chat#sendStateTyping</a></dd>
</dl> </dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div> <div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="setDescription"><span class="symbol-name">setDescription</span><span class="signature"><span class="signature-params">(description)</span>&nbsp;&rarr; <span class="signature-returns"> Promise</span></span></h3> <h3 id="setDescription"><span class="symbol-name">setDescription</span><span class="signature"><span class="signature-params">(description)</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing boolean</span></span></h3>
<p>Updates the group description</p> <p>Updates the group description</p>
<section> <section>
<h4>Parameter</h4> <h4>Parameter</h4>
@@ -762,7 +780,9 @@
<dl class="dl-compact"> <dl class="dl-compact">
<dt>Returns</dt> <dt>Returns</dt>
<dd> <dd>
<p><code>Promise</code> </p> <p><code>Promise containing boolean</code> 
<p>Returns true if the description was properly updated. This can return false if the user does not have the necessary permissions.</p>
</p>
</dd> </dd>
</dl> </dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div> <div class="symbol-detail-labels"><span class="label label-async">async</span></div>
@@ -801,7 +821,8 @@
<dl class="dl-compact"> <dl class="dl-compact">
<dt>Returns</dt> <dt>Returns</dt>
<dd> <dd>
<p><code>Promise containing boolean</code> <p>Returns true if the setting was properly updated. This can return false if the user does not have the necessary permissions.</p> <p><code>Promise containing boolean</code> 
<p>Returns true if the setting was properly updated. This can return false if the user does not have the necessary permissions.</p>
</p> </p>
</dd> </dd>
</dl> </dl>
@@ -841,12 +862,13 @@
<dl class="dl-compact"> <dl class="dl-compact">
<dt>Returns</dt> <dt>Returns</dt>
<dd> <dd>
<p><code>Promise containing boolean</code> <p>Returns true if the setting was properly updated. This can return false if the user does not have the necessary permissions.</p> <p><code>Promise containing boolean</code> 
<p>Returns true if the setting was properly updated. This can return false if the user does not have the necessary permissions.</p>
</p> </p>
</dd> </dd>
</dl> </dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div> <div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="setSubject"><span class="symbol-name">setSubject</span><span class="signature"><span class="signature-params">(subject)</span>&nbsp;&rarr; <span class="signature-returns"> Promise</span></span></h3> <h3 id="setSubject"><span class="symbol-name">setSubject</span><span class="signature"><span class="signature-params">(subject)</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing boolean</span></span></h3>
<p>Updates the group subject</p> <p>Updates the group subject</p>
<section> <section>
<h4>Parameter</h4> <h4>Parameter</h4>
@@ -879,7 +901,9 @@
<dl class="dl-compact"> <dl class="dl-compact">
<dt>Returns</dt> <dt>Returns</dt>
<dd> <dd>
<p><code>Promise</code> </p> <p><code>Promise containing boolean</code> 
<p>Returns true if the subject was properly updated. This can return false if the user does not have the necessary permissions.</p>
</p>
</dd> </dd>
</dl> </dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div> <div class="symbol-detail-labels"><span class="label label-async">async</span></div>
@@ -917,7 +941,7 @@
<footer id="jsdoc-footer" class="jsdoc-footer"> <footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container"> <div id="jsdoc-footer-container">
<p> <p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on December 7, 2021. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -4,7 +4,7 @@
<head> <head>
<meta name="generator" content="JSDoc 3.6.7"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.15.3 &raquo; Class: GroupNotification</title> <title>whatsapp-web.js 1.19.5 &raquo; Class: GroupNotification</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar"> <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container"> <div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content"> <div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -233,7 +233,7 @@
<footer id="jsdoc-footer" class="jsdoc-footer"> <footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container"> <div id="jsdoc-footer-container">
<p> <p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on December 7, 2021. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -4,7 +4,7 @@
<head> <head>
<meta name="generator" content="JSDoc 3.6.7"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.15.3 &raquo; Class: InterfaceController</title> <title>whatsapp-web.js 1.19.5 &raquo; Class: InterfaceController</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar"> <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container"> <div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content"> <div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -382,7 +382,7 @@
<footer id="jsdoc-footer" class="jsdoc-footer"> <footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container"> <div id="jsdoc-footer-container">
<p> <p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on December 7, 2021. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -4,7 +4,7 @@
<head> <head>
<meta name="generator" content="JSDoc 3.6.7"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.15.3 &raquo; Class: Label</title> <title>whatsapp-web.js 1.19.5 &raquo; Class: Label</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar"> <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container"> <div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content"> <div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -163,7 +163,7 @@
<footer id="jsdoc-footer" class="jsdoc-footer"> <footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container"> <div id="jsdoc-footer-container">
<p> <p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on December 7, 2021. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p> </p>
</div> </div>
</footer> </footer>

188
docs/LegacySessionAuth.html Normal file
View File

@@ -0,0 +1,188 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.19.5 &raquo; Class: LegacySessionAuth</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
<link href="css/baseline.css" rel="stylesheet">
</head>
<body onload="prettyPrint()">
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div>
</div>
</nav>
<div id="jsdoc-body-container">
<div id="jsdoc-content">
<div id="jsdoc-content-container">
<div id="jsdoc-main" role="main">
<header class="page-header">
<div class="symbol-detail-labels"><span class="label label-kind">class</span></div>
<h1><small></small><span class="symbol-name">LegacySessionAuth</span></h1>
<p class="source-link">Source: <a href="authStrategies_LegacySessionAuth.js.html#source-line-16">authStrategies/<wbr>LegacySessionAuth.<wbr>js:16</a></p>
<div class="symbol-classdesc">
<p>Legacy session auth strategy
Not compatible with multi-device accounts.</p>
</div>
<dl class="dl-compact">
</dl>
</header>
<section id="summary">
</section>
<section>
<h2 id="LegacySessionAuth">new&nbsp;<span class="symbol-name">LegacySessionAuth</span><span class="signature"><span class="signature-params">(options)</span></span></h2>
<section>
<h3>Parameters</h3>
<table class="jsdoc-details-table">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Optional</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<p>options</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>options</p>
<p>Values in <code>options</code> have the following properties:</p>
<table class="jsdoc-details-table">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Optional</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<p>restartOnAuthFail</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Restart client with a new session (i.e. use null 'session' var) if authentication fails</p>
</td>
</tr>
<tr>
<td>
<p>session</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Whatsapp session to restore. If not set, will start a new session</p>
</td>
</tr>
<tr>
<td>
<p>session.WABrowserId</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>session.WASecretBundle</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>session.WAToken1</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>session.WAToken2</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
</dl>
</section>
<section>
</section>
</div>
</div>
<nav id="jsdoc-toc-nav" role="navigation"></nav>
</div>
</div>
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p>
</div>
</footer>
<script src="scripts/jquery.min.js"></script>
<script src="scripts/tree.jquery.js"></script>
<script src="scripts/prettify.js"></script>
<script src="scripts/jsdoc-toc.js"></script>
<script src="scripts/linenumber.js"></script>
<script src="scripts/scrollanchor.js"></script>
</body>
</html>

View File

@@ -4,7 +4,7 @@
<head> <head>
<meta name="generator" content="JSDoc 3.6.7"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.15.3 &raquo; Class: List</title> <title>whatsapp-web.js 1.19.5 &raquo; Class: List</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar"> <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container"> <div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content"> <div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -256,7 +256,7 @@ Returns: [{&#x27;title&#x27;:&#x27;sectionTitle&#x27;,&#x27;rows&#x27;:[{&#x27;r
<footer id="jsdoc-footer" class="jsdoc-footer"> <footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container"> <div id="jsdoc-footer-container">
<p> <p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on December 7, 2021. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p> </p>
</div> </div>
</footer> </footer>

135
docs/LocalAuth.html Normal file
View File

@@ -0,0 +1,135 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.19.5 &raquo; Class: LocalAuth</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
<link href="css/baseline.css" rel="stylesheet">
</head>
<body onload="prettyPrint()">
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div>
</div>
</nav>
<div id="jsdoc-body-container">
<div id="jsdoc-content">
<div id="jsdoc-content-container">
<div id="jsdoc-main" role="main">
<header class="page-header">
<div class="symbol-detail-labels"><span class="label label-kind">class</span></div>
<h1><small></small><span class="symbol-name">LocalAuth</span></h1>
<p class="source-link">Source: <a href="authStrategies_LocalAuth.js.html#source-line-13">authStrategies/<wbr>LocalAuth.<wbr>js:13</a></p>
<div class="symbol-classdesc">
<p>Local directory-based authentication</p>
</div>
<dl class="dl-compact">
</dl>
</header>
<section id="summary">
</section>
<section>
<h2 id="LocalAuth">new&nbsp;<span class="symbol-name">LocalAuth</span><span class="signature"><span class="signature-params">(options)</span></span></h2>
<section>
<h3>Parameters</h3>
<table class="jsdoc-details-table">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Optional</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<p>options</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>options</p>
<p>Values in <code>options</code> have the following properties:</p>
<table class="jsdoc-details-table">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Optional</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<p>clientId</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Client id to distinguish instances if you are using multiple, otherwise keep null if you are using only one instance</p>
</td>
</tr>
<tr>
<td>
<p>dataPath</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Change the default path for saving session files, default is: &quot;./.wwebjs_auth/&quot;</p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
</dl>
</section>
<section>
</section>
</div>
</div>
<nav id="jsdoc-toc-nav" role="navigation"></nav>
</div>
</div>
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p>
</div>
</footer>
<script src="scripts/jquery.min.js"></script>
<script src="scripts/tree.jquery.js"></script>
<script src="scripts/prettify.js"></script>
<script src="scripts/jsdoc-toc.js"></script>
<script src="scripts/linenumber.js"></script>
<script src="scripts/scrollanchor.js"></script>
</body>
</html>

View File

@@ -4,7 +4,7 @@
<head> <head>
<meta name="generator" content="JSDoc 3.6.7"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.15.3 &raquo; Class: Location</title> <title>whatsapp-web.js 1.19.5 &raquo; Class: Location</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar"> <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container"> <div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content"> <div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -149,7 +149,7 @@
<footer id="jsdoc-footer" class="jsdoc-footer"> <footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container"> <div id="jsdoc-footer-container">
<p> <p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on December 7, 2021. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -4,7 +4,7 @@
<head> <head>
<meta name="generator" content="JSDoc 3.6.7"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.15.3 &raquo; Class: Message</title> <title>whatsapp-web.js 1.19.5 &raquo; Class: Message</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar"> <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container"> <div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content"> <div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -54,6 +54,9 @@
<dt><a href="Message.html#deviceType">deviceType</a></dt> <dt><a href="Message.html#deviceType">deviceType</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Message.html#duration">duration</a></dt>
<dd>
</dd>
<dt><a href="Message.html#forwardingScore">forwardingScore</a></dt> <dt><a href="Message.html#forwardingScore">forwardingScore</a></dt>
<dd> <dd>
</dd> </dd>
@@ -79,9 +82,15 @@
<dt><a href="Message.html#inviteV4">inviteV4</a></dt> <dt><a href="Message.html#inviteV4">inviteV4</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Message.html#isEphemeral">isEphemeral</a></dt>
<dd>
</dd>
<dt><a href="Message.html#isForwarded">isForwarded</a></dt> <dt><a href="Message.html#isForwarded">isForwarded</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Message.html#isGif">isGif</a></dt>
<dd>
</dd>
<dt><a href="Message.html#isStarred">isStarred</a></dt> <dt><a href="Message.html#isStarred">isStarred</a></dt>
<dd> <dd>
</dd> </dd>
@@ -94,19 +103,22 @@
<dt><a href="Message.html#location">location</a></dt> <dt><a href="Message.html#location">location</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Message.html#mediaKey">mediaKey</a></dt>
<dd>
</dd>
</dl> </dl>
</div> </div>
<div class="summary-column"> <div class="summary-column">
<dl class="dl-summary-callout"> <dl class="dl-summary-callout">
<dt><a href="Message.html#mediaKey">mediaKey</a></dt>
<dd>
</dd>
<dt><a href="Message.html#mentionedIds">mentionedIds</a></dt> <dt><a href="Message.html#mentionedIds">mentionedIds</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Message.html#orderId">orderId</a></dt> <dt><a href="Message.html#orderId">orderId</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Message.html#rawData">rawData</a></dt>
<dd>
</dd>
<dt><a href="Message.html#timestamp">timestamp</a></dt> <dt><a href="Message.html#timestamp">timestamp</a></dt>
<dd> <dd>
</dd> </dd>
@@ -146,13 +158,13 @@
<dt><a href="Message.html#getChat">getChat()</a></dt> <dt><a href="Message.html#getChat">getChat()</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Message.html#getContact">getContact()</a></dt>
<dd>
</dd>
</dl> </dl>
</div> </div>
<div class="summary-column"> <div class="summary-column">
<dl class="dl-summary-callout"> <dl class="dl-summary-callout">
<dt><a href="Message.html#getContact">getContact()</a></dt>
<dd>
</dd>
<dt><a href="Message.html#getInfo">getInfo()</a></dt> <dt><a href="Message.html#getInfo">getInfo()</a></dt>
<dd> <dd>
</dd> </dd>
@@ -165,11 +177,17 @@
<dt><a href="Message.html#getPayment">getPayment()</a></dt> <dt><a href="Message.html#getPayment">getPayment()</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Message.html#getQuotedMessage">getQuotedMessage()</a></dt>
<dd>
</dd>
<dt><a href="Message.html#react">react(reaction)</a></dt>
<dd>
</dd>
</dl> </dl>
</div> </div>
<div class="summary-column"> <div class="summary-column">
<dl class="dl-summary-callout"> <dl class="dl-summary-callout">
<dt><a href="Message.html#getQuotedMessage">getQuotedMessage()</a></dt> <dt><a href="Message.html#reload">reload()</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Message.html#reply">reply(content[, chatId][, options])</a></dt> <dt><a href="Message.html#reply">reply(content[, chatId][, options])</a></dt>
@@ -221,6 +239,11 @@
<p>String that represents from which device type the message was sent</p> <p>String that represents from which device type the message was sent</p>
<dl class="dl-compact"> <dl class="dl-compact">
</dl> </dl>
<h3 id="duration"><span class="symbol-name">duration</span><small class="property-type">
&nbsp;string</small></h3>
<p>Indicates the duration of the message in seconds</p>
<dl class="dl-compact">
</dl>
<h3 id="forwardingScore"><span class="symbol-name">forwardingScore</span><small class="property-type"> <h3 id="forwardingScore"><span class="symbol-name">forwardingScore</span><small class="property-type">
&nbsp;number</small></h3> &nbsp;number</small></h3>
<p>Indicates how many times the message was forwarded.</p> <p>Indicates how many times the message was forwarded.</p>
@@ -257,11 +280,21 @@
<p>Group Invite Data</p> <p>Group Invite Data</p>
<dl class="dl-compact"> <dl class="dl-compact">
</dl> </dl>
<h3 id="isEphemeral"><span class="symbol-name">isEphemeral</span><small class="property-type">
&nbsp;boolean</small></h3>
<p>Indicates if the message will disappear after it expires</p>
<dl class="dl-compact">
</dl>
<h3 id="isForwarded"><span class="symbol-name">isForwarded</span><small class="property-type"> <h3 id="isForwarded"><span class="symbol-name">isForwarded</span><small class="property-type">
&nbsp;boolean</small></h3> &nbsp;boolean</small></h3>
<p>Indicates if the message was forwarded</p> <p>Indicates if the message was forwarded</p>
<dl class="dl-compact"> <dl class="dl-compact">
</dl> </dl>
<h3 id="isGif"><span class="symbol-name">isGif</span><small class="property-type">
&nbsp;boolean</small></h3>
<p>Indicates whether the message is a Gif</p>
<dl class="dl-compact">
</dl>
<h3 id="isStarred"><span class="symbol-name">isStarred</span><small class="property-type"> <h3 id="isStarred"><span class="symbol-name">isStarred</span><small class="property-type">
&nbsp;boolean</small></h3> &nbsp;boolean</small></h3>
<p>Indicates if the message was starred</p> <p>Indicates if the message was starred</p>
@@ -297,6 +330,11 @@
<p>Order ID for message type ORDER</p> <p>Order ID for message type ORDER</p>
<dl class="dl-compact"> <dl class="dl-compact">
</dl> </dl>
<h3 id="rawData"><span class="symbol-name">rawData</span><small class="property-type">
&nbsp;Object</small></h3>
<p>Returns message in a raw format</p>
<dl class="dl-compact">
</dl>
<h3 id="timestamp"><span class="symbol-name">timestamp</span><small class="property-type"> <h3 id="timestamp"><span class="symbol-name">timestamp</span><small class="property-type">
&nbsp;number</small></h3> &nbsp;number</small></h3>
<p>Unix timestamp for when the message was created</p> <p>Unix timestamp for when the message was created</p>
@@ -362,7 +400,7 @@
<p>&nbsp;</p> <p>&nbsp;</p>
</td> </td>
<td> <td>
<p>If true and the message is sent by the current user, will delete it for everyone in the chat.</p> <p>If true and the message is sent by the current user or the user is an admin, will delete it for everyone in the chat.</p>
<p>Value can be null.</p> <p>Value can be null.</p>
</td> </td>
</tr> </tr>
@@ -382,7 +420,7 @@
</dl> </dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div> <div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="forward"><span class="symbol-name">forward</span><span class="signature"><span class="signature-params">(chat)</span>&nbsp;&rarr; <span class="signature-returns"> Promise</span></span></h3> <h3 id="forward"><span class="symbol-name">forward</span><span class="signature"><span class="signature-params">(chat)</span>&nbsp;&rarr; <span class="signature-returns"> Promise</span></span></h3>
<p>Forwards this message to another chat</p> <p>Forwards this message to another chat (that you chatted before, otherwise it will fail)</p>
<section> <section>
<h4>Parameter</h4> <h4>Parameter</h4>
<table class="jsdoc-details-table"> <table class="jsdoc-details-table">
@@ -480,6 +518,54 @@
</dd> </dd>
</dl> </dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div> <div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="react"><span class="symbol-name">react</span><span class="signature"><span class="signature-params">(reaction)</span>&nbsp;&rarr; <span class="signature-returns"> Promise</span></span></h3>
<p>React to this message with an emoji</p>
<section>
<h4>Parameter</h4>
<table class="jsdoc-details-table">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Optional</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<p>reaction</p>
</td>
<td>
<p>string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Emoji to react with. Send an empty string to remove the reaction.</p>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code>Promise</code> </p>
</dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="reload"><span class="symbol-name">reload</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing <a href="Message.html">Message</a></span></span></h3>
<p>Reloads this Message object's data in-place with the latest values from WhatsApp Web.
Note that the Message must still be in the web app cache for this to work, otherwise will return null.</p>
<dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code>Promise containing <a href="Message.html">Message</a></code> </p>
</dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="reply"><span class="symbol-name">reply</span><span class="signature"><span class="signature-params">(content[, chatId][, options])</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing <a href="Message.html">Message</a></span></span></h3> <h3 id="reply"><span class="symbol-name">reply</span><span class="signature"><span class="signature-params">(content[, chatId][, options])</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing <a href="Message.html">Message</a></span></span></h3>
<p>Sends a message as a reply to this message. If chatId is specified, it will be sent <p>Sends a message as a reply to this message. If chatId is specified, it will be sent
through the specified Chat. If not, it will send the message through the specified Chat. If not, it will send the message
@@ -564,7 +650,7 @@
<footer id="jsdoc-footer" class="jsdoc-footer"> <footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container"> <div id="jsdoc-footer-container">
<p> <p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on December 7, 2021. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -4,7 +4,7 @@
<head> <head>
<meta name="generator" content="JSDoc 3.6.7"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.15.3 &raquo; Class: MessageMedia</title> <title>whatsapp-web.js 1.19.5 &raquo; Class: MessageMedia</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar"> <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container"> <div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content"> <div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -26,7 +26,7 @@
<header class="page-header"> <header class="page-header">
<div class="symbol-detail-labels"><span class="label label-kind">class</span></div> <div class="symbol-detail-labels"><span class="label label-kind">class</span></div>
<h1><small></small><span class="symbol-name">MessageMedia</span></h1> <h1><small></small><span class="symbol-name">MessageMedia</span></h1>
<p class="source-link">Source: <a href="structures_MessageMedia.js.html#source-line-15">structures/<wbr>MessageMedia.<wbr>js:15</a></p> <p class="source-link">Source: <a href="structures_MessageMedia.js.html#source-line-16">structures/<wbr>MessageMedia.<wbr>js:16</a></p>
<div class="symbol-classdesc"> <div class="symbol-classdesc">
<p>Media attached to a message</p> <p>Media attached to a message</p>
</div> </div>
@@ -42,10 +42,6 @@
<dt><a href="MessageMedia.html#data">data</a></dt> <dt><a href="MessageMedia.html#data">data</a></dt>
<dd> <dd>
</dd> </dd>
</dl>
</div>
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="MessageMedia.html#filename">filename</a></dt> <dt><a href="MessageMedia.html#filename">filename</a></dt>
<dd> <dd>
</dd> </dd>
@@ -53,11 +49,16 @@
</div> </div>
<div class="summary-column"> <div class="summary-column">
<dl class="dl-summary-callout"> <dl class="dl-summary-callout">
<dt><a href="MessageMedia.html#filesize">filesize</a></dt>
<dd>
</dd>
<dt><a href="MessageMedia.html#mimetype">mimetype</a></dt> <dt><a href="MessageMedia.html#mimetype">mimetype</a></dt>
<dd> <dd>
</dd> </dd>
</dl> </dl>
</div> </div>
<div class="summary-column">
</div>
</div> </div>
</div> </div>
<div class="summary-callout"> <div class="summary-callout">
@@ -83,7 +84,7 @@
</div> </div>
</section> </section>
<section> <section>
<h2 id="MessageMedia">new&nbsp;<span class="symbol-name">MessageMedia</span><span class="signature"><span class="signature-params">(mimetype, data, filename)</span></span></h2> <h2 id="MessageMedia">new&nbsp;<span class="symbol-name">MessageMedia</span><span class="signature"><span class="signature-params">(mimetype, data, filename, filesize)</span></span></h2>
<section> <section>
<h3>Parameters</h3> <h3>Parameters</h3>
<table class="jsdoc-details-table"> <table class="jsdoc-details-table">
@@ -135,7 +136,22 @@
<p>&nbsp;</p> <p>&nbsp;</p>
</td> </td>
<td> <td>
<p>Document file name</p> <p>Document file name. Value can be null</p>
<p>Value can be null.</p>
</td>
</tr>
<tr>
<td>
<p>filesize</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Document file size in bytes. Value can be null</p>
<p>Value can be null.</p> <p>Value can be null.</p>
</td> </td>
</tr> </tr>
@@ -155,7 +171,12 @@
</dl> </dl>
<h3 id="filename"><span class="symbol-name">filename</span><small class="property-type"> <h3 id="filename"><span class="symbol-name">filename</span><small class="property-type">
&nbsp;nullable string</small></h3> &nbsp;nullable string</small></h3>
<p>Name of the file (for documents)</p> <p>Document file name. Value can be null</p>
<dl class="dl-compact">
</dl>
<h3 id="filesize"><span class="symbol-name">filesize</span><small class="property-type">
&nbsp;nullable number</small></h3>
<p>Document file size in bytes. Value can be null</p>
<dl class="dl-compact"> <dl class="dl-compact">
</dl> </dl>
<h3 id="mimetype"><span class="symbol-name">mimetype</span><small class="property-type"> <h3 id="mimetype"><span class="symbol-name">mimetype</span><small class="property-type">
@@ -258,7 +279,7 @@
<p>unsafeMime</p> <p>unsafeMime</p>
</td> </td>
<td> <td>
<p>number</p> <p>boolean</p>
</td> </td>
<td> <td>
<p>Yes</p> <p>Yes</p>
@@ -267,6 +288,19 @@
<p>Defaults to <code>false</code>.</p> <p>Defaults to <code>false</code>.</p>
</td> </td>
</tr> </tr>
<tr>
<td>
<p>filename</p>
</td>
<td>
<p>string</p>
</td>
<td>
<p>Yes</p>
</td>
<td>
</td>
</tr>
<tr> <tr>
<td> <td>
<p>client</p> <p>client</p>
@@ -330,7 +364,7 @@
<footer id="jsdoc-footer" class="jsdoc-footer"> <footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container"> <div id="jsdoc-footer-container">
<p> <p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on December 7, 2021. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p> </p>
</div> </div>
</footer> </footer>

66
docs/NoAuth.html Normal file
View File

@@ -0,0 +1,66 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.19.5 &raquo; Class: NoAuth</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
<link href="css/baseline.css" rel="stylesheet">
</head>
<body onload="prettyPrint()">
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div>
</div>
</nav>
<div id="jsdoc-body-container">
<div id="jsdoc-content">
<div id="jsdoc-content-container">
<div id="jsdoc-main" role="main">
<header class="page-header">
<div class="symbol-detail-labels"><span class="label label-kind">class</span></div>
<h1><small></small><span class="symbol-name">NoAuth</span></h1>
<p class="source-link">Source: <a href="authStrategies_NoAuth.js.html#source-line-9">authStrategies/<wbr>NoAuth.<wbr>js:9</a></p>
<div class="symbol-classdesc">
<p>No session restoring functionality
Will need to authenticate via QR code every time</p>
</div>
<dl class="dl-compact">
</dl>
</header>
<section id="summary">
</section>
<section>
<h2 id="NoAuth">new&nbsp;<span class="symbol-name">NoAuth</span><span class="signature"><span class="signature-params">()</span></span></h2>
<dl class="dl-compact">
</dl>
</section>
<section>
</section>
</div>
</div>
<nav id="jsdoc-toc-nav" role="navigation"></nav>
</div>
</div>
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p>
</div>
</footer>
<script src="scripts/jquery.min.js"></script>
<script src="scripts/tree.jquery.js"></script>
<script src="scripts/prettify.js"></script>
<script src="scripts/jsdoc-toc.js"></script>
<script src="scripts/linenumber.js"></script>
<script src="scripts/scrollanchor.js"></script>
</body>
</html>

View File

@@ -4,7 +4,7 @@
<head> <head>
<meta name="generator" content="JSDoc 3.6.7"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.15.3 &raquo; Class: Order</title> <title>whatsapp-web.js 1.19.5 &raquo; Class: Order</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar"> <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container"> <div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content"> <div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -102,7 +102,7 @@
<footer id="jsdoc-footer" class="jsdoc-footer"> <footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container"> <div id="jsdoc-footer-container">
<p> <p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on December 7, 2021. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -4,7 +4,7 @@
<head> <head>
<meta name="generator" content="JSDoc 3.6.7"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.15.3 &raquo; Class: PrivateChat</title> <title>whatsapp-web.js 1.19.5 &raquo; Class: PrivateChat</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar"> <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container"> <div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content"> <div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -295,7 +295,7 @@
<p>&nbsp;</p> <p>&nbsp;</p>
</td> </td>
<td> <td>
<p>Options for searching messages. Right now only limit is supported.</p> <p>Options for searching messages. Right now only limit and fromMe is supported.</p>
<p>Values in <code>searchOptions</code> have the following properties:</p> <p>Values in <code>searchOptions</code> have the following properties:</p>
<table class="jsdoc-details-table"> <table class="jsdoc-details-table">
<thead> <thead>
@@ -318,8 +318,21 @@
<p>Yes</p> <p>Yes</p>
</td> </td>
<td> <td>
<p>The amount of messages to return. Note that the actual number of returned messages may be smaller if there aren't enough messages in the conversation. Set this to Infinity to load all messages.</p> <p>The amount of messages to return. If no limit is specified, the available messages will be returned. Note that the actual number of returned messages may be smaller if there aren't enough messages in the conversation. Set this to Infinity to load all messages.</p>
<p>Defaults to <code>50</code>.</p> </td>
</tr>
<tr>
<td>
<p>fromMe</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Yes</p>
</td>
<td>
<p>Return only messages from the bot number or vise versa. To get all messages, leave the option undefined.</p>
</td> </td>
</tr> </tr>
</tbody> </tbody>
@@ -520,7 +533,7 @@
<footer id="jsdoc-footer" class="jsdoc-footer"> <footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container"> <div id="jsdoc-footer-container">
<p> <p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on December 7, 2021. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -4,7 +4,7 @@
<head> <head>
<meta name="generator" content="JSDoc 3.6.7"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.15.3 &raquo; Class: PrivateContact</title> <title>whatsapp-web.js 1.19.5 &raquo; Class: PrivateContact</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar"> <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container"> <div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content"> <div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -108,19 +108,22 @@
</div> </div>
<div class="summary-column"> <div class="summary-column">
<dl class="dl-summary-callout"> <dl class="dl-summary-callout">
<dt><a href="PrivateContact.html#getCommonGroups">getCommonGroups()</a></dt>
<dd>
</dd>
<dt><a href="PrivateContact.html#getCountryCode">getCountryCode()</a></dt> <dt><a href="PrivateContact.html#getCountryCode">getCountryCode()</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="PrivateContact.html#getFormattedNumber">getFormattedNumber()</a></dt> <dt><a href="PrivateContact.html#getFormattedNumber">getFormattedNumber()</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="PrivateContact.html#getProfilePicUrl">getProfilePicUrl()</a></dt>
<dd>
</dd>
</dl> </dl>
</div> </div>
<div class="summary-column"> <div class="summary-column">
<dl class="dl-summary-callout"> <dl class="dl-summary-callout">
<dt><a href="PrivateContact.html#getProfilePicUrl">getProfilePicUrl()</a></dt>
<dd>
</dd>
<dt><a href="PrivateContact.html#unblock">unblock()</a></dt> <dt><a href="PrivateContact.html#unblock">unblock()</a></dt>
<dd> <dd>
</dd> </dd>
@@ -262,6 +265,15 @@
<dd></dd> <dd></dd>
</dl> </dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div> <div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="getCommonGroups"><span class="symbol-name">getCommonGroups</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing Array of WAWebJS.ChatId</span></span></h3>
<p>Gets the Contact's common groups with you. Returns empty array if you don't have any common group.</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Contact.html#getCommonGroups">Contact#getCommonGroups</a></dd>
<dt>Returns</dt>
<dd></dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="getCountryCode"><span class="symbol-name">getCountryCode</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing string</span></span></h3> <h3 id="getCountryCode"><span class="symbol-name">getCountryCode</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing string</span></span></h3>
<p>Returns the contact's countrycode, (1541859685@c.us) =&gt; (1)</p> <p>Returns the contact's countrycode, (1541859685@c.us) =&gt; (1)</p>
<dl class="dl-compact"> <dl class="dl-compact">
@@ -307,7 +319,7 @@
<footer id="jsdoc-footer" class="jsdoc-footer"> <footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container"> <div id="jsdoc-footer-container">
<p> <p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on December 7, 2021. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -4,7 +4,7 @@
<head> <head>
<meta name="generator" content="JSDoc 3.6.7"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.15.3 &raquo; Class: Product</title> <title>whatsapp-web.js 1.19.5 &raquo; Class: Product</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar"> <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container"> <div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content"> <div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -127,7 +127,7 @@
<footer id="jsdoc-footer" class="jsdoc-footer"> <footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container"> <div id="jsdoc-footer-container">
<p> <p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on December 7, 2021. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p> </p>
</div> </div>
</footer> </footer>

159
docs/Reaction.html Normal file
View File

@@ -0,0 +1,159 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.19.5 &raquo; Class: Reaction</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
<link href="css/baseline.css" rel="stylesheet">
</head>
<body onload="prettyPrint()">
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div>
</div>
</nav>
<div id="jsdoc-body-container">
<div id="jsdoc-content">
<div id="jsdoc-content-container">
<div id="jsdoc-main" role="main">
<header class="page-header">
<div class="symbol-detail-labels"><span class="label label-kind">class</span></div>
<h1><small></small><span class="symbol-name">Reaction</span></h1>
<p class="source-link">Source: <a href="structures_Reaction.js.html#source-line-9">structures/<wbr>Reaction.<wbr>js:9</a></p>
<div class="symbol-classdesc">
<p>Represents a Reaction on WhatsApp</p>
</div>
<dl class="dl-compact">
</dl>
</header>
<section id="summary">
<div class="summary-callout">
<h2 class="summary-callout-heading">Properties</h2>
<div class="summary-content">
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="Reaction.html#ack">ack</a></dt>
<dd>
</dd>
<dt><a href="Reaction.html#id">id</a></dt>
<dd>
</dd>
<dt><a href="Reaction.html#msgId">msgId</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="Reaction.html#orphan">orphan</a></dt>
<dd>
</dd>
<dt><a href="Reaction.html#orphanReason">orphanReason</a></dt>
<dd>
</dd>
<dt><a href="Reaction.html#reaction">reaction</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="Reaction.html#read">read</a></dt>
<dd>
</dd>
<dt><a href="Reaction.html#senderId">senderId</a></dt>
<dd>
</dd>
<dt><a href="Reaction.html#timestamp">timestamp</a></dt>
<dd>
</dd>
</dl>
</div>
</div>
</div>
</section>
<section>
<h2 id="Reaction">new&nbsp;<span class="symbol-name">Reaction</span><span class="signature"><span class="signature-params">()</span></span></h2>
<dl class="dl-compact">
<dt>Extends</dt>
<dd><a href="Base.html">Base</a></dd>
</dl>
</section>
<section>
<h2>Properties</h2>
<section>
<h3 id="ack"><span class="symbol-name">ack</span><small class="property-type">
&nbsp;nullable number</small></h3>
<p>ACK</p>
<dl class="dl-compact">
</dl>
<h3 id="id"><span class="symbol-name">id</span><small class="property-type">
&nbsp;object</small></h3>
<p>Reaction ID</p>
<dl class="dl-compact">
</dl>
<h3 id="msgId"><span class="symbol-name">msgId</span><small class="property-type">
&nbsp;object</small></h3>
<p>Message ID</p>
<dl class="dl-compact">
</dl>
<h3 id="orphan"><span class="symbol-name">orphan</span><small class="property-type">
&nbsp;number</small></h3>
<p>Orphan</p>
<dl class="dl-compact">
</dl>
<h3 id="orphanReason"><span class="symbol-name">orphanReason</span><small class="property-type">
&nbsp;nullable string</small></h3>
<p>Orphan reason</p>
<dl class="dl-compact">
</dl>
<h3 id="reaction"><span class="symbol-name">reaction</span><small class="property-type">
&nbsp;string</small></h3>
<p>Reaction</p>
<dl class="dl-compact">
</dl>
<h3 id="read"><span class="symbol-name">read</span><small class="property-type">
&nbsp;boolean</small></h3>
<p>Read</p>
<dl class="dl-compact">
</dl>
<h3 id="senderId"><span class="symbol-name">senderId</span><small class="property-type">
&nbsp;string</small></h3>
<p>Sender ID</p>
<dl class="dl-compact">
</dl>
<h3 id="timestamp"><span class="symbol-name">timestamp</span><small class="property-type">
&nbsp;number</small></h3>
<p>Unix timestamp for when the reaction was created</p>
<dl class="dl-compact">
</dl>
</section>
</section>
</div>
</div>
<nav id="jsdoc-toc-nav" role="navigation"></nav>
</div>
</div>
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p>
</div>
</footer>
<script src="scripts/jquery.min.js"></script>
<script src="scripts/tree.jquery.js"></script>
<script src="scripts/prettify.js"></script>
<script src="scripts/jsdoc-toc.js"></script>
<script src="scripts/linenumber.js"></script>
<script src="scripts/scrollanchor.js"></script>
</body>
</html>

163
docs/RemoteAuth.html Normal file
View File

@@ -0,0 +1,163 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.19.5 &raquo; Class: RemoteAuth</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
<link href="css/baseline.css" rel="stylesheet">
</head>
<body onload="prettyPrint()">
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div>
</div>
</nav>
<div id="jsdoc-body-container">
<div id="jsdoc-content">
<div id="jsdoc-content-container">
<div id="jsdoc-main" role="main">
<header class="page-header">
<div class="symbol-detail-labels"><span class="label label-kind">class</span></div>
<h1><small></small><span class="symbol-name">RemoteAuth</span></h1>
<p class="source-link">Source: <a href="authStrategies_RemoteAuth.js.html#source-line-26">authStrategies/<wbr>RemoteAuth.<wbr>js:26</a></p>
<div class="symbol-classdesc">
<p>Remote-based authentication</p>
</div>
<dl class="dl-compact">
</dl>
</header>
<section id="summary">
</section>
<section>
<h2 id="RemoteAuth">new&nbsp;<span class="symbol-name">RemoteAuth</span><span class="signature"><span class="signature-params">(options)</span></span></h2>
<section>
<h3>Parameters</h3>
<table class="jsdoc-details-table">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Optional</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<p>options</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>options</p>
<p>Values in <code>options</code> have the following properties:</p>
<table class="jsdoc-details-table">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Optional</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<p>store</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Remote database store instance</p>
</td>
</tr>
<tr>
<td>
<p>clientId</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Client id to distinguish instances if you are using multiple, otherwise keep null if you are using only one instance</p>
</td>
</tr>
<tr>
<td>
<p>dataPath</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Change the default path for saving session files, default is: &quot;./.wwebjs_auth/&quot;</p>
</td>
</tr>
<tr>
<td>
<p>backupSyncIntervalMs</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Sets the time interval for periodic session backups. Accepts values starting from 60000ms {1 minute}</p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
</dl>
</section>
<section>
</section>
</div>
</div>
<nav id="jsdoc-toc-nav" role="navigation"></nav>
</div>
</div>
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p>
</div>
</footer>
<script src="scripts/jquery.min.js"></script>
<script src="scripts/tree.jquery.js"></script>
<script src="scripts/prettify.js"></script>
<script src="scripts/jsdoc-toc.js"></script>
<script src="scripts/linenumber.js"></script>
<script src="scripts/scrollanchor.js"></script>
</body>
</html>

View File

@@ -4,7 +4,7 @@
<head> <head>
<meta name="generator" content="JSDoc 3.6.7"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.15.3 &raquo; Class: Util</title> <title>whatsapp-web.js 1.19.5 &raquo; Class: Util</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar"> <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container"> <div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content"> <div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -26,7 +26,7 @@
<header class="page-header"> <header class="page-header">
<div class="symbol-detail-labels"><span class="label label-kind">class</span></div> <div class="symbol-detail-labels"><span class="label label-kind">class</span></div>
<h1><small></small><span class="symbol-name">Util</span></h1> <h1><small></small><span class="symbol-name">Util</span></h1>
<p class="source-link">Source: <a href="util_Util.js.html#source-line-16">util/<wbr>Util.<wbr>js:16</a></p> <p class="source-link">Source: <a href="util_Util.js.html#source-line-14">util/<wbr>Util.<wbr>js:14</a></p>
<div class="symbol-classdesc"> <div class="symbol-classdesc">
<p>Utility methods</p> <p>Utility methods</p>
</div> </div>
@@ -104,7 +104,8 @@
<dl class="dl-compact"> <dl class="dl-compact">
<dt>Returns</dt> <dt>Returns</dt>
<dd> <dd>
<p><code>Promise containing <a href="MessageMedia.html">MessageMedia</a></code> <p>media in webp format</p> <p><code>Promise containing <a href="MessageMedia.html">MessageMedia</a></code> 
<p>media in webp format</p>
</p> </p>
</dd> </dd>
</dl> </dl>
@@ -155,7 +156,8 @@
<dl class="dl-compact"> <dl class="dl-compact">
<dt>Returns</dt> <dt>Returns</dt>
<dd> <dd>
<p><code>Promise containing <a href="MessageMedia.html">MessageMedia</a></code> <p>media in webp format</p> <p><code>Promise containing <a href="MessageMedia.html">MessageMedia</a></code> 
<p>media in webp format</p>
</p> </p>
</dd> </dd>
</dl> </dl>
@@ -193,7 +195,8 @@
<dl class="dl-compact"> <dl class="dl-compact">
<dt>Returns</dt> <dt>Returns</dt>
<dd> <dd>
<p><code>Promise containing <a href="MessageMedia.html">MessageMedia</a></code> <p>media in webp format</p> <p><code>Promise containing <a href="MessageMedia.html">MessageMedia</a></code> 
<p>media in webp format</p>
</p> </p>
</dd> </dd>
</dl> </dl>
@@ -240,7 +243,7 @@
<footer id="jsdoc-footer" class="jsdoc-footer"> <footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container"> <div id="jsdoc-footer-container">
<p> <p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on December 7, 2021. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -0,0 +1,80 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.19.5 &raquo; Source: authStrategies/BaseAuthStrategy.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
<link href="css/baseline.css" rel="stylesheet">
</head>
<body onload="prettyPrint()">
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div>
</div>
</nav>
<div id="jsdoc-body-container">
<div id="jsdoc-content">
<div id="jsdoc-content-container">
<div id="jsdoc-banner" role="banner">
</div>
<div id="jsdoc-main" role="main">
<header class="page-header">
<h1>Source: authStrategies/BaseAuthStrategy.js</h1>
</header>
<article>
<pre class="prettyprint linenums"><code>&#x27;use strict&#x27;;
/**
* Base class which all authentication strategies extend
*/
class BaseAuthStrategy {
constructor() {}
setup(client) {
this.client &#x3D; client;
}
async beforeBrowserInitialized() {}
async afterBrowserInitialized() {}
async onAuthenticationNeeded() {
return {
failed: false,
restart: false,
failureEventPayload: undefined
};
}
async getAuthEventPayload() {}
async afterAuthReady() {}
async disconnect() {}
async destroy() {}
async logout() {}
}
module.exports &#x3D; BaseAuthStrategy;</code></pre>
</article>
</div>
</div>
<nav id="jsdoc-toc-nav" role="navigation"></nav>
</div>
</div>
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p>
</div>
</footer>
<script src="scripts/jquery.min.js"></script>
<script src="scripts/tree.jquery.js"></script>
<script src="scripts/prettify.js"></script>
<script src="scripts/jsdoc-toc.js"></script>
<script src="scripts/linenumber.js"></script>
<script src="scripts/scrollanchor.js"></script>
</body>
</html>

View File

@@ -0,0 +1,126 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.19.5 &raquo; Source: authStrategies/LegacySessionAuth.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
<link href="css/baseline.css" rel="stylesheet">
</head>
<body onload="prettyPrint()">
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div>
</div>
</nav>
<div id="jsdoc-body-container">
<div id="jsdoc-content">
<div id="jsdoc-content-container">
<div id="jsdoc-banner" role="banner">
</div>
<div id="jsdoc-main" role="main">
<header class="page-header">
<h1>Source: authStrategies/LegacySessionAuth.js</h1>
</header>
<article>
<pre class="prettyprint linenums"><code>&#x27;use strict&#x27;;
const BaseAuthStrategy &#x3D; require(&#x27;./BaseAuthStrategy&#x27;);
/**
* Legacy session auth strategy
* Not compatible with multi-device accounts.
* @param {object} options - options
* @param {string} options.restartOnAuthFail - Restart client with a new session (i.e. use null &#x27;session&#x27; var) if authentication fails
* @param {object} options.session - Whatsapp session to restore. If not set, will start a new session
* @param {string} options.session.WABrowserId
* @param {string} options.session.WASecretBundle
* @param {string} options.session.WAToken1
* @param {string} options.session.WAToken2
*/
class LegacySessionAuth extends BaseAuthStrategy {
constructor({ session, restartOnAuthFail }&#x3D;{}) {
super();
this.session &#x3D; session;
this.restartOnAuthFail &#x3D; restartOnAuthFail;
}
async afterBrowserInitialized() {
if(this.session) {
await this.client.pupPage.evaluateOnNewDocument(session &#x3D;&gt; {
if (document.referrer &#x3D;&#x3D;&#x3D; &#x27;https://whatsapp.com/&#x27;) {
localStorage.clear();
localStorage.setItem(&#x27;WABrowserId&#x27;, session.WABrowserId);
localStorage.setItem(&#x27;WASecretBundle&#x27;, session.WASecretBundle);
localStorage.setItem(&#x27;WAToken1&#x27;, session.WAToken1);
localStorage.setItem(&#x27;WAToken2&#x27;, session.WAToken2);
}
localStorage.setItem(&#x27;remember-me&#x27;, &#x27;true&#x27;);
}, this.session);
}
}
async onAuthenticationNeeded() {
if(this.session) {
this.session &#x3D; null;
return {
failed: true,
restart: this.restartOnAuthFail,
failureEventPayload: &#x27;Unable to log in. Are the session details valid?&#x27;
};
}
return { failed: false };
}
async getAuthEventPayload() {
const isMD &#x3D; await this.client.pupPage.evaluate(() &#x3D;&gt; {
return window.Store.MDBackend;
});
if(isMD) throw new Error(&#x27;Authenticating via JSON session is not supported for MultiDevice-enabled WhatsApp accounts.&#x27;);
const localStorage &#x3D; JSON.parse(await this.client.pupPage.evaluate(() &#x3D;&gt; {
return JSON.stringify(window.localStorage);
}));
return {
WABrowserId: localStorage.WABrowserId,
WASecretBundle: localStorage.WASecretBundle,
WAToken1: localStorage.WAToken1,
WAToken2: localStorage.WAToken2
};
}
}
module.exports &#x3D; LegacySessionAuth;
</code></pre>
</article>
</div>
</div>
<nav id="jsdoc-toc-nav" role="navigation"></nav>
</div>
</div>
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p>
</div>
</footer>
<script src="scripts/jquery.min.js"></script>
<script src="scripts/tree.jquery.js"></script>
<script src="scripts/prettify.js"></script>
<script src="scripts/jsdoc-toc.js"></script>
<script src="scripts/linenumber.js"></script>
<script src="scripts/scrollanchor.js"></script>
</body>
</html>

View File

@@ -0,0 +1,106 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.19.5 &raquo; Source: authStrategies/LocalAuth.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
<link href="css/baseline.css" rel="stylesheet">
</head>
<body onload="prettyPrint()">
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div>
</div>
</nav>
<div id="jsdoc-body-container">
<div id="jsdoc-content">
<div id="jsdoc-content-container">
<div id="jsdoc-banner" role="banner">
</div>
<div id="jsdoc-main" role="main">
<header class="page-header">
<h1>Source: authStrategies/LocalAuth.js</h1>
</header>
<article>
<pre class="prettyprint linenums"><code>&#x27;use strict&#x27;;
const path &#x3D; require(&#x27;path&#x27;);
const fs &#x3D; require(&#x27;fs&#x27;);
const BaseAuthStrategy &#x3D; require(&#x27;./BaseAuthStrategy&#x27;);
/**
* Local directory-based authentication
* @param {object} options - options
* @param {string} options.clientId - Client id to distinguish instances if you are using multiple, otherwise keep null if you are using only one instance
* @param {string} options.dataPath - Change the default path for saving session files, default is: &quot;./.wwebjs_auth/&quot;
*/
class LocalAuth extends BaseAuthStrategy {
constructor({ clientId, dataPath }&#x3D;{}) {
super();
const idRegex &#x3D; /^[-_\w]+$/i;
if(clientId &amp;amp;&amp;amp; !idRegex.test(clientId)) {
throw new Error(&#x27;Invalid clientId. Only alphanumeric characters, underscores and hyphens are allowed.&#x27;);
}
this.dataPath &#x3D; path.resolve(dataPath || &#x27;./.wwebjs_auth/&#x27;);
this.clientId &#x3D; clientId;
}
async beforeBrowserInitialized() {
const puppeteerOpts &#x3D; this.client.options.puppeteer;
const sessionDirName &#x3D; this.clientId ? &#x60;session-${this.clientId}&#x60; : &#x27;session&#x27;;
const dirPath &#x3D; path.join(this.dataPath, sessionDirName);
if(puppeteerOpts.userDataDir &amp;amp;&amp;amp; puppeteerOpts.userDataDir !&#x3D;&#x3D; dirPath) {
throw new Error(&#x27;LocalAuth is not compatible with a user-supplied userDataDir.&#x27;);
}
fs.mkdirSync(dirPath, { recursive: true });
this.client.options.puppeteer &#x3D; {
...puppeteerOpts,
userDataDir: dirPath
};
this.userDataDir &#x3D; dirPath;
}
async logout() {
if (this.userDataDir) {
return (fs.rmSync ? fs.rmSync : fs.rmdirSync).call(this, this.userDataDir, { recursive: true });
}
}
}
module.exports &#x3D; LocalAuth;</code></pre>
</article>
</div>
</div>
<nav id="jsdoc-toc-nav" role="navigation"></nav>
</div>
</div>
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p>
</div>
</footer>
<script src="scripts/jquery.min.js"></script>
<script src="scripts/tree.jquery.js"></script>
<script src="scripts/prettify.js"></script>
<script src="scripts/jsdoc-toc.js"></script>
<script src="scripts/linenumber.js"></script>
<script src="scripts/scrollanchor.js"></script>
</body>
</html>

View File

@@ -0,0 +1,65 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.19.5 &raquo; Source: authStrategies/NoAuth.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
<link href="css/baseline.css" rel="stylesheet">
</head>
<body onload="prettyPrint()">
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div>
</div>
</nav>
<div id="jsdoc-body-container">
<div id="jsdoc-content">
<div id="jsdoc-content-container">
<div id="jsdoc-banner" role="banner">
</div>
<div id="jsdoc-main" role="main">
<header class="page-header">
<h1>Source: authStrategies/NoAuth.js</h1>
</header>
<article>
<pre class="prettyprint linenums"><code>&#x27;use strict&#x27;;
const BaseAuthStrategy &#x3D; require(&#x27;./BaseAuthStrategy&#x27;);
/**
* No session restoring functionality
* Will need to authenticate via QR code every time
*/
class NoAuth extends BaseAuthStrategy { }
module.exports &#x3D; NoAuth;</code></pre>
</article>
</div>
</div>
<nav id="jsdoc-toc-nav" role="navigation"></nav>
</div>
</div>
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p>
</div>
</footer>
<script src="scripts/jquery.min.js"></script>
<script src="scripts/tree.jquery.js"></script>
<script src="scripts/prettify.js"></script>
<script src="scripts/jsdoc-toc.js"></script>
<script src="scripts/linenumber.js"></script>
<script src="scripts/scrollanchor.js"></script>
</body>
</html>

View File

@@ -0,0 +1,258 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.19.5 &raquo; Source: authStrategies/RemoteAuth.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
<link href="css/baseline.css" rel="stylesheet">
</head>
<body onload="prettyPrint()">
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div>
</div>
</nav>
<div id="jsdoc-body-container">
<div id="jsdoc-content">
<div id="jsdoc-content-container">
<div id="jsdoc-banner" role="banner">
</div>
<div id="jsdoc-main" role="main">
<header class="page-header">
<h1>Source: authStrategies/RemoteAuth.js</h1>
</header>
<article>
<pre class="prettyprint linenums"><code>&#x27;use strict&#x27;;
/* Require Optional Dependencies */
try {
var fs &#x3D; require(&#x27;fs-extra&#x27;);
var unzipper &#x3D; require(&#x27;unzipper&#x27;);
var archiver &#x3D; require(&#x27;archiver&#x27;);
} catch {
fs &#x3D; undefined;
unzipper &#x3D; undefined;
archiver &#x3D; undefined;
}
const path &#x3D; require(&#x27;path&#x27;);
const { Events } &#x3D; require(&#x27;./../util/Constants&#x27;);
const BaseAuthStrategy &#x3D; require(&#x27;./BaseAuthStrategy&#x27;);
/**
* Remote-based authentication
* @param {object} options - options
* @param {object} options.store - Remote database store instance
* @param {string} options.clientId - Client id to distinguish instances if you are using multiple, otherwise keep null if you are using only one instance
* @param {string} options.dataPath - Change the default path for saving session files, default is: &quot;./.wwebjs_auth/&quot;
* @param {number} options.backupSyncIntervalMs - Sets the time interval for periodic session backups. Accepts values starting from 60000ms {1 minute}
*/
class RemoteAuth extends BaseAuthStrategy {
constructor({ clientId, dataPath, store, backupSyncIntervalMs } &#x3D; {}) {
if (!fs &amp;amp;&amp;amp; !unzipper &amp;amp;&amp;amp; !archiver) throw new Error(&#x27;Optional Dependencies [fs-extra, unzipper, archiver] are required to use RemoteAuth. Make sure to run npm install correctly and remove the --no-optional flag&#x27;);
super();
const idRegex &#x3D; /^[-_\w]+$/i;
if (clientId &amp;amp;&amp;amp; !idRegex.test(clientId)) {
throw new Error(&#x27;Invalid clientId. Only alphanumeric characters, underscores and hyphens are allowed.&#x27;);
}
if (!backupSyncIntervalMs || backupSyncIntervalMs &amp;lt; 60000) {
throw new Error(&#x27;Invalid backupSyncIntervalMs. Accepts values starting from 60000ms {1 minute}.&#x27;);
}
if(!store) throw new Error(&#x27;Remote database store is required.&#x27;);
this.store &#x3D; store;
this.clientId &#x3D; clientId;
this.backupSyncIntervalMs &#x3D; backupSyncIntervalMs;
this.dataPath &#x3D; path.resolve(dataPath || &#x27;./.wwebjs_auth/&#x27;);
this.tempDir &#x3D; &#x60;${this.dataPath}/wwebjs_temp_session&#x60;;
this.requiredDirs &#x3D; [&#x27;Default&#x27;, &#x27;IndexedDB&#x27;, &#x27;Local Storage&#x27;]; /* &#x3D;&gt; Required Files &amp;amp; Dirs in WWebJS to restore session */
}
async beforeBrowserInitialized() {
const puppeteerOpts &#x3D; this.client.options.puppeteer;
const sessionDirName &#x3D; this.clientId ? &#x60;RemoteAuth-${this.clientId}&#x60; : &#x27;RemoteAuth&#x27;;
const dirPath &#x3D; path.join(this.dataPath, sessionDirName);
if (puppeteerOpts.userDataDir &amp;amp;&amp;amp; puppeteerOpts.userDataDir !&#x3D;&#x3D; dirPath) {
throw new Error(&#x27;RemoteAuth is not compatible with a user-supplied userDataDir.&#x27;);
}
this.userDataDir &#x3D; dirPath;
this.sessionName &#x3D; sessionDirName;
await this.extractRemoteSession();
this.client.options.puppeteer &#x3D; {
...puppeteerOpts,
userDataDir: dirPath
};
}
async logout() {
await this.disconnect();
}
async destroy() {
clearInterval(this.backupSync);
}
async disconnect() {
await this.deleteRemoteSession();
let pathExists &#x3D; await this.isValidPath(this.userDataDir);
if (pathExists) {
await fs.promises.rm(this.userDataDir, {
recursive: true,
force: true
}).catch(() &#x3D;&gt; {});
}
clearInterval(this.backupSync);
}
async afterAuthReady() {
const sessionExists &#x3D; await this.store.sessionExists({session: this.sessionName});
if(!sessionExists) {
await this.delay(60000); /* Initial delay sync required for session to be stable enough to recover */
await this.storeRemoteSession({emit: true});
}
var self &#x3D; this;
this.backupSync &#x3D; setInterval(async function () {
await self.storeRemoteSession();
}, this.backupSyncIntervalMs);
}
async storeRemoteSession(options) {
/* Compress &amp;amp; Store Session */
const pathExists &#x3D; await this.isValidPath(this.userDataDir);
if (pathExists) {
await this.compressSession();
await this.store.save({session: this.sessionName});
await fs.promises.unlink(&#x60;${this.sessionName}.zip&#x60;);
await fs.promises.rm(&#x60;${this.tempDir}&#x60;, {
recursive: true,
force: true
}).catch(() &#x3D;&gt; {});
if(options &amp;amp;&amp;amp; options.emit) this.client.emit(Events.REMOTE_SESSION_SAVED);
}
}
async extractRemoteSession() {
const pathExists &#x3D; await this.isValidPath(this.userDataDir);
const compressedSessionPath &#x3D; &#x60;${this.sessionName}.zip&#x60;;
const sessionExists &#x3D; await this.store.sessionExists({session: this.sessionName});
if (pathExists) {
await fs.promises.rm(this.userDataDir, {
recursive: true,
force: true
}).catch(() &#x3D;&gt; {});
}
if (sessionExists) {
await this.store.extract({session: this.sessionName, path: compressedSessionPath});
await this.unCompressSession(compressedSessionPath);
} else {
fs.mkdirSync(this.userDataDir, { recursive: true });
}
}
async deleteRemoteSession() {
const sessionExists &#x3D; await this.store.sessionExists({session: this.sessionName});
if (sessionExists) await this.store.delete({session: this.sessionName});
}
async compressSession() {
const archive &#x3D; archiver(&#x27;zip&#x27;);
const stream &#x3D; fs.createWriteStream(&#x60;${this.sessionName}.zip&#x60;);
await fs.copy(this.userDataDir, this.tempDir).catch(() &#x3D;&gt; {});
await this.deleteMetadata();
return new Promise((resolve, reject) &#x3D;&gt; {
archive
.directory(this.tempDir, false)
.on(&#x27;error&#x27;, err &#x3D;&gt; reject(err))
.pipe(stream);
stream.on(&#x27;close&#x27;, () &#x3D;&gt; resolve());
archive.finalize();
});
}
async unCompressSession(compressedSessionPath) {
var stream &#x3D; fs.createReadStream(compressedSessionPath);
await new Promise((resolve, reject) &#x3D;&gt; {
stream.pipe(unzipper.Extract({
path: this.userDataDir
}))
.on(&#x27;error&#x27;, err &#x3D;&gt; reject(err))
.on(&#x27;finish&#x27;, () &#x3D;&gt; resolve());
});
await fs.promises.unlink(compressedSessionPath);
}
async deleteMetadata() {
const sessionDirs &#x3D; [this.tempDir, path.join(this.tempDir, &#x27;Default&#x27;)];
for (const dir of sessionDirs) {
const sessionFiles &#x3D; await fs.promises.readdir(dir);
for (const element of sessionFiles) {
if (!this.requiredDirs.includes(element)) {
const dirElement &#x3D; path.join(dir, element);
const stats &#x3D; await fs.promises.lstat(dirElement);
if (stats.isDirectory()) {
await fs.promises.rm(dirElement, {
recursive: true,
force: true
}).catch(() &#x3D;&gt; {});
} else {
await fs.promises.unlink(dirElement).catch(() &#x3D;&gt; {});
}
}
}
}
}
async isValidPath(path) {
try {
await fs.promises.access(path);
return true;
} catch {
return false;
}
}
async delay(ms) {
return new Promise(resolve &#x3D;&gt; setTimeout(resolve, ms));
}
}
module.exports &#x3D; RemoteAuth;
</code></pre>
</article>
</div>
</div>
<nav id="jsdoc-toc-nav" role="navigation"></nav>
</div>
</div>
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p>
</div>
</footer>
<script src="scripts/jquery.min.js"></script>
<script src="scripts/tree.jquery.js"></script>
<script src="scripts/prettify.js"></script>
<script src="scripts/jsdoc-toc.js"></script>
<script src="scripts/linenumber.js"></script>
<script src="scripts/scrollanchor.js"></script>
</body>
</html>

View File

@@ -4,7 +4,7 @@
<head> <head>
<meta name="generator" content="JSDoc 3.6.7"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.15.3 &raquo; Globals</title> <title>whatsapp-web.js 1.19.5 &raquo; Globals</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar"> <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container"> <div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content"> <div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -68,16 +68,22 @@
<div class="summary-content"> <div class="summary-content">
<div class="summary-column"> <div class="summary-column">
<dl class="dl-summary-callout"> <dl class="dl-summary-callout">
<dt><a href="global.html#ButtonSpec">ButtonSpec</a></dt>
<dd>
</dd>
<dt><a href="global.html#ContactId">ContactId</a></dt> <dt><a href="global.html#ContactId">ContactId</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="global.html#GroupParticipant">GroupParticipant</a></dt> <dt><a href="global.html#FormattedButtonSpec">FormattedButtonSpec</a></dt>
<dd> <dd>
</dd> </dd>
</dl> </dl>
</div> </div>
<div class="summary-column"> <div class="summary-column">
<dl class="dl-summary-callout"> <dl class="dl-summary-callout">
<dt><a href="global.html#GroupParticipant">GroupParticipant</a></dt>
<dd>
</dd>
<dt><a href="global.html#MessageInfo">MessageInfo</a></dt> <dt><a href="global.html#MessageInfo">MessageInfo</a></dt>
<dd> <dd>
</dd> </dd>
@@ -279,6 +285,19 @@
<td> <td>
</td> </td>
</tr> </tr>
<tr>
<td>
<p>MESSAGE_REACTION</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr> <tr>
<td> <td>
<p>MEDIA_UPLOADED</p> <p>MEDIA_UPLOADED</p>
@@ -344,6 +363,19 @@
<td> <td>
</td> </td>
</tr> </tr>
<tr>
<td>
<p>LOADING_SCREEN</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr> <tr>
<td> <td>
<p>DISCONNECTED</p> <p>DISCONNECTED</p>
@@ -396,6 +428,19 @@
<td> <td>
</td> </td>
</tr> </tr>
<tr>
<td>
<p>REMOTE_SESSION_SAVED</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
</tbody> </tbody>
</table> </table>
</section> </section>
@@ -862,6 +907,19 @@
<td> <td>
</td> </td>
</tr> </tr>
<tr>
<td>
<p>LIST_RESPONSE</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr> <tr>
<td> <td>
<p>BUTTONS_RESPONSE</p> <p>BUTTONS_RESPONSE</p>
@@ -888,6 +946,214 @@
<td> <td>
</td> </td>
</tr> </tr>
<tr>
<td>
<p>BROADCAST_NOTIFICATION</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>CALL_LOG</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>CIPHERTEXT</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>DEBUG</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>E2E_NOTIFICATION</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>GP2</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>GROUP_NOTIFICATION</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>HSM</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>INTERACTIVE</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>NATIVE_FLOW</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>NOTIFICATION</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>NOTIFICATION_TEMPLATE</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>OVERSIZED</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>PROTOCOL</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>REACTION</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>TEMPLATE_BUTTON_REPLY</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
</tbody> </tbody>
</table> </table>
</section> </section>
@@ -1133,6 +1399,54 @@
</section> </section>
<h2>Abstract types</h2> <h2>Abstract types</h2>
<section> <section>
<h3 id="ButtonSpec"><span class="symbol-name">ButtonSpec</span><small class="property-type">
&nbsp;Object</small></h3>
<p>Button spec used in Buttons constructor</p>
<section>
<h4>Properties</h4>
<table class="jsdoc-details-table">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Optional</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<p>id</p>
</td>
<td>
<p>string</p>
</td>
<td>
<p>Yes</p>
</td>
<td>
<p>Custom ID to set on the button. A random one will be generated if one is not passed.</p>
</td>
</tr>
<tr>
<td>
<p>body</p>
</td>
<td>
<p>string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>The text to show on the button.</p>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
</dl>
<h3 id="ContactId"><span class="symbol-name">ContactId</span><small class="property-type"> <h3 id="ContactId"><span class="symbol-name">ContactId</span><small class="property-type">
&nbsp;Object</small></h3> &nbsp;Object</small></h3>
<p>ID that represents a contact</p> <p>ID that represents a contact</p>
@@ -1192,6 +1506,64 @@
</section> </section>
<dl class="dl-compact"> <dl class="dl-compact">
</dl> </dl>
<h3 id="FormattedButtonSpec"><span class="symbol-name">FormattedButtonSpec</span><small class="property-type">
&nbsp;Object</small></h3>
<section>
<h4>Properties</h4>
<table class="jsdoc-details-table">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Optional</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<p>buttonId</p>
</td>
<td>
<p>string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>type</p>
</td>
<td>
<p>number</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>buttonText</p>
</td>
<td>
<p>Object</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
</dl>
<h3 id="GroupParticipant"><span class="symbol-name">GroupParticipant</span><small class="property-type"> <h3 id="GroupParticipant"><span class="symbol-name">GroupParticipant</span><small class="property-type">
&nbsp;Object</small></h3> &nbsp;Object</small></h3>
<p>Group participant information</p> <p>Group participant information</p>
@@ -1381,7 +1753,7 @@
<p>Yes</p> <p>Yes</p>
</td> </td>
<td> <td>
<p>Show links preview</p> <p>Show links preview. Has no effect on multi-device accounts.</p>
<p>Defaults to <code>true</code>.</p> <p>Defaults to <code>true</code>.</p>
</td> </td>
</tr> </tr>
@@ -1647,7 +2019,7 @@
<footer id="jsdoc-footer" class="jsdoc-footer"> <footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container"> <div id="jsdoc-footer-container">
<p> <p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on December 7, 2021. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -4,7 +4,7 @@
<head> <head>
<meta name="generator" content="JSDoc 3.6.7"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.15.3 &raquo; Home</title> <title>whatsapp-web.js 1.19.5 &raquo; Home</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar"> <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container"> <div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content"> <div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -27,11 +27,11 @@
<div id="jsdoc-main" role="main"> <div id="jsdoc-main" role="main">
<header class="page-header"> <header class="page-header">
<h1> <h1>
whatsapp-web.js 1.15.3 whatsapp-web.js 1.19.5
</h1> </h1>
</header> </header>
<article> <article>
<p><a href="https://www.npmjs.com/package/whatsapp-web.js"><img src="https://img.shields.io/npm/v/whatsapp-web.js.svg" alt="npm"></a> <a href="https://depfu.com/github/pedroslopez/whatsapp-web.js?project_id=9765"><img src="https://badges.depfu.com/badges/4a65a0de96ece65fdf39e294e0c8dcba/overview.svg" alt="Depfu"></a> <img src="https://img.shields.io/badge/WhatsApp_Web-2.2147.14-brightgreen.svg" alt="WhatsApp_Web 2.2147.14"> <a href="https://discord.gg/H7DqQs4"><img src="https://img.shields.io/discord/698610475432411196.svg?logo=discord" alt="Discord Chat"></a></p> <p><a href="https://www.npmjs.com/package/whatsapp-web.js"><img src="https://img.shields.io/npm/v/whatsapp-web.js.svg" alt="npm"></a> <a href="https://depfu.com/github/pedroslopez/whatsapp-web.js?project_id=9765"><img src="https://badges.depfu.com/badges/4a65a0de96ece65fdf39e294e0c8dcba/overview.svg" alt="Depfu"></a> <img src="https://img.shields.io/badge/WhatsApp_Web-2.2306.7-brightgreen.svg" alt="WhatsApp_Web 2.2306.7"> <a href="https://discord.gg/H7DqQs4"><img src="https://img.shields.io/discord/698610475432411196.svg?logo=discord" alt="Discord Chat"></a></p>
<h1>whatsapp-web.js</h1> <h1>whatsapp-web.js</h1>
<p>A WhatsApp API client that connects through the WhatsApp Web browser app</p> <p>A WhatsApp API client that connects through the WhatsApp Web browser app</p>
<p>It uses Puppeteer to run a real instance of Whatsapp Web to avoid getting blocked.</p> <p>It uses Puppeteer to run a real instance of Whatsapp Web to avoid getting blocked.</p>
@@ -69,33 +69,7 @@ client.on('message', msg => {
client.initialize(); client.initialize();
</code></pre> </code></pre>
<p>Take a look at <a href="https://github.com/pedroslopez/whatsapp-web.js/blob/master/example.js">example.js</a> for another example with more use cases.</p> <p>Take a look at <a href="https://github.com/pedroslopez/whatsapp-web.js/blob/master/example.js">example.js</a> for another example with more use cases.</p>
<h2>Remote Access</h2> <p>For more information on saving and restoring sessions, check out the available <a href="https://wwebjs.dev/guide/authentication.html">Authentication Strategies</a>.</p>
<p>You could also connect to any previously existing browser instance:</p>
<pre class="prettyprint source lang-js"><code>const client = new Client({
puppeteer: {
browserWSEndpoint: `ws://localhost:3000`
}
});
</code></pre>
<h3>Docker</h3>
<ol>
<li>Installing a browser using browserless:</li>
</ol>
<pre class="prettyprint source"><code>docker run \
--rm \
-p 3000:3000 \
-e &quot;MAX_CONCURRENT_SESSIONS=1&quot; \
browserless/chrome:latest
</code></pre>
<p>Reference: https://docs.browserless.io/docs/docker-quickstart.html</p>
<h3>Remote Debugging</h3>
<ol start="2">
<li>Running a browser with websocket remote debugging enabled:</li>
</ol>
<blockquote>
<p>chrome.exe --remote-debugging-port=9222</p>
</blockquote>
<p>After that check the following webpage and check http://127.0.0.1:9220/json and get the <strong>webSocketDebuggerUrl</strong></p>
<h2>Supported features</h2> <h2>Supported features</h2>
<table> <table>
<thead> <thead>
@@ -105,6 +79,10 @@ client.initialize();
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr>
<td>Multi Device</td>
<td></td>
</tr>
<tr> <tr>
<td>Send messages</td> <td>Send messages</td>
<td></td> <td></td>
@@ -205,14 +183,22 @@ client.initialize();
<td>Set user status message</td> <td>Set user status message</td>
<td></td> <td></td>
</tr> </tr>
<tr>
<td>React to messages</td>
<td></td>
</tr>
</tbody> </tbody>
</table> </table>
<p>Something missing? Make an issue and let us know!</p> <p>Something missing? Make an issue and let us know!</p>
<h2>Contributing</h2> <h2>Contributing</h2>
<p>Pull requests are welcome! If you see something you'd like to add, please do. For drastic changes, please open an issue first.</p> <p>Pull requests are welcome! If you see something you'd like to add, please do. For drastic changes, please open an issue first.</p>
<h2>Donating</h2> <h2>Supporting the project</h2>
<p>You can support the maintainer of this project through the link below</p> <p>You can support the maintainer of this project through the links below</p>
<p><a href="https://www.paypal.me/psla/"><img src="https://cdn.rawgit.com/twolfson/paypal-github-button/1.0.0/dist/button.svg" alt="Support via PayPal"></a></p> <ul>
<li><a href="https://github.com/sponsors/pedroslopez">Support via GitHub Sponsors</a></li>
<li><a href="https://www.paypal.me/psla/">Support via PayPal</a></li>
<li><a href="https://m.do.co/c/73f906a36ed4">Sign up for DigitalOcean</a> and get $200 in credit when you sign up (Referral)</li>
</ul>
<h2>Disclaimer</h2> <h2>Disclaimer</h2>
<p>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. &quot;WhatsApp&quot; as well as related names, marks, emblems and images are registered trademarks of their respective owners.</p> <p>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. &quot;WhatsApp&quot; as well as related names, marks, emblems and images are registered trademarks of their respective owners.</p>
<h2>License</h2> <h2>License</h2>
@@ -251,6 +237,30 @@ client.initialize();
</div> </div>
</div> </div>
</section> </section>
<section>
<div class="symbol-index-content">
<h2 id="BaseAuthStrategy">BaseAuthStrategy</h2>
<div class="symbol-index-section">
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name">
<a href="BaseAuthStrategy.html" class="!symbol-index-name">BaseAuthStrategy()</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
</dl>
</div>
</div>
</div>
</section>
<section> <section>
<div class="symbol-index-content"> <div class="symbol-index-content">
<h2 id="BusinessContact">BusinessContact</h2> <h2 id="BusinessContact">BusinessContact</h2>
@@ -282,6 +292,11 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="BusinessContact.html#getCommonGroups" class="!symbol-index-name">BusinessContact#<wbr>getCommonGroups()</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="BusinessContact.html#getCountryCode" class="!symbol-index-name">BusinessContact#<wbr>getCountryCode()</a> <a href="BusinessContact.html#getCountryCode" class="!symbol-index-name">BusinessContact#<wbr>getCountryCode()</a>
</dt> </dt>
@@ -292,15 +307,15 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="BusinessContact.html#getProfilePicUrl" class="!symbol-index-name">BusinessContact#<wbr>getProfilePicUrl()</a> <a href="BusinessContact.html#getProfilePicUrl" class="!symbol-index-name">BusinessContact#<wbr>getProfilePicUrl()</a>
</dt> </dt>
<dd> <dd>
</dd> </dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="BusinessContact.html#id" class="!symbol-index-name">BusinessContact#<wbr>id</a> <a href="BusinessContact.html#id" class="!symbol-index-name">BusinessContact#<wbr>id</a>
</dt> </dt>
@@ -336,15 +351,15 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="BusinessContact.html#isUser" class="!symbol-index-name">BusinessContact#<wbr>isUser</a> <a href="BusinessContact.html#isUser" class="!symbol-index-name">BusinessContact#<wbr>isUser</a>
</dt> </dt>
<dd> <dd>
</dd> </dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="BusinessContact.html#isWAContact" class="!symbol-index-name">BusinessContact#<wbr>isWAContact</a> <a href="BusinessContact.html#isWAContact" class="!symbol-index-name">BusinessContact#<wbr>isWAContact</a>
</dt> </dt>
@@ -483,6 +498,11 @@ client.initialize();
</div> </div>
<div class="symbol-index-column"> <div class="symbol-index-column">
<dl class="symbol-index-list"> <dl class="symbol-index-list">
<dt class="symbol-index-name">
<a href="Call.html#reject" class="!symbol-index-name">Call#<wbr>reject()</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="Call.html#timestamp" class="!symbol-index-name">Call#<wbr>timestamp</a> <a href="Call.html#timestamp" class="!symbol-index-name">Call#<wbr>timestamp</a>
</dt> </dt>
@@ -703,7 +723,7 @@ client.initialize();
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="Client.html#acceptGroupV4Invite" class="!symbol-index-name">Client#<wbr>acceptGroupV4Invite(inviteV4)</a> <a href="Client.html#acceptGroupV4Invite" class="!symbol-index-name">Client#<wbr>acceptGroupV4Invite(inviteInfo)</a>
</dt> </dt>
<dd> <dd>
</dd> </dd>
@@ -792,6 +812,11 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="Client.html#event:message_reaction" class="!symbol-index-name">Client#<wbr>event:message_reaction</a>
</dt>
<dd>
</dd>
</dl> </dl>
</div> </div>
<div class="symbol-index-column"> <div class="symbol-index-column">
@@ -841,6 +866,11 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="Client.html#getCommonGroups" class="!symbol-index-name">Client#<wbr>getCommonGroups(contactId)</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="Client.html#getContactById" class="!symbol-index-name">Client#<wbr>getContactById(contactId)</a> <a href="Client.html#getContactById" class="!symbol-index-name">Client#<wbr>getContactById(contactId)</a>
</dt> </dt>
@@ -955,6 +985,11 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="Client.html#sendPresenceUnavailable" class="!symbol-index-name">Client#<wbr>sendPresenceUnavailable()</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="Client.html#sendSeen" class="!symbol-index-name">Client#<wbr>sendSeen(chatId)</a> <a href="Client.html#sendSeen" class="!symbol-index-name">Client#<wbr>sendSeen(chatId)</a>
</dt> </dt>
@@ -1070,6 +1105,11 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="Contact.html#getCommonGroups" class="!symbol-index-name">Contact#<wbr>getCommonGroups()</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="Contact.html#getCountryCode" class="!symbol-index-name">Contact#<wbr>getCountryCode()</a> <a href="Contact.html#getCountryCode" class="!symbol-index-name">Contact#<wbr>getCountryCode()</a>
</dt> </dt>
@@ -1124,15 +1164,15 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="Contact.html#isUser" class="!symbol-index-name">Contact#<wbr>isUser</a> <a href="Contact.html#isUser" class="!symbol-index-name">Contact#<wbr>isUser</a>
</dt> </dt>
<dd> <dd>
</dd> </dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="Contact.html#isWAContact" class="!symbol-index-name">Contact#<wbr>isWAContact</a> <a href="Contact.html#isWAContact" class="!symbol-index-name">Contact#<wbr>isWAContact</a>
</dt> </dt>
@@ -1204,20 +1244,25 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="global.html#Events#.GROUP_UPDATE" class="!symbol-index-name">Events.<wbr>GROUP_UPDATE</a> <a href="global.html#Events#.GROUP_UPDATE" class="!symbol-index-name">Events.<wbr>GROUP_UPDATE</a>
</dt> </dt>
<dd> <dd>
</dd> </dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="global.html#Events#.INCOMING_CALL" class="!symbol-index-name">Events.<wbr>INCOMING_CALL</a> <a href="global.html#Events#.INCOMING_CALL" class="!symbol-index-name">Events.<wbr>INCOMING_CALL</a>
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="global.html#Events#.LOADING_SCREEN" class="!symbol-index-name">Events.<wbr>LOADING_SCREEN</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="global.html#Events#.MEDIA_UPLOADED" class="!symbol-index-name">Events.<wbr>MEDIA_UPLOADED</a> <a href="global.html#Events#.MEDIA_UPLOADED" class="!symbol-index-name">Events.<wbr>MEDIA_UPLOADED</a>
</dt> </dt>
@@ -1233,6 +1278,11 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="global.html#Events#.MESSAGE_REACTION" class="!symbol-index-name">Events.<wbr>MESSAGE_REACTION</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="global.html#Events#.MESSAGE_RECEIVED" class="!symbol-index-name">Events.<wbr>MESSAGE_RECEIVED</a> <a href="global.html#Events#.MESSAGE_RECEIVED" class="!symbol-index-name">Events.<wbr>MESSAGE_RECEIVED</a>
</dt> </dt>
@@ -1262,6 +1312,11 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="global.html#Events#.REMOTE_SESSION_SAVED" class="!symbol-index-name">Events.<wbr>REMOTE_SESSION_SAVED</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="global.html#Events#.STATE_CHANGED" class="!symbol-index-name">Events.<wbr>STATE_CHANGED</a> <a href="global.html#Events#.STATE_CHANGED" class="!symbol-index-name">Events.<wbr>STATE_CHANGED</a>
</dt> </dt>
@@ -1767,6 +1822,30 @@ client.initialize();
</div> </div>
</div> </div>
</section> </section>
<section>
<div class="symbol-index-content">
<h2 id="LegacySessionAuth">LegacySessionAuth</h2>
<div class="symbol-index-section">
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name">
<a href="LegacySessionAuth.html" class="!symbol-index-name">LegacySessionAuth(options)</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
</dl>
</div>
</div>
</div>
</section>
<section> <section>
<div class="symbol-index-content"> <div class="symbol-index-content">
<h2 id="List">List</h2> <h2 id="List">List</h2>
@@ -1821,6 +1900,30 @@ client.initialize();
</div> </div>
</div> </div>
</section> </section>
<section>
<div class="symbol-index-content">
<h2 id="LocalAuth">LocalAuth</h2>
<div class="symbol-index-section">
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name">
<a href="LocalAuth.html" class="!symbol-index-name">LocalAuth(options)</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
</dl>
</div>
</div>
</div>
</section>
<section> <section>
<div class="symbol-index-content"> <div class="symbol-index-content">
<h2 id="Location">Location</h2> <h2 id="Location">Location</h2>
@@ -1911,6 +2014,11 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="Message.html#duration" class="!symbol-index-name">Message#<wbr>duration</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="Message.html#forward" class="!symbol-index-name">Message#<wbr>forward(chat)</a> <a href="Message.html#forward" class="!symbol-index-name">Message#<wbr>forward(chat)</a>
</dt> </dt>
@@ -1936,15 +2044,15 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="Message.html#getContact" class="!symbol-index-name">Message#<wbr>getContact()</a> <a href="Message.html#getContact" class="!symbol-index-name">Message#<wbr>getContact()</a>
</dt> </dt>
<dd> <dd>
</dd> </dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="Message.html#getInfo" class="!symbol-index-name">Message#<wbr>getInfo()</a> <a href="Message.html#getInfo" class="!symbol-index-name">Message#<wbr>getInfo()</a>
</dt> </dt>
@@ -1990,11 +2098,21 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="Message.html#isEphemeral" class="!symbol-index-name">Message#<wbr>isEphemeral</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="Message.html#isForwarded" class="!symbol-index-name">Message#<wbr>isForwarded</a> <a href="Message.html#isForwarded" class="!symbol-index-name">Message#<wbr>isForwarded</a>
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="Message.html#isGif" class="!symbol-index-name">Message#<wbr>isGif</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="Message.html#isStarred" class="!symbol-index-name">Message#<wbr>isStarred</a> <a href="Message.html#isStarred" class="!symbol-index-name">Message#<wbr>isStarred</a>
</dt> </dt>
@@ -2010,15 +2128,15 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="Message.html#location" class="!symbol-index-name">Message#<wbr>location</a> <a href="Message.html#location" class="!symbol-index-name">Message#<wbr>location</a>
</dt> </dt>
<dd> <dd>
</dd> </dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="Message.html#mediaKey" class="!symbol-index-name">Message#<wbr>mediaKey</a> <a href="Message.html#mediaKey" class="!symbol-index-name">Message#<wbr>mediaKey</a>
</dt> </dt>
@@ -2034,6 +2152,21 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="Message.html#rawData" class="!symbol-index-name">Message#<wbr>rawData</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="Message.html#react" class="!symbol-index-name">Message#<wbr>react(reaction)</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="Message.html#reload" class="!symbol-index-name">Message#<wbr>reload()</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="Message.html#reply" class="!symbol-index-name">Message#<wbr>reply(content[, chatId][, options])</a> <a href="Message.html#reply" class="!symbol-index-name">Message#<wbr>reply(content[, chatId][, options])</a>
</dt> </dt>
@@ -2135,7 +2268,7 @@ client.initialize();
<div class="symbol-index-column"> <div class="symbol-index-column">
<dl class="symbol-index-list"> <dl class="symbol-index-list">
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="MessageMedia.html" class="!symbol-index-name">MessageMedia(mimetype, data, filename)</a> <a href="MessageMedia.html" class="!symbol-index-name">MessageMedia(mimetype, data, filename, filesize)</a>
</dt> </dt>
<dd> <dd>
</dd> </dd>
@@ -2144,29 +2277,34 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="MessageMedia.html#.fromUrl" class="!symbol-index-name">MessageMedia.<wbr>fromUrl(url[, options])</a> <a href="MessageMedia.html#.fromUrl" class="!symbol-index-name">MessageMedia.<wbr>fromUrl(url[, options])</a>
</dt> </dt>
<dd> <dd>
</dd> </dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="MessageMedia.html#data" class="!symbol-index-name">MessageMedia#<wbr>data</a> <a href="MessageMedia.html#data" class="!symbol-index-name">MessageMedia#<wbr>data</a>
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="MessageMedia.html#filename" class="!symbol-index-name">MessageMedia#<wbr>filename</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="MessageMedia.html#filesize" class="!symbol-index-name">MessageMedia#<wbr>filesize</a>
</dt>
<dd>
</dd>
</dl> </dl>
</div> </div>
<div class="symbol-index-column"> <div class="symbol-index-column">
<dl class="symbol-index-list"> <dl class="symbol-index-list">
<dt class="symbol-index-name">
<a href="MessageMedia.html#filename" class="!symbol-index-name">MessageMedia#<wbr>filename</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="MessageMedia.html#mimetype" class="!symbol-index-name">MessageMedia#<wbr>mimetype</a> <a href="MessageMedia.html#mimetype" class="!symbol-index-name">MessageMedia#<wbr>mimetype</a>
</dt> </dt>
@@ -2188,11 +2326,26 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="global.html#MessageTypes#.BROADCAST_NOTIFICATION" class="!symbol-index-name">MessageTypes.<wbr>BROADCAST_NOTIFICATION</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="global.html#MessageTypes#.BUTTONS_RESPONSE" class="!symbol-index-name">MessageTypes.<wbr>BUTTONS_RESPONSE</a> <a href="global.html#MessageTypes#.BUTTONS_RESPONSE" class="!symbol-index-name">MessageTypes.<wbr>BUTTONS_RESPONSE</a>
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="global.html#MessageTypes#.CALL_LOG" class="!symbol-index-name">MessageTypes.<wbr>CALL_LOG</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="global.html#MessageTypes#.CIPHERTEXT" class="!symbol-index-name">MessageTypes.<wbr>CIPHERTEXT</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="global.html#MessageTypes#.CONTACT_CARD" class="!symbol-index-name">MessageTypes.<wbr>CONTACT_CARD</a> <a href="global.html#MessageTypes#.CONTACT_CARD" class="!symbol-index-name">MessageTypes.<wbr>CONTACT_CARD</a>
</dt> </dt>
@@ -2203,11 +2356,26 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="global.html#MessageTypes#.DEBUG" class="!symbol-index-name">MessageTypes.<wbr>DEBUG</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="global.html#MessageTypes#.DOCUMENT" class="!symbol-index-name">MessageTypes.<wbr>DOCUMENT</a> <a href="global.html#MessageTypes#.DOCUMENT" class="!symbol-index-name">MessageTypes.<wbr>DOCUMENT</a>
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="global.html#MessageTypes#.E2E_NOTIFICATION" class="!symbol-index-name">MessageTypes.<wbr>E2E_NOTIFICATION</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="global.html#MessageTypes#.GP2" class="!symbol-index-name">MessageTypes.<wbr>GP2</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="global.html#MessageTypes#.GROUP_INVITE" class="!symbol-index-name">MessageTypes.<wbr>GROUP_INVITE</a> <a href="global.html#MessageTypes#.GROUP_INVITE" class="!symbol-index-name">MessageTypes.<wbr>GROUP_INVITE</a>
</dt> </dt>
@@ -2217,26 +2385,70 @@ client.initialize();
</div> </div>
<div class="symbol-index-column"> <div class="symbol-index-column">
<dl class="symbol-index-list"> <dl class="symbol-index-list">
<dt class="symbol-index-name">
<a href="global.html#MessageTypes#.GROUP_NOTIFICATION" class="!symbol-index-name">MessageTypes.<wbr>GROUP_NOTIFICATION</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="global.html#MessageTypes#.HSM" class="!symbol-index-name">MessageTypes.<wbr>HSM</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="global.html#MessageTypes#.IMAGE" class="!symbol-index-name">MessageTypes.<wbr>IMAGE</a> <a href="global.html#MessageTypes#.IMAGE" class="!symbol-index-name">MessageTypes.<wbr>IMAGE</a>
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="global.html#MessageTypes#.INTERACTIVE" class="!symbol-index-name">MessageTypes.<wbr>INTERACTIVE</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="global.html#MessageTypes#.LIST" class="!symbol-index-name">MessageTypes.<wbr>LIST</a> <a href="global.html#MessageTypes#.LIST" class="!symbol-index-name">MessageTypes.<wbr>LIST</a>
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="global.html#MessageTypes#.LIST_RESPONSE" class="!symbol-index-name">MessageTypes.<wbr>LIST_RESPONSE</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="global.html#MessageTypes#.LOCATION" class="!symbol-index-name">MessageTypes.<wbr>LOCATION</a> <a href="global.html#MessageTypes#.LOCATION" class="!symbol-index-name">MessageTypes.<wbr>LOCATION</a>
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="global.html#MessageTypes#.NATIVE_FLOW" class="!symbol-index-name">MessageTypes.<wbr>NATIVE_FLOW</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="global.html#MessageTypes#.NOTIFICATION" class="!symbol-index-name">MessageTypes.<wbr>NOTIFICATION</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="global.html#MessageTypes#.NOTIFICATION_TEMPLATE" class="!symbol-index-name">MessageTypes.<wbr>NOTIFICATION_TEMPLATE</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="global.html#MessageTypes#.ORDER" class="!symbol-index-name">MessageTypes.<wbr>ORDER</a> <a href="global.html#MessageTypes#.ORDER" class="!symbol-index-name">MessageTypes.<wbr>ORDER</a>
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="global.html#MessageTypes#.OVERSIZED" class="!symbol-index-name">MessageTypes.<wbr>OVERSIZED</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="global.html#MessageTypes#.PAYMENT" class="!symbol-index-name">MessageTypes.<wbr>PAYMENT</a> <a href="global.html#MessageTypes#.PAYMENT" class="!symbol-index-name">MessageTypes.<wbr>PAYMENT</a>
</dt> </dt>
@@ -2247,10 +2459,16 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
</dl> <dt class="symbol-index-name">
</div> <a href="global.html#MessageTypes#.PROTOCOL" class="!symbol-index-name">MessageTypes.<wbr>PROTOCOL</a>
<div class="symbol-index-column"> </dt>
<dl class="symbol-index-list"> <dd>
</dd>
<dt class="symbol-index-name">
<a href="global.html#MessageTypes#.REACTION" class="!symbol-index-name">MessageTypes.<wbr>REACTION</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="global.html#MessageTypes#.REVOKED" class="!symbol-index-name">MessageTypes.<wbr>REVOKED</a> <a href="global.html#MessageTypes#.REVOKED" class="!symbol-index-name">MessageTypes.<wbr>REVOKED</a>
</dt> </dt>
@@ -2261,6 +2479,11 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="global.html#MessageTypes#.TEMPLATE_BUTTON_REPLY" class="!symbol-index-name">MessageTypes.<wbr>TEMPLATE_BUTTON_REPLY</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="global.html#MessageTypes#.TEXT" class="!symbol-index-name">MessageTypes.<wbr>TEXT</a> <a href="global.html#MessageTypes#.TEXT" class="!symbol-index-name">MessageTypes.<wbr>TEXT</a>
</dt> </dt>
@@ -2286,6 +2509,30 @@ client.initialize();
</div> </div>
</div> </div>
</section> </section>
<section>
<div class="symbol-index-content">
<h2 id="NoAuth">NoAuth</h2>
<div class="symbol-index-section">
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name">
<a href="NoAuth.html" class="!symbol-index-name">NoAuth()</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
</dl>
</div>
</div>
</div>
</section>
<section> <section>
<div class="symbol-index-content"> <div class="symbol-index-content">
<h2 id="Order">Order</h2> <h2 id="Order">Order</h2>
@@ -2574,6 +2821,11 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="PrivateContact.html#getCommonGroups" class="!symbol-index-name">PrivateContact#<wbr>getCommonGroups()</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="PrivateContact.html#getCountryCode" class="!symbol-index-name">PrivateContact#<wbr>getCountryCode()</a> <a href="PrivateContact.html#getCountryCode" class="!symbol-index-name">PrivateContact#<wbr>getCountryCode()</a>
</dt> </dt>
@@ -2628,15 +2880,15 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="PrivateContact.html#isUser" class="!symbol-index-name">PrivateContact#<wbr>isUser</a> <a href="PrivateContact.html#isUser" class="!symbol-index-name">PrivateContact#<wbr>isUser</a>
</dt> </dt>
<dd> <dd>
</dd> </dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="PrivateContact.html#isWAContact" class="!symbol-index-name">PrivateContact#<wbr>isWAContact</a> <a href="PrivateContact.html#isWAContact" class="!symbol-index-name">PrivateContact#<wbr>isWAContact</a>
</dt> </dt>
@@ -2770,6 +3022,99 @@ client.initialize();
</div> </div>
</div> </div>
</section> </section>
<section>
<div class="symbol-index-content">
<h2 id="Reaction">Reaction</h2>
<div class="symbol-index-section">
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name">
<a href="Reaction.html" class="!symbol-index-name">Reaction()</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="Reaction.html#ack" class="!symbol-index-name">Reaction#<wbr>ack</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="Reaction.html#id" class="!symbol-index-name">Reaction#<wbr>id</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="Reaction.html#msgId" class="!symbol-index-name">Reaction#<wbr>msgId</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name">
<a href="Reaction.html#orphan" class="!symbol-index-name">Reaction#<wbr>orphan</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="Reaction.html#orphanReason" class="!symbol-index-name">Reaction#<wbr>orphanReason</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="Reaction.html#reaction" class="!symbol-index-name">Reaction#<wbr>reaction</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="Reaction.html#read" class="!symbol-index-name">Reaction#<wbr>read</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name">
<a href="Reaction.html#senderId" class="!symbol-index-name">Reaction#<wbr>senderId</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="Reaction.html#timestamp" class="!symbol-index-name">Reaction#<wbr>timestamp</a>
</dt>
<dd>
</dd>
</dl>
</div>
</div>
</div>
</section>
<section>
<div class="symbol-index-content">
<h2 id="RemoteAuth">RemoteAuth</h2>
<div class="symbol-index-section">
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name">
<a href="RemoteAuth.html" class="!symbol-index-name">RemoteAuth(options)</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
</dl>
</div>
</div>
</div>
</section>
<section> <section>
<div class="symbol-index-content"> <div class="symbol-index-content">
<h2 id="Status">Status</h2> <h2 id="Status">Status</h2>
@@ -2936,7 +3281,7 @@ client.initialize();
<footer id="jsdoc-footer" class="jsdoc-footer"> <footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container"> <div id="jsdoc-footer-container">
<p> <p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on December 7, 2021. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -6,7 +6,7 @@
treeNode.tree({ treeNode.tree({
autoEscape: false, autoEscape: false,
closedIcon: '&#x21e2;', closedIcon: '&#x21e2;',
data: [{"label":"<a href=\"global.html\">Globals</a>","id":"global","children":[]},{"label":"<a href=\"Base.html\">Base</a>","id":"Base","children":[]},{"label":"<a href=\"BusinessContact.html\">BusinessContact</a>","id":"BusinessContact","children":[]},{"label":"<a href=\"Buttons.html\">Buttons</a>","id":"Buttons","children":[]},{"label":"<a href=\"Call.html\">Call</a>","id":"Call","children":[]},{"label":"<a href=\"Chat.html\">Chat</a>","id":"Chat","children":[]},{"label":"<a href=\"Client.html\">Client</a>","id":"Client","children":[]},{"label":"<a href=\"ClientInfo.html\">ClientInfo</a>","id":"ClientInfo","children":[]},{"label":"<a href=\"Contact.html\">Contact</a>","id":"Contact","children":[]},{"label":"<a href=\"GroupChat.html\">GroupChat</a>","id":"GroupChat","children":[]},{"label":"<a href=\"GroupNotification.html\">GroupNotification</a>","id":"GroupNotification","children":[]},{"label":"<a href=\"InterfaceController.html\">InterfaceController</a>","id":"InterfaceController","children":[]},{"label":"<a href=\"Label.html\">Label</a>","id":"Label","children":[]},{"label":"<a href=\"List.html\">List</a>","id":"List","children":[]},{"label":"<a href=\"Location.html\">Location</a>","id":"Location","children":[]},{"label":"<a href=\"Message.html\">Message</a>","id":"Message","children":[]},{"label":"<a href=\"MessageMedia.html\">MessageMedia</a>","id":"MessageMedia","children":[]},{"label":"<a href=\"Order.html\">Order</a>","id":"Order","children":[]},{"label":"<a href=\"PrivateChat.html\">PrivateChat</a>","id":"PrivateChat","children":[]},{"label":"<a href=\"PrivateContact.html\">PrivateContact</a>","id":"PrivateContact","children":[]},{"label":"<a href=\"Product.html\">Product</a>","id":"Product","children":[]},{"label":"<a href=\"Util.html\">Util</a>","id":"Util","children":[]}], data: [{"label":"<a href=\"global.html\">Globals</a>","id":"global","children":[]},{"label":"<a href=\"Base.html\">Base</a>","id":"Base","children":[]},{"label":"<a href=\"BaseAuthStrategy.html\">BaseAuthStrategy</a>","id":"BaseAuthStrategy","children":[]},{"label":"<a href=\"BusinessContact.html\">BusinessContact</a>","id":"BusinessContact","children":[]},{"label":"<a href=\"Buttons.html\">Buttons</a>","id":"Buttons","children":[]},{"label":"<a href=\"Call.html\">Call</a>","id":"Call","children":[]},{"label":"<a href=\"Chat.html\">Chat</a>","id":"Chat","children":[]},{"label":"<a href=\"Client.html\">Client</a>","id":"Client","children":[]},{"label":"<a href=\"ClientInfo.html\">ClientInfo</a>","id":"ClientInfo","children":[]},{"label":"<a href=\"Contact.html\">Contact</a>","id":"Contact","children":[]},{"label":"<a href=\"GroupChat.html\">GroupChat</a>","id":"GroupChat","children":[]},{"label":"<a href=\"GroupNotification.html\">GroupNotification</a>","id":"GroupNotification","children":[]},{"label":"<a href=\"InterfaceController.html\">InterfaceController</a>","id":"InterfaceController","children":[]},{"label":"<a href=\"Label.html\">Label</a>","id":"Label","children":[]},{"label":"<a href=\"LegacySessionAuth.html\">LegacySessionAuth</a>","id":"LegacySessionAuth","children":[]},{"label":"<a href=\"List.html\">List</a>","id":"List","children":[]},{"label":"<a href=\"LocalAuth.html\">LocalAuth</a>","id":"LocalAuth","children":[]},{"label":"<a href=\"Location.html\">Location</a>","id":"Location","children":[]},{"label":"<a href=\"Message.html\">Message</a>","id":"Message","children":[]},{"label":"<a href=\"MessageMedia.html\">MessageMedia</a>","id":"MessageMedia","children":[]},{"label":"<a href=\"NoAuth.html\">NoAuth</a>","id":"NoAuth","children":[]},{"label":"<a href=\"Order.html\">Order</a>","id":"Order","children":[]},{"label":"<a href=\"PrivateChat.html\">PrivateChat</a>","id":"PrivateChat","children":[]},{"label":"<a href=\"PrivateContact.html\">PrivateContact</a>","id":"PrivateContact","children":[]},{"label":"<a href=\"Product.html\">Product</a>","id":"Product","children":[]},{"label":"<a href=\"Reaction.html\">Reaction</a>","id":"Reaction","children":[]},{"label":"<a href=\"RemoteAuth.html\">RemoteAuth</a>","id":"RemoteAuth","children":[]},{"label":"<a href=\"Util.html\">Util</a>","id":"Util","children":[]}],
openedIcon: ' &#x21e3;', openedIcon: ' &#x21e3;',
saveState: false, saveState: false,
useContextMenu: false useContextMenu: false

View File

@@ -4,7 +4,7 @@
<head> <head>
<meta name="generator" content="JSDoc 3.6.7"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.15.3 &raquo; Source: structures/Base.js</title> <title>whatsapp-web.js 1.19.5 &raquo; Source: structures/Base.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar"> <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container"> <div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content"> <div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -60,7 +60,7 @@ module.exports &#x3D; Base;</code></pre>
<footer id="jsdoc-footer" class="jsdoc-footer"> <footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container"> <div id="jsdoc-footer-container">
<p> <p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on December 7, 2021. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -4,7 +4,7 @@
<head> <head>
<meta name="generator" content="JSDoc 3.6.7"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.15.3 &raquo; Source: structures/BusinessContact.js</title> <title>whatsapp-web.js 1.19.5 &raquo; Source: structures/BusinessContact.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar"> <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container"> <div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content"> <div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -59,7 +59,7 @@ module.exports &#x3D; BusinessContact;</code></pre>
<footer id="jsdoc-footer" class="jsdoc-footer"> <footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container"> <div id="jsdoc-footer-container">
<p> <p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on December 7, 2021. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -4,7 +4,7 @@
<head> <head>
<meta name="generator" content="JSDoc 3.6.7"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.15.3 &raquo; Source: structures/Buttons.js</title> <title>whatsapp-web.js 1.19.5 &raquo; Source: structures/Buttons.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar"> <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container"> <div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content"> <div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -34,13 +34,27 @@
const MessageMedia &#x3D; require(&#x27;./MessageMedia&#x27;); const MessageMedia &#x3D; require(&#x27;./MessageMedia&#x27;);
const Util &#x3D; require(&#x27;../util/Util&#x27;); const Util &#x3D; require(&#x27;../util/Util&#x27;);
/**
* Button spec used in Buttons constructor
* @typedef {Object} ButtonSpec
* @property {string&#x3D;} id - Custom ID to set on the button. A random one will be generated if one is not passed.
* @property {string} body - The text to show on the button.
*/
/**
* @typedef {Object} FormattedButtonSpec
* @property {string} buttonId
* @property {number} type
* @property {Object} buttonText
*/
/** /**
* Message type buttons * Message type buttons
*/ */
class Buttons { class Buttons {
/** /**
* @param {string|MessageMedia} body * @param {string|MessageMedia} body
* @param {Array&amp;lt;Array&amp;lt;string&gt;&gt;} buttons * @param {ButtonSpec[]} buttons - See {@link ButtonSpec}
* @param {string?} title * @param {string?} title
* @param {string?} footer * @param {string?} footer
*/ */
@@ -72,7 +86,7 @@ class Buttons {
/** /**
* buttons of message * buttons of message
* @type {Array&amp;lt;Array&amp;lt;string&gt;&gt;} * @type {FormattedButtonSpec[]}
*/ */
this.buttons &#x3D; this._format(buttons); this.buttons &#x3D; this._format(buttons);
if(!this.buttons.length){ throw &#x27;[BT01] No buttons&#x27;;} if(!this.buttons.length){ throw &#x27;[BT01] No buttons&#x27;;}
@@ -81,8 +95,8 @@ class Buttons {
/** /**
* Creates button array from simple array * Creates button array from simple array
* @param {Array&amp;lt;Array&amp;lt;string&gt;&gt;} buttons * @param {ButtonSpec[]} buttons
* @returns {Array&amp;lt;Array&amp;lt;string&gt;&gt;} * @returns {FormattedButtonSpec[]}
* @example * @example
* Input: [{id:&#x27;customId&#x27;,body:&#x27;button1&#x27;},{body:&#x27;button2&#x27;},{body:&#x27;button3&#x27;},{body:&#x27;button4&#x27;}] * Input: [{id:&#x27;customId&#x27;,body:&#x27;button1&#x27;},{body:&#x27;button2&#x27;},{body:&#x27;button3&#x27;},{body:&#x27;button4&#x27;}]
* Returns: [{ buttonId:&#x27;customId&#x27;,buttonText:{&#x27;displayText&#x27;:&#x27;button1&#x27;},type: 1 },{buttonId:&#x27;n3XKsL&#x27;,buttonText:{&#x27;displayText&#x27;:&#x27;button2&#x27;},type:1},{buttonId:&#x27;NDJk0a&#x27;,buttonText:{&#x27;displayText&#x27;:&#x27;button3&#x27;},type:1}] * Returns: [{ buttonId:&#x27;customId&#x27;,buttonText:{&#x27;displayText&#x27;:&#x27;button1&#x27;},type: 1 },{buttonId:&#x27;n3XKsL&#x27;,buttonText:{&#x27;displayText&#x27;:&#x27;button2&#x27;},type:1},{buttonId:&#x27;NDJk0a&#x27;,buttonText:{&#x27;displayText&#x27;:&#x27;button3&#x27;},type:1}]
@@ -106,7 +120,7 @@ module.exports &#x3D; Buttons;</code></pre>
<footer id="jsdoc-footer" class="jsdoc-footer"> <footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container"> <div id="jsdoc-footer-container">
<p> <p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on December 7, 2021. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -4,7 +4,7 @@
<head> <head>
<meta name="generator" content="JSDoc 3.6.7"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.15.3 &raquo; Source: structures/Call.js</title> <title>whatsapp-web.js 1.19.5 &raquo; Source: structures/Call.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar"> <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container"> <div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content"> <div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -93,7 +93,15 @@ class Call extends Base {
return super._patch(data); return super._patch(data);
} }
/**
* Reject the call
*/
async reject() {
return this.client.pupPage.evaluate((peerJid, id) &#x3D;&gt; {
return window.WWebJS.rejectCall(peerJid, id);
}, this.from, this.id);
}
} }
module.exports &#x3D; Call;</code></pre> module.exports &#x3D; Call;</code></pre>
@@ -106,7 +114,7 @@ module.exports &#x3D; Call;</code></pre>
<footer id="jsdoc-footer" class="jsdoc-footer"> <footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container"> <div id="jsdoc-footer-container">
<p> <p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on December 7, 2021. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -4,7 +4,7 @@
<head> <head>
<meta name="generator" content="JSDoc 3.6.7"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.15.3 &raquo; Source: structures/Chat.js</title> <title>whatsapp-web.js 1.19.5 &raquo; Source: structures/Chat.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar"> <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container"> <div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content"> <div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -96,7 +96,7 @@ class Chat extends Base {
/** /**
* Indicates if the chat is muted or not * Indicates if the chat is muted or not
* @type {number} * @type {boolean}
*/ */
this.isMuted &#x3D; data.isMuted; this.isMuted &#x3D; data.isMuted;
@@ -201,31 +201,42 @@ class Chat extends Base {
/** /**
* Loads chat messages, sorted from earliest to latest. * Loads chat messages, sorted from earliest to latest.
* @param {Object} searchOptions Options for searching messages. Right now only limit is supported. * @param {Object} searchOptions Options for searching messages. Right now only limit and fromMe is supported.
* @param {Number} [searchOptions.limit&#x3D;50] The amount of messages to return. Note that the actual number of returned messages may be smaller if there aren&#x27;t enough messages in the conversation. Set this to Infinity to load all messages. * @param {Number} [searchOptions.limit] The amount of messages to return. If no limit is specified, the available messages will be returned. Note that the actual number of returned messages may be smaller if there aren&#x27;t enough messages in the conversation. Set this to Infinity to load all messages.
* @param {Boolean} [searchOptions.fromMe] Return only messages from the bot number or vise versa. To get all messages, leave the option undefined.
* @returns {Promise&amp;lt;Array&amp;lt;Message&gt;&gt;} * @returns {Promise&amp;lt;Array&amp;lt;Message&gt;&gt;}
*/ */
async fetchMessages(searchOptions) { async fetchMessages(searchOptions) {
if (!searchOptions || !searchOptions.limit) { let messages &#x3D; await this.client.pupPage.evaluate(async (chatId, searchOptions) &#x3D;&gt; {
searchOptions &#x3D; { limit: 50 }; const msgFilter &#x3D; (m) &#x3D;&gt; {
} if (m.isNotification) {
let messages &#x3D; await this.client.pupPage.evaluate(async (chatId, limit) &#x3D;&gt; { return false; // dont include notification messages
const msgFilter &#x3D; m &#x3D;&gt; !m.isNotification; // dont include notification messages }
if (searchOptions &amp;amp;&amp;amp; searchOptions.fromMe &amp;amp;&amp;amp; m.id.fromMe !&#x3D;&#x3D; searchOptions.fromMe) {
return false;
}
return true;
};
const chat &#x3D; window.Store.Chat.get(chatId); const chat &#x3D; window.Store.Chat.get(chatId);
let msgs &#x3D; chat.msgs.models.filter(msgFilter); let msgs &#x3D; chat.msgs.getModelsArray().filter(msgFilter);
while (msgs.length &amp;lt; limit) { if (searchOptions &amp;amp;&amp;amp; searchOptions.limit &gt; 0) {
const loadedMessages &#x3D; await chat.loadEarlierMsgs(); while (msgs.length &amp;lt; searchOptions.limit) {
if (!loadedMessages) break; const loadedMessages &#x3D; await window.Store.ConversationMsgs.loadEarlierMsgs(chat);
msgs &#x3D; [...loadedMessages.filter(msgFilter), ...msgs]; if (!loadedMessages || !loadedMessages.length) break;
msgs &#x3D; [...loadedMessages.filter(msgFilter), ...msgs];
}
if (msgs.length &gt; searchOptions.limit) {
msgs.sort((a, b) &#x3D;&gt; (a.t &gt; b.t) ? 1 : -1);
msgs &#x3D; msgs.splice(msgs.length - searchOptions.limit);
}
} }
msgs.sort((a, b) &#x3D;&gt; (a.t &gt; b.t) ? 1 : -1);
if (msgs.length &gt; limit) msgs &#x3D; msgs.splice(msgs.length - limit);
return msgs.map(m &#x3D;&gt; window.WWebJS.getMessageModel(m)); return msgs.map(m &#x3D;&gt; window.WWebJS.getMessageModel(m));
}, this.id._serialized, searchOptions.limit); }, this.id._serialized, searchOptions);
return messages.map(m &#x3D;&gt; new Message(this.client, m)); return messages.map(m &#x3D;&gt; new Message(this.client, m));
} }
@@ -288,7 +299,7 @@ module.exports &#x3D; Chat;
<footer id="jsdoc-footer" class="jsdoc-footer"> <footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container"> <div id="jsdoc-footer-container">
<p> <p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on December 7, 2021. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -4,7 +4,7 @@
<head> <head>
<meta name="generator" content="JSDoc 3.6.7"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.15.3 &raquo; Source: structures/ClientInfo.js</title> <title>whatsapp-web.js 1.19.5 &raquo; Source: structures/ClientInfo.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar"> <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container"> <div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content"> <div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -51,12 +51,6 @@ class ClientInfo extends Base {
*/ */
this.pushname &#x3D; data.pushname; this.pushname &#x3D; data.pushname;
/**
* @type {object}
* @deprecated Use .wid instead
*/
this.me &#x3D; data.wid;
/** /**
* Current user ID * Current user ID
* @type {object} * @type {object}
@@ -64,18 +58,25 @@ class ClientInfo extends Base {
this.wid &#x3D; data.wid; this.wid &#x3D; data.wid;
/** /**
* Information about the phone this client is connected to * @type {object}
* @deprecated Use .wid instead
*/
this.me &#x3D; data.wid;
/**
* Information about the phone this client is connected to. Not available in multi-device.
* @type {object} * @type {object}
* @property {string} wa_version WhatsApp Version running on the phone * @property {string} wa_version WhatsApp Version running on the phone
* @property {string} os_version OS Version running on the phone (iOS or Android version) * @property {string} os_version OS Version running on the phone (iOS or Android version)
* @property {string} device_manufacturer Device manufacturer * @property {string} device_manufacturer Device manufacturer
* @property {string} device_model Device model * @property {string} device_model Device model
* @property {string} os_build_number OS build number * @property {string} os_build_number OS build number
* @deprecated
*/ */
this.phone &#x3D; data.phone; this.phone &#x3D; data.phone;
/** /**
* Platform the phone is running on * Platform WhatsApp is running on
* @type {string} * @type {string}
*/ */
this.platform &#x3D; data.platform; this.platform &#x3D; data.platform;
@@ -88,6 +89,7 @@ class ClientInfo extends Base {
* @returns {object} batteryStatus * @returns {object} batteryStatus
* @returns {number} batteryStatus.battery - The current battery percentage * @returns {number} batteryStatus.battery - The current battery percentage
* @returns {boolean} batteryStatus.plugged - Indicates if the phone is plugged in (true) or not (false) * @returns {boolean} batteryStatus.plugged - Indicates if the phone is plugged in (true) or not (false)
* @deprecated
*/ */
async getBatteryStatus() { async getBatteryStatus() {
return await this.client.pupPage.evaluate(() &#x3D;&gt; { return await this.client.pupPage.evaluate(() &#x3D;&gt; {
@@ -95,7 +97,6 @@ class ClientInfo extends Base {
return { battery, plugged }; return { battery, plugged };
}); });
} }
} }
module.exports &#x3D; ClientInfo;</code></pre> module.exports &#x3D; ClientInfo;</code></pre>
@@ -108,7 +109,7 @@ module.exports &#x3D; ClientInfo;</code></pre>
<footer id="jsdoc-footer" class="jsdoc-footer"> <footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container"> <div id="jsdoc-footer-container">
<p> <p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on December 7, 2021. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -4,7 +4,7 @@
<head> <head>
<meta name="generator" content="JSDoc 3.6.7"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.15.3 &raquo; Source: structures/Contact.js</title> <title>whatsapp-web.js 1.19.5 &raquo; Source: structures/Contact.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar"> <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container"> <div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content"> <div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -214,7 +214,8 @@ class Contact extends Base {
*/ */
async getAbout() { async getAbout() {
const about &#x3D; await this.client.pupPage.evaluate(async (contactId) &#x3D;&gt; { const about &#x3D; await this.client.pupPage.evaluate(async (contactId) &#x3D;&gt; {
return window.Store.Wap.statusFind(contactId); const wid &#x3D; window.Store.WidFactory.createWid(contactId);
return window.Store.StatusUtils.getStatus(wid);
}, this.id._serialized); }, this.id._serialized);
if (typeof about.status !&#x3D;&#x3D; &#x27;string&#x27;) if (typeof about.status !&#x3D;&#x3D; &#x27;string&#x27;)
@@ -222,6 +223,14 @@ class Contact extends Base {
return about.status; return about.status;
} }
/**
* Gets the Contact&#x27;s common groups with you. Returns empty array if you don&#x27;t have any common group.
* @returns {Promise&amp;lt;WAWebJS.ChatId[]&gt;}
*/
async getCommonGroups() {
return await this.client.getCommonGroups(this.id._serialized);
}
} }
@@ -236,7 +245,7 @@ module.exports &#x3D; Contact;
<footer id="jsdoc-footer" class="jsdoc-footer"> <footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container"> <div id="jsdoc-footer-container">
<p> <p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on December 7, 2021. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -4,7 +4,7 @@
<head> <head>
<meta name="generator" content="JSDoc 3.6.7"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.15.3 &raquo; Source: structures/GroupChat.js</title> <title>whatsapp-web.js 1.19.5 &raquo; Source: structures/GroupChat.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar"> <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container"> <div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content"> <div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -90,8 +90,15 @@ class GroupChat extends Chat {
* @returns {Promise&amp;lt;Object&gt;} * @returns {Promise&amp;lt;Object&gt;}
*/ */
async addParticipants(participantIds) { async addParticipants(participantIds) {
return await this.client.pupPage.evaluate((chatId, participantIds) &#x3D;&gt; { return await this.client.pupPage.evaluate(async (chatId, participantIds) &#x3D;&gt; {
return window.Store.Wap.addParticipants(chatId, participantIds); const chatWid &#x3D; window.Store.WidFactory.createWid(chatId);
const chat &#x3D; await window.Store.Chat.find(chatWid);
const participants &#x3D; await Promise.all(participantIds.map(async p &#x3D;&gt; {
const wid &#x3D; 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); }, this.id._serialized, participantIds);
} }
@@ -101,8 +108,14 @@ class GroupChat extends Chat {
* @returns {Promise&amp;lt;Object&gt;} * @returns {Promise&amp;lt;Object&gt;}
*/ */
async removeParticipants(participantIds) { async removeParticipants(participantIds) {
return await this.client.pupPage.evaluate((chatId, participantIds) &#x3D;&gt; { return await this.client.pupPage.evaluate(async (chatId, participantIds) &#x3D;&gt; {
return window.Store.Wap.removeParticipants(chatId, participantIds); const chatWid &#x3D; window.Store.WidFactory.createWid(chatId);
const chat &#x3D; await window.Store.Chat.find(chatWid);
const participants &#x3D; participantIds.map(p &#x3D;&gt; {
return chat.groupMetadata.participants.get(p);
}).filter(p &#x3D;&gt; Boolean(p));
await window.Store.GroupParticipants.removeParticipants(chat, participants);
return { status: 200 };
}, this.id._serialized, participantIds); }, this.id._serialized, participantIds);
} }
@@ -112,8 +125,14 @@ class GroupChat extends Chat {
* @returns {Promise&amp;lt;{ status: number }&gt;} Object with status code indicating if the operation was successful * @returns {Promise&amp;lt;{ status: number }&gt;} Object with status code indicating if the operation was successful
*/ */
async promoteParticipants(participantIds) { async promoteParticipants(participantIds) {
return await this.client.pupPage.evaluate((chatId, participantIds) &#x3D;&gt; { return await this.client.pupPage.evaluate(async (chatId, participantIds) &#x3D;&gt; {
return window.Store.Wap.promoteParticipants(chatId, participantIds); const chatWid &#x3D; window.Store.WidFactory.createWid(chatId);
const chat &#x3D; await window.Store.Chat.find(chatWid);
const participants &#x3D; participantIds.map(p &#x3D;&gt; {
return chat.groupMetadata.participants.get(p);
}).filter(p &#x3D;&gt; Boolean(p));
await window.Store.GroupParticipants.promoteParticipants(chat, participants);
return { status: 200 };
}, this.id._serialized, participantIds); }, this.id._serialized, participantIds);
} }
@@ -123,54 +142,81 @@ class GroupChat extends Chat {
* @returns {Promise&amp;lt;{ status: number }&gt;} Object with status code indicating if the operation was successful * @returns {Promise&amp;lt;{ status: number }&gt;} Object with status code indicating if the operation was successful
*/ */
async demoteParticipants(participantIds) { async demoteParticipants(participantIds) {
return await this.client.pupPage.evaluate((chatId, participantIds) &#x3D;&gt; { return await this.client.pupPage.evaluate(async (chatId, participantIds) &#x3D;&gt; {
return window.Store.Wap.demoteParticipants(chatId, participantIds); const chatWid &#x3D; window.Store.WidFactory.createWid(chatId);
const chat &#x3D; await window.Store.Chat.find(chatWid);
const participants &#x3D; participantIds.map(p &#x3D;&gt; {
return chat.groupMetadata.participants.get(p);
}).filter(p &#x3D;&gt; Boolean(p));
await window.Store.GroupParticipants.demoteParticipants(chat, participants);
return { status: 200 };
}, this.id._serialized, participantIds); }, this.id._serialized, participantIds);
} }
/** /**
* Updates the group subject * Updates the group subject
* @param {string} subject * @param {string} subject
* @returns {Promise} * @returns {Promise&amp;lt;boolean&gt;} Returns true if the subject was properly updated. This can return false if the user does not have the necessary permissions.
*/ */
async setSubject(subject) { async setSubject(subject) {
let res &#x3D; await this.client.pupPage.evaluate((chatId, subject) &#x3D;&gt; { const success &#x3D; await this.client.pupPage.evaluate(async (chatId, subject) &#x3D;&gt; {
return window.Store.Wap.changeSubject(chatId, subject); const chatWid &#x3D; window.Store.WidFactory.createWid(chatId);
try {
await window.Store.GroupUtils.setGroupSubject(chatWid, subject);
return true;
} catch (err) {
if(err.name &#x3D;&#x3D;&#x3D; &#x27;ServerStatusCodeError&#x27;) return false;
throw err;
}
}, this.id._serialized, subject); }, this.id._serialized, subject);
if(res.status &#x3D;&#x3D; 200) { if(!success) return false;
this.name &#x3D; subject; this.name &#x3D; subject;
} return true;
} }
/** /**
* Updates the group description * Updates the group description
* @param {string} description * @param {string} description
* @returns {Promise} * @returns {Promise&amp;lt;boolean&gt;} Returns true if the description was properly updated. This can return false if the user does not have the necessary permissions.
*/ */
async setDescription(description) { async setDescription(description) {
let res &#x3D; await this.client.pupPage.evaluate((chatId, description) &#x3D;&gt; { const success &#x3D; await this.client.pupPage.evaluate(async (chatId, description) &#x3D;&gt; {
let descId &#x3D; window.Store.GroupMetadata.get(chatId).descId; const chatWid &#x3D; window.Store.WidFactory.createWid(chatId);
return window.Store.Wap.setGroupDescription(chatId, description, window.Store.genId(), descId); let descId &#x3D; window.Store.GroupMetadata.get(chatWid).descId;
try {
await window.Store.GroupUtils.setGroupDescription(chatWid, description, window.Store.MsgKey.newId(), descId);
return true;
} catch (err) {
if(err.name &#x3D;&#x3D;&#x3D; &#x27;ServerStatusCodeError&#x27;) return false;
throw err;
}
}, this.id._serialized, description); }, this.id._serialized, description);
if (res.status &#x3D;&#x3D; 200) { if(!success) return false;
this.groupMetadata.desc &#x3D; description; this.groupMetadata.desc &#x3D; description;
} return true;
} }
/** /**
* Updates the group settings to only allow admins to send messages. * Updates the group settings to only allow admins to send messages.
* @param {boolean} [adminsOnly&#x3D;true] Enable or disable this option * @param {boolean} [adminsOnly&#x3D;true] Enable or disable this option
* @returns {Promise&amp;lt;boolean&gt;} Returns true if the setting was properly updated. This can return false if the user does not have the necessary permissions. * @returns {Promise&amp;lt;boolean&gt;} Returns true if the setting was properly updated. This can return false if the user does not have the necessary permissions.
*/ */
async setMessagesAdminsOnly(adminsOnly&#x3D;true) { async setMessagesAdminsOnly(adminsOnly&#x3D;true) {
let res &#x3D; await this.client.pupPage.evaluate((chatId, value) &#x3D;&gt; { const success &#x3D; await this.client.pupPage.evaluate(async (chatId, adminsOnly) &#x3D;&gt; {
return window.Store.Wap.setGroupProperty(chatId, &#x27;announcement&#x27;, value); const chatWid &#x3D; window.Store.WidFactory.createWid(chatId);
try {
await window.Store.GroupUtils.setGroupProperty(chatWid, &#x27;announcement&#x27;, adminsOnly ? 1 : 0);
return true;
} catch (err) {
if(err.name &#x3D;&#x3D;&#x3D; &#x27;ServerStatusCodeError&#x27;) return false;
throw err;
}
}, this.id._serialized, adminsOnly); }, this.id._serialized, adminsOnly);
if (res.status !&#x3D;&#x3D; 200) return false; if(!success) return false;
this.groupMetadata.announce &#x3D; adminsOnly; this.groupMetadata.announce &#x3D; adminsOnly;
return true; return true;
} }
@@ -181,11 +227,18 @@ class GroupChat extends Chat {
* @returns {Promise&amp;lt;boolean&gt;} Returns true if the setting was properly updated. This can return false if the user does not have the necessary permissions. * @returns {Promise&amp;lt;boolean&gt;} Returns true if the setting was properly updated. This can return false if the user does not have the necessary permissions.
*/ */
async setInfoAdminsOnly(adminsOnly&#x3D;true) { async setInfoAdminsOnly(adminsOnly&#x3D;true) {
let res &#x3D; await this.client.pupPage.evaluate((chatId, value) &#x3D;&gt; { const success &#x3D; await this.client.pupPage.evaluate(async (chatId, adminsOnly) &#x3D;&gt; {
return window.Store.Wap.setGroupProperty(chatId, &#x27;restrict&#x27;, value); const chatWid &#x3D; window.Store.WidFactory.createWid(chatId);
try {
await window.Store.GroupUtils.setGroupProperty(chatWid, &#x27;restrict&#x27;, adminsOnly ? 1 : 0);
return true;
} catch (err) {
if(err.name &#x3D;&#x3D;&#x3D; &#x27;ServerStatusCodeError&#x27;) return false;
throw err;
}
}, this.id._serialized, adminsOnly); }, this.id._serialized, adminsOnly);
if (res.status !&#x3D;&#x3D; 200) return false; if(!success) return false;
this.groupMetadata.restrict &#x3D; adminsOnly; this.groupMetadata.restrict &#x3D; adminsOnly;
return true; return true;
@@ -196,25 +249,25 @@ class GroupChat extends Chat {
* @returns {Promise&amp;lt;string&gt;} Group&#x27;s invite code * @returns {Promise&amp;lt;string&gt;} Group&#x27;s invite code
*/ */
async getInviteCode() { async getInviteCode() {
let res &#x3D; await this.client.pupPage.evaluate(chatId &#x3D;&gt; { const codeRes &#x3D; await this.client.pupPage.evaluate(async chatId &#x3D;&gt; {
return window.Store.Wap.groupInviteCode(chatId); const chatWid &#x3D; window.Store.WidFactory.createWid(chatId);
return window.Store.Invite.queryGroupInviteCode(chatWid);
}, this.id._serialized); }, this.id._serialized);
if (res.status &#x3D;&#x3D; 200) { return codeRes.code;
return res.code;
}
throw new Error(&#x27;Not authorized&#x27;);
} }
/** /**
* Invalidates the current group invite code and generates a new one * Invalidates the current group invite code and generates a new one
* @returns {Promise} * @returns {Promise&amp;lt;string&gt;} New invite code
*/ */
async revokeInvite() { async revokeInvite() {
return await this.client.pupPage.evaluate(chatId &#x3D;&gt; { const codeRes &#x3D; await this.client.pupPage.evaluate(chatId &#x3D;&gt; {
return window.Store.Wap.revokeGroupInvite(chatId); const chatWid &#x3D; window.Store.WidFactory.createWid(chatId);
return window.Store.Invite.resetGroupInviteCode(chatWid);
}, this.id._serialized); }, this.id._serialized);
return codeRes.code;
} }
/** /**
@@ -222,8 +275,10 @@ class GroupChat extends Chat {
* @returns {Promise} * @returns {Promise}
*/ */
async leave() { async leave() {
return await this.client.pupPage.evaluate(chatId &#x3D;&gt; { await this.client.pupPage.evaluate(async chatId &#x3D;&gt; {
return window.Store.Wap.leaveGroup(chatId); const chatWid &#x3D; window.Store.WidFactory.createWid(chatId);
const chat &#x3D; await window.Store.Chat.find(chatWid);
return window.Store.GroupUtils.sendExitGroup(chat);
}, this.id._serialized); }, this.id._serialized);
} }
@@ -239,7 +294,7 @@ module.exports &#x3D; GroupChat;</code></pre>
<footer id="jsdoc-footer" class="jsdoc-footer"> <footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container"> <div id="jsdoc-footer-container">
<p> <p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on December 7, 2021. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -4,7 +4,7 @@
<head> <head>
<meta name="generator" content="JSDoc 3.6.7"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.15.3 &raquo; Source: structures/GroupNotification.js</title> <title>whatsapp-web.js 1.19.5 &raquo; Source: structures/GroupNotification.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar"> <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container"> <div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content"> <div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -74,7 +74,7 @@ class GroupNotification extends Base {
* *
* @type {string} * @type {string}
*/ */
this.chatId &#x3D; typeof (data.to) &#x3D;&#x3D;&#x3D; &#x27;object&#x27; ? data.to._serialized : data.to; this.chatId &#x3D; typeof (data.id.remote) &#x3D;&#x3D;&#x3D; &#x27;object&#x27; ? data.id.remote._serialized : data.id.remote;
/** /**
* ContactId for the user that produced the GroupNotification. * ContactId for the user that produced the GroupNotification.
@@ -143,7 +143,7 @@ module.exports &#x3D; GroupNotification;
<footer id="jsdoc-footer" class="jsdoc-footer"> <footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container"> <div id="jsdoc-footer-container">
<p> <p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on December 7, 2021. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -4,7 +4,7 @@
<head> <head>
<meta name="generator" content="JSDoc 3.6.7"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.15.3 &raquo; Source: structures/Label.js</title> <title>whatsapp-web.js 1.19.5 &raquo; Source: structures/Label.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar"> <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container"> <div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content"> <div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -88,7 +88,7 @@ module.exports &#x3D; Label;</code></pre>
<footer id="jsdoc-footer" class="jsdoc-footer"> <footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container"> <div id="jsdoc-footer-container">
<p> <p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on December 7, 2021. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -4,7 +4,7 @@
<head> <head>
<meta name="generator" content="JSDoc 3.6.7"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.15.3 &raquo; Source: structures/List.js</title> <title>whatsapp-web.js 1.19.5 &raquo; Source: structures/List.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar"> <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container"> <div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content"> <div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -88,7 +88,7 @@ class List {
*/ */
_format(sections){ _format(sections){
if(!sections.length){throw &#x27;[LT02] List without sections&#x27;;} if(!sections.length){throw &#x27;[LT02] List without sections&#x27;;}
if(sections.length &gt; 1){throw &#x27;[LT05] Lists with more than one section are having problems&#x27;;} if(sections.length &gt; 1 &amp;amp;&amp;amp; sections.filter(s &#x3D;&gt; typeof s.title &#x3D;&#x3D; &#x27;undefined&#x27;).length &gt; 1){throw &#x27;[LT05] You can\&#x27;t have more than one empty title.&#x27;;}
return sections.map( (section) &#x3D;&gt;{ return sections.map( (section) &#x3D;&gt;{
if(!section.rows.length){throw &#x27;[LT03] Section without rows&#x27;;} if(!section.rows.length){throw &#x27;[LT03] Section without rows&#x27;;}
return { return {
@@ -107,7 +107,8 @@ class List {
} }
module.exports &#x3D; List;</code></pre> module.exports &#x3D; List;
</code></pre>
</article> </article>
</div> </div>
</div> </div>
@@ -117,7 +118,7 @@ module.exports &#x3D; List;</code></pre>
<footer id="jsdoc-footer" class="jsdoc-footer"> <footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container"> <div id="jsdoc-footer-container">
<p> <p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on December 7, 2021. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -4,7 +4,7 @@
<head> <head>
<meta name="generator" content="JSDoc 3.6.7"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.15.3 &raquo; Source: structures/Location.js</title> <title>whatsapp-web.js 1.19.5 &raquo; Source: structures/Location.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar"> <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container"> <div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content"> <div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -71,7 +71,7 @@ module.exports &#x3D; Location;</code></pre>
<footer id="jsdoc-footer" class="jsdoc-footer"> <footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container"> <div id="jsdoc-footer-container">
<p> <p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on December 7, 2021. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -4,7 +4,7 @@
<head> <head>
<meta name="generator" content="JSDoc 3.6.7"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.15.3 &raquo; Source: structures/Message.js</title> <title>whatsapp-web.js 1.19.5 &raquo; Source: structures/Message.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar"> <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container"> <div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content"> <div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -50,13 +50,14 @@ class Message extends Base {
} }
_patch(data) { _patch(data) {
this._data &#x3D; data;
/** /**
* MediaKey that represents the sticker &#x27;ID&#x27; * MediaKey that represents the sticker &#x27;ID&#x27;
* @type {string} * @type {string}
*/ */
this.mediaKey &#x3D; data.mediaKey; this.mediaKey &#x3D; data.mediaKey;
/** /**
* ID that represents the message * ID that represents the message
* @type {object} * @type {object}
@@ -81,7 +82,7 @@ class Message extends Base {
*/ */
this.body &#x3D; this.hasMedia ? data.caption || &#x27;&#x27; : data.body || &#x27;&#x27;; this.body &#x3D; this.hasMedia ? data.caption || &#x27;&#x27; : data.body || &#x27;&#x27;;
/** /**
* Message type * Message type
* @type {MessageTypes} * @type {MessageTypes}
*/ */
@@ -101,9 +102,9 @@ class Message extends Base {
/** /**
* ID for who this message is for. * ID for who this message is for.
* *
* If the message is sent by the current user, it will be the Chat to which the message is being sent. * If the message is sent by the current user, it will be the Chat to which the message is being sent.
* If the message is sent by another user, it will be the ID for the current user. * If the message is sent by another user, it will be the ID for the current user.
* @type {string} * @type {string}
*/ */
this.to &#x3D; (typeof (data.to) &#x3D;&#x3D;&#x3D; &#x27;object&#x27; &amp;amp;&amp;amp; data.to !&#x3D;&#x3D; null) ? data.to._serialized : data.to; this.to &#x3D; (typeof (data.to) &#x3D;&#x3D;&#x3D; &#x27;object&#x27; &amp;amp;&amp;amp; data.to !&#x3D;&#x3D; null) ? data.to._serialized : data.to;
@@ -118,8 +119,8 @@ class Message extends Base {
* String that represents from which device type the message was sent * String that represents from which device type the message was sent
* @type {string} * @type {string}
*/ */
this.deviceType &#x3D; data.id.id.length &gt; 21 ? &#x27;android&#x27; : data.id.id.substring(0,2) &#x3D;&#x3D;&#x27;3A&#x27; ? &#x27;ios&#x27; : &#x27;web&#x27;; this.deviceType &#x3D; data.id.id.length &gt; 21 ? &#x27;android&#x27; : data.id.id.substring(0, 2) &#x3D;&#x3D; &#x27;3A&#x27; ? &#x27;ios&#x27; : &#x27;web&#x27;;
/** /**
* Indicates if the message was forwarded * Indicates if the message was forwarded
* @type {boolean} * @type {boolean}
@@ -145,14 +146,14 @@ class Message extends Base {
* @type {boolean} * @type {boolean}
*/ */
this.isStarred &#x3D; data.star; this.isStarred &#x3D; data.star;
/** /**
* Indicates if the message was a broadcast * Indicates if the message was a broadcast
* @type {boolean} * @type {boolean}
*/ */
this.broadcast &#x3D; data.broadcast; this.broadcast &#x3D; data.broadcast;
/** /**
* Indicates if the message was sent by the current user * Indicates if the message was sent by the current user
* @type {boolean} * @type {boolean}
*/ */
@@ -164,6 +165,12 @@ class Message extends Base {
*/ */
this.hasQuotedMsg &#x3D; data.quotedMsg ? true : false; this.hasQuotedMsg &#x3D; data.quotedMsg ? true : false;
/**
* Indicates the duration of the message in seconds
* @type {string}
*/
this.duration &#x3D; data.duration ? data.duration : undefined;
/** /**
* Location information contained in the message, if the message is type &quot;location&quot; * Location information contained in the message, if the message is type &quot;location&quot;
* @type {Location} * @type {Location}
@@ -188,7 +195,7 @@ class Message extends Base {
fromId: data.from._serialized, fromId: data.from._serialized,
toId: data.to._serialized toId: data.to._serialized
} : undefined; } : undefined;
/** /**
* Indicates the mentions in the message body. * Indicates the mentions in the message body.
* @type {Array&amp;lt;string&gt;} * @type {Array&amp;lt;string&gt;}
@@ -210,6 +217,18 @@ class Message extends Base {
*/ */
this.token &#x3D; data.token ? data.token : undefined; this.token &#x3D; data.token ? data.token : undefined;
/**
* Indicates whether the message is a Gif
* @type {boolean}
*/
this.isGif &#x3D; Boolean(data.isGif);
/**
* Indicates if the message will disappear after it expires
* @type {boolean}
*/
this.isEphemeral &#x3D; data.isEphemeral;
/** Title */ /** Title */
if (data.title) { if (data.title) {
this.title &#x3D; data.title; this.title &#x3D; data.title;
@@ -233,7 +252,7 @@ class Message extends Base {
/** /**
* Links included in the message. * Links included in the message.
* @type {Array&amp;lt;{link: string, isSuspicious: boolean}&gt;} * @type {Array&amp;lt;{link: string, isSuspicious: boolean}&gt;}
* *
*/ */
this.links &#x3D; data.links; this.links &#x3D; data.links;
@@ -241,7 +260,7 @@ class Message extends Base {
if (data.dynamicReplyButtons) { if (data.dynamicReplyButtons) {
this.dynamicReplyButtons &#x3D; data.dynamicReplyButtons; this.dynamicReplyButtons &#x3D; data.dynamicReplyButtons;
} }
/** Selected Button Id **/ /** Selected Button Id **/
if (data.selectedButtonId) { if (data.selectedButtonId) {
this.selectedButtonId &#x3D; data.selectedButtonId; this.selectedButtonId &#x3D; data.selectedButtonId;
@@ -251,7 +270,7 @@ class Message extends Base {
if (data.listResponse &amp;amp;&amp;amp; data.listResponse.singleSelectReply.selectedRowId) { if (data.listResponse &amp;amp;&amp;amp; data.listResponse.singleSelectReply.selectedRowId) {
this.selectedRowId &#x3D; data.listResponse.singleSelectReply.selectedRowId; this.selectedRowId &#x3D; data.listResponse.singleSelectReply.selectedRowId;
} }
return super._patch(data); return super._patch(data);
} }
@@ -259,6 +278,32 @@ class Message extends Base {
return this.fromMe ? this.to : this.from; return this.fromMe ? this.to : this.from;
} }
/**
* Reloads this Message object&#x27;s data in-place with the latest values from WhatsApp Web.
* Note that the Message must still be in the web app cache for this to work, otherwise will return null.
* @returns {Promise&amp;lt;Message&gt;}
*/
async reload() {
const newData &#x3D; await this.client.pupPage.evaluate((msgId) &#x3D;&gt; {
const msg &#x3D; window.Store.Msg.get(msgId);
if(!msg) return null;
return window.WWebJS.getMessageModel(msg);
}, this.id._serialized);
if(!newData) return null;
this._patch(newData);
return this;
}
/**
* Returns message in a raw format
* @type {Object}
*/
get rawData() {
return this._data;
}
/** /**
* Returns the Chat this message was sent in * Returns the Chat this message was sent in
* @returns {Promise&amp;lt;Chat&gt;} * @returns {Promise&amp;lt;Chat&gt;}
@@ -291,20 +336,21 @@ class Message extends Base {
if (!this.hasQuotedMsg) return undefined; if (!this.hasQuotedMsg) return undefined;
const quotedMsg &#x3D; await this.client.pupPage.evaluate((msgId) &#x3D;&gt; { const quotedMsg &#x3D; await this.client.pupPage.evaluate((msgId) &#x3D;&gt; {
let msg &#x3D; window.Store.Msg.get(msgId); const msg &#x3D; window.Store.Msg.get(msgId);
return msg.quotedMsgObj().serialize(); const quotedMsg &#x3D; window.Store.QuotedMsg.getQuotedMsgObj(msg);
return window.WWebJS.getMessageModel(quotedMsg);
}, this.id._serialized); }, this.id._serialized);
return new Message(this.client, quotedMsg); return new Message(this.client, quotedMsg);
} }
/** /**
* Sends a message as a reply to this message. If chatId is specified, it will be sent * Sends a message as a reply to this message. If chatId is specified, it will be sent
* through the specified Chat. If not, it will send the message * through the specified Chat. If not, it will send the message
* in the same Chat as the original message was sent. * in the same Chat as the original message was sent.
* *
* @param {string|MessageMedia|Location} content * @param {string|MessageMedia|Location} content
* @param {string} [chatId] * @param {string} [chatId]
* @param {MessageSendOptions} [options] * @param {MessageSendOptions} [options]
* @returns {Promise&amp;lt;Message&gt;} * @returns {Promise&amp;lt;Message&gt;}
*/ */
@@ -321,6 +367,20 @@ class Message extends Base {
return this.client.sendMessage(chatId, content, options); return this.client.sendMessage(chatId, content, options);
} }
/**
* React to this message with an emoji
* @param {string} reaction - Emoji to react with. Send an empty string to remove the reaction.
* @return {Promise}
*/
async react(reaction){
await this.client.pupPage.evaluate(async (messageId, reaction) &#x3D;&gt; {
if (!messageId) { return undefined; }
const msg &#x3D; await window.Store.Msg.get(messageId);
await window.Store.sendReactionToMsg(msg, reaction);
}, this.id._serialized, reaction);
}
/** /**
* Accept Group V4 Invite * Accept Group V4 Invite
* @returns {Promise&amp;lt;Object&gt;} * @returns {Promise&amp;lt;Object&gt;}
@@ -328,10 +388,10 @@ class Message extends Base {
async acceptGroupV4Invite() { async acceptGroupV4Invite() {
return await this.client.acceptGroupV4Invite(this.inviteV4); return await this.client.acceptGroupV4Invite(this.inviteV4);
} }
/** /**
* Forwards this message to another chat * Forwards this message to another chat (that you chatted before, otherwise it will fail)
* *
* @param {string|Chat} chat Chat model or chat ID to which the message will be forwarded * @param {string|Chat} chat Chat model or chat ID to which the message will be forwarded
* @returns {Promise} * @returns {Promise}
*/ */
@@ -357,11 +417,13 @@ class Message extends Base {
const result &#x3D; await this.client.pupPage.evaluate(async (msgId) &#x3D;&gt; { const result &#x3D; await this.client.pupPage.evaluate(async (msgId) &#x3D;&gt; {
const msg &#x3D; window.Store.Msg.get(msgId); const msg &#x3D; window.Store.Msg.get(msgId);
if (!msg) {
return undefined;
}
if (msg.mediaData.mediaStage !&#x3D; &#x27;RESOLVED&#x27;) { if (msg.mediaData.mediaStage !&#x3D; &#x27;RESOLVED&#x27;) {
// try to resolve media // try to resolve media
await msg.downloadMedia({ await msg.downloadMedia({
downloadEvenIfExpensive: true, downloadEvenIfExpensive: true,
rmrReason: 1 rmrReason: 1
}); });
} }
@@ -372,7 +434,7 @@ class Message extends Base {
} }
try { try {
const decryptedMedia &#x3D; await window.Store.DownloadManager.downloadAndDecrypt({ const decryptedMedia &#x3D; await window.Store.DownloadManager.downloadAndMaybeDecrypt({
directPath: msg.directPath, directPath: msg.directPath,
encFilehash: msg.encFilehash, encFilehash: msg.encFilehash,
filehash: msg.filehash, filehash: msg.filehash,
@@ -381,13 +443,14 @@ class Message extends Base {
type: msg.type, type: msg.type,
signal: (new AbortController).signal signal: (new AbortController).signal
}); });
const data &#x3D; window.WWebJS.arrayBufferToBase64(decryptedMedia); const data &#x3D; await window.WWebJS.arrayBufferToBase64Async(decryptedMedia);
return { return {
data, data,
mimetype: msg.mimetype, mimetype: msg.mimetype,
filename: msg.filename filename: msg.filename,
filesize: msg.size
}; };
} catch (e) { } catch (e) {
if(e.status &amp;amp;&amp;amp; e.status &#x3D;&#x3D;&#x3D; 404) return undefined; if(e.status &amp;amp;&amp;amp; e.status &#x3D;&#x3D;&#x3D; 404) return undefined;
@@ -396,19 +459,20 @@ class Message extends Base {
}, this.id._serialized); }, this.id._serialized);
if (!result) return undefined; if (!result) return undefined;
return new MessageMedia(result.mimetype, result.data, result.filename); return new MessageMedia(result.mimetype, result.data, result.filename, result.filesize);
} }
/** /**
* Deletes a message from the chat * Deletes a message from the chat
* @param {?boolean} everyone If true and the message is sent by the current user, will delete it for everyone in the chat. * @param {?boolean} everyone If true and the message is sent by the current user or the user is an admin, will delete it for everyone in the chat.
*/ */
async delete(everyone) { async delete(everyone) {
await this.client.pupPage.evaluate((msgId, everyone) &#x3D;&gt; { await this.client.pupPage.evaluate((msgId, everyone) &#x3D;&gt; {
let msg &#x3D; window.Store.Msg.get(msgId); let msg &#x3D; window.Store.Msg.get(msgId);
if (everyone &amp;amp;&amp;amp; msg.id.fromMe &amp;amp;&amp;amp; msg.canRevoke()) { const canRevoke &#x3D; window.Store.MsgActionChecks.canSenderRevokeMsg(msg) || window.Store.MsgActionChecks.canAdminRevokeMsg(msg);
return window.Store.Cmd.sendRevokeMsgs(msg.chat, [msg], true); if (everyone &amp;amp;&amp;amp; canRevoke) {
return window.Store.Cmd.sendRevokeMsgs(msg.chat, [msg], { type: msg.id.fromMe ? &#x27;Sender&#x27; : &#x27;Admin&#x27; });
} }
return window.Store.Cmd.sendDeleteMsgs(msg.chat, [msg], true); return window.Store.Cmd.sendDeleteMsgs(msg.chat, [msg], true);
@@ -422,8 +486,8 @@ class Message extends Base {
await this.client.pupPage.evaluate((msgId) &#x3D;&gt; { await this.client.pupPage.evaluate((msgId) &#x3D;&gt; {
let msg &#x3D; window.Store.Msg.get(msgId); let msg &#x3D; window.Store.Msg.get(msgId);
if (msg.canStar()) { if (window.Store.MsgActionChecks.canStarMsg(msg)) {
return msg.chat.sendStarMsgs([msg], true); return window.Store.Cmd.sendStarMsgs(msg.chat, [msg], false);
} }
}, this.id._serialized); }, this.id._serialized);
} }
@@ -435,8 +499,8 @@ class Message extends Base {
await this.client.pupPage.evaluate((msgId) &#x3D;&gt; { await this.client.pupPage.evaluate((msgId) &#x3D;&gt; {
let msg &#x3D; window.Store.Msg.get(msgId); let msg &#x3D; window.Store.Msg.get(msgId);
if (msg.canStar()) { if (window.Store.MsgActionChecks.canStarMsg(msg)) {
return msg.chat.sendStarMsgs([msg], false); return window.Store.Cmd.sendUnstarMsgs(msg.chat, [msg], false);
} }
}, this.id._serialized); }, this.id._serialized);
} }
@@ -459,14 +523,10 @@ class Message extends Base {
async getInfo() { async getInfo() {
const info &#x3D; await this.client.pupPage.evaluate(async (msgId) &#x3D;&gt; { const info &#x3D; await this.client.pupPage.evaluate(async (msgId) &#x3D;&gt; {
const msg &#x3D; window.Store.Msg.get(msgId); const msg &#x3D; window.Store.Msg.get(msgId);
if(!msg) return null; if (!msg) return null;
return await window.Store.Wap.queryMsgInfo(msg.id);
}, this.id._serialized);
if(info.status) { return await window.Store.MessageInfo.sendQueryMsgInfo(msg.id);
return null; }, this.id._serialized);
}
return info; return info;
} }
@@ -477,9 +537,9 @@ class Message extends Base {
*/ */
async getOrder() { async getOrder() {
if (this.type &#x3D;&#x3D;&#x3D; MessageTypes.ORDER) { if (this.type &#x3D;&#x3D;&#x3D; MessageTypes.ORDER) {
const result &#x3D; await this.client.pupPage.evaluate((orderId, token) &#x3D;&gt; { const result &#x3D; await this.client.pupPage.evaluate((orderId, token, chatId) &#x3D;&gt; {
return window.WWebJS.getOrderDetail(orderId, token); return window.WWebJS.getOrderDetail(orderId, token, chatId);
}, this.orderId, this.token); }, this.orderId, this.token, this._getChatId());
if (!result) return undefined; if (!result) return undefined;
return new Order(this.client, result); return new Order(this.client, result);
} }
@@ -513,7 +573,7 @@ module.exports &#x3D; Message;
<footer id="jsdoc-footer" class="jsdoc-footer"> <footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container"> <div id="jsdoc-footer-container">
<p> <p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on December 7, 2021. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -4,7 +4,7 @@
<head> <head>
<meta name="generator" content="JSDoc 3.6.7"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.15.3 &raquo; Source: structures/MessageMedia.js</title> <title>whatsapp-web.js 1.19.5 &raquo; Source: structures/MessageMedia.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar"> <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container"> <div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content"> <div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -41,10 +41,11 @@ const { URL } &#x3D; require(&#x27;url&#x27;);
* Media attached to a message * Media attached to a message
* @param {string} mimetype MIME type of the attachment * @param {string} mimetype MIME type of the attachment
* @param {string} data Base64-encoded data of the file * @param {string} data Base64-encoded data of the file
* @param {?string} filename Document file name * @param {?string} filename Document file name. Value can be null
* @param {?number} filesize Document file size in bytes. Value can be null
*/ */
class MessageMedia { class MessageMedia {
constructor(mimetype, data, filename) { constructor(mimetype, data, filename, filesize) {
/** /**
* MIME type of the attachment * MIME type of the attachment
* @type {string} * @type {string}
@@ -58,10 +59,16 @@ class MessageMedia {
this.data &#x3D; data; this.data &#x3D; data;
/** /**
* Name of the file (for documents) * Document file name. Value can be null
* @type {?string} * @type {?string}
*/ */
this.filename &#x3D; filename; this.filename &#x3D; filename;
/**
* Document file size in bytes. Value can be null
* @type {?number}
*/
this.filesize &#x3D; filesize;
} }
/** /**
@@ -81,29 +88,30 @@ class MessageMedia {
* Creates a MessageMedia instance from a URL * Creates a MessageMedia instance from a URL
* @param {string} url * @param {string} url
* @param {Object} [options] * @param {Object} [options]
* @param {number} [options.unsafeMime&#x3D;false] * @param {boolean} [options.unsafeMime&#x3D;false]
* @param {string} [options.filename]
* @param {object} [options.client] * @param {object} [options.client]
* @param {object} [options.reqOptions] * @param {object} [options.reqOptions]
* @param {number} [options.reqOptions.size&#x3D;0] * @param {number} [options.reqOptions.size&#x3D;0]
* @returns {Promise&amp;lt;MessageMedia&gt;} * @returns {Promise&amp;lt;MessageMedia&gt;}
*/ */
static async fromUrl(url, options &#x3D; {}) { static async fromUrl(url, options &#x3D; {}) {
let mimetype; const pUrl &#x3D; new URL(url);
let mimetype &#x3D; mime.getType(pUrl.pathname);
if (!options.unsafeMime) { if (!mimetype &amp;amp;&amp;amp; !options.unsafeMime)
const pUrl &#x3D; new URL(url); throw new Error(&#x27;Unable to determine MIME type using URL. Set unsafeMime to true to download it anyway.&#x27;);
mimetype &#x3D; mime.getType(pUrl.pathname);
if (!mimetype)
throw new Error(&#x27;Unable to determine MIME type&#x27;);
}
async function fetchData (url, options) { async function fetchData (url, options) {
const reqOptions &#x3D; Object.assign({ headers: { accept: &#x27;image/* video/* text/* audio/*&#x27; } }, options); const reqOptions &#x3D; Object.assign({ headers: { accept: &#x27;image/* video/* text/* audio/*&#x27; } }, options);
const response &#x3D; await fetch(url, reqOptions); const response &#x3D; await fetch(url, reqOptions);
const mime &#x3D; response.headers.get(&#x27;Content-Type&#x27;); const mime &#x3D; response.headers.get(&#x27;Content-Type&#x27;);
let data &#x3D; &#x27;&#x27;; const size &#x3D; response.headers.get(&#x27;Content-Length&#x27;);
const contentDisposition &#x3D; response.headers.get(&#x27;Content-Disposition&#x27;);
const name &#x3D; contentDisposition ? contentDisposition.match(/((?&amp;lt;&#x3D;filename&#x3D;&quot;)(.*)(?&#x3D;&quot;))/) : null;
let data &#x3D; &#x27;&#x27;;
if (response.buffer) { if (response.buffer) {
data &#x3D; (await response.buffer()).toString(&#x27;base64&#x27;); data &#x3D; (await response.buffer()).toString(&#x27;base64&#x27;);
} else { } else {
@@ -114,21 +122,25 @@ class MessageMedia {
data &#x3D; btoa(data); data &#x3D; btoa(data);
} }
return { data, mime }; return { data, mime, name, size };
} }
const res &#x3D; options.client const res &#x3D; options.client
? (await options.client.pupPage.evaluate(fetchData, url, options.reqOptions)) ? (await options.client.pupPage.evaluate(fetchData, url, options.reqOptions))
: (await fetchData(url, options.reqOptions)); : (await fetchData(url, options.reqOptions));
const filename &#x3D; options.filename ||
(res.name ? res.name[0] : (pUrl.pathname.split(&#x27;/&#x27;).pop() || &#x27;file&#x27;));
if (!mimetype) if (!mimetype)
mimetype &#x3D; res.mime; mimetype &#x3D; res.mime;
return new MessageMedia(mimetype, res.data, null); return new MessageMedia(mimetype, res.data, filename, res.size || null);
} }
} }
module.exports &#x3D; MessageMedia;</code></pre> module.exports &#x3D; MessageMedia;
</code></pre>
</article> </article>
</div> </div>
</div> </div>
@@ -138,7 +150,7 @@ module.exports &#x3D; MessageMedia;</code></pre>
<footer id="jsdoc-footer" class="jsdoc-footer"> <footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container"> <div id="jsdoc-footer-container">
<p> <p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on December 7, 2021. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -4,7 +4,7 @@
<head> <head>
<meta name="generator" content="JSDoc 3.6.7"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.15.3 &raquo; Source: structures/Order.js</title> <title>whatsapp-web.js 1.19.5 &raquo; Source: structures/Order.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar"> <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container"> <div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content"> <div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -90,7 +90,7 @@ module.exports &#x3D; Order;</code></pre>
<footer id="jsdoc-footer" class="jsdoc-footer"> <footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container"> <div id="jsdoc-footer-container">
<p> <p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on December 7, 2021. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -4,7 +4,7 @@
<head> <head>
<meta name="generator" content="JSDoc 3.6.7"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.15.3 &raquo; Source: structures/Payment.js</title> <title>whatsapp-web.js 1.19.5 &raquo; Source: structures/Payment.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar"> <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container"> <div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content"> <div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -71,7 +71,6 @@ class Payment extends Base {
/** /**
* The paymentStatus * The paymentStatus
* @type {number}
* *
* Possible Status * Possible Status
* 0:UNKNOWN_STATUS * 0:UNKNOWN_STATUS
@@ -86,6 +85,8 @@ class Payment extends Base {
* 9:CANCELLED * 9:CANCELLED
* 10:WAITING_FOR_PAYER * 10:WAITING_FOR_PAYER
* 11:WAITING * 11:WAITING
*
* @type {number}
*/ */
this.paymentStatus &#x3D; data.paymentStatus; this.paymentStatus &#x3D; data.paymentStatus;
@@ -117,7 +118,7 @@ module.exports &#x3D; Payment;
<footer id="jsdoc-footer" class="jsdoc-footer"> <footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container"> <div id="jsdoc-footer-container">
<p> <p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on December 7, 2021. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -4,7 +4,7 @@
<head> <head>
<meta name="generator" content="JSDoc 3.6.7"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.15.3 &raquo; Source: structures/PrivateChat.js</title> <title>whatsapp-web.js 1.19.5 &raquo; Source: structures/PrivateChat.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar"> <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container"> <div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content"> <div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -51,7 +51,7 @@ module.exports &#x3D; PrivateChat;</code></pre>
<footer id="jsdoc-footer" class="jsdoc-footer"> <footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container"> <div id="jsdoc-footer-container">
<p> <p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on December 7, 2021. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -4,7 +4,7 @@
<head> <head>
<meta name="generator" content="JSDoc 3.6.7"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.15.3 &raquo; Source: structures/PrivateContact.js</title> <title>whatsapp-web.js 1.19.5 &raquo; Source: structures/PrivateContact.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar"> <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container"> <div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content"> <div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -51,7 +51,7 @@ module.exports &#x3D; PrivateContact;</code></pre>
<footer id="jsdoc-footer" class="jsdoc-footer"> <footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container"> <div id="jsdoc-footer-container">
<p> <p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on December 7, 2021. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -4,7 +4,7 @@
<head> <head>
<meta name="generator" content="JSDoc 3.6.7"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.15.3 &raquo; Source: structures/Product.js</title> <title>whatsapp-web.js 1.19.5 &raquo; Source: structures/Product.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar"> <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container"> <div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content"> <div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -106,7 +106,7 @@ module.exports &#x3D; Product;</code></pre>
<footer id="jsdoc-footer" class="jsdoc-footer"> <footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container"> <div id="jsdoc-footer-container">
<p> <p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on December 7, 2021. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -4,7 +4,7 @@
<head> <head>
<meta name="generator" content="JSDoc 3.6.7"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.15.3 &raquo; Source: structures/ProductMetadata.js</title> <title>whatsapp-web.js 1.19.5 &raquo; Source: structures/ProductMetadata.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar"> <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container"> <div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content"> <div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -63,7 +63,7 @@ module.exports &#x3D; ProductMetadata;</code></pre>
<footer id="jsdoc-footer" class="jsdoc-footer"> <footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container"> <div id="jsdoc-footer-container">
<p> <p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on December 7, 2021. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -0,0 +1,122 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.19.5 &raquo; Source: structures/Reaction.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
<link href="css/baseline.css" rel="stylesheet">
</head>
<body onload="prettyPrint()">
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div>
</div>
</nav>
<div id="jsdoc-body-container">
<div id="jsdoc-content">
<div id="jsdoc-content-container">
<div id="jsdoc-banner" role="banner">
</div>
<div id="jsdoc-main" role="main">
<header class="page-header">
<h1>Source: structures/Reaction.js</h1>
</header>
<article>
<pre class="prettyprint linenums"><code>&#x27;use strict&#x27;;
const Base &#x3D; require(&#x27;./Base&#x27;);
/**
* Represents a Reaction on WhatsApp
* @extends {Base}
*/
class Reaction extends Base {
constructor(client, data) {
super(client);
if (data) this._patch(data);
}
_patch(data) {
/**
* Reaction ID
* @type {object}
*/
this.id &#x3D; data.msgKey;
/**
* Orphan
* @type {number}
*/
this.orphan &#x3D; data.orphan;
/**
* Orphan reason
* @type {?string}
*/
this.orphanReason &#x3D; data.orphanReason;
/**
* Unix timestamp for when the reaction was created
* @type {number}
*/
this.timestamp &#x3D; data.timestamp;
/**
* Reaction
* @type {string}
*/
this.reaction &#x3D; data.reactionText;
/**
* Read
* @type {boolean}
*/
this.read &#x3D; data.read;
/**
* Message ID
* @type {object}
*/
this.msgId &#x3D; data.parentMsgKey;
/**
* Sender ID
* @type {string}
*/
this.senderId &#x3D; data.senderUserJid;
/**
* ACK
* @type {?number}
*/
this.ack &#x3D; data.ack;
return super._patch(data);
}
}
module.exports &#x3D; Reaction;</code></pre>
</article>
</div>
</div>
<nav id="jsdoc-toc-nav" role="navigation"></nav>
</div>
</div>
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p>
</div>
</footer>
<script src="scripts/jquery.min.js"></script>
<script src="scripts/tree.jquery.js"></script>
<script src="scripts/prettify.js"></script>
<script src="scripts/jsdoc-toc.js"></script>
<script src="scripts/linenumber.js"></script>
<script src="scripts/scrollanchor.js"></script>
</body>
</html>

View File

@@ -4,7 +4,7 @@
<head> <head>
<meta name="generator" content="JSDoc 3.6.7"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.15.3 &raquo; Source: util/Constants.js</title> <title>whatsapp-web.js 1.19.5 &raquo; Source: util/Constants.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar"> <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container"> <div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content"> <div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -38,14 +38,11 @@ exports.DefaultOptions &#x3D; {
headless: true, headless: true,
defaultViewport: null defaultViewport: null
}, },
session: false, authTimeoutMs: 0,
qrTimeoutMs: 45000,
qrRefreshIntervalMs: 20000,
authTimeoutMs: 45000,
qrMaxRetries: 0, qrMaxRetries: 0,
takeoverOnConflict: false, takeoverOnConflict: false,
takeoverTimeoutMs: 0, takeoverTimeoutMs: 0,
userAgent: &#x27;Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.109 Safari/537.36&#x27;, userAgent: &#x27;Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.67 Safari/537.36&#x27;,
ffmpegPath: &#x27;ffmpeg&#x27;, ffmpegPath: &#x27;ffmpeg&#x27;,
bypassCSP: false bypassCSP: false
}; };
@@ -75,15 +72,18 @@ exports.Events &#x3D; {
MESSAGE_REVOKED_EVERYONE: &#x27;message_revoke_everyone&#x27;, MESSAGE_REVOKED_EVERYONE: &#x27;message_revoke_everyone&#x27;,
MESSAGE_REVOKED_ME: &#x27;message_revoke_me&#x27;, MESSAGE_REVOKED_ME: &#x27;message_revoke_me&#x27;,
MESSAGE_ACK: &#x27;message_ack&#x27;, MESSAGE_ACK: &#x27;message_ack&#x27;,
MESSAGE_REACTION: &#x27;message_reaction&#x27;,
MEDIA_UPLOADED: &#x27;media_uploaded&#x27;, MEDIA_UPLOADED: &#x27;media_uploaded&#x27;,
GROUP_JOIN: &#x27;group_join&#x27;, GROUP_JOIN: &#x27;group_join&#x27;,
GROUP_LEAVE: &#x27;group_leave&#x27;, GROUP_LEAVE: &#x27;group_leave&#x27;,
GROUP_UPDATE: &#x27;group_update&#x27;, GROUP_UPDATE: &#x27;group_update&#x27;,
QR_RECEIVED: &#x27;qr&#x27;, QR_RECEIVED: &#x27;qr&#x27;,
LOADING_SCREEN: &#x27;loading_screen&#x27;,
DISCONNECTED: &#x27;disconnected&#x27;, DISCONNECTED: &#x27;disconnected&#x27;,
STATE_CHANGED: &#x27;change_state&#x27;, STATE_CHANGED: &#x27;change_state&#x27;,
BATTERY_CHANGED: &#x27;change_battery&#x27;, BATTERY_CHANGED: &#x27;change_battery&#x27;,
INCOMING_CALL: &#x27;incoming_call&#x27; INCOMING_CALL: &#x27;call&#x27;,
REMOTE_SESSION_SAVED: &#x27;remote_session_saved&#x27;
}; };
/** /**
@@ -108,8 +108,25 @@ exports.MessageTypes &#x3D; {
UNKNOWN: &#x27;unknown&#x27;, UNKNOWN: &#x27;unknown&#x27;,
GROUP_INVITE: &#x27;groups_v4_invite&#x27;, GROUP_INVITE: &#x27;groups_v4_invite&#x27;,
LIST: &#x27;list&#x27;, LIST: &#x27;list&#x27;,
LIST_RESPONSE: &#x27;list_response&#x27;,
BUTTONS_RESPONSE: &#x27;buttons_response&#x27;, BUTTONS_RESPONSE: &#x27;buttons_response&#x27;,
PAYMENT: &#x27;payment&#x27; PAYMENT: &#x27;payment&#x27;,
BROADCAST_NOTIFICATION: &#x27;broadcast_notification&#x27;,
CALL_LOG: &#x27;call_log&#x27;,
CIPHERTEXT: &#x27;ciphertext&#x27;,
DEBUG: &#x27;debug&#x27;,
E2E_NOTIFICATION: &#x27;e2e_notification&#x27;,
GP2: &#x27;gp2&#x27;,
GROUP_NOTIFICATION: &#x27;group_notification&#x27;,
HSM: &#x27;hsm&#x27;,
INTERACTIVE: &#x27;interactive&#x27;,
NATIVE_FLOW: &#x27;native_flow&#x27;,
NOTIFICATION: &#x27;notification&#x27;,
NOTIFICATION_TEMPLATE: &#x27;notification_template&#x27;,
OVERSIZED: &#x27;oversized&#x27;,
PROTOCOL: &#x27;protocol&#x27;,
REACTION: &#x27;reaction&#x27;,
TEMPLATE_BUTTON_REPLY: &#x27;template_button_reply&#x27;,
}; };
/** /**
@@ -183,7 +200,7 @@ exports.MessageAck &#x3D; {
<footer id="jsdoc-footer" class="jsdoc-footer"> <footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container"> <div id="jsdoc-footer-container">
<p> <p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on December 7, 2021. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -4,7 +4,7 @@
<head> <head>
<meta name="generator" content="JSDoc 3.6.7"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.15.3 &raquo; Source: util/InterfaceController.js</title> <title>whatsapp-web.js 1.19.5 &raquo; Source: util/InterfaceController.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar"> <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container"> <div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content"> <div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -110,6 +110,7 @@ class InterfaceController {
*/ */
async getFeatures() { async getFeatures() {
return await this.pupPage.evaluate(() &#x3D;&gt; { return await this.pupPage.evaluate(() &#x3D;&gt; {
if(!window.Store.Features) throw new Error(&#x27;This version of Whatsapp Web does not support features&#x27;);
return window.Store.Features.F; return window.Store.Features.F;
}); });
} }
@@ -120,6 +121,7 @@ class InterfaceController {
*/ */
async checkFeatureStatus(feature) { async checkFeatureStatus(feature) {
return await this.pupPage.evaluate((feature) &#x3D;&gt; { return await this.pupPage.evaluate((feature) &#x3D;&gt; {
if(!window.Store.Features) throw new Error(&#x27;This version of Whatsapp Web does not support features&#x27;);
return window.Store.Features.supportsFeature(feature); return window.Store.Features.supportsFeature(feature);
}, feature); }, feature);
} }
@@ -130,6 +132,7 @@ class InterfaceController {
*/ */
async enableFeatures(features) { async enableFeatures(features) {
await this.pupPage.evaluate((features) &#x3D;&gt; { await this.pupPage.evaluate((features) &#x3D;&gt; {
if(!window.Store.Features) throw new Error(&#x27;This version of Whatsapp Web does not support features&#x27;);
for (const feature in features) { for (const feature in features) {
window.Store.Features.setFeature(features[feature], true); window.Store.Features.setFeature(features[feature], true);
} }
@@ -142,6 +145,7 @@ class InterfaceController {
*/ */
async disableFeatures(features) { async disableFeatures(features) {
await this.pupPage.evaluate((features) &#x3D;&gt; { await this.pupPage.evaluate((features) &#x3D;&gt; {
if(!window.Store.Features) throw new Error(&#x27;This version of Whatsapp Web does not support features&#x27;);
for (const feature in features) { for (const feature in features) {
window.Store.Features.setFeature(features[feature], false); window.Store.Features.setFeature(features[feature], false);
} }
@@ -160,7 +164,7 @@ module.exports &#x3D; InterfaceController;
<footer id="jsdoc-footer" class="jsdoc-footer"> <footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container"> <div id="jsdoc-footer-container">
<p> <p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on December 7, 2021. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -4,7 +4,7 @@
<head> <head>
<meta name="generator" content="JSDoc 3.6.7"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.15.3 &raquo; Source: util/Util.js</title> <title>whatsapp-web.js 1.19.5 &raquo; Source: util/Util.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar"> <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container"> <div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content"> <div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -31,21 +31,18 @@
<article> <article>
<pre class="prettyprint linenums"><code>&#x27;use strict&#x27;; <pre class="prettyprint linenums"><code>&#x27;use strict&#x27;;
const sharp &#x3D; require(&#x27;sharp&#x27;);
const path &#x3D; require(&#x27;path&#x27;); const path &#x3D; require(&#x27;path&#x27;);
const Crypto &#x3D; require(&#x27;crypto&#x27;); const Crypto &#x3D; require(&#x27;crypto&#x27;);
const { tmpdir } &#x3D; require(&#x27;os&#x27;); const { tmpdir } &#x3D; require(&#x27;os&#x27;);
const ffmpeg &#x3D; require(&#x27;fluent-ffmpeg&#x27;); const ffmpeg &#x3D; require(&#x27;fluent-ffmpeg&#x27;);
const webp &#x3D; require(&#x27;node-webpmux&#x27;); const webp &#x3D; require(&#x27;node-webpmux&#x27;);
const fs &#x3D; require(&#x27;fs&#x27;).promises; const fs &#x3D; require(&#x27;fs&#x27;).promises;
const has &#x3D; (o, k) &#x3D;&gt; Object.prototype.hasOwnProperty.call(o, k); const has &#x3D; (o, k) &#x3D;&gt; Object.prototype.hasOwnProperty.call(o, k);
/** /**
* Utility methods * Utility methods
*/ */
class Util { class Util {
constructor() { constructor() {
throw new Error(&#x60;The ${this.constructor.name} class may not be instantiated.&#x60;); throw new Error(&#x60;The ${this.constructor.name} class may not be instantiated.&#x60;);
} }
@@ -54,7 +51,7 @@ class Util {
var result &#x3D; &#x27;&#x27;; var result &#x3D; &#x27;&#x27;;
var characters &#x3D; &#x27;ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789&#x27;; var characters &#x3D; &#x27;ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789&#x27;;
var charactersLength &#x3D; characters.length; var charactersLength &#x3D; characters.length;
for ( var i &#x3D; 0; i &amp;lt; length; i++ ) { for (var i &#x3D; 0; i &amp;lt; length; i++) {
result +&#x3D; characters.charAt(Math.floor(Math.random() * charactersLength)); result +&#x3D; characters.charAt(Math.floor(Math.random() * charactersLength));
} }
return result; return result;
@@ -86,33 +83,19 @@ class Util {
* *
* @returns {Promise&amp;lt;MessageMedia&gt;} media in webp format * @returns {Promise&amp;lt;MessageMedia&gt;} media in webp format
*/ */
static async formatImageToWebpSticker(media) { static async formatImageToWebpSticker(media, pupPage) {
if (!media.mimetype.includes(&#x27;image&#x27;)) if (!media.mimetype.includes(&#x27;image&#x27;))
throw new Error(&#x27;media is not a image&#x27;); throw new Error(&#x27;media is not a image&#x27;);
if (media.mimetype.includes(&#x27;webp&#x27;)) { if (media.mimetype.includes(&#x27;webp&#x27;)) {
return media; return media;
} }
const buff &#x3D; Buffer.from(media.data, &#x27;base64&#x27;); return pupPage.evaluate((media) &#x3D;&gt; {
return window.WWebJS.toStickerData(media);
let sharpImg &#x3D; sharp(buff); }, media);
sharpImg &#x3D; sharpImg.webp();
sharpImg &#x3D; sharpImg.resize(512, 512, {
fit: &#x27;contain&#x27;,
background: { r: 0, g: 0, b: 0, alpha: 0 },
});
let webpBase64 &#x3D; (await sharpImg.toBuffer()).toString(&#x27;base64&#x27;);
return {
mimetype: &#x27;image/webp&#x27;,
data: webpBase64,
filename: media.filename,
};
} }
/** /**
* Formats a video to webp * Formats a video to webp
* @param {MessageMedia} media * @param {MessageMedia} media
@@ -122,14 +105,14 @@ class Util {
static async formatVideoToWebpSticker(media) { static async formatVideoToWebpSticker(media) {
if (!media.mimetype.includes(&#x27;video&#x27;)) if (!media.mimetype.includes(&#x27;video&#x27;))
throw new Error(&#x27;media is not a video&#x27;); throw new Error(&#x27;media is not a video&#x27;);
const videoType &#x3D; media.mimetype.split(&#x27;/&#x27;)[1]; const videoType &#x3D; media.mimetype.split(&#x27;/&#x27;)[1];
const tempFile &#x3D; path.join( const tempFile &#x3D; path.join(
tmpdir(), tmpdir(),
&#x60;${Crypto.randomBytes(6).readUIntLE(0, 6).toString(36)}.webp&#x60; &#x60;${Crypto.randomBytes(6).readUIntLE(0, 6).toString(36)}.webp&#x60;
); );
const stream &#x3D; new (require(&#x27;stream&#x27;).Readable)(); const stream &#x3D; new (require(&#x27;stream&#x27;).Readable)();
const buffer &#x3D; Buffer.from( const buffer &#x3D; Buffer.from(
media.data.replace(&#x60;data:${media.mimetype};base64,&#x60;, &#x27;&#x27;), media.data.replace(&#x60;data:${media.mimetype};base64,&#x60;, &#x27;&#x27;),
@@ -166,17 +149,17 @@ class Util {
.toFormat(&#x27;webp&#x27;) .toFormat(&#x27;webp&#x27;)
.save(tempFile); .save(tempFile);
}); });
const data &#x3D; await fs.readFile(tempFile, &#x27;base64&#x27;); const data &#x3D; await fs.readFile(tempFile, &#x27;base64&#x27;);
await fs.unlink(tempFile); await fs.unlink(tempFile);
return { return {
mimetype: &#x27;image/webp&#x27;, mimetype: &#x27;image/webp&#x27;,
data: data, data: data,
filename: media.filename, filename: media.filename,
}; };
} }
/** /**
* Sticker metadata. * Sticker metadata.
* @typedef {Object} StickerMetadata * @typedef {Object} StickerMetadata
@@ -192,14 +175,14 @@ class Util {
* *
* @returns {Promise&amp;lt;MessageMedia&gt;} media in webp format * @returns {Promise&amp;lt;MessageMedia&gt;} media in webp format
*/ */
static async formatToWebpSticker(media, metadata) { static async formatToWebpSticker(media, metadata, pupPage) {
let webpMedia; let webpMedia;
if (media.mimetype.includes(&#x27;image&#x27;)) if (media.mimetype.includes(&#x27;image&#x27;))
webpMedia &#x3D; await this.formatImageToWebpSticker(media); webpMedia &#x3D; await this.formatImageToWebpSticker(media, pupPage);
else if (media.mimetype.includes(&#x27;video&#x27;)) else if (media.mimetype.includes(&#x27;video&#x27;))
webpMedia &#x3D; await this.formatVideoToWebpSticker(media); webpMedia &#x3D; await this.formatVideoToWebpSticker(media);
else else
throw new Error(&#x27;Invalid media format&#x27;); throw new Error(&#x27;Invalid media format&#x27;);
if (metadata.name || metadata.author) { if (metadata.name || metadata.author) {
@@ -242,7 +225,7 @@ module.exports &#x3D; Util;
<footer id="jsdoc-footer" class="jsdoc-footer"> <footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container"> <div id="jsdoc-footer-container">
<p> <p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on December 7, 2021. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -1,42 +1,27 @@
const fs = require('fs'); const { Client, Location, List, Buttons, LocalAuth } = require('./index');
const { Client, Location, List, Buttons } = require('./index');
const SESSION_FILE_PATH = './session.json'; const client = new Client({
let sessionCfg; authStrategy: new LocalAuth(),
if (fs.existsSync(SESSION_FILE_PATH)) { puppeteer: { headless: false }
sessionCfg = require(SESSION_FILE_PATH); });
}
const client = new Client({ puppeteer: { headless: false }, session: sessionCfg });
// You can use an existing session and avoid scanning a QR code by adding a "session" object to the client options.
// This object must include WABrowserId, WASecretBundle, WAToken1 and WAToken2.
// You also could connect to an existing instance of a browser
// {
// puppeteer: {
// browserWSEndpoint: `ws://localhost:3000`
// }
// }
client.initialize(); client.initialize();
client.on('loading_screen', (percent, message) => {
console.log('LOADING SCREEN', percent, message);
});
client.on('qr', (qr) => { client.on('qr', (qr) => {
// NOTE: This event will not be fired if a session is specified. // NOTE: This event will not be fired if a session is specified.
console.log('QR RECEIVED', qr); console.log('QR RECEIVED', qr);
}); });
client.on('authenticated', (session) => { client.on('authenticated', () => {
console.log('AUTHENTICATED', session); console.log('AUTHENTICATED');
sessionCfg=session;
fs.writeFile(SESSION_FILE_PATH, JSON.stringify(session), function (err) {
if (err) {
console.error(err);
}
});
}); });
client.on('auth_failure', msg => { client.on('auth_failure', msg => {
// Fired if session restore was unsuccessfull // Fired if session restore was unsuccessful
console.error('AUTHENTICATION FAILURE', msg); console.error('AUTHENTICATION FAILURE', msg);
}); });
@@ -124,9 +109,8 @@ client.on('message', async msg => {
client.sendMessage(msg.from, ` client.sendMessage(msg.from, `
*Connection info* *Connection info*
User name: ${info.pushname} User name: ${info.pushname}
My number: ${info.me.user} My number: ${info.wid.user}
Platform: ${info.platform} Platform: ${info.platform}
WhatsApp version: ${info.phone.wa_version}
`); `);
} else if (msg.body === '!mediainfo' && msg.hasMedia) { } else if (msg.body === '!mediainfo' && msg.hasMedia) {
const attachmentData = await msg.downloadMedia(); const attachmentData = await msg.downloadMedia();
@@ -205,12 +189,14 @@ client.on('message', async msg => {
client.interface.openChatWindowAt(quotedMsg.id._serialized); client.interface.openChatWindowAt(quotedMsg.id._serialized);
} }
} else if (msg.body === '!buttons') { } else if (msg.body === '!buttons') {
let button = new Buttons('Button body',[{body:'bt1'},{body:'bt2'},{body:'bt3'}],'title','footer'); let button = new Buttons('Button body', [{ body: 'bt1' }, { body: 'bt2' }, { body: 'bt3' }], 'title', 'footer');
client.sendMessage(msg.from, button); client.sendMessage(msg.from, button);
} else if (msg.body === '!list') { } else if (msg.body === '!list') {
let sections = [{title:'sectionTitle',rows:[{title:'ListItem1', description: 'desc'},{title:'ListItem2'}]}]; let sections = [{ title: 'sectionTitle', rows: [{ title: 'ListItem1', description: 'desc' }, { title: 'ListItem2' }] }];
let list = new List('List body','btnText',sections,'Title','footer'); let list = new List('List body', 'btnText', sections, 'Title', 'footer');
client.sendMessage(msg.from, list); client.sendMessage(msg.from, list);
} else if (msg.body === '!reaction') {
msg.react('👍');
} }
}); });
@@ -245,7 +231,7 @@ client.on('message_ack', (msg, ack) => {
ACK_PLAYED: 4 ACK_PLAYED: 4
*/ */
if(ack == 3) { if (ack == 3) {
// The message was read // The message was read
} }
}); });
@@ -267,17 +253,68 @@ client.on('group_update', (notification) => {
console.log('update', notification); console.log('update', notification);
}); });
client.on('change_battery', (batteryInfo) => { client.on('change_state', state => {
// Battery percentage for attached device has changed console.log('CHANGE STATE', state);
const { battery, plugged } = batteryInfo;
console.log(`Battery: ${battery}% - Charging? ${plugged}`);
}); });
client.on('change_state', state => { // Change to false if you don't want to reject incoming calls
console.log('CHANGE STATE', state ); let rejectCalls = true;
client.on('call', async (call) => {
console.log('Call received, rejecting. GOTO Line 261 to disable', call);
if (rejectCalls) await call.reject();
await client.sendMessage(call.from, `[${call.fromMe ? 'Outgoing' : 'Incoming'}] Phone call from ${call.from}, type ${call.isGroup ? 'group' : ''} ${call.isVideo ? 'video' : 'audio'} call. ${rejectCalls ? 'This call was automatically rejected by the script.' : ''}`);
}); });
client.on('disconnected', (reason) => { client.on('disconnected', (reason) => {
console.log('Client was logged out', reason); console.log('Client was logged out', reason);
}); });
client.on('contact_changed', async (message, oldId, newId, isContact) => {
/** The time the event occurred. */
const eventTime = (new Date(message.timestamp * 1000)).toLocaleString();
console.log(
`The contact ${oldId.slice(0, -5)}` +
`${!isContact ? ' that participates in group ' +
`${(await client.getChatById(message.to ?? message.from)).name} ` : ' '}` +
`changed their phone number\nat ${eventTime}.\n` +
`Their new phone number is ${newId.slice(0, -5)}.\n`);
/**
* Information about the {@name message}:
*
* 1. If a notification was emitted due to a group participant changing their phone number:
* {@name message.author} is a participant's id before the change.
* {@name message.recipients[0]} is a participant's id after the change (a new one).
*
* 1.1 If the contact who changed their number WAS in the current user's contact list at the time of the change:
* {@name message.to} is a group chat id the event was emitted in.
* {@name message.from} is a current user's id that got an notification message in the group.
* Also the {@name message.fromMe} is TRUE.
*
* 1.2 Otherwise:
* {@name message.from} is a group chat id the event was emitted in.
* {@name message.to} is @type {undefined}.
* Also {@name message.fromMe} is FALSE.
*
* 2. If a notification was emitted due to a contact changing their phone number:
* {@name message.templateParams} is an array of two user's ids:
* the old (before the change) and a new one, stored in alphabetical order.
* {@name message.from} is a current user's id that has a chat with a user,
* whos phone number was changed.
* {@name message.to} is a user's id (after the change), the current user has a chat with.
*/
});
client.on('group_admin_changed', (notification) => {
if (notification.type === 'promote') {
/**
* Emitted when a current user is promoted to an admin.
* {@link notification.author} is a user who performs the action of promoting/demoting the current user.
*/
console.log(`You were promoted by ${notification.author}`);
} else if (notification.type === 'demote')
/** Emitted when a current user is demoted to a regular user. */
console.log(`You were demoted by ${notification.author}`);
});

318
index.d.ts vendored
View File

@@ -1,7 +1,7 @@
import { EventEmitter } from 'events' import { EventEmitter } from 'events'
import { RequestInit } from 'node-fetch' import { RequestInit } from 'node-fetch'
import puppeteer = require('puppeteer') import * as puppeteer from 'puppeteer'
declare namespace WAWebJS { declare namespace WAWebJS {
@@ -84,6 +84,9 @@ declare namespace WAWebJS {
/** Returns the contact ID's profile picture URL, if privacy settings allow it */ /** Returns the contact ID's profile picture URL, if privacy settings allow it */
getProfilePicUrl(contactId: string): Promise<string> getProfilePicUrl(contactId: string): Promise<string>
/** Gets the Contact's common groups with you. Returns empty array if you don't have any common group. */
getCommonGroups(contactId: string): Promise<ChatId[]>
/** Gets the current connection state for the client */ /** Gets the current connection state for the client */
getState(): Promise<WAState> getState(): Promise<WAState>
@@ -111,13 +114,16 @@ declare namespace WAWebJS {
/** Send a message to a specific chatId */ /** Send a message to a specific chatId */
sendMessage(chatId: string, content: MessageContent, options?: MessageSendOptions): Promise<Message> sendMessage(chatId: string, content: MessageContent, options?: MessageSendOptions): Promise<Message>
/** Searches for messages */ /** Searches for messages */
searchMessages(query: string, options?: { chatId?: string, page?: number, limit?: number }): Promise<Message[]> searchMessages(query: string, options?: { chatId?: string, page?: number, limit?: number }): Promise<Message[]>
/** Marks the client as online */ /** Marks the client as online */
sendPresenceAvailable(): Promise<void> sendPresenceAvailable(): Promise<void>
/** Marks the client as offline */
sendPresenceUnavailable(): Promise<void>
/** Mark as seen for the Chat */ /** Mark as seen for the Chat */
sendSeen(chatId: string): Promise<boolean> sendSeen(chatId: string): Promise<boolean>
@@ -134,14 +140,20 @@ declare namespace WAWebJS {
* Sets the current user's display name * Sets the current user's display name
* @param displayName New display name * @param displayName New display name
*/ */
setDisplayName(displayName: string): Promise<void> setDisplayName(displayName: string): Promise<boolean>
/** Changes and returns the archive state of the Chat */ /** Changes and returns the archive state of the Chat */
unarchiveChat(chatId: string): Promise<boolean> unarchiveChat(chatId: string): Promise<boolean>
/** Unmutes the Chat */ /** Unmutes the Chat */
unmuteChat(chatId: string): Promise<void> unmuteChat(chatId: string): Promise<void>
/** Sets the current user's profile picture */
setProfilePicture(media: MessageMedia): Promise<boolean>
/** Deletes the current user's profile picture */
deleteProfilePicture(): Promise<boolean>
/** Generic event */ /** Generic event */
on(event: string, listener: (...args: any) => void): this on(event: string, listener: (...args: any) => void): this
@@ -150,11 +162,16 @@ declare namespace WAWebJS {
/** Emitted when authentication is successful */ /** Emitted when authentication is successful */
on(event: 'authenticated', listener: ( on(event: 'authenticated', listener: (
/** Object containing session information. Can be used to restore the session */ /**
session: ClientSession * Object containing session information, when using LegacySessionAuth. Can be used to restore the session
*/
session?: ClientSession
) => void): this ) => void): this
/** Emitted when the battery percentage for the attached device changes */ /**
* Emitted when the battery percentage for the attached device changes
* @deprecated
*/
on(event: 'change_battery', listener: (batteryInfo: BatteryInfo) => void): this on(event: 'change_battery', listener: (batteryInfo: BatteryInfo) => void): this
/** Emitted when the connection state changes */ /** Emitted when the connection state changes */
@@ -166,7 +183,7 @@ declare namespace WAWebJS {
/** Emitted when the client has been disconnected */ /** Emitted when the client has been disconnected */
on(event: 'disconnected', listener: ( on(event: 'disconnected', listener: (
/** reason that caused the disconnect */ /** reason that caused the disconnect */
reason: WAState | "NAVIGATED" reason: WAState | "NAVIGATION"
) => void): this ) => void): this
/** Emitted when a user joins the chat via invite link or is added by an admin */ /** Emitted when a user joins the chat via invite link or is added by an admin */
@@ -181,12 +198,30 @@ declare namespace WAWebJS {
notification: GroupNotification notification: GroupNotification
) => void): this ) => void): this
/** Emitted when a current user is promoted to an admin or demoted to a regular user */
on(event: 'group_admin_changed', listener: (
/** GroupNotification with more information about the action */
notification: GroupNotification
) => void): this
/** Emitted when group settings are updated, such as subject, description or picture */ /** Emitted when group settings are updated, such as subject, description or picture */
on(event: 'group_update', listener: ( on(event: 'group_update', listener: (
/** GroupNotification with more information about the action */ /** GroupNotification with more information about the action */
notification: GroupNotification notification: GroupNotification
) => void): this ) => void): this
/** Emitted when a contact or a group participant changed their phone number. */
on(event: 'contact_changed', listener: (
/** Message with more information about the event. */
message: Message,
/** Old user's id. */
oldId : String,
/** New user's id. */
newId : String,
/** Indicates if a contact or a group participant changed their phone number. */
isContact : Boolean
) => void): this
/** Emitted when media has been uploaded for a message sent by the client */ /** Emitted when media has been uploaded for a message sent by the client */
on(event: 'media_uploaded', listener: ( on(event: 'media_uploaded', listener: (
/** The message with media that was uploaded */ /** The message with media that was uploaded */
@@ -206,6 +241,12 @@ declare namespace WAWebJS {
/** The new ACK value */ /** The new ACK value */
ack: MessageAck ack: MessageAck
) => void): this ) => void): this
/** Emitted when a chat unread count changes */
on(event: 'unread_count', listener: (
/** The chat that was affected */
chat: Chat
) => void): this
/** Emitted when a new message is created, which may include the current user's own messages */ /** Emitted when a new message is created, which may include the current user's own messages */
on(event: 'message_create', listener: ( on(event: 'message_create', listener: (
@@ -230,6 +271,31 @@ declare namespace WAWebJS {
message: Message message: Message
) => void): this ) => void): this
/** Emitted when a reaction is sent, received, updated or removed */
on(event: 'message_reaction', listener: (
/** The reaction object */
reaction: Reaction
) => void): this
/** Emitted when a chat is removed */
on(event: 'chat_removed', listener: (
/** The chat that was removed */
chat: Chat
) => void): this
/** Emitted when a chat is archived/unarchived */
on(event: 'chat_archived', listener: (
/** The chat that was archived/unarchived */
chat: Chat,
/** State the chat is currently in */
currState: boolean,
/** State the chat was previously in */
prevState: boolean
) => void): this
/** Emitted when loading screen is appearing */
on(event: 'loading_screen', listener: (percent: string, message: string) => void): this
/** Emitted when the QR code is received */ /** Emitted when the QR code is received */
on(event: 'qr', listener: ( on(event: 'qr', listener: (
/** qr code string /** qr code string
@@ -245,6 +311,9 @@ declare namespace WAWebJS {
/** Emitted when the client has initialized and is ready to receive messages */ /** Emitted when the client has initialized and is ready to receive messages */
on(event: 'ready', listener: () => void): this on(event: 'ready', listener: () => void): this
/** Emitted when the RemoteAuth session is saved successfully on the external Database */
on(event: 'remote_session_saved', listener: () => void): this
} }
/** Current connection information */ /** Current connection information */
@@ -256,7 +325,10 @@ declare namespace WAWebJS {
me: ContactId me: ContactId
/** Current user ID */ /** Current user ID */
wid: ContactId wid: ContactId
/** Information about the phone this client is connected to */ /**
* Information about the phone this client is connected to. Not available in multi-device.
* @deprecated
*/
phone: ClientInfoPhone phone: ClientInfoPhone
/** Platform the phone is running on */ /** Platform the phone is running on */
platform: string platform: string
@@ -267,7 +339,10 @@ declare namespace WAWebJS {
getBatteryStatus: () => Promise<BatteryInfo> getBatteryStatus: () => Promise<BatteryInfo>
} }
/** Information about the phone this client is connected to */ /**
* Information about the phone this client is connected to
* @deprecated
*/
export interface ClientInfoPhone { export interface ClientInfoPhone {
/** WhatsApp Version running on the phone */ /** WhatsApp Version running on the phone */
wa_version: string wa_version: string
@@ -284,23 +359,22 @@ declare namespace WAWebJS {
/** Options for initializing the whatsapp client */ /** Options for initializing the whatsapp client */
export interface ClientOptions { export interface ClientOptions {
/** Timeout for authentication selector in puppeteer /** Timeout for authentication selector in puppeteer
* @default 45000 */ * @default 0 */
authTimeoutMs?: number, authTimeoutMs?: number,
/** Puppeteer launch options. View docs here: https://github.com/puppeteer/puppeteer/ */ /** Puppeteer launch options. View docs here: https://github.com/puppeteer/puppeteer/ */
puppeteer?: puppeteer.LaunchOptions & puppeteer.BrowserLaunchArgumentOptions & puppeteer.BrowserConnectOptions puppeteer?: puppeteer.PuppeteerNodeLaunchOptions & puppeteer.ConnectOptions
/** Refresh interval for qr code (how much time to wait before checking if the qr code has changed) /** Determines how to save and restore sessions. Will use LegacySessionAuth if options.session is set. Otherwise, NoAuth will be used. */
* @default 20000 */ authStrategy?: AuthStrategy,
qrRefreshIntervalMs?: number /** How many times should the qrcode be refreshed before giving up
/** Timeout for qr code selector in puppeteer
* @default 45000 */
qrTimeoutMs?: number,
/** How many times should the qrcode be refreshed before giving up
* @default 0 (disabled) */ * @default 0 (disabled) */
qrMaxRetries?: number, qrMaxRetries?: number,
/** Restart client with a new session (i.e. use null 'session' var) if authentication fails /**
* @default false */ * @deprecated This option should be set directly on the LegacySessionAuth
*/
restartOnAuthFail?: boolean restartOnAuthFail?: boolean
/** Whatsapp session to restore. If not set, will start a new session */ /**
* @deprecated Only here for backwards-compatibility. You should move to using LocalAuth, or set the authStrategy to LegacySessionAuth explicitly.
*/
session?: ClientSession session?: ClientSession
/** If another whatsapp web session is detected (another browser), take over the session in the current browser /** If another whatsapp web session is detected (another browser), take over the session in the current browser
* @default false */ * @default false */
@@ -316,7 +390,81 @@ declare namespace WAWebJS {
ffmpegPath?: string ffmpegPath?: string
} }
/** Represents a Whatsapp client session */ /**
* Base class which all authentication strategies extend
*/
export abstract class AuthStrategy {
setup: (client: Client) => void;
beforeBrowserInitialized: () => Promise<void>;
afterBrowserInitialized: () => Promise<void>;
onAuthenticationNeeded: () => Promise<{
failed?: boolean;
restart?: boolean;
failureEventPayload?: any
}>;
getAuthEventPayload: () => Promise<any>;
afterAuthReady: () => Promise<void>;
disconnect: () => Promise<void>;
destroy: () => Promise<void>;
logout: () => Promise<void>;
}
/**
* No session restoring functionality
* Will need to authenticate via QR code every time
*/
export class NoAuth extends AuthStrategy {}
/**
* Local directory-based authentication
*/
export class LocalAuth extends AuthStrategy {
public clientId?: string;
public dataPath?: string;
constructor(options?: {
clientId?: string,
dataPath?: string
})
}
/**
* Remote-based authentication
*/
export class RemoteAuth extends AuthStrategy {
public clientId?: string;
public dataPath?: string;
constructor(options?: {
store: Store,
clientId?: string,
dataPath?: string,
backupSyncIntervalMs: number
})
}
/**
* Remote store interface
*/
export interface Store {
sessionExists: (options: { session: string }) => Promise<boolean> | boolean,
delete: (options: { session: string }) => Promise<any> | any,
save: (options: { session: string }) => Promise<any> | any,
extract: (options: { session: string, path: string }) => Promise<any> | any,
}
/**
* Legacy session auth strategy
* Not compatible with multi-device accounts.
*/
export class LegacySessionAuth extends AuthStrategy {
constructor(options?: {
session?: ClientSession,
restartOnAuthFail?: boolean,
})
}
/**
* Represents a WhatsApp client session
*/
export interface ClientSession { export interface ClientSession {
WABrowserId: string, WABrowserId: string,
WASecretBundle: string, WASecretBundle: string,
@@ -324,6 +472,9 @@ declare namespace WAWebJS {
WAToken2: string, WAToken2: string,
} }
/**
* @deprecated
*/
export interface BatteryInfo { export interface BatteryInfo {
/** The current battery percentage */ /** The current battery percentage */
battery: number, battery: number,
@@ -393,13 +544,18 @@ declare namespace WAWebJS {
MESSAGE_REVOKED_ME = 'message_revoke_me', MESSAGE_REVOKED_ME = 'message_revoke_me',
MESSAGE_ACK = 'message_ack', MESSAGE_ACK = 'message_ack',
MEDIA_UPLOADED = 'media_uploaded', MEDIA_UPLOADED = 'media_uploaded',
CONTACT_CHANGED = 'contact_changed',
GROUP_JOIN = 'group_join', GROUP_JOIN = 'group_join',
GROUP_LEAVE = 'group_leave', GROUP_LEAVE = 'group_leave',
GROUP_ADMIN_CHANGED = 'group_admin_changed',
GROUP_UPDATE = 'group_update', GROUP_UPDATE = 'group_update',
QR_RECEIVED = 'qr', QR_RECEIVED = 'qr',
LOADING_SCREEN = 'loading_screen',
DISCONNECTED = 'disconnected', DISCONNECTED = 'disconnected',
STATE_CHANGED = 'change_state', STATE_CHANGED = 'change_state',
BATTERY_CHANGED = 'change_battery', BATTERY_CHANGED = 'change_battery',
REMOTE_SESSION_SAVED = 'remote_session_saved',
CALL = 'call'
} }
/** Group notification types */ /** Group notification types */
@@ -443,6 +599,25 @@ declare namespace WAWebJS {
PAYMENT = 'payment', PAYMENT = 'payment',
UNKNOWN = 'unknown', UNKNOWN = 'unknown',
GROUP_INVITE = 'groups_v4_invite', GROUP_INVITE = 'groups_v4_invite',
LIST = 'list',
LIST_RESPONSE = 'list_response',
BUTTONS_RESPONSE = 'buttons_response',
BROADCAST_NOTIFICATION = 'broadcast_notification',
CALL_LOG = 'call_log',
CIPHERTEXT = 'ciphertext',
DEBUG = 'debug',
E2E_NOTIFICATION = 'e2e_notification',
GP2 = 'gp2',
GROUP_NOTIFICATION = 'group_notification',
HSM = 'hsm',
INTERACTIVE = 'interactive',
NATIVE_FLOW = 'native_flow',
NOTIFICATION = 'notification',
NOTIFICATION_TEMPLATE = 'notification_template',
OVERSIZED = 'oversized',
PROTOCOL = 'protocol',
REACTION = 'reaction',
TEMPLATE_BUTTON_REPLY = 'template_button_reply',
} }
/** Client status */ /** Client status */
@@ -510,6 +685,7 @@ declare namespace WAWebJS {
* broadcast: false, * broadcast: false,
* fromMe: false, * fromMe: false,
* hasQuotedMsg: false, * hasQuotedMsg: false,
* hasReaction: false,
* location: undefined, * location: undefined,
* mentionedIds: [] * mentionedIds: []
* } * }
@@ -519,12 +695,18 @@ declare namespace WAWebJS {
ack: MessageAck, ack: MessageAck,
/** If the message was sent to a group, this field will contain the user that sent the message. */ /** If the message was sent to a group, this field will contain the user that sent the message. */
author?: string, author?: string,
/** String that represents from which device type the message was sent */
deviceType: string,
/** Message content */ /** Message content */
body: string, body: string,
/** Indicates if the message was a broadcast */ /** Indicates if the message was a broadcast */
broadcast: boolean, broadcast: boolean,
/** Indicates if the message was a status update */ /** Indicates if the message was a status update */
isStatus: boolean, isStatus: boolean,
/** Indicates if the message is a Gif */
isGif: boolean,
/** Indicates if the message will disappear after it expires */
isEphemeral: boolean,
/** ID for the Chat that this message was sent to, except if the message was sent by the current user */ /** ID for the Chat that this message was sent to, except if the message was sent by the current user */
from: string, from: string,
/** Indicates if the message was sent by the current user */ /** Indicates if the message was sent by the current user */
@@ -533,6 +715,10 @@ declare namespace WAWebJS {
hasMedia: boolean, hasMedia: boolean,
/** Indicates if the message was sent as a reply to another message */ /** Indicates if the message was sent as a reply to another message */
hasQuotedMsg: boolean, hasQuotedMsg: boolean,
/** Indicates whether there are reactions to the message */
hasReaction: boolean,
/** Indicates the duration of the message in seconds */
duration: string,
/** ID that represents the message */ /** ID that represents the message */
id: MessageId, id: MessageId,
/** Indicates if the message was forwarded */ /** Indicates if the message was forwarded */
@@ -585,11 +771,18 @@ declare namespace WAWebJS {
selectedButtonId?: string, selectedButtonId?: string,
/** Selected list row ID */ /** Selected list row ID */
selectedRowId?: string, selectedRowId?: string,
/** Returns message in a raw format */
rawData: object,
/*
* Reloads this Message object's data in-place with the latest values from WhatsApp Web.
* Note that the Message must still be in the web app cache for this to work, otherwise will return null.
*/
reload: () => Promise<Message>,
/** Accept the Group V4 Invite in message */ /** Accept the Group V4 Invite in message */
acceptGroupV4Invite: () => Promise<{status: number}>, acceptGroupV4Invite: () => Promise<{status: number}>,
/** Deletes the message from the chat */ /** Deletes the message from the chat */
delete: (everyone?: boolean) => Promise<void>, delete: (everyone?: boolean) => Promise<void>,
/** Downloads and returns the attatched message media */ /** Downloads and returns the attached message media */
downloadMedia: () => Promise<MessageMedia>, downloadMedia: () => Promise<MessageMedia>,
/** Returns the Chat this message was sent in */ /** Returns the Chat this message was sent in */
getChat: () => Promise<Chat>, getChat: () => Promise<Chat>,
@@ -605,24 +798,30 @@ declare namespace WAWebJS {
* If not, it will send the message in the same Chat as the original message was sent. * If not, it will send the message in the same Chat as the original message was sent.
*/ */
reply: (content: MessageContent, chatId?: string, options?: MessageSendOptions) => Promise<Message>, reply: (content: MessageContent, chatId?: string, options?: MessageSendOptions) => Promise<Message>,
/** React to this message with an emoji*/
react: (reaction: string) => Promise<void>,
/** /**
* Forwards this message to another chat * Forwards this message to another chat (that you chatted before, otherwise it will fail)
*/ */
forward: (chat: Chat | string) => Promise<void>, forward: (chat: Chat | string) => Promise<void>,
/** Star this message */ /** Star this message */
star: () => Promise<void>, star: () => Promise<void>,
/** Unstar this message */ /** Unstar this message */
unstar: () => Promise<void>, unstar: () => Promise<void>,
/** Get information about message delivery statuso */ /** Get information about message delivery status */
getInfo: () => Promise<MessageInfo | null>, getInfo: () => Promise<MessageInfo | null>,
/** /**
* Gets the order associated with a given message * Gets the order associated with a given message
*/ */
getOrder: () => Order, getOrder: () => Promise<Order>,
/** /**
* Gets the payment details associated with a given message * Gets the payment details associated with a given message
*/ */
getPayment: () => Payment, getPayment: () => Promise<Payment>,
/**
* Gets the reactions associated with the given message
*/
getReactions: () => Promise<ReactionList[]>,
} }
/** ID that represents a message */ /** ID that represents a message */
@@ -656,7 +855,7 @@ declare namespace WAWebJS {
/** Options for sending a message */ /** Options for sending a message */
export interface MessageSendOptions { export interface MessageSendOptions {
/** Show links preview */ /** Show links preview. Has no effect on multi-device accounts. */
linkPreview?: boolean linkPreview?: boolean
/** Send audio as voice message */ /** Send audio as voice message */
sendAudioAsVoice?: boolean sendAudioAsVoice?: boolean
@@ -690,6 +889,7 @@ declare namespace WAWebJS {
export interface MediaFromURLOptions { export interface MediaFromURLOptions {
client?: Client client?: Client
filename?: string
unsafeMime?: boolean unsafeMime?: boolean
reqOptions?: RequestInit reqOptions?: RequestInit
} }
@@ -702,13 +902,16 @@ declare namespace WAWebJS {
data: string data: string
/** Document file name. Value can be null */ /** Document file name. Value can be null */
filename?: string | null filename?: string | null
/** Document file size in bytes. Value can be null. */
filesize?: number | null
/** /**
* @param {string} mimetype MIME type of the attachment * @param {string} mimetype MIME type of the attachment
* @param {string} data Base64-encoded data of the file * @param {string} data Base64-encoded data of the file
* @param {?string} filename Document file name. Value can be null * @param {?string} filename Document file name. Value can be null
* @param {?number} filesize Document file size in bytes. Value can be null.
*/ */
constructor(mimetype: string, data: string, filename?: string | null) constructor(mimetype: string, data: string, filename?: string | null, filesize?: number | null)
/** Creates a MessageMedia instance from a local file path */ /** Creates a MessageMedia instance from a local file path */
static fromFilePath: (filePath: string) => MessageMedia static fromFilePath: (filePath: string) => MessageMedia
@@ -810,6 +1013,9 @@ declare namespace WAWebJS {
/** Gets the Contact's current "about" info. Returns null if you don't have permission to read their status. */ /** Gets the Contact's current "about" info. Returns null if you don't have permission to read their status. */
getAbout: () => Promise<string | null>, getAbout: () => Promise<string | null>,
/** Gets the Contact's common groups with you. Returns empty array if you don't have any common group. */
getCommonGroups: () => Promise<ChatId[]>
} }
@@ -868,6 +1074,8 @@ declare namespace WAWebJS {
timestamp: number, timestamp: number,
/** Amount of messages unread */ /** Amount of messages unread */
unreadCount: number, unreadCount: number,
/** Last message fo chat */
lastMessage: Message,
/** Archives this chat */ /** Archives this chat */
archive: () => Promise<void>, archive: () => Promise<void>,
@@ -907,12 +1115,15 @@ declare namespace WAWebJS {
export interface MessageSearchOptions { export interface MessageSearchOptions {
/** /**
* The amount of messages to return. * The amount of messages to return. If no limit is specified, the available messages will be returned.
* Note that the actual number of returned messages may be smaller if there aren't enough messages in the conversation. * Note that the actual number of returned messages may be smaller if there aren't enough messages in the conversation.
* Set this to Infinity to load all messages. * Set this to Infinity to load all messages.
* @default 50
*/ */
limit?: number limit?: number
/**
* Return only messages from the bot number or vise versa. To get all messages, leave the option undefined.
*/
fromMe?: boolean
} }
/** /**
@@ -954,7 +1165,7 @@ declare namespace WAWebJS {
} }
/** Promotes or demotes participants by IDs to regular users or admins */ /** Promotes or demotes participants by IDs to regular users or admins */
export type ChangeParticipantsPermisions = export type ChangeParticipantsPermissions =
(participantIds: Array<string>) => Promise<{ status: number }> (participantIds: Array<string>) => Promise<{ status: number }>
/** Adds or removes a list of participants by ID to the group */ /** Adds or removes a list of participants by ID to the group */
@@ -984,13 +1195,13 @@ declare namespace WAWebJS {
/** Removes a list of participants by ID to the group */ /** Removes a list of participants by ID to the group */
removeParticipants: ChangeGroupParticipants; removeParticipants: ChangeGroupParticipants;
/** Promotes participants by IDs to admins */ /** Promotes participants by IDs to admins */
promoteParticipants: ChangeParticipantsPermisions; promoteParticipants: ChangeParticipantsPermissions;
/** Demotes participants by IDs to regular users */ /** Demotes participants by IDs to regular users */
demoteParticipants: ChangeParticipantsPermisions; demoteParticipants: ChangeParticipantsPermissions;
/** Updates the group subject */ /** Updates the group subject */
setSubject: (subject: string) => Promise<void>; setSubject: (subject: string) => Promise<boolean>;
/** Updates the group description */ /** Updates the group description */
setDescription: (description: string) => Promise<void>; setDescription: (description: string) => Promise<boolean>;
/** Updates the group settings to only allow admins to send messages /** Updates the group settings to only allow admins to send messages
* @param {boolean} [adminsOnly=true] Enable or disable this option * @param {boolean} [adminsOnly=true] Enable or disable this option
* @returns {Promise<boolean>} Returns true if the setting was properly updated. This can return false if the user does not have the necessary permissions. * @returns {Promise<boolean>} Returns true if the setting was properly updated. This can return false if the user does not have the necessary permissions.
@@ -1008,6 +1219,10 @@ declare namespace WAWebJS {
revokeInvite: () => Promise<void>; revokeInvite: () => Promise<void>;
/** Makes the bot leave the group */ /** Makes the bot leave the group */
leave: () => Promise<void>; leave: () => Promise<void>;
/** Sets the group's picture.*/
setPicture: (media: MessageMedia) => Promise<boolean>;
/** Deletes the group's picture */
deletePicture: () => Promise<boolean>;
} }
/** /**
@@ -1173,6 +1388,9 @@ declare namespace WAWebJS {
webClientShouldHandle: boolean, webClientShouldHandle: boolean,
/** Object with participants */ /** Object with participants */
participants: object participants: object
/** Reject the call */
reject: () => Promise<void>
} }
/** Message type List */ /** Message type List */
@@ -1186,14 +1404,34 @@ declare namespace WAWebJS {
constructor(body: string, buttonText: string, sections: Array<any>, title?: string | null, footer?: string | null) constructor(body: string, buttonText: string, sections: Array<any>, title?: string | null, footer?: string | null)
} }
/** Message type buttons */ /** Message type Buttons */
export class Buttons { export class Buttons {
body: string | MessageMedia body: string | MessageMedia
buttons: Array<Array<string>> buttons: Array<{ buttonId: string; buttonText: {displayText: string}; type: number }>
title?: string | null title?: string | null
footer?: string | null footer?: string | null
constructor(body: string, buttons: Array<Array<string>>, title?: string | null, footer?: string | null) constructor(body: string, buttons: Array<{ id?: string; body: string }>, title?: string | null, footer?: string | null)
}
/** Message type Reaction */
export class Reaction {
id: MessageId
orphan: number
orphanReason?: string
timestamp: number
reaction: string
read: boolean
msgId: MessageId
senderId: string
ack?: number
}
export type ReactionList = {
id: string,
aggregateEmoji: string,
hasReactionByMe: boolean,
senders: Array<Reaction>
} }
} }

View File

@@ -21,5 +21,12 @@ module.exports = {
ProductMetadata: require('./src/structures/ProductMetadata'), ProductMetadata: require('./src/structures/ProductMetadata'),
List: require('./src/structures/List'), List: require('./src/structures/List'),
Buttons: require('./src/structures/Buttons'), Buttons: require('./src/structures/Buttons'),
// Auth Strategies
NoAuth: require('./src/authStrategies/NoAuth'),
LocalAuth: require('./src/authStrategies/LocalAuth'),
RemoteAuth: require('./src/authStrategies/RemoteAuth'),
LegacySessionAuth: require('./src/authStrategies/LegacySessionAuth'),
...Constants ...Constants
}; };

View File

@@ -1,11 +1,12 @@
{ {
"name": "whatsapp-web.js", "name": "whatsapp-web.js",
"version": "1.15.3", "version": "1.19.5",
"description": "Library for interacting with the WhatsApp Web API ", "description": "Library for interacting with the WhatsApp Web API ",
"main": "./index.js", "main": "./index.js",
"typings": "./index.d.ts", "typings": "./index.d.ts",
"scripts": { "scripts": {
"test": "mocha tests", "test": "mocha tests --recursive --timeout 5000",
"test-single": "mocha",
"shell": "node --experimental-repl-await ./shell.js", "shell": "node --experimental-repl-await ./shell.js",
"generate-docs": "node_modules/.bin/jsdoc --configure .jsdoc.json --verbose" "generate-docs": "node_modules/.bin/jsdoc --configure .jsdoc.json --verbose"
}, },
@@ -31,23 +32,29 @@
"@pedroslopez/moduleraid": "^5.0.2", "@pedroslopez/moduleraid": "^5.0.2",
"fluent-ffmpeg": "^2.1.2", "fluent-ffmpeg": "^2.1.2",
"jsqr": "^1.3.1", "jsqr": "^1.3.1",
"mime": "^2.4.5", "mime": "^3.0.0",
"node-fetch": "^2.6.5",
"node-webpmux": "^3.1.0", "node-webpmux": "^3.1.0",
"puppeteer": "^10.1.0", "puppeteer": "^13.0.0"
"sharp": "^0.28.3"
}, },
"devDependencies": { "devDependencies": {
"@types/node-fetch": "^2.5.11", "@types/node-fetch": "^2.5.12",
"chai": "^4.3.4", "chai": "^4.3.4",
"dotenv": "^10.0.0", "chai-as-promised": "^7.1.1",
"eslint": "^7.27.0", "dotenv": "^16.0.0",
"eslint-plugin-mocha": "^9.0.0", "eslint": "^8.4.1",
"eslint-plugin-mocha": "^10.0.3",
"jsdoc": "^3.6.4", "jsdoc": "^3.6.4",
"jsdoc-baseline": "^0.1.5", "jsdoc-baseline": "^0.1.5",
"mocha": "^9.0.2", "mocha": "^9.0.2",
"sinon": "^11.1.1" "sinon": "^13.0.1"
}, },
"engines": { "engines": {
"node": ">=12.0.0" "node": ">=12.0.0"
},
"optionalDependencies": {
"archiver": "^5.3.1",
"fs-extra": "^10.1.0",
"unzipper": "^0.10.11"
} }
} }

View File

@@ -2,24 +2,17 @@
* ==== wwebjs-shell ==== * ==== wwebjs-shell ====
* Used for quickly testing library features * Used for quickly testing library features
* *
* Running `npm run shell` will start WhatsApp Web in headless mode * Running `npm run shell` will start WhatsApp Web with headless=false
* and then drop you into Node REPL with `client` in its context. * and then drop you into Node REPL with `client` in its context.
*/ */
const repl = require('repl'); const repl = require('repl');
const fs = require('fs');
const { Client } = require('./index'); const { Client, LocalAuth } = require('./index');
const SESSION_FILE_PATH = './session.json';
let sessionCfg;
if (fs.existsSync(SESSION_FILE_PATH)) {
sessionCfg = require(SESSION_FILE_PATH);
}
const client = new Client({ const client = new Client({
puppeteer: { headless: false }, puppeteer: { headless: false },
session: sessionCfg authStrategy: new LocalAuth()
}); });
console.log('Initializing...'); console.log('Initializing...');
@@ -30,6 +23,10 @@ client.on('qr', () => {
console.log('Please scan the QR code on the browser.'); console.log('Please scan the QR code on the browser.');
}); });
client.on('authenticated', (session) => {
console.log(JSON.stringify(session));
});
client.on('ready', () => { client.on('ready', () => {
const shell = repl.start('wwebjs> '); const shell = repl.start('wwebjs> ');
shell.context.client = client; shell.context.client = client;

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,27 @@
'use strict';
/**
* Base class which all authentication strategies extend
*/
class BaseAuthStrategy {
constructor() {}
setup(client) {
this.client = client;
}
async beforeBrowserInitialized() {}
async afterBrowserInitialized() {}
async onAuthenticationNeeded() {
return {
failed: false,
restart: false,
failureEventPayload: undefined
};
}
async getAuthEventPayload() {}
async afterAuthReady() {}
async disconnect() {}
async destroy() {}
async logout() {}
}
module.exports = BaseAuthStrategy;

View File

@@ -0,0 +1,72 @@
'use strict';
const BaseAuthStrategy = require('./BaseAuthStrategy');
/**
* Legacy session auth strategy
* Not compatible with multi-device accounts.
* @param {object} options - options
* @param {string} options.restartOnAuthFail - Restart client with a new session (i.e. use null 'session' var) if authentication fails
* @param {object} options.session - Whatsapp session to restore. If not set, will start a new session
* @param {string} options.session.WABrowserId
* @param {string} options.session.WASecretBundle
* @param {string} options.session.WAToken1
* @param {string} options.session.WAToken2
*/
class LegacySessionAuth extends BaseAuthStrategy {
constructor({ session, restartOnAuthFail }={}) {
super();
this.session = session;
this.restartOnAuthFail = restartOnAuthFail;
}
async afterBrowserInitialized() {
if(this.session) {
await this.client.pupPage.evaluateOnNewDocument(session => {
if (document.referrer === 'https://whatsapp.com/') {
localStorage.clear();
localStorage.setItem('WABrowserId', session.WABrowserId);
localStorage.setItem('WASecretBundle', session.WASecretBundle);
localStorage.setItem('WAToken1', session.WAToken1);
localStorage.setItem('WAToken2', session.WAToken2);
}
localStorage.setItem('remember-me', 'true');
}, this.session);
}
}
async onAuthenticationNeeded() {
if(this.session) {
this.session = null;
return {
failed: true,
restart: this.restartOnAuthFail,
failureEventPayload: 'Unable to log in. Are the session details valid?'
};
}
return { failed: false };
}
async getAuthEventPayload() {
const isMD = await this.client.pupPage.evaluate(() => {
return window.Store.MDBackend;
});
if(isMD) throw new Error('Authenticating via JSON session is not supported for MultiDevice-enabled WhatsApp accounts.');
const localStorage = JSON.parse(await this.client.pupPage.evaluate(() => {
return JSON.stringify(window.localStorage);
}));
return {
WABrowserId: localStorage.WABrowserId,
WASecretBundle: localStorage.WASecretBundle,
WAToken1: localStorage.WAToken1,
WAToken2: localStorage.WAToken2
};
}
}
module.exports = LegacySessionAuth;

View File

@@ -0,0 +1,53 @@
'use strict';
const path = require('path');
const fs = require('fs');
const BaseAuthStrategy = require('./BaseAuthStrategy');
/**
* Local directory-based authentication
* @param {object} options - options
* @param {string} options.clientId - Client id to distinguish instances if you are using multiple, otherwise keep null if you are using only one instance
* @param {string} options.dataPath - Change the default path for saving session files, default is: "./.wwebjs_auth/"
*/
class LocalAuth extends BaseAuthStrategy {
constructor({ clientId, dataPath }={}) {
super();
const idRegex = /^[-_\w]+$/i;
if(clientId && !idRegex.test(clientId)) {
throw new Error('Invalid clientId. Only alphanumeric characters, underscores and hyphens are allowed.');
}
this.dataPath = path.resolve(dataPath || './.wwebjs_auth/');
this.clientId = clientId;
}
async beforeBrowserInitialized() {
const puppeteerOpts = this.client.options.puppeteer;
const sessionDirName = this.clientId ? `session-${this.clientId}` : 'session';
const dirPath = path.join(this.dataPath, sessionDirName);
if(puppeteerOpts.userDataDir && puppeteerOpts.userDataDir !== dirPath) {
throw new Error('LocalAuth is not compatible with a user-supplied userDataDir.');
}
fs.mkdirSync(dirPath, { recursive: true });
this.client.options.puppeteer = {
...puppeteerOpts,
userDataDir: dirPath
};
this.userDataDir = dirPath;
}
async logout() {
if (this.userDataDir) {
return (fs.rmSync ? fs.rmSync : fs.rmdirSync).call(this, this.userDataDir, { recursive: true });
}
}
}
module.exports = LocalAuth;

View File

@@ -0,0 +1,12 @@
'use strict';
const BaseAuthStrategy = require('./BaseAuthStrategy');
/**
* No session restoring functionality
* Will need to authenticate via QR code every time
*/
class NoAuth extends BaseAuthStrategy { }
module.exports = NoAuth;

View File

@@ -0,0 +1,204 @@
'use strict';
/* Require Optional Dependencies */
try {
var fs = require('fs-extra');
var unzipper = require('unzipper');
var archiver = require('archiver');
} catch {
fs = undefined;
unzipper = undefined;
archiver = undefined;
}
const path = require('path');
const { Events } = require('./../util/Constants');
const BaseAuthStrategy = require('./BaseAuthStrategy');
/**
* Remote-based authentication
* @param {object} options - options
* @param {object} options.store - Remote database store instance
* @param {string} options.clientId - Client id to distinguish instances if you are using multiple, otherwise keep null if you are using only one instance
* @param {string} options.dataPath - Change the default path for saving session files, default is: "./.wwebjs_auth/"
* @param {number} options.backupSyncIntervalMs - Sets the time interval for periodic session backups. Accepts values starting from 60000ms {1 minute}
*/
class RemoteAuth extends BaseAuthStrategy {
constructor({ clientId, dataPath, store, backupSyncIntervalMs } = {}) {
if (!fs && !unzipper && !archiver) throw new Error('Optional Dependencies [fs-extra, unzipper, archiver] are required to use RemoteAuth. Make sure to run npm install correctly and remove the --no-optional flag');
super();
const idRegex = /^[-_\w]+$/i;
if (clientId && !idRegex.test(clientId)) {
throw new Error('Invalid clientId. Only alphanumeric characters, underscores and hyphens are allowed.');
}
if (!backupSyncIntervalMs || backupSyncIntervalMs < 60000) {
throw new Error('Invalid backupSyncIntervalMs. Accepts values starting from 60000ms {1 minute}.');
}
if(!store) throw new Error('Remote database store is required.');
this.store = store;
this.clientId = clientId;
this.backupSyncIntervalMs = backupSyncIntervalMs;
this.dataPath = path.resolve(dataPath || './.wwebjs_auth/');
this.tempDir = `${this.dataPath}/wwebjs_temp_session`;
this.requiredDirs = ['Default', 'IndexedDB', 'Local Storage']; /* => Required Files & Dirs in WWebJS to restore session */
}
async beforeBrowserInitialized() {
const puppeteerOpts = this.client.options.puppeteer;
const sessionDirName = this.clientId ? `RemoteAuth-${this.clientId}` : 'RemoteAuth';
const dirPath = path.join(this.dataPath, sessionDirName);
if (puppeteerOpts.userDataDir && puppeteerOpts.userDataDir !== dirPath) {
throw new Error('RemoteAuth is not compatible with a user-supplied userDataDir.');
}
this.userDataDir = dirPath;
this.sessionName = sessionDirName;
await this.extractRemoteSession();
this.client.options.puppeteer = {
...puppeteerOpts,
userDataDir: dirPath
};
}
async logout() {
await this.disconnect();
}
async destroy() {
clearInterval(this.backupSync);
}
async disconnect() {
await this.deleteRemoteSession();
let pathExists = await this.isValidPath(this.userDataDir);
if (pathExists) {
await fs.promises.rm(this.userDataDir, {
recursive: true,
force: true
}).catch(() => {});
}
clearInterval(this.backupSync);
}
async afterAuthReady() {
const sessionExists = await this.store.sessionExists({session: this.sessionName});
if(!sessionExists) {
await this.delay(60000); /* Initial delay sync required for session to be stable enough to recover */
await this.storeRemoteSession({emit: true});
}
var self = this;
this.backupSync = setInterval(async function () {
await self.storeRemoteSession();
}, this.backupSyncIntervalMs);
}
async storeRemoteSession(options) {
/* Compress & Store Session */
const pathExists = await this.isValidPath(this.userDataDir);
if (pathExists) {
await this.compressSession();
await this.store.save({session: this.sessionName});
await fs.promises.unlink(`${this.sessionName}.zip`);
await fs.promises.rm(`${this.tempDir}`, {
recursive: true,
force: true
}).catch(() => {});
if(options && options.emit) this.client.emit(Events.REMOTE_SESSION_SAVED);
}
}
async extractRemoteSession() {
const pathExists = await this.isValidPath(this.userDataDir);
const compressedSessionPath = `${this.sessionName}.zip`;
const sessionExists = await this.store.sessionExists({session: this.sessionName});
if (pathExists) {
await fs.promises.rm(this.userDataDir, {
recursive: true,
force: true
}).catch(() => {});
}
if (sessionExists) {
await this.store.extract({session: this.sessionName, path: compressedSessionPath});
await this.unCompressSession(compressedSessionPath);
} else {
fs.mkdirSync(this.userDataDir, { recursive: true });
}
}
async deleteRemoteSession() {
const sessionExists = await this.store.sessionExists({session: this.sessionName});
if (sessionExists) await this.store.delete({session: this.sessionName});
}
async compressSession() {
const archive = archiver('zip');
const stream = fs.createWriteStream(`${this.sessionName}.zip`);
await fs.copy(this.userDataDir, this.tempDir).catch(() => {});
await this.deleteMetadata();
return new Promise((resolve, reject) => {
archive
.directory(this.tempDir, false)
.on('error', err => reject(err))
.pipe(stream);
stream.on('close', () => resolve());
archive.finalize();
});
}
async unCompressSession(compressedSessionPath) {
var stream = fs.createReadStream(compressedSessionPath);
await new Promise((resolve, reject) => {
stream.pipe(unzipper.Extract({
path: this.userDataDir
}))
.on('error', err => reject(err))
.on('finish', () => resolve());
});
await fs.promises.unlink(compressedSessionPath);
}
async deleteMetadata() {
const sessionDirs = [this.tempDir, path.join(this.tempDir, 'Default')];
for (const dir of sessionDirs) {
const sessionFiles = await fs.promises.readdir(dir);
for (const element of sessionFiles) {
if (!this.requiredDirs.includes(element)) {
const dirElement = path.join(dir, element);
const stats = await fs.promises.lstat(dirElement);
if (stats.isDirectory()) {
await fs.promises.rm(dirElement, {
recursive: true,
force: true
}).catch(() => {});
} else {
await fs.promises.unlink(dirElement).catch(() => {});
}
}
}
}
}
async isValidPath(path) {
try {
await fs.promises.access(path);
return true;
} catch {
return false;
}
}
async delay(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
}
module.exports = RemoteAuth;

View File

@@ -3,13 +3,27 @@
const MessageMedia = require('./MessageMedia'); const MessageMedia = require('./MessageMedia');
const Util = require('../util/Util'); const Util = require('../util/Util');
/**
* Button spec used in Buttons constructor
* @typedef {Object} ButtonSpec
* @property {string=} id - Custom ID to set on the button. A random one will be generated if one is not passed.
* @property {string} body - The text to show on the button.
*/
/**
* @typedef {Object} FormattedButtonSpec
* @property {string} buttonId
* @property {number} type
* @property {Object} buttonText
*/
/** /**
* Message type buttons * Message type buttons
*/ */
class Buttons { class Buttons {
/** /**
* @param {string|MessageMedia} body * @param {string|MessageMedia} body
* @param {Array<Array<string>>} buttons * @param {ButtonSpec[]} buttons - See {@link ButtonSpec}
* @param {string?} title * @param {string?} title
* @param {string?} footer * @param {string?} footer
*/ */
@@ -41,7 +55,7 @@ class Buttons {
/** /**
* buttons of message * buttons of message
* @type {Array<Array<string>>} * @type {FormattedButtonSpec[]}
*/ */
this.buttons = this._format(buttons); this.buttons = this._format(buttons);
if(!this.buttons.length){ throw '[BT01] No buttons';} if(!this.buttons.length){ throw '[BT01] No buttons';}
@@ -50,8 +64,8 @@ class Buttons {
/** /**
* Creates button array from simple array * Creates button array from simple array
* @param {Array<Array<string>>} buttons * @param {ButtonSpec[]} buttons
* @returns {Array<Array<string>>} * @returns {FormattedButtonSpec[]}
* @example * @example
* Input: [{id:'customId',body:'button1'},{body:'button2'},{body:'button3'},{body:'button4'}] * Input: [{id:'customId',body:'button1'},{body:'button2'},{body:'button3'},{body:'button4'}]
* Returns: [{ buttonId:'customId',buttonText:{'displayText':'button1'},type: 1 },{buttonId:'n3XKsL',buttonText:{'displayText':'button2'},type:1},{buttonId:'NDJk0a',buttonText:{'displayText':'button3'},type:1}] * Returns: [{ buttonId:'customId',buttonText:{'displayText':'button1'},type: 1 },{buttonId:'n3XKsL',buttonText:{'displayText':'button2'},type:1},{buttonId:'NDJk0a',buttonText:{'displayText':'button3'},type:1}]

View File

@@ -62,7 +62,15 @@ class Call extends Base {
return super._patch(data); 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; module.exports = Call;

View File

@@ -65,7 +65,7 @@ class Chat extends Base {
/** /**
* Indicates if the chat is muted or not * Indicates if the chat is muted or not
* @type {number} * @type {boolean}
*/ */
this.isMuted = data.isMuted; this.isMuted = data.isMuted;
@@ -75,6 +75,12 @@ class Chat extends Base {
*/ */
this.muteExpiration = data.muteExpiration; this.muteExpiration = data.muteExpiration;
/**
* Last message fo chat
* @type {Message}
*/
this.lastMessage = data.lastMessage ? new Message(super.client, data.lastMessage) : undefined;
return super._patch(data); return super._patch(data);
} }
@@ -170,31 +176,42 @@ class Chat extends Base {
/** /**
* Loads chat messages, sorted from earliest to latest. * Loads chat messages, sorted from earliest to latest.
* @param {Object} searchOptions Options for searching messages. Right now only limit is supported. * @param {Object} searchOptions Options for searching messages. Right now only limit and fromMe is supported.
* @param {Number} [searchOptions.limit=50] The amount of messages to return. Note that the actual number of returned messages may be smaller if there aren't enough messages in the conversation. Set this to Infinity to load all messages. * @param {Number} [searchOptions.limit] The amount of messages to return. If no limit is specified, the available messages will be returned. Note that the actual number of returned messages may be smaller if there aren't enough messages in the conversation. Set this to Infinity to load all messages.
* @param {Boolean} [searchOptions.fromMe] Return only messages from the bot number or vise versa. To get all messages, leave the option undefined.
* @returns {Promise<Array<Message>>} * @returns {Promise<Array<Message>>}
*/ */
async fetchMessages(searchOptions) { async fetchMessages(searchOptions) {
if (!searchOptions || !searchOptions.limit) { let messages = await this.client.pupPage.evaluate(async (chatId, searchOptions) => {
searchOptions = { limit: 50 }; const msgFilter = (m) => {
} if (m.isNotification) {
let messages = await this.client.pupPage.evaluate(async (chatId, limit) => { return false; // dont include notification messages
const msgFilter = m => !m.isNotification; // dont include notification messages }
if (searchOptions && searchOptions.fromMe && m.id.fromMe !== searchOptions.fromMe) {
return false;
}
return true;
};
const chat = window.Store.Chat.get(chatId); const chat = window.Store.Chat.get(chatId);
let msgs = chat.msgs.models.filter(msgFilter); let msgs = chat.msgs.getModelsArray().filter(msgFilter);
while (msgs.length < limit) { if (searchOptions && searchOptions.limit > 0) {
const loadedMessages = await chat.loadEarlierMsgs(); while (msgs.length < searchOptions.limit) {
if (!loadedMessages) break; const loadedMessages = await window.Store.ConversationMsgs.loadEarlierMsgs(chat);
msgs = [...loadedMessages.filter(msgFilter), ...msgs]; if (!loadedMessages || !loadedMessages.length) break;
msgs = [...loadedMessages.filter(msgFilter), ...msgs];
}
if (msgs.length > searchOptions.limit) {
msgs.sort((a, b) => (a.t > b.t) ? 1 : -1);
msgs = msgs.splice(msgs.length - searchOptions.limit);
}
} }
msgs.sort((a, b) => (a.t > b.t) ? 1 : -1);
if (msgs.length > limit) msgs = msgs.splice(msgs.length - limit);
return msgs.map(m => window.WWebJS.getMessageModel(m)); return msgs.map(m => window.WWebJS.getMessageModel(m));
}, this.id._serialized, searchOptions.limit); }, this.id._serialized, searchOptions);
return messages.map(m => new Message(this.client, m)); return messages.map(m => new Message(this.client, m));
} }

View File

@@ -20,12 +20,6 @@ class ClientInfo extends Base {
*/ */
this.pushname = data.pushname; this.pushname = data.pushname;
/**
* @type {object}
* @deprecated Use .wid instead
*/
this.me = data.wid;
/** /**
* Current user ID * Current user ID
* @type {object} * @type {object}
@@ -33,18 +27,25 @@ class ClientInfo extends Base {
this.wid = data.wid; this.wid = data.wid;
/** /**
* Information about the phone this client is connected to * @type {object}
* @deprecated Use .wid instead
*/
this.me = data.wid;
/**
* Information about the phone this client is connected to. Not available in multi-device.
* @type {object} * @type {object}
* @property {string} wa_version WhatsApp Version running on the phone * @property {string} wa_version WhatsApp Version running on the phone
* @property {string} os_version OS Version running on the phone (iOS or Android version) * @property {string} os_version OS Version running on the phone (iOS or Android version)
* @property {string} device_manufacturer Device manufacturer * @property {string} device_manufacturer Device manufacturer
* @property {string} device_model Device model * @property {string} device_model Device model
* @property {string} os_build_number OS build number * @property {string} os_build_number OS build number
* @deprecated
*/ */
this.phone = data.phone; this.phone = data.phone;
/** /**
* Platform the phone is running on * Platform WhatsApp is running on
* @type {string} * @type {string}
*/ */
this.platform = data.platform; this.platform = data.platform;
@@ -57,6 +58,7 @@ class ClientInfo extends Base {
* @returns {object} batteryStatus * @returns {object} batteryStatus
* @returns {number} batteryStatus.battery - The current battery percentage * @returns {number} batteryStatus.battery - The current battery percentage
* @returns {boolean} batteryStatus.plugged - Indicates if the phone is plugged in (true) or not (false) * @returns {boolean} batteryStatus.plugged - Indicates if the phone is plugged in (true) or not (false)
* @deprecated
*/ */
async getBatteryStatus() { async getBatteryStatus() {
return await this.client.pupPage.evaluate(() => { return await this.client.pupPage.evaluate(() => {
@@ -64,7 +66,6 @@ class ClientInfo extends Base {
return { battery, plugged }; return { battery, plugged };
}); });
} }
} }
module.exports = ClientInfo; module.exports = ClientInfo;

View File

@@ -183,7 +183,8 @@ class Contact extends Base {
*/ */
async getAbout() { async getAbout() {
const about = await this.client.pupPage.evaluate(async (contactId) => { const about = await this.client.pupPage.evaluate(async (contactId) => {
return window.Store.Wap.statusFind(contactId); const wid = window.Store.WidFactory.createWid(contactId);
return window.Store.StatusUtils.getStatus(wid);
}, this.id._serialized); }, this.id._serialized);
if (typeof about.status !== 'string') if (typeof about.status !== 'string')
@@ -191,6 +192,14 @@ class Contact extends Base {
return about.status; return about.status;
} }
/**
* Gets the Contact's common groups with you. Returns empty array if you don't have any common group.
* @returns {Promise<WAWebJS.ChatId[]>}
*/
async getCommonGroups() {
return await this.client.getCommonGroups(this.id._serialized);
}
} }

View File

@@ -59,8 +59,15 @@ class GroupChat extends Chat {
* @returns {Promise<Object>} * @returns {Promise<Object>}
*/ */
async addParticipants(participantIds) { async addParticipants(participantIds) {
return await this.client.pupPage.evaluate((chatId, participantIds) => { return await this.client.pupPage.evaluate(async (chatId, participantIds) => {
return window.Store.Wap.addParticipants(chatId, participantIds); const chatWid = window.Store.WidFactory.createWid(chatId);
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); }, this.id._serialized, participantIds);
} }
@@ -70,8 +77,14 @@ class GroupChat extends Chat {
* @returns {Promise<Object>} * @returns {Promise<Object>}
*/ */
async removeParticipants(participantIds) { async removeParticipants(participantIds) {
return await this.client.pupPage.evaluate((chatId, participantIds) => { return await this.client.pupPage.evaluate(async (chatId, participantIds) => {
return window.Store.Wap.removeParticipants(chatId, participantIds); const chatWid = window.Store.WidFactory.createWid(chatId);
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); }, this.id._serialized, participantIds);
} }
@@ -81,8 +94,14 @@ class GroupChat extends Chat {
* @returns {Promise<{ status: number }>} Object with status code indicating if the operation was successful * @returns {Promise<{ status: number }>} Object with status code indicating if the operation was successful
*/ */
async promoteParticipants(participantIds) { async promoteParticipants(participantIds) {
return await this.client.pupPage.evaluate((chatId, participantIds) => { return await this.client.pupPage.evaluate(async (chatId, participantIds) => {
return window.Store.Wap.promoteParticipants(chatId, participantIds); const chatWid = window.Store.WidFactory.createWid(chatId);
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); }, this.id._serialized, participantIds);
} }
@@ -92,54 +111,81 @@ class GroupChat extends Chat {
* @returns {Promise<{ status: number }>} Object with status code indicating if the operation was successful * @returns {Promise<{ status: number }>} Object with status code indicating if the operation was successful
*/ */
async demoteParticipants(participantIds) { async demoteParticipants(participantIds) {
return await this.client.pupPage.evaluate((chatId, participantIds) => { return await this.client.pupPage.evaluate(async (chatId, participantIds) => {
return window.Store.Wap.demoteParticipants(chatId, participantIds); const chatWid = window.Store.WidFactory.createWid(chatId);
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); }, this.id._serialized, participantIds);
} }
/** /**
* Updates the group subject * Updates the group subject
* @param {string} subject * @param {string} subject
* @returns {Promise} * @returns {Promise<boolean>} Returns true if the subject was properly updated. This can return false if the user does not have the necessary permissions.
*/ */
async setSubject(subject) { async setSubject(subject) {
let res = await this.client.pupPage.evaluate((chatId, subject) => { const success = await this.client.pupPage.evaluate(async (chatId, subject) => {
return window.Store.Wap.changeSubject(chatId, subject); const chatWid = window.Store.WidFactory.createWid(chatId);
try {
await window.Store.GroupUtils.setGroupSubject(chatWid, subject);
return true;
} catch (err) {
if(err.name === 'ServerStatusCodeError') return false;
throw err;
}
}, this.id._serialized, subject); }, this.id._serialized, subject);
if(res.status == 200) { if(!success) return false;
this.name = subject; this.name = subject;
} return true;
} }
/** /**
* Updates the group description * Updates the group description
* @param {string} description * @param {string} description
* @returns {Promise} * @returns {Promise<boolean>} Returns true if the description was properly updated. This can return false if the user does not have the necessary permissions.
*/ */
async setDescription(description) { async setDescription(description) {
let res = await this.client.pupPage.evaluate((chatId, description) => { const success = await this.client.pupPage.evaluate(async (chatId, description) => {
let descId = window.Store.GroupMetadata.get(chatId).descId; const chatWid = window.Store.WidFactory.createWid(chatId);
return window.Store.Wap.setGroupDescription(chatId, description, window.Store.genId(), descId); let descId = window.Store.GroupMetadata.get(chatWid).descId;
try {
await window.Store.GroupUtils.setGroupDescription(chatWid, description, window.Store.MsgKey.newId(), descId);
return true;
} catch (err) {
if(err.name === 'ServerStatusCodeError') return false;
throw err;
}
}, this.id._serialized, description); }, this.id._serialized, description);
if (res.status == 200) { if(!success) return false;
this.groupMetadata.desc = description; this.groupMetadata.desc = description;
} return true;
} }
/** /**
* Updates the group settings to only allow admins to send messages. * Updates the group settings to only allow admins to send messages.
* @param {boolean} [adminsOnly=true] Enable or disable this option * @param {boolean} [adminsOnly=true] Enable or disable this option
* @returns {Promise<boolean>} Returns true if the setting was properly updated. This can return false if the user does not have the necessary permissions. * @returns {Promise<boolean>} Returns true if the setting was properly updated. This can return false if the user does not have the necessary permissions.
*/ */
async setMessagesAdminsOnly(adminsOnly=true) { async setMessagesAdminsOnly(adminsOnly=true) {
let res = await this.client.pupPage.evaluate((chatId, value) => { const success = await this.client.pupPage.evaluate(async (chatId, adminsOnly) => {
return window.Store.Wap.setGroupProperty(chatId, 'announcement', value); const chatWid = window.Store.WidFactory.createWid(chatId);
try {
await window.Store.GroupUtils.setGroupProperty(chatWid, 'announcement', adminsOnly ? 1 : 0);
return true;
} catch (err) {
if(err.name === 'ServerStatusCodeError') return false;
throw err;
}
}, this.id._serialized, adminsOnly); }, this.id._serialized, adminsOnly);
if (res.status !== 200) return false; if(!success) return false;
this.groupMetadata.announce = adminsOnly; this.groupMetadata.announce = adminsOnly;
return true; return true;
} }
@@ -150,40 +196,72 @@ class GroupChat extends Chat {
* @returns {Promise<boolean>} Returns true if the setting was properly updated. This can return false if the user does not have the necessary permissions. * @returns {Promise<boolean>} Returns true if the setting was properly updated. This can return false if the user does not have the necessary permissions.
*/ */
async setInfoAdminsOnly(adminsOnly=true) { async setInfoAdminsOnly(adminsOnly=true) {
let res = await this.client.pupPage.evaluate((chatId, value) => { const success = await this.client.pupPage.evaluate(async (chatId, adminsOnly) => {
return window.Store.Wap.setGroupProperty(chatId, 'restrict', value); const chatWid = window.Store.WidFactory.createWid(chatId);
try {
await window.Store.GroupUtils.setGroupProperty(chatWid, 'restrict', adminsOnly ? 1 : 0);
return true;
} catch (err) {
if(err.name === 'ServerStatusCodeError') return false;
throw err;
}
}, this.id._serialized, adminsOnly); }, this.id._serialized, adminsOnly);
if (res.status !== 200) return false; if(!success) return false;
this.groupMetadata.restrict = adminsOnly; this.groupMetadata.restrict = adminsOnly;
return true; return true;
} }
/**
* Deletes the group's picture.
* @returns {Promise<boolean>} Returns true if the picture was properly deleted. This can return false if the user does not have the necessary permissions.
*/
async deletePicture() {
const success = await this.client.pupPage.evaluate((chatid) => {
return window.WWebJS.deletePicture(chatid);
}, this.id._serialized);
return success;
}
/**
* Sets the group's picture.
* @param {MessageMedia} media
* @returns {Promise<boolean>} Returns true if the picture was properly updated. This can return false if the user does not have the necessary permissions.
*/
async setPicture(media) {
const success = await this.client.pupPage.evaluate((chatid, media) => {
return window.WWebJS.setPicture(chatid, media);
}, this.id._serialized, media);
return success;
}
/** /**
* Gets the invite code for a specific group * Gets the invite code for a specific group
* @returns {Promise<string>} Group's invite code * @returns {Promise<string>} Group's invite code
*/ */
async getInviteCode() { async getInviteCode() {
let res = await this.client.pupPage.evaluate(chatId => { const codeRes = await this.client.pupPage.evaluate(async chatId => {
return window.Store.Wap.groupInviteCode(chatId); const chatWid = window.Store.WidFactory.createWid(chatId);
return window.Store.Invite.queryGroupInviteCode(chatWid);
}, this.id._serialized); }, this.id._serialized);
if (res.status == 200) { return codeRes.code;
return res.code;
}
throw new Error('Not authorized');
} }
/** /**
* Invalidates the current group invite code and generates a new one * Invalidates the current group invite code and generates a new one
* @returns {Promise} * @returns {Promise<string>} New invite code
*/ */
async revokeInvite() { async revokeInvite() {
return await this.client.pupPage.evaluate(chatId => { const codeRes = await this.client.pupPage.evaluate(chatId => {
return window.Store.Wap.revokeGroupInvite(chatId); const chatWid = window.Store.WidFactory.createWid(chatId);
return window.Store.Invite.resetGroupInviteCode(chatWid);
}, this.id._serialized); }, this.id._serialized);
return codeRes.code;
} }
/** /**
@@ -191,8 +269,10 @@ class GroupChat extends Chat {
* @returns {Promise} * @returns {Promise}
*/ */
async leave() { async leave() {
return await this.client.pupPage.evaluate(chatId => { await this.client.pupPage.evaluate(async chatId => {
return window.Store.Wap.leaveGroup(chatId); const chatWid = window.Store.WidFactory.createWid(chatId);
const chat = await window.Store.Chat.find(chatWid);
return window.Store.GroupUtils.sendExitGroup(chat);
}, this.id._serialized); }, this.id._serialized);
} }

View File

@@ -43,7 +43,7 @@ class GroupNotification extends Base {
* *
* @type {string} * @type {string}
*/ */
this.chatId = typeof (data.to) === 'object' ? data.to._serialized : data.to; this.chatId = typeof (data.id.remote) === 'object' ? data.id.remote._serialized : data.id.remote;
/** /**
* ContactId for the user that produced the GroupNotification. * ContactId for the user that produced the GroupNotification.

View File

@@ -57,7 +57,7 @@ class List {
*/ */
_format(sections){ _format(sections){
if(!sections.length){throw '[LT02] List without sections';} if(!sections.length){throw '[LT02] List without sections';}
if(sections.length > 1){throw '[LT05] Lists with more than one section are having problems';} if(sections.length > 1 && sections.filter(s => typeof s.title == 'undefined').length > 1){throw '[LT05] You can\'t have more than one empty title.';}
return sections.map( (section) =>{ return sections.map( (section) =>{
if(!section.rows.length){throw '[LT03] Section without rows';} if(!section.rows.length){throw '[LT03] Section without rows';}
return { return {
@@ -76,4 +76,4 @@ class List {
} }
module.exports = List; module.exports = List;

View File

@@ -5,7 +5,8 @@ const MessageMedia = require('./MessageMedia');
const Location = require('./Location'); const Location = require('./Location');
const Order = require('./Order'); const Order = require('./Order');
const Payment = require('./Payment'); const Payment = require('./Payment');
const { MessageTypes } = require('../util/Constants'); const Reaction = require('./Reaction');
const {MessageTypes} = require('../util/Constants');
/** /**
* Represents a Message on WhatsApp * Represents a Message on WhatsApp
@@ -19,13 +20,14 @@ class Message extends Base {
} }
_patch(data) { _patch(data) {
this._data = data;
/** /**
* MediaKey that represents the sticker 'ID' * MediaKey that represents the sticker 'ID'
* @type {string} * @type {string}
*/ */
this.mediaKey = data.mediaKey; this.mediaKey = data.mediaKey;
/** /**
* ID that represents the message * ID that represents the message
* @type {object} * @type {object}
@@ -50,7 +52,7 @@ class Message extends Base {
*/ */
this.body = this.hasMedia ? data.caption || '' : data.body || ''; this.body = this.hasMedia ? data.caption || '' : data.body || '';
/** /**
* Message type * Message type
* @type {MessageTypes} * @type {MessageTypes}
*/ */
@@ -70,9 +72,9 @@ class Message extends Base {
/** /**
* ID for who this message is for. * ID for who this message is for.
* *
* If the message is sent by the current user, it will be the Chat to which the message is being sent. * If the message is sent by the current user, it will be the Chat to which the message is being sent.
* If the message is sent by another user, it will be the ID for the current user. * If the message is sent by another user, it will be the ID for the current user.
* @type {string} * @type {string}
*/ */
this.to = (typeof (data.to) === 'object' && data.to !== null) ? data.to._serialized : data.to; this.to = (typeof (data.to) === 'object' && data.to !== null) ? data.to._serialized : data.to;
@@ -87,8 +89,8 @@ class Message extends Base {
* String that represents from which device type the message was sent * String that represents from which device type the message was sent
* @type {string} * @type {string}
*/ */
this.deviceType = data.id.id.length > 21 ? 'android' : data.id.id.substring(0,2) =='3A' ? 'ios' : 'web'; this.deviceType = data.id.id.length > 21 ? 'android' : data.id.id.substring(0, 2) == '3A' ? 'ios' : 'web';
/** /**
* Indicates if the message was forwarded * Indicates if the message was forwarded
* @type {boolean} * @type {boolean}
@@ -114,14 +116,14 @@ class Message extends Base {
* @type {boolean} * @type {boolean}
*/ */
this.isStarred = data.star; this.isStarred = data.star;
/** /**
* Indicates if the message was a broadcast * Indicates if the message was a broadcast
* @type {boolean} * @type {boolean}
*/ */
this.broadcast = data.broadcast; this.broadcast = data.broadcast;
/** /**
* Indicates if the message was sent by the current user * Indicates if the message was sent by the current user
* @type {boolean} * @type {boolean}
*/ */
@@ -133,6 +135,18 @@ class Message extends Base {
*/ */
this.hasQuotedMsg = data.quotedMsg ? true : false; this.hasQuotedMsg = data.quotedMsg ? true : false;
/**
* Indicates whether there are reactions to the message
* @type {boolean}
*/
this.hasReaction = data.hasReaction ? true : false;
/**
* Indicates the duration of the message in seconds
* @type {string}
*/
this.duration = data.duration ? data.duration : undefined;
/** /**
* Location information contained in the message, if the message is type "location" * Location information contained in the message, if the message is type "location"
* @type {Location} * @type {Location}
@@ -157,7 +171,7 @@ class Message extends Base {
fromId: data.from._serialized, fromId: data.from._serialized,
toId: data.to._serialized toId: data.to._serialized
} : undefined; } : undefined;
/** /**
* Indicates the mentions in the message body. * Indicates the mentions in the message body.
* @type {Array<string>} * @type {Array<string>}
@@ -179,6 +193,18 @@ class Message extends Base {
*/ */
this.token = data.token ? data.token : undefined; this.token = data.token ? data.token : undefined;
/**
* Indicates whether the message is a Gif
* @type {boolean}
*/
this.isGif = Boolean(data.isGif);
/**
* Indicates if the message will disappear after it expires
* @type {boolean}
*/
this.isEphemeral = data.isEphemeral;
/** Title */ /** Title */
if (data.title) { if (data.title) {
this.title = data.title; this.title = data.title;
@@ -202,7 +228,7 @@ class Message extends Base {
/** /**
* Links included in the message. * Links included in the message.
* @type {Array<{link: string, isSuspicious: boolean}>} * @type {Array<{link: string, isSuspicious: boolean}>}
* *
*/ */
this.links = data.links; this.links = data.links;
@@ -210,7 +236,7 @@ class Message extends Base {
if (data.dynamicReplyButtons) { if (data.dynamicReplyButtons) {
this.dynamicReplyButtons = data.dynamicReplyButtons; this.dynamicReplyButtons = data.dynamicReplyButtons;
} }
/** Selected Button Id **/ /** Selected Button Id **/
if (data.selectedButtonId) { if (data.selectedButtonId) {
this.selectedButtonId = data.selectedButtonId; this.selectedButtonId = data.selectedButtonId;
@@ -220,7 +246,7 @@ class Message extends Base {
if (data.listResponse && data.listResponse.singleSelectReply.selectedRowId) { if (data.listResponse && data.listResponse.singleSelectReply.selectedRowId) {
this.selectedRowId = data.listResponse.singleSelectReply.selectedRowId; this.selectedRowId = data.listResponse.singleSelectReply.selectedRowId;
} }
return super._patch(data); return super._patch(data);
} }
@@ -228,6 +254,32 @@ class Message extends Base {
return this.fromMe ? this.to : this.from; return this.fromMe ? this.to : this.from;
} }
/**
* Reloads this Message object's data in-place with the latest values from WhatsApp Web.
* Note that the Message must still be in the web app cache for this to work, otherwise will return null.
* @returns {Promise<Message>}
*/
async reload() {
const newData = await this.client.pupPage.evaluate((msgId) => {
const msg = window.Store.Msg.get(msgId);
if(!msg) return null;
return window.WWebJS.getMessageModel(msg);
}, this.id._serialized);
if(!newData) return null;
this._patch(newData);
return this;
}
/**
* Returns message in a raw format
* @type {Object}
*/
get rawData() {
return this._data;
}
/** /**
* Returns the Chat this message was sent in * Returns the Chat this message was sent in
* @returns {Promise<Chat>} * @returns {Promise<Chat>}
@@ -260,20 +312,21 @@ class Message extends Base {
if (!this.hasQuotedMsg) return undefined; if (!this.hasQuotedMsg) return undefined;
const quotedMsg = await this.client.pupPage.evaluate((msgId) => { const quotedMsg = await this.client.pupPage.evaluate((msgId) => {
let msg = window.Store.Msg.get(msgId); const msg = window.Store.Msg.get(msgId);
return msg.quotedMsgObj().serialize(); const quotedMsg = window.Store.QuotedMsg.getQuotedMsgObj(msg);
return window.WWebJS.getMessageModel(quotedMsg);
}, this.id._serialized); }, this.id._serialized);
return new Message(this.client, quotedMsg); return new Message(this.client, quotedMsg);
} }
/** /**
* Sends a message as a reply to this message. If chatId is specified, it will be sent * Sends a message as a reply to this message. If chatId is specified, it will be sent
* through the specified Chat. If not, it will send the message * through the specified Chat. If not, it will send the message
* in the same Chat as the original message was sent. * in the same Chat as the original message was sent.
* *
* @param {string|MessageMedia|Location} content * @param {string|MessageMedia|Location} content
* @param {string} [chatId] * @param {string} [chatId]
* @param {MessageSendOptions} [options] * @param {MessageSendOptions} [options]
* @returns {Promise<Message>} * @returns {Promise<Message>}
*/ */
@@ -290,6 +343,20 @@ class Message extends Base {
return this.client.sendMessage(chatId, content, options); return this.client.sendMessage(chatId, content, options);
} }
/**
* React to this message with an emoji
* @param {string} reaction - Emoji to react with. Send an empty string to remove the reaction.
* @return {Promise}
*/
async react(reaction){
await this.client.pupPage.evaluate(async (messageId, reaction) => {
if (!messageId) { return undefined; }
const msg = await window.Store.Msg.get(messageId);
await window.Store.sendReactionToMsg(msg, reaction);
}, this.id._serialized, reaction);
}
/** /**
* Accept Group V4 Invite * Accept Group V4 Invite
* @returns {Promise<Object>} * @returns {Promise<Object>}
@@ -297,10 +364,10 @@ class Message extends Base {
async acceptGroupV4Invite() { async acceptGroupV4Invite() {
return await this.client.acceptGroupV4Invite(this.inviteV4); return await this.client.acceptGroupV4Invite(this.inviteV4);
} }
/** /**
* Forwards this message to another chat * Forwards this message to another chat (that you chatted before, otherwise it will fail)
* *
* @param {string|Chat} chat Chat model or chat ID to which the message will be forwarded * @param {string|Chat} chat Chat model or chat ID to which the message will be forwarded
* @returns {Promise} * @returns {Promise}
*/ */
@@ -326,11 +393,13 @@ class Message extends Base {
const result = await this.client.pupPage.evaluate(async (msgId) => { const result = await this.client.pupPage.evaluate(async (msgId) => {
const msg = window.Store.Msg.get(msgId); const msg = window.Store.Msg.get(msgId);
if (!msg) {
return undefined;
}
if (msg.mediaData.mediaStage != 'RESOLVED') { if (msg.mediaData.mediaStage != 'RESOLVED') {
// try to resolve media // try to resolve media
await msg.downloadMedia({ await msg.downloadMedia({
downloadEvenIfExpensive: true, downloadEvenIfExpensive: true,
rmrReason: 1 rmrReason: 1
}); });
} }
@@ -341,7 +410,7 @@ class Message extends Base {
} }
try { try {
const decryptedMedia = await window.Store.DownloadManager.downloadAndDecrypt({ const decryptedMedia = await window.Store.DownloadManager.downloadAndMaybeDecrypt({
directPath: msg.directPath, directPath: msg.directPath,
encFilehash: msg.encFilehash, encFilehash: msg.encFilehash,
filehash: msg.filehash, filehash: msg.filehash,
@@ -350,13 +419,14 @@ class Message extends Base {
type: msg.type, type: msg.type,
signal: (new AbortController).signal signal: (new AbortController).signal
}); });
const data = window.WWebJS.arrayBufferToBase64(decryptedMedia); const data = await window.WWebJS.arrayBufferToBase64Async(decryptedMedia);
return { return {
data, data,
mimetype: msg.mimetype, mimetype: msg.mimetype,
filename: msg.filename filename: msg.filename,
filesize: msg.size
}; };
} catch (e) { } catch (e) {
if(e.status && e.status === 404) return undefined; if(e.status && e.status === 404) return undefined;
@@ -365,19 +435,20 @@ class Message extends Base {
}, this.id._serialized); }, this.id._serialized);
if (!result) return undefined; if (!result) return undefined;
return new MessageMedia(result.mimetype, result.data, result.filename); return new MessageMedia(result.mimetype, result.data, result.filename, result.filesize);
} }
/** /**
* Deletes a message from the chat * Deletes a message from the chat
* @param {?boolean} everyone If true and the message is sent by the current user, will delete it for everyone in the chat. * @param {?boolean} everyone If true and the message is sent by the current user or the user is an admin, will delete it for everyone in the chat.
*/ */
async delete(everyone) { async delete(everyone) {
await this.client.pupPage.evaluate((msgId, everyone) => { await this.client.pupPage.evaluate((msgId, everyone) => {
let msg = window.Store.Msg.get(msgId); let msg = window.Store.Msg.get(msgId);
if (everyone && msg.id.fromMe && msg.canRevoke()) { const canRevoke = window.Store.MsgActionChecks.canSenderRevokeMsg(msg) || window.Store.MsgActionChecks.canAdminRevokeMsg(msg);
return window.Store.Cmd.sendRevokeMsgs(msg.chat, [msg], true); if (everyone && canRevoke) {
return window.Store.Cmd.sendRevokeMsgs(msg.chat, [msg], { type: msg.id.fromMe ? 'Sender' : 'Admin' });
} }
return window.Store.Cmd.sendDeleteMsgs(msg.chat, [msg], true); return window.Store.Cmd.sendDeleteMsgs(msg.chat, [msg], true);
@@ -391,8 +462,8 @@ class Message extends Base {
await this.client.pupPage.evaluate((msgId) => { await this.client.pupPage.evaluate((msgId) => {
let msg = window.Store.Msg.get(msgId); let msg = window.Store.Msg.get(msgId);
if (msg.canStar()) { if (window.Store.MsgActionChecks.canStarMsg(msg)) {
return msg.chat.sendStarMsgs([msg], true); return window.Store.Cmd.sendStarMsgs(msg.chat, [msg], false);
} }
}, this.id._serialized); }, this.id._serialized);
} }
@@ -404,8 +475,8 @@ class Message extends Base {
await this.client.pupPage.evaluate((msgId) => { await this.client.pupPage.evaluate((msgId) => {
let msg = window.Store.Msg.get(msgId); let msg = window.Store.Msg.get(msgId);
if (msg.canStar()) { if (window.Store.MsgActionChecks.canStarMsg(msg)) {
return msg.chat.sendStarMsgs([msg], false); return window.Store.Cmd.sendUnstarMsgs(msg.chat, [msg], false);
} }
}, this.id._serialized); }, this.id._serialized);
} }
@@ -428,14 +499,10 @@ class Message extends Base {
async getInfo() { async getInfo() {
const info = await this.client.pupPage.evaluate(async (msgId) => { const info = await this.client.pupPage.evaluate(async (msgId) => {
const msg = window.Store.Msg.get(msgId); const msg = window.Store.Msg.get(msgId);
if(!msg) return null; if (!msg) return null;
return await window.Store.Wap.queryMsgInfo(msg.id);
}, this.id._serialized);
if(info.status) { return await window.Store.MessageInfo.sendQueryMsgInfo(msg.id);
return null; }, this.id._serialized);
}
return info; return info;
} }
@@ -446,9 +513,9 @@ class Message extends Base {
*/ */
async getOrder() { async getOrder() {
if (this.type === MessageTypes.ORDER) { if (this.type === MessageTypes.ORDER) {
const result = await this.client.pupPage.evaluate((orderId, token) => { const result = await this.client.pupPage.evaluate((orderId, token, chatId) => {
return window.WWebJS.getOrderDetail(orderId, token); return window.WWebJS.getOrderDetail(orderId, token, chatId);
}, this.orderId, this.token); }, this.orderId, this.token, this._getChatId());
if (!result) return undefined; if (!result) return undefined;
return new Order(this.client, result); return new Order(this.client, result);
} }
@@ -469,6 +536,44 @@ class Message extends Base {
} }
return undefined; return undefined;
} }
/**
* Reaction List
* @typedef {Object} ReactionList
* @property {string} id Original emoji
* @property {string} aggregateEmoji aggregate emoji
* @property {boolean} hasReactionByMe Flag who sent the reaction
* @property {Array<Reaction>} senders Reaction senders, to this message
*/
/**
* Gets the reactions associated with the given message
* @return {Promise<ReactionList[]>}
*/
async getReactions() {
if (!this.hasReaction) {
return undefined;
}
const reactions = await this.client.pupPage.evaluate(async (msgId) => {
const msgReactions = await window.Store.Reactions.find(msgId);
if (!msgReactions || !msgReactions.reactions.length) return null;
return msgReactions.reactions.serialize();
}, this.id._serialized);
if (!reactions) {
return undefined;
}
return reactions.map(reaction => {
reaction.senders = reaction.senders.map(sender => {
sender.timestamp = Math.round(sender.timestamp / 1000);
return new Reaction(this.client, sender);
});
return reaction;
});
}
} }
module.exports = Message; module.exports = Message;

View File

@@ -10,10 +10,11 @@ const { URL } = require('url');
* Media attached to a message * Media attached to a message
* @param {string} mimetype MIME type of the attachment * @param {string} mimetype MIME type of the attachment
* @param {string} data Base64-encoded data of the file * @param {string} data Base64-encoded data of the file
* @param {?string} filename Document file name * @param {?string} filename Document file name. Value can be null
* @param {?number} filesize Document file size in bytes. Value can be null
*/ */
class MessageMedia { class MessageMedia {
constructor(mimetype, data, filename) { constructor(mimetype, data, filename, filesize) {
/** /**
* MIME type of the attachment * MIME type of the attachment
* @type {string} * @type {string}
@@ -27,10 +28,16 @@ class MessageMedia {
this.data = data; this.data = data;
/** /**
* Name of the file (for documents) * Document file name. Value can be null
* @type {?string} * @type {?string}
*/ */
this.filename = filename; this.filename = filename;
/**
* Document file size in bytes. Value can be null
* @type {?number}
*/
this.filesize = filesize;
} }
/** /**
@@ -50,29 +57,30 @@ class MessageMedia {
* Creates a MessageMedia instance from a URL * Creates a MessageMedia instance from a URL
* @param {string} url * @param {string} url
* @param {Object} [options] * @param {Object} [options]
* @param {number} [options.unsafeMime=false] * @param {boolean} [options.unsafeMime=false]
* @param {string} [options.filename]
* @param {object} [options.client] * @param {object} [options.client]
* @param {object} [options.reqOptions] * @param {object} [options.reqOptions]
* @param {number} [options.reqOptions.size=0] * @param {number} [options.reqOptions.size=0]
* @returns {Promise<MessageMedia>} * @returns {Promise<MessageMedia>}
*/ */
static async fromUrl(url, options = {}) { static async fromUrl(url, options = {}) {
let mimetype; const pUrl = new URL(url);
let mimetype = mime.getType(pUrl.pathname);
if (!options.unsafeMime) { if (!mimetype && !options.unsafeMime)
const pUrl = new URL(url); throw new Error('Unable to determine MIME type using URL. Set unsafeMime to true to download it anyway.');
mimetype = mime.getType(pUrl.pathname);
if (!mimetype)
throw new Error('Unable to determine MIME type');
}
async function fetchData (url, options) { async function fetchData (url, options) {
const reqOptions = Object.assign({ headers: { accept: 'image/* video/* text/* audio/*' } }, options); const reqOptions = Object.assign({ headers: { accept: 'image/* video/* text/* audio/*' } }, options);
const response = await fetch(url, reqOptions); const response = await fetch(url, reqOptions);
const mime = response.headers.get('Content-Type'); const mime = response.headers.get('Content-Type');
let data = ''; const size = response.headers.get('Content-Length');
const contentDisposition = response.headers.get('Content-Disposition');
const name = contentDisposition ? contentDisposition.match(/((?<=filename=")(.*)(?="))/) : null;
let data = '';
if (response.buffer) { if (response.buffer) {
data = (await response.buffer()).toString('base64'); data = (await response.buffer()).toString('base64');
} else { } else {
@@ -83,18 +91,21 @@ class MessageMedia {
data = btoa(data); data = btoa(data);
} }
return { data, mime }; return { data, mime, name, size };
} }
const res = options.client const res = options.client
? (await options.client.pupPage.evaluate(fetchData, url, options.reqOptions)) ? (await options.client.pupPage.evaluate(fetchData, url, options.reqOptions))
: (await fetchData(url, options.reqOptions)); : (await fetchData(url, options.reqOptions));
const filename = options.filename ||
(res.name ? res.name[0] : (pUrl.pathname.split('/').pop() || 'file'));
if (!mimetype) if (!mimetype)
mimetype = res.mime; mimetype = res.mime;
return new MessageMedia(mimetype, res.data, null); return new MessageMedia(mimetype, res.data, filename, res.size || null);
} }
} }
module.exports = MessageMedia; module.exports = MessageMedia;

View File

@@ -40,7 +40,6 @@ class Payment extends Base {
/** /**
* The paymentStatus * The paymentStatus
* @type {number}
* *
* Possible Status * Possible Status
* 0:UNKNOWN_STATUS * 0:UNKNOWN_STATUS
@@ -55,6 +54,8 @@ class Payment extends Base {
* 9:CANCELLED * 9:CANCELLED
* 10:WAITING_FOR_PAYER * 10:WAITING_FOR_PAYER
* 11:WAITING * 11:WAITING
*
* @type {number}
*/ */
this.paymentStatus = data.paymentStatus; this.paymentStatus = data.paymentStatus;

View File

@@ -0,0 +1,69 @@
'use strict';
const Base = require('./Base');
/**
* Represents a Reaction on WhatsApp
* @extends {Base}
*/
class Reaction extends Base {
constructor(client, data) {
super(client);
if (data) this._patch(data);
}
_patch(data) {
/**
* Reaction ID
* @type {object}
*/
this.id = data.msgKey;
/**
* Orphan
* @type {number}
*/
this.orphan = data.orphan;
/**
* Orphan reason
* @type {?string}
*/
this.orphanReason = data.orphanReason;
/**
* Unix timestamp for when the reaction was created
* @type {number}
*/
this.timestamp = data.timestamp;
/**
* Reaction
* @type {string}
*/
this.reaction = data.reactionText;
/**
* Read
* @type {boolean}
*/
this.read = data.read;
/**
* Message ID
* @type {object}
*/
this.msgId = data.parentMsgKey;
/**
* Sender ID
* @type {string}
*/
this.senderId = data.senderUserJid;
/**
* ACK
* @type {?number}
*/
this.ack = data.ack;
return super._patch(data);
}
}
module.exports = Reaction;

View File

@@ -17,5 +17,6 @@ module.exports = {
Call: require('./Call'), Call: require('./Call'),
Buttons: require('./Buttons'), Buttons: require('./Buttons'),
List: require('./List'), List: require('./List'),
Payment: require('./Payment') Payment: require('./Payment'),
Reaction: require('./Reaction'),
}; };

View File

@@ -7,14 +7,11 @@ exports.DefaultOptions = {
headless: true, headless: true,
defaultViewport: null defaultViewport: null
}, },
session: false, authTimeoutMs: 0,
qrTimeoutMs: 45000,
qrRefreshIntervalMs: 20000,
authTimeoutMs: 45000,
qrMaxRetries: 0, qrMaxRetries: 0,
takeoverOnConflict: false, takeoverOnConflict: false,
takeoverTimeoutMs: 0, takeoverTimeoutMs: 0,
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.109 Safari/537.36', userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.67 Safari/537.36',
ffmpegPath: 'ffmpeg', ffmpegPath: 'ffmpeg',
bypassCSP: false bypassCSP: false
}; };
@@ -39,20 +36,28 @@ exports.Events = {
AUTHENTICATED: 'authenticated', AUTHENTICATED: 'authenticated',
AUTHENTICATION_FAILURE: 'auth_failure', AUTHENTICATION_FAILURE: 'auth_failure',
READY: 'ready', READY: 'ready',
CHAT_REMOVED: 'chat_removed',
CHAT_ARCHIVED: 'chat_archived',
MESSAGE_RECEIVED: 'message', MESSAGE_RECEIVED: 'message',
MESSAGE_CREATE: 'message_create', MESSAGE_CREATE: 'message_create',
MESSAGE_REVOKED_EVERYONE: 'message_revoke_everyone', MESSAGE_REVOKED_EVERYONE: 'message_revoke_everyone',
MESSAGE_REVOKED_ME: 'message_revoke_me', MESSAGE_REVOKED_ME: 'message_revoke_me',
MESSAGE_ACK: 'message_ack', MESSAGE_ACK: 'message_ack',
UNREAD_COUNT: 'unread_count',
MESSAGE_REACTION: 'message_reaction',
MEDIA_UPLOADED: 'media_uploaded', MEDIA_UPLOADED: 'media_uploaded',
CONTACT_CHANGED: 'contact_changed',
GROUP_JOIN: 'group_join', GROUP_JOIN: 'group_join',
GROUP_LEAVE: 'group_leave', GROUP_LEAVE: 'group_leave',
GROUP_ADMIN_CHANGED: 'group_admin_changed',
GROUP_UPDATE: 'group_update', GROUP_UPDATE: 'group_update',
QR_RECEIVED: 'qr', QR_RECEIVED: 'qr',
LOADING_SCREEN: 'loading_screen',
DISCONNECTED: 'disconnected', DISCONNECTED: 'disconnected',
STATE_CHANGED: 'change_state', STATE_CHANGED: 'change_state',
BATTERY_CHANGED: 'change_battery', BATTERY_CHANGED: 'change_battery',
INCOMING_CALL: 'incoming_call' INCOMING_CALL: 'call',
REMOTE_SESSION_SAVED: 'remote_session_saved'
}; };
/** /**
@@ -77,8 +82,25 @@ exports.MessageTypes = {
UNKNOWN: 'unknown', UNKNOWN: 'unknown',
GROUP_INVITE: 'groups_v4_invite', GROUP_INVITE: 'groups_v4_invite',
LIST: 'list', LIST: 'list',
LIST_RESPONSE: 'list_response',
BUTTONS_RESPONSE: 'buttons_response', BUTTONS_RESPONSE: 'buttons_response',
PAYMENT: 'payment' PAYMENT: 'payment',
BROADCAST_NOTIFICATION: 'broadcast_notification',
CALL_LOG: 'call_log',
CIPHERTEXT: 'ciphertext',
DEBUG: 'debug',
E2E_NOTIFICATION: 'e2e_notification',
GP2: 'gp2',
GROUP_NOTIFICATION: 'group_notification',
HSM: 'hsm',
INTERACTIVE: 'interactive',
NATIVE_FLOW: 'native_flow',
NOTIFICATION: 'notification',
NOTIFICATION_TEMPLATE: 'notification_template',
OVERSIZED: 'oversized',
PROTOCOL: 'protocol',
REACTION: 'reaction',
TEMPLATE_BUTTON_REPLY: 'template_button_reply',
}; };
/** /**

View File

@@ -5,41 +5,68 @@ exports.ExposeStore = (moduleRaidStr) => {
eval('var moduleRaid = ' + moduleRaidStr); eval('var moduleRaid = ' + moduleRaidStr);
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
window.mR = moduleRaid(); window.mR = moduleRaid();
window.Store = Object.assign({}, window.mR.findModule('Chat')[0].default); window.Store = Object.assign({}, window.mR.findModule(m => m.default && m.default.Chat)[0].default);
window.Store.AppState = window.mR.findModule('STREAM')[0].Socket; window.Store.AppState = window.mR.findModule('Socket')[0].Socket;
window.Store.Conn = window.mR.findModule('Conn')[0].Conn; window.Store.Conn = window.mR.findModule('Conn')[0].Conn;
window.Store.BlockContact = window.mR.findModule('blockContact')[0];
window.Store.Call = window.mR.findModule('CallCollection')[0].CallCollection;
window.Store.Cmd = window.mR.findModule('Cmd')[0].Cmd;
window.Store.CryptoLib = window.mR.findModule('decryptE2EMedia')[0]; window.Store.CryptoLib = window.mR.findModule('decryptE2EMedia')[0];
window.Store.Wap = window.mR.findModule('queryLinkPreview')[0].default; window.Store.DownloadManager = window.mR.findModule('downloadManager')[0].downloadManager;
window.Store.SendSeen = window.mR.findModule('sendSeen')[0]; window.Store.GroupMetadata = window.mR.findModule('GroupMetadata')[0].default.GroupMetadata;
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('prepRawMedia')[0];
window.Store.MediaObject = window.mR.findModule('getOrCreateMediaObject')[0];
window.Store.NumberInfo = window.mR.findModule('formattedPhoneNumber')[0];
window.Store.MediaTypes = window.mR.findModule('msgToMediaType')[0];
window.Store.MediaUpload = window.mR.findModule('uploadMedia')[0];
window.Store.MsgKey = window.mR.findModule((module) => module.default && module.default.fromString)[0].default;
window.Store.MessageInfo = window.mR.findModule('sendQueryMsgInfo')[0];
window.Store.OpaqueData = window.mR.findModule(module => module.default && module.default.createFromData)[0].default;
window.Store.QueryExist = window.mR.findModule('queryExists')[0] ? window.mR.findModule('queryExists')[0].queryExists : window.mR.findModule('queryExist')[0].queryWidExists;
window.Store.QueryProduct = window.mR.findModule('queryProduct')[0];
window.Store.QueryOrder = window.mR.findModule('queryOrder')[0];
window.Store.SendClear = window.mR.findModule('sendClear')[0]; window.Store.SendClear = window.mR.findModule('sendClear')[0];
window.Store.SendDelete = window.mR.findModule('sendDelete')[0]; window.Store.SendDelete = window.mR.findModule('sendDelete')[0];
window.Store.genId = window.mR.findModule('randomId')[0].randomId;
window.Store.SendMessage = window.mR.findModule('addAndSendMsgToChat')[0]; window.Store.SendMessage = window.mR.findModule('addAndSendMsgToChat')[0];
window.Store.MsgKey = window.mR.findModule((module) => module.default && module.default.fromString)[0].default; window.Store.SendSeen = window.mR.findModule('sendSeen')[0];
window.Store.Invite = window.mR.findModule('sendJoinGroupViaInvite')[0]; window.Store.User = window.mR.findModule('getMaybeMeUser')[0];
window.Store.OpaqueData = window.mR.findModule(module => module.default && module.default.createFromData)[0].default; window.Store.UploadUtils = window.mR.findModule((module) => (module.default && module.default.encryptAndUpload) ? module.default : null)[0].default;
window.Store.MediaPrep = window.mR.findModule('MediaPrep')[0];
window.Store.MediaObject = window.mR.findModule('getOrCreateMediaObject')[0];
window.Store.MediaUpload = window.mR.findModule('uploadMedia')[0];
window.Store.NumberInfo = window.mR.findModule('formattedPhoneNumber')[0];
window.Store.Cmd = window.mR.findModule('Cmd')[0].Cmd;
window.Store.MediaTypes = window.mR.findModule('msgToMediaType')[0];
window.Store.VCard = window.mR.findModule('vcardFromContactModel')[0];
window.Store.UserConstructor = window.mR.findModule((module) => (module.default && module.default.prototype && module.default.prototype.isServer && module.default.prototype.isUser) ? module.default : null)[0].default; window.Store.UserConstructor = window.mR.findModule((module) => (module.default && module.default.prototype && module.default.prototype.isServer && module.default.prototype.isUser) ? module.default : null)[0].default;
window.Store.Validators = window.mR.findModule('findLinks')[0]; window.Store.Validators = window.mR.findModule('findLinks')[0];
window.Store.VCard = window.mR.findModule('vcardFromContactModel')[0];
window.Store.WidFactory = window.mR.findModule('createWid')[0]; window.Store.WidFactory = window.mR.findModule('createWid')[0];
window.Store.BlockContact = window.mR.findModule('blockContact')[0]; window.Store.ProfilePic = window.mR.findModule('profilePicResync')[0];
window.Store.GroupMetadata = window.mR.findModule((module) => module.default && module.default.handlePendingInvite)[0].default; window.Store.PresenceUtils = window.mR.findModule('sendPresenceAvailable')[0];
window.Store.Sticker = window.mR.findModule('Sticker')[0].default.Sticker; window.Store.ChatState = window.mR.findModule('sendChatStateComposing')[0];
window.Store.UploadUtils = window.mR.findModule((module) => (module.default && module.default.encryptAndUpload) ? module.default : null)[0].default; window.Store.GroupParticipants = window.mR.findModule('promoteParticipants')[0];
window.Store.Label = window.mR.findModule('LabelCollection')[0].default; window.Store.JoinInviteV4 = window.mR.findModule('sendJoinGroupViaInviteV4')[0];
window.Store.Features = window.mR.findModule('FEATURE_CHANGE_EVENT')[0].GK; window.Store.findCommonGroups = window.mR.findModule('findCommonGroups')[0].findCommonGroups;
window.Store.QueryOrder = window.mR.findModule('queryOrder')[0]; window.Store.StatusUtils = window.mR.findModule('setMyStatus')[0];
window.Store.QueryProduct = window.mR.findModule('queryProduct')[0]; window.Store.ConversationMsgs = window.mR.findModule('loadEarlierMsgs')[0];
window.Store.DownloadManager = window.mR.findModule('downloadManager')[0].downloadManager; window.Store.sendReactionToMsg = window.mR.findModule('sendReactionToMsg')[0].sendReactionToMsg;
window.Store.Call = window.mR.findModule('CallCollection')[0].CallCollection; window.Store.createOrUpdateReactionsModule = window.mR.findModule('createOrUpdateReactions')[0];
window.Store.EphemeralFields = window.mR.findModule('getEphemeralFields')[0];
window.Store.ReplyUtils = window.mR.findModule('canReplyMsg').length > 0 && window.mR.findModule('canReplyMsg')[0];
window.Store.MsgActionChecks = window.mR.findModule('canSenderRevokeMsg')[0];
window.Store.QuotedMsg = window.mR.findModule('getQuotedMsgObj')[0];
window.Store.Socket = window.mR.findModule('deprecatedSendIq')[0];
window.Store.SocketWap = window.mR.findModule('wap')[0];
window.Store.StickerTools = {
...window.mR.findModule('toWebpSticker')[0],
...window.mR.findModule('addWebpMetadata')[0]
};
window.Store.GroupUtils = {
...window.mR.findModule('createGroup')[0],
...window.mR.findModule('setGroupDescription')[0],
...window.mR.findModule('sendExitGroup')[0],
...window.mR.findModule('sendSetPicture')[0]
};
if(!window.Store.Chat._find) { if (!window.Store.Chat._find) {
window.Store.Chat._find = e => { window.Store.Chat._find = e => {
const target = window.Store.Chat.get(e); const target = window.Store.Chat.get(e);
return target ? Promise.resolve(target) : Promise.resolve({ return target ? Promise.resolve(target) : Promise.resolve({
@@ -47,19 +74,29 @@ exports.ExposeStore = (moduleRaidStr) => {
}); });
}; };
} }
// TODO remove these once everybody has been updated to WWebJS with legacy sessions removed
const _linkPreview = window.mR.findModule('queryLinkPreview');
if (_linkPreview && _linkPreview[0] && _linkPreview[0].default) {
window.Store.Wap = _linkPreview[0].default;
}
const _isMDBackend = window.mR.findModule('isMDBackend');
if(_isMDBackend && _isMDBackend[0] && _isMDBackend[0].isMDBackend) {
window.Store.MDBackend = _isMDBackend[0].isMDBackend();
} else {
window.Store.MDBackend = true;
}
const _features = window.mR.findModule('FEATURE_CHANGE_EVENT')[0];
if(_features) {
window.Store.Features = _features.LegacyPhoneFeatures;
}
}; };
exports.LoadUtils = () => { exports.LoadUtils = () => {
window.WWebJS = {}; window.WWebJS = {};
window.WWebJS.getNumberId = async (id) => {
let result = await window.Store.Wap.queryExist(id);
if (result.jid === undefined)
throw 'The number provided is not a registered whatsapp user';
return result.jid;
};
window.WWebJS.sendSeen = async (chatId) => { window.WWebJS.sendSeen = async (chatId) => {
let chat = window.Store.Chat.get(chatId); let chat = window.Store.Chat.get(chatId);
if (chat !== undefined) { if (chat !== undefined) {
@@ -69,14 +106,14 @@ exports.LoadUtils = () => {
return false; return false;
}; };
window.WWebJS.sendMessage = async (chat, content, options = {}) => { window.WWebJS.sendMessage = async (chat, content, options = {}) => {
let attOptions = {}; let attOptions = {};
if (options.attachment) { if (options.attachment) {
attOptions = options.sendMediaAsSticker attOptions = options.sendMediaAsSticker
? await window.WWebJS.processStickerData(options.attachment) ? await window.WWebJS.processStickerData(options.attachment)
: await window.WWebJS.processMediaData(options.attachment, { : await window.WWebJS.processMediaData(options.attachment, {
forceVoice: options.sendAudioAsVoice, forceVoice: options.sendAudioAsVoice,
forceDocument: options.sendMediaAsDocument, forceDocument: options.sendMediaAsDocument,
forceGif: options.sendVideoAsGif forceGif: options.sendVideoAsGif
}); });
@@ -86,11 +123,16 @@ exports.LoadUtils = () => {
delete options.attachment; delete options.attachment;
delete options.sendMediaAsSticker; delete options.sendMediaAsSticker;
} }
let quotedMsgOptions = {}; let quotedMsgOptions = {};
if (options.quotedMessageId) { if (options.quotedMessageId) {
let quotedMessage = window.Store.Msg.get(options.quotedMessageId); let quotedMessage = window.Store.Msg.get(options.quotedMessageId);
if (quotedMessage.canReply()) {
// TODO remove .canReply() once all clients are updated to >= v2.2241.6
const canReply = window.Store.ReplyUtils ?
window.Store.ReplyUtils.canReplyMsg(quotedMessage.unsafe()) :
quotedMessage.canReply();
if (canReply) {
quotedMsgOptions = quotedMessage.msgContextInfo(chat); quotedMsgOptions = quotedMessage.msgContextInfo(chat);
} }
delete options.quotedMessageId; delete options.quotedMessageId;
@@ -146,25 +188,29 @@ exports.LoadUtils = () => {
if (options.linkPreview) { if (options.linkPreview) {
delete options.linkPreview; delete options.linkPreview;
const link = window.Store.Validators.findLink(content);
if (link) { // Not supported yet by WhatsApp Web on MD
const preview = await window.Store.Wap.queryLinkPreview(link.url); if(!window.Store.MDBackend) {
preview.preview = true; const link = window.Store.Validators.findLink(content);
preview.subtype = 'url'; if (link) {
options = { ...options, ...preview }; const preview = await window.Store.Wap.queryLinkPreview(link.url);
preview.preview = true;
preview.subtype = 'url';
options = { ...options, ...preview };
}
} }
} }
let extraOptions = {}; let buttonOptions = {};
if(options.buttons){ if(options.buttons){
let caption; let caption;
if(options.buttons.type === 'chat') { if (options.buttons.type === 'chat') {
content = options.buttons.body; content = options.buttons.body;
caption = content; caption = content;
}else{ } else {
caption = options.caption ? options.caption : ' '; //Caption can't be empty caption = options.caption ? options.caption : ' '; //Caption can't be empty
} }
extraOptions = { buttonOptions = {
productHeaderImageRejected: false, productHeaderImageRejected: false,
isFromTemplate: false, isFromTemplate: false,
isDynamicReplyButtonsMsg: true, isDynamicReplyButtonsMsg: true,
@@ -177,12 +223,12 @@ exports.LoadUtils = () => {
delete options.buttons; delete options.buttons;
} }
let listOptions = {};
if(options.list){ if(options.list){
if(window.Store.Conn.platform === 'smba' || window.Store.Conn.platform === 'smbi'){ if(window.Store.Conn.platform === 'smba' || window.Store.Conn.platform === 'smbi'){
throw '[LT01] Whatsapp business can\'t send this yet'; throw '[LT01] Whatsapp business can\'t send this yet';
} }
extraOptions = { listOptions = {
...extraOptions,
type: 'list', type: 'list',
footer: options.list.footer, footer: options.list.footer,
list: { list: {
@@ -192,31 +238,45 @@ exports.LoadUtils = () => {
body: options.list.description body: options.list.description
}; };
delete options.list; delete options.list;
delete extraOptions.list.footer; delete listOptions.list.footer;
} }
const meUser = window.Store.User.getMaybeMeUser();
const isMD = window.Store.MDBackend;
const newMsgId = new window.Store.MsgKey({ const newMsgId = new window.Store.MsgKey({
fromMe: true, from: meUser,
remote: chat.id, to: chat.id,
id: window.Store.genId(), id: window.Store.MsgKey.newId(),
participant: isMD && chat.id.isGroup() ? meUser : undefined,
selfDir: 'out',
}); });
const extraOptions = options.extraOptions || {};
delete options.extraOptions;
const ephemeralFields = window.Store.EphemeralFields.getEphemeralFields(chat);
const message = { const message = {
...options, ...options,
id: newMsgId, id: newMsgId,
ack: 0, ack: 0,
body: content, body: content,
from: window.Store.Conn.wid, from: meUser,
to: chat.id, to: chat.id,
local: true, local: true,
self: 'out', self: 'out',
t: parseInt(new Date().getTime() / 1000), t: parseInt(new Date().getTime() / 1000),
isNewMsg: true, isNewMsg: true,
type: 'chat', type: 'chat',
...ephemeralFields,
...locationOptions, ...locationOptions,
...attOptions, ...attOptions,
...(attOptions.toJSON ? attOptions.toJSON() : {}),
...quotedMsgOptions, ...quotedMsgOptions,
...vcardOptions, ...vcardOptions,
...buttonOptions,
...listOptions,
...extraOptions ...extraOptions
}; };
@@ -224,11 +284,25 @@ exports.LoadUtils = () => {
return window.Store.Msg.get(newMsgId._serialized); return window.Store.Msg.get(newMsgId._serialized);
}; };
window.WWebJS.toStickerData = async (mediaInfo) => {
if (mediaInfo.mimetype == 'image/webp') return mediaInfo;
const file = window.WWebJS.mediaInfoToFile(mediaInfo);
const webpSticker = await window.Store.StickerTools.toWebpSticker(file);
const webpBuffer = await webpSticker.arrayBuffer();
const data = window.WWebJS.arrayBufferToBase64(webpBuffer);
return {
mimetype: 'image/webp',
data
};
};
window.WWebJS.processStickerData = async (mediaInfo) => { window.WWebJS.processStickerData = async (mediaInfo) => {
if (mediaInfo.mimetype !== 'image/webp') throw new Error('Invalid media type'); if (mediaInfo.mimetype !== 'image/webp') throw new Error('Invalid media type');
const file = window.WWebJS.mediaInfoToFile(mediaInfo); const file = window.WWebJS.mediaInfoToFile(mediaInfo);
let filehash = await window.WWebJS.getFileHash(file); let filehash = await window.WWebJS.getFileHash(file);
let mediaKey = await window.WWebJS.generateHash(32); let mediaKey = await window.WWebJS.generateHash(32);
const controller = new AbortController(); const controller = new AbortController();
@@ -314,10 +388,11 @@ exports.LoadUtils = () => {
window.WWebJS.getMessageModel = message => { window.WWebJS.getMessageModel = message => {
const msg = message.serialize(); const msg = message.serialize();
msg.isEphemeral = message.isEphemeral;
msg.isStatusV3 = message.isStatusV3; msg.isStatusV3 = message.isStatusV3;
msg.links = (message.getLinks()).map(link => ({ msg.links = (message.getRawLinks()).map(link => ({
link: link.href, link: link.href,
isSuspicious: Boolean(link.suspiciousCharacters && link.suspiciousCharacters.size) isSuspicious: Boolean(link.suspiciousCharacters && link.suspiciousCharacters.size)
})); }));
@@ -327,31 +402,41 @@ exports.LoadUtils = () => {
if (msg.dynamicReplyButtons) { if (msg.dynamicReplyButtons) {
msg.dynamicReplyButtons = JSON.parse(JSON.stringify(msg.dynamicReplyButtons)); msg.dynamicReplyButtons = JSON.parse(JSON.stringify(msg.dynamicReplyButtons));
} }
if(msg.replyButtons) { if (msg.replyButtons) {
msg.replyButtons = JSON.parse(JSON.stringify(msg.replyButtons)); msg.replyButtons = JSON.parse(JSON.stringify(msg.replyButtons));
} }
if(typeof msg.id.remote === 'object') { if (typeof msg.id.remote === 'object') {
msg.id = Object.assign({}, msg.id, {remote: msg.id.remote._serialized}); msg.id = Object.assign({}, msg.id, { remote: msg.id.remote._serialized });
} }
delete msg.pendingAckUpdate; delete msg.pendingAckUpdate;
return msg; return msg;
}; };
window.WWebJS.getChatModel = async chat => { window.WWebJS.getChatModel = async chat => {
let res = chat.serialize(); let res = chat.serialize();
res.isGroup = chat.isGroup; res.isGroup = chat.isGroup;
res.formattedTitle = chat.formattedTitle; res.formattedTitle = chat.formattedTitle;
res.isMuted = chat.mute && chat.mute.isMuted; res.isMuted = chat.mute && chat.mute.isMuted;
if (chat.groupMetadata) { if (chat.groupMetadata) {
await window.Store.GroupMetadata.update(chat.id._serialized); const chatWid = window.Store.WidFactory.createWid((chat.id._serialized));
await window.Store.GroupMetadata.update(chatWid);
res.groupMetadata = chat.groupMetadata.serialize(); res.groupMetadata = chat.groupMetadata.serialize();
} }
res.lastMessage = null;
if (res.msgs && res.msgs.length) {
const lastMessage = window.Store.Msg.get(chat.lastReceivedKey._serialized);
if (lastMessage) {
res.lastMessage = window.WWebJS.getMessageModel(lastMessage);
}
}
delete res.msgs; delete res.msgs;
delete res.msgUnsyncedButtonReplyMsgs; delete res.msgUnsyncedButtonReplyMsgs;
delete res.unsyncedButtonReplies; delete res.unsyncedButtonReplies;
@@ -366,7 +451,7 @@ exports.LoadUtils = () => {
}; };
window.WWebJS.getChats = async () => { window.WWebJS.getChats = async () => {
const chats = window.Store.Chat.models; const chats = window.Store.Chat.getModelsArray();
const chatPromises = chats.map(chat => window.WWebJS.getChatModel(chat)); const chatPromises = chats.map(chat => window.WWebJS.getChatModel(chat));
return await Promise.all(chatPromises); return await Promise.all(chatPromises);
@@ -398,12 +483,12 @@ exports.LoadUtils = () => {
}; };
window.WWebJS.getContacts = () => { window.WWebJS.getContacts = () => {
const contacts = window.Store.Contact.models; const contacts = window.Store.Contact.getModelsArray();
return contacts.map(contact => window.WWebJS.getContactModel(contact)); return contacts.map(contact => window.WWebJS.getContactModel(contact));
}; };
window.WWebJS.mediaInfoToFile = ({ data, mimetype, filename }) => { window.WWebJS.mediaInfoToFile = ({ data, mimetype, filename }) => {
const binaryData = atob(data); const binaryData = window.atob(data);
const buffer = new ArrayBuffer(binaryData.length); const buffer = new ArrayBuffer(binaryData.length);
const view = new Uint8Array(buffer); const view = new Uint8Array(buffer);
@@ -420,15 +505,29 @@ exports.LoadUtils = () => {
window.WWebJS.arrayBufferToBase64 = (arrayBuffer) => { window.WWebJS.arrayBufferToBase64 = (arrayBuffer) => {
let binary = ''; let binary = '';
const bytes = new Uint8Array( arrayBuffer ); const bytes = new Uint8Array(arrayBuffer);
const len = bytes.byteLength; const len = bytes.byteLength;
for (let i = 0; i < len; i++) { for (let i = 0; i < len; i++) {
binary += String.fromCharCode( bytes[ i ] ); binary += String.fromCharCode(bytes[i]);
} }
return window.btoa( binary ); return window.btoa(binary);
}; };
window.WWebJS.getFileHash = async (data) => { window.WWebJS.arrayBufferToBase64Async = (arrayBuffer) =>
new Promise((resolve, reject) => {
const blob = new Blob([arrayBuffer], {
type: 'application/octet-stream',
});
const fileReader = new FileReader();
fileReader.onload = () => {
const [, data] = fileReader.result.split(',');
resolve(data);
};
fileReader.onerror = (e) => reject(e);
fileReader.readAsDataURL(blob);
});
window.WWebJS.getFileHash = async (data) => {
let buffer = await data.arrayBuffer(); let buffer = await data.arrayBuffer();
const hashBuffer = await crypto.subtle.digest('SHA-256', buffer); const hashBuffer = await crypto.subtle.digest('SHA-256', buffer);
return btoa(String.fromCharCode(...new Uint8Array(hashBuffer))); return btoa(String.fromCharCode(...new Uint8Array(hashBuffer)));
@@ -438,7 +537,7 @@ exports.LoadUtils = () => {
var result = ''; var result = '';
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
var charactersLength = characters.length; var charactersLength = characters.length;
for ( var i = 0; i < length; i++ ) { for (var i = 0; i < length; i++) {
result += characters.charAt(Math.floor(Math.random() * charactersLength)); result += characters.charAt(Math.floor(Math.random() * charactersLength));
} }
return result; return result;
@@ -463,15 +562,18 @@ exports.LoadUtils = () => {
}; };
window.WWebJS.sendChatstate = async (state, chatId) => { window.WWebJS.sendChatstate = async (state, chatId) => {
if (window.Store.MDBackend) {
chatId = window.Store.WidFactory.createWid(chatId);
}
switch (state) { switch (state) {
case 'typing': case 'typing':
await window.Store.Wap.sendChatstateComposing(chatId); await window.Store.ChatState.sendChatStateComposing(chatId);
break; break;
case 'recording': case 'recording':
await window.Store.Wap.sendChatstateRecording(chatId); await window.Store.ChatState.sendChatStateRecording(chatId);
break; break;
case 'stop': case 'stop':
await window.Store.Wap.sendChatstatePaused(chatId); await window.Store.ChatState.sendChatStatePaused(chatId);
break; break;
default: default:
throw 'Invalid chatstate'; throw 'Invalid chatstate';
@@ -483,12 +585,12 @@ exports.LoadUtils = () => {
window.WWebJS.getLabelModel = label => { window.WWebJS.getLabelModel = label => {
let res = label.serialize(); let res = label.serialize();
res.hexColor = label.hexColor; res.hexColor = label.hexColor;
return res; return res;
}; };
window.WWebJS.getLabels = () => { window.WWebJS.getLabels = () => {
const labels = window.Store.Label.models; const labels = window.Store.Label.getModelsArray();
return labels.map(label => window.WWebJS.getLabelModel(label)); return labels.map(label => window.WWebJS.getLabelModel(label));
}; };
@@ -502,8 +604,9 @@ exports.LoadUtils = () => {
return (chat.labels || []).map(id => window.WWebJS.getLabel(id)); return (chat.labels || []).map(id => window.WWebJS.getLabel(id));
}; };
window.WWebJS.getOrderDetail = async (orderId, token) => { window.WWebJS.getOrderDetail = async (orderId, token, chatId) => {
return window.Store.QueryOrder.queryOrder(orderId, 80, 80, token); const chatWid = window.Store.WidFactory.createWid(chatId);
return window.Store.QueryOrder.queryOrder(chatWid, orderId, 80, 80, token);
}; };
window.WWebJS.getProductMetadata = async (productId) => { window.WWebJS.getProductMetadata = async (productId) => {
@@ -515,21 +618,90 @@ exports.LoadUtils = () => {
return undefined; return undefined;
}; };
};
exports.MarkAllRead = () => { window.WWebJS.rejectCall = async (peerJid, id) => {
let Chats = window.Store.Chat.models; peerJid = peerJid.split('@')[0] + '@s.whatsapp.net';
let userId = window.Store.User.getMaybeMeUser().user + '@s.whatsapp.net';
const stanza = window.Store.SocketWap.wap('call', {
id: window.Store.SocketWap.generateId(),
from: window.Store.SocketWap.USER_JID(userId),
to: window.Store.SocketWap.USER_JID(peerJid),
}, [
window.Store.SocketWap.wap('reject', {
'call-id': id,
'call-creator': window.Store.SocketWap.USER_JID(peerJid),
count: '0',
})
]);
await window.Store.Socket.deprecatedCastStanza(stanza);
};
for (let chatIndex in Chats) { window.WWebJS.cropAndResizeImage = async (media, options = {}) => {
if (isNaN(chatIndex)) { if (!media.mimetype.includes('image'))
continue; throw new Error('Media is not an image');
if (options.mimetype && !options.mimetype.includes('image'))
delete options.mimetype;
options = Object.assign({ size: 640, mimetype: media.mimetype, quality: .75, asDataUrl: false }, options);
const img = await new Promise ((resolve, reject) => {
const img = new Image();
img.onload = () => resolve(img);
img.onerror = reject;
img.src = `data:${media.mimetype};base64,${media.data}`;
});
const sl = Math.min(img.width, img.height);
const sx = Math.floor((img.width - sl) / 2);
const sy = Math.floor((img.height - sl) / 2);
const canvas = document.createElement('canvas');
canvas.width = options.size;
canvas.height = options.size;
const ctx = canvas.getContext('2d');
ctx.drawImage(img, sx, sy, sl, sl, 0, 0, options.size, options.size);
const dataUrl = canvas.toDataURL(options.mimetype, options.quality);
if (options.asDataUrl)
return dataUrl;
return Object.assign(media, {
mimetype: options.mimeType,
data: dataUrl.replace(`data:${options.mimeType};base64,`, '')
});
};
window.WWebJS.setPicture = async (chatid, media) => {
const thumbnail = await window.WWebJS.cropAndResizeImage(media, { asDataUrl: true, mimetype: 'image/jpeg', size: 96 });
const profilePic = await window.WWebJS.cropAndResizeImage(media, { asDataUrl: true, mimetype: 'image/jpeg', size: 640 });
const chatWid = window.Store.WidFactory.createWid(chatid);
try {
const collection = window.Store.ProfilePicThumb.get(chatid);
if (!collection.canSet()) return;
const res = await window.Store.GroupUtils.sendSetPicture(chatWid, thumbnail, profilePic);
return res ? res.status === 200 : false;
} catch (err) {
if(err.name === 'ServerStatusCodeError') return false;
throw err;
} }
};
let chat = Chats[chatIndex]; window.WWebJS.deletePicture = async (chatid) => {
const chatWid = window.Store.WidFactory.createWid(chatid);
try {
const collection = window.Store.ProfilePicThumb.get(chatid);
if (!collection.canDelete()) return;
if (chat.unreadCount > 0) { const res = await window.Store.GroupUtils.requestDeletePicture(chatWid);
chat.markSeen(); return res ? res.status === 200 : false;
window.Store.Wap.sendConversationSeen(chat.id, chat.getLastMsgKeyForAction(), chat.unreadCount - chat.pendingSeenCount); } catch (err) {
if(err.name === 'ServerStatusCodeError') return false;
throw err;
} }
} };
}; };

View File

@@ -79,6 +79,7 @@ class InterfaceController {
*/ */
async getFeatures() { async getFeatures() {
return await this.pupPage.evaluate(() => { 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; return window.Store.Features.F;
}); });
} }
@@ -89,6 +90,7 @@ class InterfaceController {
*/ */
async checkFeatureStatus(feature) { async checkFeatureStatus(feature) {
return await this.pupPage.evaluate((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); return window.Store.Features.supportsFeature(feature);
}, feature); }, feature);
} }
@@ -99,6 +101,7 @@ class InterfaceController {
*/ */
async enableFeatures(features) { async enableFeatures(features) {
await this.pupPage.evaluate((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) { for (const feature in features) {
window.Store.Features.setFeature(features[feature], true); window.Store.Features.setFeature(features[feature], true);
} }
@@ -111,6 +114,7 @@ class InterfaceController {
*/ */
async disableFeatures(features) { async disableFeatures(features) {
await this.pupPage.evaluate((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) { for (const feature in features) {
window.Store.Features.setFeature(features[feature], false); window.Store.Features.setFeature(features[feature], false);
} }

View File

@@ -1,20 +1,17 @@
'use strict'; 'use strict';
const sharp = require('sharp');
const path = require('path'); const path = require('path');
const Crypto = require('crypto'); const Crypto = require('crypto');
const { tmpdir } = require('os'); const { tmpdir } = require('os');
const ffmpeg = require('fluent-ffmpeg'); const ffmpeg = require('fluent-ffmpeg');
const webp = require('node-webpmux'); const webp = require('node-webpmux');
const fs = require('fs').promises; const fs = require('fs').promises;
const has = (o, k) => Object.prototype.hasOwnProperty.call(o, k); const has = (o, k) => Object.prototype.hasOwnProperty.call(o, k);
/** /**
* Utility methods * Utility methods
*/ */
class Util { class Util {
constructor() { constructor() {
throw new Error(`The ${this.constructor.name} class may not be instantiated.`); throw new Error(`The ${this.constructor.name} class may not be instantiated.`);
} }
@@ -23,7 +20,7 @@ class Util {
var result = ''; var result = '';
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
var charactersLength = characters.length; var charactersLength = characters.length;
for ( var i = 0; i < length; i++ ) { for (var i = 0; i < length; i++) {
result += characters.charAt(Math.floor(Math.random() * charactersLength)); result += characters.charAt(Math.floor(Math.random() * charactersLength));
} }
return result; return result;
@@ -55,33 +52,19 @@ class Util {
* *
* @returns {Promise<MessageMedia>} media in webp format * @returns {Promise<MessageMedia>} media in webp format
*/ */
static async formatImageToWebpSticker(media) { static async formatImageToWebpSticker(media, pupPage) {
if (!media.mimetype.includes('image')) if (!media.mimetype.includes('image'))
throw new Error('media is not a image'); throw new Error('media is not a image');
if (media.mimetype.includes('webp')) { if (media.mimetype.includes('webp')) {
return media; return media;
} }
const buff = Buffer.from(media.data, 'base64'); return pupPage.evaluate((media) => {
return window.WWebJS.toStickerData(media);
let sharpImg = sharp(buff); }, media);
sharpImg = sharpImg.webp();
sharpImg = sharpImg.resize(512, 512, {
fit: 'contain',
background: { r: 0, g: 0, b: 0, alpha: 0 },
});
let webpBase64 = (await sharpImg.toBuffer()).toString('base64');
return {
mimetype: 'image/webp',
data: webpBase64,
filename: media.filename,
};
} }
/** /**
* Formats a video to webp * Formats a video to webp
* @param {MessageMedia} media * @param {MessageMedia} media
@@ -91,14 +74,14 @@ class Util {
static async formatVideoToWebpSticker(media) { static async formatVideoToWebpSticker(media) {
if (!media.mimetype.includes('video')) if (!media.mimetype.includes('video'))
throw new Error('media is not a video'); throw new Error('media is not a video');
const videoType = media.mimetype.split('/')[1]; const videoType = media.mimetype.split('/')[1];
const tempFile = path.join( const tempFile = path.join(
tmpdir(), tmpdir(),
`${Crypto.randomBytes(6).readUIntLE(0, 6).toString(36)}.webp` `${Crypto.randomBytes(6).readUIntLE(0, 6).toString(36)}.webp`
); );
const stream = new (require('stream').Readable)(); const stream = new (require('stream').Readable)();
const buffer = Buffer.from( const buffer = Buffer.from(
media.data.replace(`data:${media.mimetype};base64,`, ''), media.data.replace(`data:${media.mimetype};base64,`, ''),
@@ -135,17 +118,17 @@ class Util {
.toFormat('webp') .toFormat('webp')
.save(tempFile); .save(tempFile);
}); });
const data = await fs.readFile(tempFile, 'base64'); const data = await fs.readFile(tempFile, 'base64');
await fs.unlink(tempFile); await fs.unlink(tempFile);
return { return {
mimetype: 'image/webp', mimetype: 'image/webp',
data: data, data: data,
filename: media.filename, filename: media.filename,
}; };
} }
/** /**
* Sticker metadata. * Sticker metadata.
* @typedef {Object} StickerMetadata * @typedef {Object} StickerMetadata
@@ -161,14 +144,14 @@ class Util {
* *
* @returns {Promise<MessageMedia>} media in webp format * @returns {Promise<MessageMedia>} media in webp format
*/ */
static async formatToWebpSticker(media, metadata) { static async formatToWebpSticker(media, metadata, pupPage) {
let webpMedia; let webpMedia;
if (media.mimetype.includes('image')) if (media.mimetype.includes('image'))
webpMedia = await this.formatImageToWebpSticker(media); webpMedia = await this.formatImageToWebpSticker(media, pupPage);
else if (media.mimetype.includes('video')) else if (media.mimetype.includes('video'))
webpMedia = await this.formatVideoToWebpSticker(media); webpMedia = await this.formatVideoToWebpSticker(media);
else else
throw new Error('Invalid media format'); throw new Error('Invalid media format');
if (metadata.name || metadata.author) { if (metadata.name || metadata.author) {

Some files were not shown because too many files have changed in this diff Show More