Compare commits

...

432 Commits

Author SHA1 Message Date
pedroslopez
e2f31092a5 Update supported WhatsApp Web version to v2.2247.7 2023-01-05 03:46:32 +00: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
Pedro Lopez
c55db82f73 mark version v1.15.3 2021-12-07 23:06:53 -04:00
github-actions[bot]
4e837b00f9 Update supported WhatsApp Web version to v2.2147.14 (#1033)
Co-authored-by: pedroslopez <pedroslopez@users.noreply.github.com>
2021-12-07 23:05:54 -04:00
tuyuribr
89a06b15a8 Hot Fix WA 2.2147.14 (#1035)
* Hot Fix WA 2.2147.14

* Update Injected.js

* Update Client.js

* sendPresence1

* Update Client.js

* queryLinkPreview

* openChatDrawer

* revert back to using Wap

Co-authored-by: Pedro Lopez <pedroslopez@me.com>
2021-12-07 23:04:44 -04:00
Pedro Lopez
55247576da add script to get change log 2021-11-24 10:07:27 -04:00
Pedro Lopez
8a1f6f0648 chore: mark version v1.15.2 2021-11-24 09:49:16 -04:00
github-actions[bot]
254ca884aa Update supported WhatsApp Web version to v2.2146.9 (#969)
Co-authored-by: pedroslopez <pedroslopez@users.noreply.github.com>
Co-authored-by: Pedro S. Lopez <pslamoros@hotmail.com>
2021-11-24 09:43:59 -04:00
tuyuribr
3958105926 Fix WA 2.2146.9 (#990)
* Fix WA 2.2146.9

WA is serving two versions to me,  so we need to check window.mR.findModule('Conn').lengh for a while

* to singleQuotes

* Update Injected.js

* simplify getting `Conn` module, use different object for `Store`

Co-authored-by: Pedro Lopez <pedroslopez@me.com>
2021-11-24 09:40:01 -04:00
Pedro Lopez
818bf48e5d fix: convert button ids to string 2021-11-01 21:30:34 -04:00
Pedro S. Lopez
d71544566c move links section in readme 2021-10-30 21:29:39 -04:00
Pedro S. Lopez
187aa50131 Url updates for wwebjs.dev (#944)
* Update package.json

* update links in readme
2021-10-30 21:27:08 -04:00
Pedro Lopez
e11e00d938 chore: update docs for v1.15.1 2021-10-30 00:46:37 -04:00
Pedro Lopez
d9dd89ccaf chore: mark version v1.15.1 2021-10-30 00:46:09 -04:00
Pedro Lopez
3aa0e4f7b3 fix: dont modify id reference when serializing message 2021-10-30 00:45:04 -04:00
Pedro Lopez
d82cf448d9 chore: mark version v1.15.0 2021-10-30 00:15:24 -04:00
github-actions[bot]
3f576c990c Update supported WhatsApp Web version to v2.2142.12 (#827)
Co-authored-by: pedroslopez <pedroslopez@users.noreply.github.com>
Co-authored-by: Pedro S. Lopez <pslamoros@hotmail.com>
2021-10-30 00:14:07 -04:00
Pedro Lopez
d44a525b02 fix: serialize message id remote when fetching messages
close #825
2021-10-30 00:12:06 -04:00
Pedro Lopez
d8217029ba add test for maxQrRetries 2021-10-30 00:03:19 -04:00
victormga
2a7337b142 max qr refresh before giving up (#852)
* max qr refresh before giving up

* Update src/Client.js

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

Co-authored-by: Rajeh Taher <rajeh@reforward.dev>
2021-10-29 23:45:04 -04:00
Pedro S. Lopez
1fcfaa0362 Update README.md (#907) 2021-10-29 23:43:27 -04:00
Pedro Lopez
c434e04e41 fix countrycode and formatted number functions, add tests 2021-10-29 23:41:49 -04:00
Rajeh Taher
97a1d399ee Format phone numbers (#650)
* 📦 Declared NumberInfo in store

* 📝 Add client.js functionality

* 🚨 eslint just admires singlequote strings

* 📝 Add shortcuts to using client method

*  Adding parity between the ids

*  Same method name parity

* 🚨 ESLint indentation error.

* 🚨 ESLint doublequote string error.

* 🎨 Proposed changes

* 🎨 Fixed badly done code :v and applied proposed changes.

*  fixed calling the wrong function (sigh)

*  Fixed missing try-catch code.

* 🚨 Fixes ESLint indentation errors.

*  fix the documentation issues.

* 🏷️ typescript

* 🏷️ Typo in function name

Co-authored-by: Rajeh Taher <rajeh@reforward.tk>
2021-10-29 23:33:38 -04:00
Rajeh Taher
dbf9bf2158 Type file improvements (#855)
* Updated Types

* Updated types to include (#868)

* Update index.d.ts

* fix list type

Co-authored-by: Pedro Lopez <pedroslopez@me.com>
Co-authored-by: Pedro S. Lopez <pslamoros@hotmail.com>
2021-10-29 23:32:13 -04:00
Pedro Lopez
353af130d0 remove unnecessary default 2021-10-29 23:25:06 -04:00
Rajeh Taher
06107af67d Allow a chat to be muted indefinitely (#849)
* muteChat fixed

* Update src/Client.js

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

* Update src/Client.js

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

* date fix

Co-authored-by: Pedro S. Lopez <pedroslopez@me.com>
2021-10-29 23:24:36 -04:00
Muhamad Ristiyanto
4338664590 Add getBlockedContacts method (#770)
* add simple method to get blocked ids

* Change getBlockedList to getBlockedIds

* getBlockedIds to getBlockedContacts

* typo

* ESLint & other changes

* 🏷️ types

* fix: no `this.client`

* add tests

Co-authored-by: Rajeh Taher <rajeh@reforward.dev>
Co-authored-by: Pedro Lopez <pedroslopez@me.com>
Co-authored-by: Pedro S. Lopez <pslamoros@hotmail.com>
2021-10-30 03:18:26 +00:00
Rajeh Taher
95facee885 Fixes GroupNotification.getChat() returning client's chat. (#699)
* 🥅 getChat returns expected, instead of the client's chat.

* 🥅 Fixed .reply method too

* revert + fix
2021-10-29 23:00:10 -04:00
Pedro Lopez
1f38b762ed add warning for multidevice, keep working for forced upgrade 2021-10-29 22:58:57 -04:00
tuyuribr
b60029ed09 feat: Send buttons and Lists (#756) 2021-09-14 00:06:05 +03:00
tuyuribr
ab415ff9be feat: Include payment info (#684) 2021-09-13 23:58:39 +03:00
Pedro Lopez
7beeff4901 chore: mark version 1.14.1 2021-09-01 09:19:28 -04:00
Pedro Lopez
022c87f3c7 optionally patch _find function if it's not found 2021-09-01 09:18:34 -04:00
Pedro Lopez
e527fe74fd fix: patch find function to get chats 2021-09-01 09:16:12 -04:00
Pedro S. Lopez
7597608f9d Update README.md 2021-08-02 00:49:03 -04:00
Pedro Lopez
be018e651d update .npmignore 2021-08-02 00:07:52 -04:00
Pedro Lopez
64189d2d67 chore: mark version v1.14.0 2021-08-01 23:59:56 -04:00
Pedro Lopez
38e31a07cf Update package.json and readme for node 12 support 2021-08-01 23:57:21 -04:00
Pedro Lopez
40cec51956 fix: node v12 support 2021-08-01 23:56:27 -04:00
Pedro S. Lopez
d9ccb6f276 fix: correctly resolve media that hasn't been downloaded (#763)
* fix: correctly abort if media does not exist

* catch 404s

* dont throw for media that cant be fetched
2021-08-01 23:29:06 -04:00
github-actions[bot]
628b6e4d49 Update supported WhatsApp Web version to v2.2126.14 (#806)
Co-authored-by: pedroslopez <pedroslopez@users.noreply.github.com>
2021-08-01 23:13:07 -04:00
Pedro S. Lopez
8e56aef3ce fix: more stable latest version check (#805) 2021-08-01 23:04:02 -04:00
Wictor Nogueira
cd774bef17 feat: Add MessageMedia.fromUrl method (#769) 2021-07-31 16:36:11 +03:00
Pedro S. Lopez
9c2592e164 chore: temporarily stop update action from auto running 2021-07-20 14:51:58 -04:00
Pedro S. Lopez
ae6d61bda9 fix: correctly serialize messages with replyButtons 2021-07-19 22:23:06 -04:00
Pedro S. Lopez
98acd2312d delete gh branch automatically when closing update PR 2021-07-19 19:46:24 -04:00
Pedro Lopez
62c7c15f44 chore: update links 2021-07-19 00:19:40 -04:00
Pedro Lopez
e12c53f6ce chore: specify minimum required node version 2021-07-19 00:11:57 -04:00
Pedro S. Lopez
811008da4b Delete CNAME 2021-07-18 23:37:45 -04:00
Pedro S. Lopez
863284c9d1 Create CNAME 2021-07-18 23:37:21 -04:00
Pedro S. Lopez
ec95483518 Create CNAME 2021-07-18 23:36:02 -04:00
Pedro S. Lopez
ff2eb95751 Change WA Web update PR branch name 2021-07-18 22:57:18 -04:00
dependabot[bot]
1b5e9d2392 chore(deps-dev): bump mocha from 8.4.0 to 9.0.2 (#776)
Bumps [mocha](https://github.com/mochajs/mocha) from 8.4.0 to 9.0.2.
- [Release notes](https://github.com/mochajs/mocha/releases)
- [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mochajs/mocha/compare/v8.4.0...v9.0.2)

---
updated-dependencies:
- dependency-name: 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>
2021-07-18 22:55:06 -04:00
Pedro Lopez
340e9764fe Publish gh-pages site (branch name change) 2021-07-18 22:43:07 -04:00
Rajeh Taher
084525ddfa Add Operating System information for bug reports. (#725)
* 📄 Add Operating System information for bug reports.

* 🐛 Forgot Line Break
2021-07-17 22:04:44 -04:00
github-actions[bot]
3398501ee6 Update supported WhatsApp Web version to v2.2126.11 (#766)
Co-authored-by: pedroslopez <pedroslopez@users.noreply.github.com>
Co-authored-by: Pedro S. Lopez <pslamoros@hotmail.com>
2021-07-17 00:07:38 -04:00
tuyuribr
cdede835af Include Calls (#720)
* Get Call module

* The call event

* Update onCall index.d.ts
2021-07-17 00:05:53 -04:00
Pedro S. Lopez
449d0f01d8 Trim current version string 2021-07-16 03:19:58 -04:00
Pedro S. Lopez
4ed9312eb7 Update update.yml 2021-07-16 03:09:54 -04:00
Pedro S. Lopez
76deaad2fd Update update.yml 2021-07-16 03:05:18 -04:00
Pedro S. Lopez
284903dce4 Update README.md 2021-07-16 02:53:39 -04:00
Pedro S. Lopez
a03cc41d22 Add tests and detect WhatsApp Web updates (#686)
* test setup, add initializer tests

* test sending messages

* add script to check latest version

* add github action

* use env vars

* configure environment with .env file

* add test for sticker name and author

* add DownloadManager model

* test chats and contacts

* test for number utility functions

* throw error if no remote id has been set

* Update .version
2021-07-16 02:50:05 -04:00
ApeironTsuka
04d2308bbc Update node-webpmux 2.x syntax to 3.x (support upstream breaking change) (#762)
Co-authored-by: Apeiron <apeiron@none>
2021-07-15 22:50:54 -04:00
Pedro S. Lopez
dc9b7e5f3d Update minimum moduleRaid version to 5.0.2
close #741
2021-07-14 22:42:21 -04:00
dependabot[bot]
cc7a729223 chore(deps): bump puppeteer from 5.5.0 to 10.1.0 (#750)
Bumps [puppeteer](https://github.com/puppeteer/puppeteer) from 5.5.0 to 10.1.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/v5.5.0...v10.1.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-07-14 18:39:24 -04:00
dependabot[bot]
2ec46f674a chore(deps): bump sharp from 0.26.3 to 0.28.3 (#751)
Bumps [sharp](https://github.com/lovell/sharp) from 0.26.3 to 0.28.3.
- [Release notes](https://github.com/lovell/sharp/releases)
- [Changelog](https://github.com/lovell/sharp/blob/master/docs/changelog.md)
- [Commits](https://github.com/lovell/sharp/compare/v0.26.3...v0.28.3)

---
updated-dependencies:
- dependency-name: sharp
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-14 18:35:59 -04:00
dependabot[bot]
22993fc23d chore(deps): bump node-webpmux from 2.0.3 to 3.0.0 (#749)
Bumps [node-webpmux](https://github.com/ApeironTsuka/node-webpmux) from 2.0.3 to 3.0.0.
- [Release notes](https://github.com/ApeironTsuka/node-webpmux/releases)
- [Commits](https://github.com/ApeironTsuka/node-webpmux/commits)

---
updated-dependencies:
- dependency-name: node-webpmux
  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-07-14 18:33:36 -04:00
Edson Tégila
cd52075447 Add the option to use "browserWSEndpoint" (#727)
* Update Client.js

* Update package.json

* Update package.json

* 🚨🔥 Fixed ESLint and removed old code.

* Update README.md

* Update README.md

* Update Client.js

* chore(deps): bump sharp from 0.26.3 to 0.28.3

Bumps [sharp](https://github.com/lovell/sharp) from 0.26.3 to 0.28.3.
- [Release notes](https://github.com/lovell/sharp/releases)
- [Changelog](https://github.com/lovell/sharp/blob/master/docs/changelog.md)
- [Commits](https://github.com/lovell/sharp/compare/v0.26.3...v0.28.3)

---
updated-dependencies:
- dependency-name: sharp
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

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

* Update package.json

* Update README.md

* Update example.js

* Update README.md

Co-authored-by: Rajeh Taher <52720753+PurpShell@users.noreply.github.com>
Co-authored-by: Rajeh Taher <rajeh@reforward.tk>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Aliyss Snow <33941859+Aliyss@users.noreply.github.com>
2021-07-13 10:27:00 -07:00
Rajeh Taher
54a07fa22f feat: Add support to suspicious links (#642) 2021-07-12 11:03:11 -07:00
Pedro S. Lopez
1d49f74ab4 Update dependabot.yml 2021-07-11 21:29:58 -04:00
Pedro S. Lopez
ea4dfb17f3 Create dependabot.yml 2021-07-11 21:28:39 -04:00
stefanfuchs
efa6cf98d2 fix: location class type (#718) 2021-07-12 00:54:32 +00:00
Giancarlo Rocha
9d715735ed feat: message forwarding score (#716) 2021-07-11 20:52:54 -04:00
Pedro Lopez
4afff38713 Fix download media (v1.13.2) 2021-07-09 03:08:52 -04:00
Pedro Lopez
b13dea0339 chore: mark version v1.13.1 2021-07-09 02:39:13 -04:00
Pedro S. Lopez
0ef6061d7e Fix downloading media for WhatsApp Web v2.2126.10 (#735)
* fix downloadMedia

* return a boolean for hasMedia
2021-07-09 02:38:31 -04:00
Pedro Lopez
0465507009 chore: mark version v1.13.0 2021-07-09 01:22:08 -04:00
Pedro Lopez
2fd96e76b9 update readme to indicate node 14 is required 2021-07-09 01:18:09 -04:00
Pedro Lopez
caab11cfe4 bump minimum required moduleraid version 2021-07-09 01:14:07 -04:00
Pedro S. Lopez
ebba1b9ab9 Update lint.yml 2021-06-05 19:02:08 -04:00
JoseHM8A
cdc00e934d feat: acceptGroupV4Invite (#677)
* Added option client.acceptGroupV4Invite()

* Update Client.js

* Update index.d.ts

Added a description to the inviteV4 object

Renamed "invite" by "inviteV4"

* Update Client.js

* Update Message.js

renamed "invite" to "inviteV4"

* Update Client.js

* Added message.acceptGroupV4Invite method

* Update index.d.ts

acceptGroupV4Invite

* better typings, refactor some names

Co-authored-by: Pedro Lopez <pedroslopez@me.com>
2021-06-05 17:10:47 -04:00
Pedro S. Lopez
795570a697 chore: update eslint and ecmaVersion (#680) 2021-06-02 23:39:01 -04:00
Pedro S. Lopez
0465742ffb chore: update lint action (#679)
* update lint action

* fix script path

* ignore docs

* update names
2021-06-02 23:17:28 -04:00
Ricardo Araújo Paes
38976558f5 feat(dev): add argument bypassCSP to use in pupperter (#635) 2021-06-01 22:05:44 -04:00
Wictor Nogueira
b895437458 add searchMessages method (#586)
* add searchMessages method

* fix typing

* fix typing

* remove unused statement

Co-authored-by: Pedro S. Lopez <pslamoros@hotmail.com>
2021-06-01 21:54:27 -04:00
tuyuribr
0a061f982c feat: Add from which device the message was sent (#648)
* Add from which device the message was sent.

Use the message Id for fingerprint the device that was being use when the message was sent

* To single quotes

Co-authored-by: Pedro S. Lopez <pslamoros@hotmail.com>
2021-05-31 21:03:23 -04:00
Aliyss Snow
63d11d3f84 feat: disable / enable WA Web features (#543)
* Added Features and Enabling/Disabling of Features within WhatsappWeb

* remove feature commands from example

Co-authored-by: Pedro S. Lopez <pslamoros@hotmail.com>
Co-authored-by: Pedro Lopez <pedroslopez@me.com>
2021-05-31 20:58:55 -04:00
renjop
5177a257cf feat: Get Orders and Products (#612)
* - Get products and orders

* - Get products and orders

* - Eslint fixes

* - Eslint fixes

* allow downloading media for products

* products and orders work on normal accounts

Co-authored-by: Renato Jop <renato.jop@consystec-corp.com>
Co-authored-by: Pedro Lopez <pedroslopez@me.com>
Co-authored-by: Pedro S. Lopez <pslamoros@hotmail.com>
2021-05-31 20:46:43 -04:00
Wictor Nogueira
f506c171c1 add extra option to MessageSendOptions (#600)
Co-authored-by: Pedro S. Lopez <pslamoros@hotmail.com>
2021-05-31 19:24:30 -04:00
tuyuribr
64e2cc48fc feat: openChatWindow can open new chats (#592)
Open the chat window even if you never chatted with the chatId

Co-authored-by: Pedro S. Lopez <pslamoros@hotmail.com>
2021-05-31 19:21:57 -04:00
Wictor Nogueira
6c66ab2bef Add sendVideoAsGif option (#578)
* Add sendVideoAsGif option

* fix typo

Co-authored-by: Pedro S. Lopez <pslamoros@hotmail.com>
2021-05-31 19:18:10 -04:00
Rajeh Taher
efc7018f9a Add support for sticker Name and author (#527)
* Added Sticker author and sticker name support

This patch of Client.js includes support for sticker metadata

* Docs: stickerName and stickerAuthor in MessageOpts

* Hotfix_Sticker_Feature

fixes a bug

* Update global.html

* updated

* fixed comma

* Fixed duplicate code

* Fixing eslint

* Fixing eslint again

* eslint....

* fixing problem with eslint.

* move sticker exif data filling to Utils.formatToWebpSticker() function

* Update Client.js

* Added temporary stuff

* eslint

* Update Util.js

* eslint bad :D

* eslint

* polish work with files

* fix error and TODOs

* clean up code to match with repo code style

* update typescript params

* Update src/util/Util.js

camel Case

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

* Update Util.js

*  webp-converter  node-webpmux

* Update Util.js

*  Use node-webpmux

*  node-webpmux  node-webpmux-commonjs

* ✏️ Fixed require mode

* :heavy_plus_sign:node-webpmux  node-webpmux-commonjs

* ⬆️ Node-webpmux update changes

* 🚨 removing try/catch

* 🚨 complier warnings

* 🧐 stupid mistakes

* ⬆️ Upgrade required version

* 🐛 creating a buffer the right way

* 🐛 linting and simplification

* 🐛 unsimplification

* 🚨 eslint loves singlequotes

*  Added emojis / categories in metadata

* 🏷️ TypeScript Declarations

*  Sticker Categories in sendMessage

* 🏷️ Improved TS declarations

* fix stickerCategories type

* fix: don't set name/author if not defined

Co-authored-by: Marcelo Carvalho <mpirescarvalho17@gmail.com>
Co-authored-by: Pedro S. Lopez <pslamoros@hotmail.com>
Co-authored-by: Pedro S. Lopez <pedroslopez@me.com>
2021-05-31 19:13:30 -04:00
Pedro Lopez
5991b28b88 update supported whatsapp web ver to v2.2114.8 2021-04-20 23:02:33 -04:00
Pedro Lopez
2894832b00 chore: mark version v1.12.6 2021-04-20 22:59:35 -04:00
Pedro Lopez
6cece4a006 fix: emit disconnected event on page navigation
This also addresses an issue due to a change in behavior from WhatsApp Web when the session is logged out from the device.
2021-04-20 20:02:22 -04:00
Pedro Lopez
f1e2f32988 fix: click correct element on manual qr code refresh 2021-04-20 19:39:13 -04:00
Pedro S. Lopez
f564e41781 chore: bump version to v1.12.5 2021-02-25 00:31:39 -04:00
Jacob Galam
e6015162c5 fix(types): media type in MessageSendOptions (#554)
Co-authored-by: Pedro S. Lopez <pslamoros@hotmail.com>
2021-02-25 00:27:23 -04:00
Pedro S. Lopez
bc90ffcb19 fix: WhatsApp Web v2.2106.5 compatibility 2021-02-25 00:23:49 -04:00
Antoine Schaller
2702757dce fix: star() & unstar() functions (#547) 2021-02-15 22:24:07 -04:00
Pedro S. Lopez
56171f957e chore: don't auto set bug label on issues
This should be manually added when it's confirmed a bug
2021-02-13 11:29:16 -04:00
Pedro S. Lopez
204a1c79af chore: mark version v1.12.4 2021-02-11 18:44:15 -04:00
Pedro S. Lopez
168c84250e fix sending stickers on WhatsApp Web v2.2104.6 2021-02-11 18:40:35 -04:00
Pedro S. Lopez
d96e8e5eb5 chore: mark version v1.12.3 2021-02-09 15:40:57 -04:00
Pedro S. Lopez
0cbb0373ad fix(ts): getNumberId typings caused error on build 2021-02-09 15:35:57 -04:00
Pedro S. Lopez
1f756142e4 ignore logs on npm publish 2021-02-09 00:48:58 -04:00
Pedro S. Lopez
4047afe332 chore: mark version v1.12.2 2021-02-09 00:47:28 -04:00
Pedro S. Lopez
89029ac916 add docs 2021-02-09 00:43:45 -04:00
Artem Sinelnikov
fa4923db98 fixed acceptInvite typings 2021-02-09 00:43:45 -04:00
Pedro S. Lopez
559133c3c4 fix: upload media on WhatsApp Web v2.2104.6 2021-02-09 00:35:25 -04:00
Pedro S. Lopez
e2acd03efc fix: download media on WhatsApp Web v2.2104.6 2021-02-09 00:24:48 -04:00
Pedro S. Lopez
c6974295a6 chore: mark version v1.12.1 2021-01-30 20:38:10 -04:00
Pedro S. Lopez
6590c75c8a fix (ts): include pupPage and pupBrowser properties on Client typedef 2021-01-30 20:36:46 -04:00
Pedro S. Lopez
1bdc7335d8 chore: mark version v1.12.0 2020-12-29 00:38:44 -04:00
Pedro S. Lopez
bb9d160f72 docs: switch links to point to the guide 2020-12-29 00:37:25 -04:00
Pedro S. Lopez
cea1830dde docs: fix error generating Label docs 2020-12-29 00:33:49 -04:00
Pedro S. Lopez
f639c53f0a feat: Get message delivery information (close #418) 2020-12-29 00:33:49 -04:00
Raphael R
3e32fe27ea feat: mark chat as unread (#475)
Co-authored-by: Pedro S. Lopez <pedroslopez@me.com>
2020-12-29 00:33:49 -04:00
Marcelo Carvalho
5c6195738f feat: add GroupChat types (#485)
Co-authored-by: Pedro S. Lopez <pedroslopez@me.com>
2020-12-29 00:33:49 -04:00
Pedro S. Lopez
32575490da docs: fix typo 2020-12-29 00:33:49 -04:00
Antoine Schaller
5a0ccc8b17 feat: added starred indicator to messages (#501)
Co-authored-by: Pedro S. Lopez <pedroslopez@me.com>
2020-12-29 00:33:49 -04:00
Marcelo Carvalho
1b946940f4 feat: star/unstar messages (#494) 2020-12-29 00:33:49 -04:00
Pedro S. Lopez
71dbe99023 feat: get Contact's "About" text (close #491) 2020-12-29 00:33:49 -04:00
Pedro S. Lopez
8b101d1f3d feat: get links included in message (#457) 2020-12-29 00:33:49 -04:00
Marcelo Carvalho
e2a642a81b feat: send media as stickers (#479)
Adds the option `sendMediaAsSticker` that will take care of converting media to appropriate formats and send it as a sticker. Note that ffmpeg is required to properly convert animated stickers that are not in webp format.

Co-authored-by: Pedro S. Lopez <pedroslopez@me.com>
2020-12-29 00:33:49 -04:00
Pedro Lopez
0c0a5a752b docs: fix slight typo 2020-12-29 00:33:49 -04:00
Marcelo Carvalho
e141a5df97 feat: send media as document (#490)
Co-authored-by: Pedro S. Lopez <pslamoros@hotmail.com>
2020-12-29 00:33:49 -04:00
Lucas Rosa
576768e390 feat: Get registered ID for a given phone number (#483)
Exposes internal getNumberById function for easy usage.
This can help with dealing with brazilian numbers with the extra digit, always returning the correct ID.

This will probably eventually replace the current isRegisteredUser function.

Co-authored-by: Pedro Lopez <pedroslopez@me.com>
2020-12-29 00:33:49 -04:00
Aliyss Snow
87cb5a0519 feat(interface): Open chat search, open chat at message position (#447) 2020-12-29 00:33:49 -04:00
dyegoaurelio
274d24002b feat: WA Business Labels support (#407)
* Get all labels
* Get chats by label
* Get labels assigned to chats

Co-authored-by: Pedro S. Lopez <pslamoros@hotmail.com>
Co-authored-by: Pedro Lopez <pedroslopez@me.com>
2020-12-29 00:33:49 -04:00
Pedro Lopez
563f73d290 chore: mark version v1.11.2 2020-12-21 22:13:14 -04:00
Pedro Lopez
4b3079d2c1 chore: bump supported WhatsApp Web version to v2.2049.10 2020-12-21 22:08:13 -04:00
Pedro Lopez
7b0e356fcc chore: ignore all session files on npm 2020-12-21 22:04:02 -04:00
Pedro Lopez
467f2af7d8 fix: properly serialize chats with pending button replies
close #489
2020-12-21 21:55:38 -04:00
Pedro Lopez
19b1b9fdef chore: mark version v1.11.1 2020-11-19 15:07:29 -04:00
victormga
a1d09e0e21 fix: fetchMessages when msgs length is smaller than limit (#438) 2020-11-19 15:03:39 -04:00
victormga
d86ccec5d1 fix: Expose store on WhatsApp Web v2.2047.10 (#437)
Fixed whatsapp updates

close #436
2020-11-19 14:55:41 -04:00
Pedro Lopez
f359ad40ee chore: bump supported WhatsApp Web version to v2.2045.15 2020-11-05 02:27:39 -04:00
Pedro Lopez
db7a8bcd3b chore: bump version to v1.11.0-post 2020-11-05 02:26:20 -04:00
Pedro Lopez
edbf4139e7 chore: mark version v1.11.0 (again)
PR had to be merged and added to the release
2020-11-05 02:09:32 -04:00
Pedro S. Lopez
709c43cc9f feat: add received vcards to the message (#400)
close #398 

Co-authored-by: Pedro S. Lopez <pedroslopez@me.com>
2020-11-05 02:07:40 -04:00
Pedro Lopez
054ef4a84f add typings 2020-11-05 02:06:13 -04:00
Pedro S. Lopez
c9bc0a1c8b Merge branch 'master' into bugfix-multi_vcard 2020-11-05 01:55:03 -04:00
Pedro Lopez
6b3c8465e9 chore: mark version v1.11.0 2020-11-05 01:51:39 -04:00
Pedro Lopez
43aa6b3716 chore: add blocking functionality to readme 2020-11-05 01:43:45 -04:00
Pedro Lopez
7738f7910b fix linting issues 2020-11-05 01:40:12 -04:00
Pedro Lopez
fc7a1a9974 fix: address removal of Conn.me
This change on WhatsApp Web v2.2045.15 caused errors when sending messages and getting the current user id
2020-11-05 01:37:51 -04:00
Pedro Lopez
b0465ceeff fix: expose GroupMetadata
WhatsApp Web v2.2045.15+ no longer has this in the store by default
2020-11-05 01:20:52 -04:00
Lucas Rosa
2abe4a157d Merge branch 'master' into bugfix-multi_vcard 2020-11-02 13:20:25 -03:00
yuvalfis
e520a96b20 fix: serialize msgs.buttons and delete msgs from chat model (#402)
Co-authored-by: yuvalFishler <yuvalf@realfriend.ai>

close #386
2020-11-01 18:32:46 -04:00
Lucas Rosa
75296b652b feat: add received vcards to the message. 2020-10-26 19:49:06 -03:00
Lucas Rosa
b15ec768d3 fix: show multiple vcard as array in body 2020-10-26 16:23:26 -03:00
Pedro S. Lopez
42dd866a53 feat: boolean for indicating Status update messages (#396) 2020-10-26 00:45:09 -04:00
Pedro S. Lopez
20e07c43d7 feat: block/unblock contacts (#397) 2020-10-26 00:44:03 -04:00
Pedro S. Lopez
9b096db784 feat: Send contacts (#395)
Introduces the ability to send contact cards. You can send Contacts directly or send a vCard string and it will be automatically parsed. If you'd like to disable this autoparse functionality, you can set `parseVCards: false` as an option while sending a message.

close #293
2020-10-25 22:44:37 -04:00
Pedro S. Lopez
668106be2d chore: add group settings functionality to readme 2020-10-25 19:23:28 -04:00
Pedro Lopez
cc5d85b2b1 chore: bump version to v1.10.0-post 2020-10-25 19:15:40 -04:00
Pedro Lopez
3d06babed9 chore: mark version v1.10.0 2020-10-21 15:22:05 -04:00
Pedro Lopez
0ca909233d Merge branch 'master' of https://github.com/pedroslopez/whatsapp-web.js 2020-10-21 15:21:08 -04:00
Pedro Lopez
f4a2c44ed7 chore: bump supported WhatsApp Web version to v2.2043.8 2020-10-21 15:21:02 -04:00
Pedro S. Lopez
604656cf73 fix: change OpaqueData module lookup function (#391)
A change introduced in WhatsApp Web v2.2043.8 caused this to break, leading to issues while sending media

fix #390
2020-10-21 15:18:51 -04:00
Aliyss Snow
aedf41b762 feat: Pin and unpin Chats (#166)
* Added Pinning
- chat.pin() to pin
- chat.unpin() to unpin

Co-authored-by: Pedro S. Lopez <pedroslopez@me.com>
2020-10-11 15:50:12 -04:00
Pedro S. Lopez
bf2775d1f0 feat: update group settings (messages and set info admins only) (#374)
close #187
2020-10-11 15:14:06 -04:00
Pedro Lopez
0b112004d5 chore: mark version v1.9.0 2020-10-09 02:34:02 -04:00
Pedro Lopez
336fb9b551 chore: update supported WhatsApp Web version to v2.2041.6 2020-10-09 02:32:42 -04:00
Pedro Lopez
ba6ec7feab fix: apply message serialization fix everywhere
Moving this to a serializer function like done with a couple other models guarantees getting messages with pending acks won't fail elsewhere. It also sets it up so the we can add/remove properties on the Message model as needed in the future.

related: 51a1028588
2020-10-09 02:29:07 -04:00
Pedro Lopez
51a1028588 fix: remove pendingAckUpdate from serialization on changed message ack
As of WhatsApp Web v2.2041.6, a "pendingAckUpdate" property was added to the Message model that persists on serialization but is a non-serializable type. This fix removes it from the change:ack so it can be properly sent through puppeteer.

fix #371
2020-10-09 01:40:07 -04:00
Pedro Lopez
1c31139434 fix(types): add missing type defs for chat.muteExpiration 2020-09-27 19:18:07 -04:00
Pedro Lopez
ee21e14547 feat: indicate if chat is currently muted 2020-09-27 19:15:34 -04:00
Leonardo Almeida
cbf8fb7cf5 feat: chat mute expiration timestamp (#351)
add chat.muteExpiration to indicate when the mute expires

Co-authored-by: Pedro S. Lopez <pedroslopez@me.com>
2020-09-27 19:11:08 -04:00
Pedro Lopez
c7d5eb67ee chore: bump version to v1.8.2-post 2020-09-01 15:27:36 -04:00
Pedro Lopez
7fcd43f100 chore: mark version v1.8.2 2020-09-01 15:23:46 -04:00
Pedro Lopez
a60f0ce139 chore: update supported WhatsApp Web version to v2.2035.14 2020-09-01 15:00:45 -04:00
Pedro Lopez
ab0db80063 fix: reliably get group metadata
GroupMetadata was only loaded for the first couple chats, so you could not access it on older group chats without performing an action that would update its state

close #264
2020-09-01 12:48:22 -04:00
Hendra827
e7c76fe069 chore: update puppeteer to v5.2.1 2020-08-31 14:11:31 -04:00
Pedro Lopez
233382ce7a chore: ignore test session files when pushing to git 2020-08-28 23:15:15 -04:00
Pedro Lopez
e08dd7d835 chore: add .npmignore for smaller package size 2020-08-28 23:12:45 -04:00
Pedro Lopez
a1e8e8cf51 chore: bump version to v1.8.1-post 2020-08-28 23:08:25 -04:00
Pedro Lopez
a1e0970e1e chore: mark version v1.8.1 2020-08-28 23:04:31 -04:00
Caio Henrique Agiani
c827b32328 fix(types): correct response type for message.forward() (#324) 2020-08-28 22:00:13 -04:00
Pedro Lopez
2345b5c4ee chore: bump version to v1.8.0-post 2020-08-25 23:26:55 -04:00
Pedro Lopez
8627fc3d71 chore: mark version v1.8.0 2020-08-25 23:06:36 -04:00
Pedro Lopez
502b22f6d7 feat: forward messages
close #316
2020-08-25 23:00:35 -04:00
Pedro Lopez
590ecc2351 chore: update supported WhatsApp Web version to 2.2035.12 2020-08-25 22:34:10 -04:00
Pedro Lopez
7da8345722 fix: upload media
As of WhatsApp Web v2.2035.12, the structure of the return value for  `uploadMedia()` now returns an object that contains the previously returned data in its `mediaEntry` property.

fix #318
2020-08-25 22:30:04 -04:00
Pedro Lopez
4344df6152 fix: properly detect successful authentication on dark mode 2020-08-25 21:40:57 -04:00
Pedro Lopez
382259488b feat(dev): Interactive shell for quick testing/exploration 2020-08-17 23:43:50 -04:00
Pedro Lopez
7180beda2e feat: Get corresponding Chat from Contact object and vice versa
close #269
2020-08-17 23:31:19 -04:00
Pedro Lopez
34aa136bf9 fix(docs): Correctly document Chat timestamp property
close #287
2020-08-17 22:36:32 -04:00
Pedro Lopez
2a58cfe8e2 fix(types): properly set optional arguments when sending / replying to messages
close #309
2020-08-17 22:28:27 -04:00
Pedro Lopez
9da553ecb9 feat: Set client's display name (pushname) 2020-08-17 22:19:29 -04:00
stefanfuchs
97705b1865 fix: MessageMedia interface to class (index.d.ts) (#301)
* fix: change MessageMedia to class

* fix: remove all references to MessageMediaInterface

* add MessageMedia constructor params docs
2020-08-08 15:03:09 -04:00
stefanfuchs
fbdfd2c4dd fix: Constants export in index.js (#285)
* fix: add Constants export in index.js
* fix: add missing constants export in index.d.ts


Co-authored-by: Pedro S. Lopez <pedroslopez@me.com>
2020-08-03 02:58:15 -04:00
stefanfuchs
5c84a1651d chore: add missing types in JSDoc/TSDoc (ClientOptions, ClientInfo, MessageSendOptions, Session) (#286)
* chore: add ClientOptions and ClientInfo in JSDoc

* chore: add MessageSendOptions type

* chore: add ClientSession type in JSDoc

* chore: remove @todo from createGroup (was already solved)

Co-authored-by: Pedro Lopez <pedroslopez@me.com>
2020-08-03 02:52:37 -04:00
stefanfuchs
bfea74f567 fix: add missing type definitions (#278)
* fix: @todo docs improvements

* fix: add ClientInfo to Client typings

* add ClientInfoPhone

* fix: set getBatteryStatus as async

* add ClientInfo comment

Co-authored-by: Pedro S. Lopez <pedroslopez@me.com>
2020-07-11 02:58:57 -04:00
YY
a10b458cd5 feat: custom user Agent in Client (#271)
* Added Option to Custom User Agent in Client

* Update Typescript Index

* Delete Variable UserAgent From Client

* Update Variable UserAgent to userAgent
2020-07-03 02:05:23 -04:00
Pedro Lopez
de2c441870 chore: update supported whatsapp web version 2.2025.6 2020-06-18 01:48:10 -04:00
Pedro Lopez
bff60bc9f6 chore: bump version v1.7.0-post 2020-06-18 01:47:46 -04:00
Pedro Lopez
9cc668e4d9 chore: mark version v1.7.0 2020-06-18 01:41:36 -04:00
Pedro Lopez
753b6772ab feat: get current battery status 2020-06-18 01:28:25 -04:00
Pedro Lopez
300b367fa0 feat: logout client
close #255
2020-06-17 23:58:02 -04:00
Pedro Lopez
b0baeaa8da Merge branch 'master' of https://github.com/pedroslopez/whatsapp-web.js 2020-06-17 23:30:01 -04:00
Pedro Lopez
ad9ae1f703 fix: move invite info to client
Since static methods do not have access to `this.client`, it was giving an error when trying to call these functions. The client itself is a better place for them.

close #258
2020-06-17 23:29:34 -04:00
Pedro Lopez
b89f0e146f fix: move invite info to client
Since static methods do not have access to `this.client`, it was giving an error when trying to call these functions. The client itself is a better place for them.
2020-06-17 23:28:54 -04:00
Maximilian Walterskirchen
6c7a3f9899 fix: Added check for null in Message constructor (#253)
Co-authored-by: Walterskirchen <walterskirchen@walter-group.com>
Co-authored-by: Pedro S. Lopez <pedroslopez@me.com>
2020-06-16 18:15:19 -04:00
stefanfuchs
d7459eac23 feat: add typescript definition file (#252)
Co-authored-by: Pedro S. Lopez <pedroslopez@me.com>
2020-06-16 18:12:14 -04:00
Javier Portillo
2abd3729d8 fix: clear qr refresh interval on client.destroy() (#249)
* fix: client.destroy() keeps trying to get QR code when client is not authorized yet

Co-authored-by: Javier Portillo <javier.marquez@dada-dada.com>
2020-06-08 22:31:22 -04:00
Pedro S. Lopez
810ff4603b chore: add discord link to issue creation 2020-06-07 18:10:49 -04:00
Pedro S. Lopez
4d5619019c chore: Add issue templates
close #246
2020-06-07 18:06:02 -04:00
Pedro Lopez
84213cc781 chore: bump version v1.6.1-post 2020-06-04 20:25:04 -04:00
Pedro Lopez
bf94d20db3 Merge branch 'hotfix/v1.6.1' 2020-06-04 20:23:55 -04:00
Pedro Lopez
2e3b2f2a43 chore: mark version v1.6.1 2020-06-04 20:20:43 -04:00
Caio Henrique Agiani
9c9b3c4441 fix: WhatsApp Autentication by oguzhan51 (#237)
The selector used to detect successful authentication was changed in WhatsApp Web v2.2023.2

Co-authored-by: oguzhan51
2020-06-04 20:15:40 -04:00
Caio Henrique Agiani
832e402671 fix: WhatsApp Autentication by oguzhan51 (#237)
The selector used to detect successful authentication was changed in WhatsApp Web v2.2023.2

Co-authored-by: oguzhan51
2020-06-04 20:03:44 -04:00
Aliyss Snow
47011a32a5 feat: Interface controls (#220)
- Open chat drawer
- Open chat window
- Open message info drawer
- Close drawer
2020-05-31 18:14:21 -04:00
Pedro S. Lopez
a7ca628775 chore: update required node version (#222)
Puppeteer v3 now requires 10.18.1+
2020-05-26 13:52:52 -04:00
Aliyss Snow
aa60e89911 docs: add mute/unmute feature to readme (#214)
Co-authored-by: Pedro S. Lopez <pedroslopez@me.com>
2020-05-24 19:27:41 -04:00
Pedro Lopez
d922e4df2f chore: bump version to v1.6.0-post 2020-05-24 01:11:07 -04:00
Pedro Lopez
c032ea4387 chore: mark version v1.6.0 2020-05-24 00:57:54 -04:00
Pedro Lopez
a80fcfa740 update supported whatsapp web version to v2.2021.3 2020-05-24 00:55:12 -04:00
Pedro Lopez
44f837c42a fix: remove unreliable return values for new mute state 2020-05-24 00:19:23 -04:00
Aliyss Snow
4beeab9b2c feat: mute/unmute chats (#168)
Co-authored-by: Pedro S. Lopez <pedroslopez@me.com>
2020-05-24 00:10:26 -04:00
Pedro Lopez
cca74ec8b9 docs: indicate return type for MessageMedia.fromFilePath 2020-05-23 23:28:19 -04:00
Pedro Lopez
8b656c2caf fix: set thumbnail for media messages
close #55
2020-05-23 23:21:13 -04:00
Pedro Lopez
4d09a4b60c fix: media would stay stuck uploading when using the media option 2020-05-23 22:55:18 -04:00
Pedro Lopez
7d2c89cf84 docs: fix wrong parameter name 2020-05-23 22:37:31 -04:00
Pedro Lopez
0928f48762 Merge branch 'master' of https://github.com/pedroslopez/whatsapp-web.js 2020-05-23 22:36:04 -04:00
Pedro Lopez
eb82e80343 feat: Helper function to create MessageMedia from a local file path 2020-05-23 22:35:59 -04:00
Caio Henrique Agiani
f5a0de7def fix: Wait for WhatsApp page load (#209)
* Fix bug on Puppeteer timeout 30000 ms exceeded
2020-05-23 21:52:46 -04:00
Pedro Lopez
d6637d662a fix: visual glitch when sending message to new chat; no longer require at least one chat to have been created 2020-05-16 02:08:13 -04:00
Pedro Lopez
4188734839 Ignore lock files 2020-05-16 01:22:05 -04:00
Pedro Lopez
207ea200b4 Merge branch 'master' of https://github.com/pedroslopez/whatsapp-web.js 2020-05-16 01:12:20 -04:00
Pedro Lopez
b062f9f82f Update puppeteer to version 3.0.4 2020-05-16 01:12:14 -04:00
Pedro S. Lopez
4d7a6ee4c2 Update supported whatsapp web version 2020-05-16 00:50:16 -04:00
depfu[bot]
e528e8c50e Update jsqr to version 1.3.1 (#185)
Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com>
2020-05-02 17:56:43 -04:00
Aliyss Snow
bcd02aa5e4 set defaultViewPort option for puppeteer (#167)
- Mainly for those who like to keep the GUI open.
- Expands to fit and looks like it usually would.
2020-04-20 22:57:59 -04:00
Pedro Lopez
686c99f0c7 feat: send audio as voice note
This adds the 'sendAudioAsVoice' option for messages

close #160
2020-04-14 23:18:08 -04:00
Pedro Lopez
59ee68b227 chore: bump version to v1.5.1-post 2020-04-14 22:49:57 -04:00
Pedro Lopez
f40c8d4ffe chore: mark version v1.5.1 2020-04-14 22:47:07 -04:00
Pedro Lopez
bab54aea8b fix: set url subtype for messages with link previews
Co-authored-by: João Vitor Miranda <joao.miranda@aluno.ufabc.edu.br>
Co-authored-by: Top <shmuliktop@users.noreply.github.com>
2020-04-14 22:42:05 -04:00
Pedro Lopez
f0a1e05600 chore: bump version v1.5.0-post 2020-04-11 20:00:28 -04:00
Pedro Lopez
303d814376 chore: mark version v1.5.0 2020-04-11 19:49:45 -04:00
Pedro Lopez
044f62216b feat: link previews
After this commit, previews for links will be enabled by default. To disable it, use linkPreview: false as an option when sending the message.

close #98
2020-04-11 19:45:06 -04:00
Pedro Lopez
2b3c3e971a docs: add new param to jsdoc for getProfilePicUrl 2020-04-11 19:04:15 -04:00
Pedro Lopez
8528d9b0b6 feat: get profile pic url by user ID
This moves the function from Contact to Client to enable getting profile picture without requiring a conversation before. The old function is still available on Contact for convenience and backwards-compatibility.
2020-04-11 19:03:47 -04:00
Pedro Lopez
7eb7fa8e28 feat: send online status
close #69
2020-04-11 18:56:23 -04:00
Pedro Lopez
8714e90df9 revert: included this by mistake on last commit 2020-04-11 18:52:01 -04:00
Pedro Lopez
478f7136d9 feat: takeover on conflict
This adds funcitonality to takeover after a certain timeout if WhatsApp Web has been opened in another browser

close #119
2020-04-11 18:48:50 -04:00
Pedro S. Lopez
20bbe3d0c4 readme: add discord logo to shield 2020-04-11 16:32:53 -04:00
Pedro S. Lopez
33db17e67d add discord link 2020-04-11 16:31:17 -04:00
Pedro Lopez
1c2b4592b5 chore: bump version to v1.4.1-post 2020-04-11 15:04:00 -04:00
Pedro Lopez
ce0a80383c chore: mark version v1.4.1 2020-04-11 15:01:44 -04:00
Pedro Lopez
97e488b10a chore: update supported WhatsApp Web version to 2.2013.7 2020-04-11 15:00:42 -04:00
Pedro Lopez
ef507fcb95 Merge branch 'master' of https://github.com/pedroslopez/whatsapp-web.js 2020-04-11 14:59:39 -04:00
Pedro Lopez
8e011e0233 feat: get current whatsapp web version 2020-04-11 14:59:32 -04:00
InstantlyMoist
470c7aea04 feat: added MediaKey in order to see which sticker has been sent (#146) 2020-04-11 14:54:19 -04:00
Antoine Schaller
f92f1ec6bf Fix uploadMedia arguments after origin code change (#153) 2020-04-11 14:53:22 -04:00
depfu[bot]
702a0ab103 Update jsdoc to version 3.6.4 (#144)
Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com>
2020-04-07 23:38:56 -04:00
Pedro Lopez
d9fb5693d1 chore: bump version v1.4.0-post 2020-04-05 23:45:18 -04:00
Pedro Lopez
3cbf1e9c2f chore: mark version v1.4.0 2020-04-05 23:39:22 -04:00
Aliyss Snow
93a617336a feat: battery percentage changed event (#126)
New "change_battery" event is triggered when the battery percentage changes. Has current battery percentage and charging state as object param.

Co-authored-by: Pedro S. Lopez <pedroslopez@me.com>
2020-04-05 23:36:03 -04:00
kurob1993
1780436b93 fix: make pupBrowser and pupPage available sooner (#137)
* move this.pupBrowser variable to line 51 to resolve not being able to close the browser when it is not connected to the internet

* move pupPage along with pupBrowser

Co-authored-by: Pedro S. Lopez <pedroslopez@me.com>
2020-04-05 23:04:03 -04:00
Pedro Lopez
7acbd3d800 fix: properly set chatId
This was causing errors when using the .reply() function
2020-04-05 22:57:59 -04:00
Pedro Lopez
67435b2244 fix: group events were not being triggered 2020-04-05 22:57:36 -04:00
Pedro Lopez
743ac93f6e feat: allow setting timeouts via options 2020-04-03 01:49:16 -04:00
Pedro Lopez
0a7412cf17 feat: create groups
close #131
2020-04-03 01:45:06 -04:00
Pedro Lopez
d1e357d23b chore: bump version v1.3.1-post 2020-04-02 02:35:36 -04:00
Pedro Lopez
3610cef926 chore(docs): mark v1.3.1 2020-04-02 02:33:44 -04:00
Pedro Lopez
4e5eeace2f chore: mark v1.3.1 2020-04-02 02:33:17 -04:00
Pedro Lopez
6c43a2d2ed fix: increase timeouts
close #130
2020-04-02 02:30:50 -04:00
Pedro Lopez
001c045c08 fix: only return undefined for ERROR_* media states
This was causing a regression as of 1.2.5 that caused media files sent by the client to not be properly downloaded
cc #111 @stevefold
2020-04-02 02:24:12 -04:00
Pedro S. Lopez
c3ba79464b Update README.md 2020-03-31 12:43:03 -04:00
Pedro Lopez
237331b656 chore: bump version to v1.3.0-post 2020-03-29 23:59:05 -04:00
Pedro Lopez
9d0b58a847 chore: mark version v1.3.0 2020-03-29 23:51:49 -04:00
Pedro Lopez
842c4f0e06 feat: check if ID is a valid whatsapp user
close #120
2020-03-29 22:58:08 -04:00
Pedro Lopez
2dddc781c5 fix: initialize takes no params 2020-03-29 21:47:47 -04:00
Pedro S. Lopez
d8cd2d1d83 chore: updated whatsapp web version 2020-03-23 18:59:53 -04:00
Pedro Lopez
80d5783f22 feat: new event for when media is uploaded
Messages created by the current client don't have attatched media on message_create because it is still being uploaded and sent. This event allows you to detect when the media has been properly sent so it can be downloaded.

close #111
2020-03-22 20:38:26 -04:00
Pedro Lopez
cb54487197 feat: add ack to message model
close #108
2020-03-22 20:00:53 -04:00
Steven L
d08b343815 Added "restartOnAuthFail" as an option (#112)
- When true, the sessions passed is discarded when reinitialized.
2020-03-22 19:52:46 -04:00
Pedro Lopez
ec1a80dfb4 chore: bump version to v1.2.5-post 2020-03-15 15:36:57 -04:00
Pedro Lopez
56ed020d65 chore: mark version v1.2.5 2020-03-15 15:32:37 -04:00
Pedro Lopez
25b96378c7 fix: properly handle unresolved media 2020-03-15 15:29:56 -04:00
Pedro S. Lopez
5934ec531f fix: return undefined when attempting to download nonexistent media
This could occur when the user has deleted the media and it can no longer be downloaded.
2020-03-15 15:20:50 -04:00
Pedro Lopez
65542f6025 chore/fix: update requires for new moduleraid package
For got to do this on the previous release
2020-03-15 02:05:20 -04:00
Pedro Lopez
00c603e623 chore: use published moduleraid
Pulling this from github was causing confusion and issues on installation for users that did not have git installed. I have published the library myself for now, but should be changed back to the official library when an official release is made.
2020-03-15 02:03:11 -04:00
Pedro Lopez
bcd18428eb chore: bump version to v1.2.4-post 2020-03-14 17:46:33 -04:00
Pedro Lopez
995abbf4a6 chore: mark version v1.2.4 2020-03-14 17:43:31 -04:00
Pedro Lopez
8599a6d918 fix: properly download media if it has not been loaded
This issue occurred when attempting to download media from old messages.
2020-03-14 17:37:59 -04:00
Pedro Lopez
5e9deff8a9 chore: bump version v1.2.3-post 2020-03-13 17:54:22 -04:00
121 changed files with 18645 additions and 2722 deletions

3
.env.example Normal file
View File

@@ -0,0 +1,3 @@
WWEBJS_TEST_REMOTE_ID=XXXXXXXXXX@c.us
WWEBJS_TEST_CLIENT_ID=authenticated
WWEBJS_TEST_MD=1

View File

@@ -5,14 +5,16 @@
"es6": true, "es6": true,
"node": true "node": true
}, },
"extends": "eslint:recommended", "extends": ["eslint:recommended", "plugin:mocha/recommended"],
"globals": { "globals": {
"Atomics": "readonly", "Atomics": "readonly",
"SharedArrayBuffer": "readonly" "SharedArrayBuffer": "readonly"
}, },
"parserOptions": { "parserOptions": {
"ecmaVersion": 2018 "ecmaVersion": 2020
}, },
"plugins": ["mocha"],
"ignorePatterns": ["docs"],
"rules": { "rules": {
"indent": [ "indent": [
"error", "error",

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"]

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.

5
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Official WWebJS Discord Server
url: https://discord.gg/H7DqQs4
about: Please ask and answer questions 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

7
.github/dependabot.yml vendored Normal file
View File

@@ -0,0 +1,7 @@
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
open-pull-requests-limit: 10
schedule:
interval: "monthly"

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).

View File

@@ -6,19 +6,15 @@ on:
jobs: jobs:
eslint: eslint:
name: eslint name: ESLint
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v2
- name: install node v12 - name: Install node v14
uses: actions/setup-node@v1 uses: actions/setup-node@v2
with: with:
node-version: 12 node-version: '14'
- name: npm install - name: Install dependencies
run: npm install run: npm install
- name: eslint - name: Run ESLint
uses: icrawl/action-eslint@v1 run: ./node_modules/.bin/eslint .
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
job-name: eslint

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 }}

39
.github/workflows/update.yml vendored Normal file
View File

@@ -0,0 +1,39 @@
name: Update
on:
schedule:
- cron: "0/15 * * * *"
workflow_dispatch:
jobs:
update:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./tools/version-checker
steps:
- uses: actions/checkout@v2
- name: Install node v16
uses: actions/setup-node@v2
with:
node-version: '16'
- name: Install dependencies
run: npm install
- name: Run Updater
run: ./update-version
- name: Store WA Version
run: echo WA_VERSION=`cat ./.version` >> $GITHUB_ENV
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
branch: auto-wa-web-update/patch
delete-branch: true
commit-message: Update supported WhatsApp Web version to v${{ env.WA_VERSION }}
title: Update WhatsApp Web Version (${{ env.WA_VERSION }})
body: |
A new version of WhatsApp Web has been detected!
Tests should be run against this new version before merging.
labels: WhatsApp Change
reviewers: pedroslopez

12
.gitignore vendored
View File

@@ -36,6 +36,10 @@ build/Release
node_modules/ node_modules/
jspm_packages/ jspm_packages/
# Lock files
package-lock.json
yarn.lock
# TypeScript v1 declaration files # TypeScript v1 declaration files
typings/ typings/
@@ -59,3 +63,11 @@ typings/
# next.js build output # next.js build output
.next .next
# macOS
._*
.DS_Store
# Test sessions
*session.json
.wwebjs_auth/

19
.npmignore Normal file
View File

@@ -0,0 +1,19 @@
docs/*
.github/*
.eslintrc.json
.jsdoc.json
.editorconfig
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
*session.json
.wwebjs_auth/
.env
tools/
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 0.4.1296](https://img.shields.io/badge/WhatsApp_Web-0.4.1296-brightgreen.svg) [![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.2247.7](https://img.shields.io/badge/WhatsApp_Web-2.2247.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
@@ -7,16 +7,24 @@ It uses Puppeteer to run a real instance of Whatsapp Web to avoid getting blocke
**NOTE:** I can't guarantee you will not be blocked by using this method, although it has worked for me. WhatsApp does not allow bots or unofficial clients on their platform, so this shouldn't be considered totally safe. **NOTE:** I can't guarantee you will not be blocked by using this method, although it has worked for me. WhatsApp does not allow bots or unofficial clients on their platform, so this shouldn't be considered totally safe.
## Quick Links
* [Guide / Getting Started](https://wwebjs.dev/guide) _(work in progress)_
* [Reference documentation](https://docs.wwebjs.dev/)
* [GitHub](https://github.com/pedroslopez/whatsapp-web.js)
* [npm](https://npmjs.org/package/whatsapp-web.js)
## Installation ## Installation
The module is now available on npm! `npm i whatsapp-web.js` The module is now available on npm! `npm i whatsapp-web.js`
Please note that Node v8+ is required due to Puppeteer. Please note that Node v12+ is required.
## Example usage ## Example usage
```js ```js
const { Client } = require('whatsapp-web.js'); const { Client } = require('whatsapp-web.js');
const client = new Client(); const client = new Client();
client.on('qr', (qr) => { client.on('qr', (qr) => {
@@ -39,38 +47,69 @@ 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.
For more information on saving and restoring sessions, check out the available [Authentication Strategies](https://wwebjs.dev/guide/authentication.html).
## 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) | ✅ |
| Send media (video) | ✅ (requires google chrome) | | Send media (video) | ✅ [(requires google chrome)](https://wwebjs.dev/guide/handling-attachments.html#caveat-for-sending-videos-and-gifs) |
| Send stickers | _pending_ | | Send stickers | |
| Receive media (images/audio/video/documents) | ✅ | | Receive media (images/audio/video/documents) | ✅ |
| Send contact cards | _pending_ | | Send contact cards | |
| Send location | ✅ | | Send location | ✅ |
| Send buttons | ✅ |
| Send lists | ✅ (business accounts not supported) |
| Receive location | ✅ | | Receive location | ✅ |
| Message replies | ✅ | | Message replies | ✅ |
| Join groups by invite | ✅ | | Join groups by invite | ✅ |
| Get invite for group | ✅ | | Get invite for group | ✅ |
| Modify group info (subject, description) | ✅ | | Modify group info (subject, description) | ✅ |
| Modify group settings (send messages, edit info) | ✅ |
| Add group participants | ✅ | | Add group participants | ✅ |
| Kick group participants | ✅ | | Kick group participants | ✅ |
| Promote/demote group participants | ✅ | | Promote/demote group participants | ✅ |
| Mention users | ✅ | | Mention users | ✅ |
| Mute/unmute chats | ✅ |
| Block/unblock contacts | ✅ |
| 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!
## Links
* [Documentation](https://pedroslopez.me/whatsapp-web.js) _(preview)_
* [GitHub](https://github.com/pedroslopez/whatsapp-web.js)
## Contributing ## Contributing
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.
## Supporting the project
You can support the maintainer of this project through the links below
- [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
This project is not affiliated, associated, authorized, endorsed by, or in any way officially connected with WhatsApp or any of its subsidiaries or its affiliates. The official WhatsApp website can be found at https://whatsapp.com. "WhatsApp" as well as related names, marks, emblems and images are registered trademarks of their respective owners.
## License
Copyright 2019 Pedro S Lopez
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this project except in compliance with the License.
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Binary file not shown.

Binary file not shown.

View File

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.3"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.2.3 &raquo; Class: Base</title> <title>whatsapp-web.js 1.18.4 &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>2.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>18.<wbr>4</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">Base</span></h1> <h1><small></small><span class="symbol-name">Base</span></h1>
<p class="source-link">Source: <a href="structures_Base.js.html#source-line-7">structures/<wbr>Base.<wbr>js:7</a></p> <p class="source-link">Source: <a href="structures_Base.js.html#source-line-6">structures/<wbr>Base.<wbr>js:6</a></p>
<div class="symbol-classdesc"> <div class="symbol-classdesc">
<p>Represents a WhatsApp data structure</p> <p>Represents a WhatsApp data structure</p>
</div> </div>
@@ -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.3 on March 13, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on November 26, 2022.
</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.18.4 &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>18.<wbr>4</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 November 26, 2022.
</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

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.3"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.2.3 &raquo; Class: BusinessContact</title> <title>whatsapp-web.js 1.18.4 &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>2.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>18.<wbr>4</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -45,19 +45,22 @@
<dt><a href="BusinessContact.html#id">id</a></dt> <dt><a href="BusinessContact.html#id">id</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="BusinessContact.html#isBlocked">isBlocked</a></dt>
<dd>
</dd>
<dt><a href="BusinessContact.html#isBusiness">isBusiness</a></dt> <dt><a href="BusinessContact.html#isBusiness">isBusiness</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="BusinessContact.html#isEnterprise">isEnterprise</a></dt> <dt><a href="BusinessContact.html#isEnterprise">isEnterprise</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="BusinessContact.html#isGroup">isGroup</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#isGroup">isGroup</a></dt>
<dd>
</dd>
<dt><a href="BusinessContact.html#isMe">isMe</a></dt> <dt><a href="BusinessContact.html#isMe">isMe</a></dt>
<dd> <dd>
</dd> </dd>
@@ -70,13 +73,13 @@
<dt><a href="BusinessContact.html#isWAContact">isWAContact</a></dt> <dt><a href="BusinessContact.html#isWAContact">isWAContact</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="BusinessContact.html#name">name</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#name">name</a></dt>
<dd>
</dd>
<dt><a href="BusinessContact.html#number">number</a></dt> <dt><a href="BusinessContact.html#number">number</a></dt>
<dd> <dd>
</dd> </dd>
@@ -91,18 +94,43 @@
</div> </div>
</div> </div>
<div class="summary-callout"> <div class="summary-callout">
<h2 class="summary-callout-heading">Method</h2> <h2 class="summary-callout-heading">Methods</h2>
<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="BusinessContact.html#getProfilePicUrl">getProfilePicUrl()</a></dt> <dt><a href="BusinessContact.html#block">block()</a></dt>
<dd>
</dd>
<dt><a href="BusinessContact.html#getAbout">getAbout()</a></dt>
<dd>
</dd>
<dt><a href="BusinessContact.html#getChat">getChat()</a></dt>
<dd> <dd>
</dd> </dd>
</dl> </dl>
</div> </div>
<div class="summary-column"> <div class="summary-column">
<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>
<dd>
</dd>
<dt><a href="BusinessContact.html#getFormattedNumber">getFormattedNumber()</a></dt>
<dd>
</dd>
</dl>
</div> </div>
<div class="summary-column"> <div class="summary-column">
<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>
<dd>
</dd>
</dl>
</div> </div>
</div> </div>
</div> </div>
@@ -128,6 +156,13 @@
<dt>Inherited from</dt> <dt>Inherited from</dt>
<dd><a href="Contact.html#id">Contact#id</a></dd> <dd><a href="Contact.html#id">Contact#id</a></dd>
</dl> </dl>
<h3 id="isBlocked"><span class="symbol-name">isBlocked</span><small class="property-type">
&nbsp;unknown</small></h3>
<p>Indicates if you have blocked this contact</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Contact.html#isBlocked">Contact#isBlocked</a></dd>
</dl>
<h3 id="isBusiness"><span class="symbol-name">isBusiness</span><small class="property-type"> <h3 id="isBusiness"><span class="symbol-name">isBusiness</span><small class="property-type">
&nbsp;unknown</small></h3> &nbsp;unknown</small></h3>
<p>Indicates if the contact is a business contact</p> <p>Indicates if the contact is a business contact</p>
@@ -206,8 +241,63 @@
<dd><a href="Contact.html#shortName">Contact#shortName</a></dd> <dd><a href="Contact.html#shortName">Contact#shortName</a></dd>
</dl> </dl>
</section> </section>
<h2>Method</h2> <h2>Methods</h2>
<section> <section>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="block"><span class="symbol-name">block</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing boolean</span></span></h3>
<p>Blocks this contact from WhatsApp</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Contact.html#block">Contact#block</a></dd>
<dt>Returns</dt>
<dd></dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="getAbout"><span class="symbol-name">getAbout</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing nullable string</span></span></h3>
<p>Gets the Contact's current &quot;about&quot; info. Returns null if you don't have permission to read their status.</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Contact.html#getAbout">Contact#getAbout</a></dd>
<dt>Returns</dt>
<dd></dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="getChat"><span class="symbol-name">getChat</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing <a href="Chat.html">Chat</a></span></span></h3>
<p>Returns the Chat that corresponds to this Contact.
Will return null when getting chat for currently logged in user.</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Contact.html#getChat">Contact#getChat</a></dd>
<dt>Returns</dt>
<dd></dd>
</dl>
<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>
<p>Returns the contact's countrycode, (1541859685@c.us) =&gt; (1)</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Contact.html#getCountryCode">Contact#getCountryCode</a></dd>
<dt>Returns</dt>
<dd></dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="getFormattedNumber"><span class="symbol-name">getFormattedNumber</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 formatted phone number, (12345678901@c.us) =&gt; (+1 (234) 5678-901)</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Contact.html#getFormattedNumber">Contact#getFormattedNumber</a></dd>
<dt>Returns</dt>
<dd></dd>
</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="getProfilePicUrl"><span class="symbol-name">getProfilePicUrl</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing string</span></span></h3> <h3 id="getProfilePicUrl"><span class="symbol-name">getProfilePicUrl</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 profile picture URL, if privacy settings allow it</p> <p>Returns the contact's profile picture URL, if privacy settings allow it</p>
@@ -217,6 +307,15 @@
<dt>Returns</dt> <dt>Returns</dt>
<dd></dd> <dd></dd>
</dl> </dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="unblock"><span class="symbol-name">unblock</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing boolean</span></span></h3>
<p>Unblocks this contact from WhatsApp</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Contact.html#unblock">Contact#unblock</a></dd>
<dt>Returns</dt>
<dd></dd>
</dl>
</section> </section>
</section> </section>
</div> </div>
@@ -227,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.3 on March 13, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on November 26, 2022.
</p> </p>
</div> </div>
</footer> </footer>

249
docs/Buttons.html Normal file
View File

@@ -0,0 +1,249 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.18.4 &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/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>18.<wbr>4</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">Buttons</span></h1>
<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">
<p>Message type buttons</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="Buttons.html#body">body</a></dt>
<dd>
</dd>
<dt><a href="Buttons.html#buttons">buttons</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="Buttons.html#footer">footer</a></dt>
<dd>
</dd>
<dt><a href="Buttons.html#title">title</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
</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="Buttons.html#_format">_format(buttons)</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
</div>
<div class="summary-column">
</div>
</div>
</div>
</section>
<section>
<h2 id="Buttons">new&nbsp;<span class="symbol-name">Buttons</span><span class="signature"><span class="signature-params">(body, buttons, title, footer)</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>body</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>buttons</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>See <a href="global.html#ButtonSpec"><code>ButtonSpec</code></a></p>
</td>
</tr>
<tr>
<td>
<p>title</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Value can be null.</p>
</td>
</tr>
<tr>
<td>
<p>footer</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Value can be null.</p>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
</dl>
</section>
<section>
<h2>Properties</h2>
<section>
<h3 id="body"><span class="symbol-name">body</span><small class="property-type">
&nbsp;(string or <a href="MessageMedia.html">MessageMedia</a>)</small></h3>
<p>Message body</p>
<dl class="dl-compact">
</dl>
<h3 id="buttons"><span class="symbol-name">buttons</span><small class="property-type">
&nbsp;Array of <a href="global.html#FormattedButtonSpec">FormattedButtonSpec</a></small></h3>
<p>buttons of message</p>
<dl class="dl-compact">
</dl>
<h3 id="footer"><span class="symbol-name">footer</span><small class="property-type">
&nbsp;string</small></h3>
<p>footer of message</p>
<dl class="dl-compact">
</dl>
<h3 id="title"><span class="symbol-name">title</span><small class="property-type">
&nbsp;string</small></h3>
<p>title of message</p>
<dl class="dl-compact">
</dl>
</section>
<h2>Method</h2>
<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 <a href="global.html#FormattedButtonSpec">FormattedButtonSpec</a></span></span></h3>
<p>Creates button array from simple array</p>
<section>
<h4>
Example
</h4>
<div>
<pre class="prettyprint"><code>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}]</code></pre>
</div>
</section>
<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>buttons</p>
</td>
<td>
<p>Array of <a href="global.html#ButtonSpec">ButtonSpec</a></p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code>Array of <a href="global.html#FormattedButtonSpec">FormattedButtonSpec</a></code> </p>
</dd>
</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 November 26, 2022.
</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>

1
docs/CNAME Normal file
View File

@@ -0,0 +1 @@
docs.wwebjs.dev

159
docs/Call.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.18.4 &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/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>18.<wbr>4</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">Call</span></h1>
<p class="source-link">Source: <a href="structures_Call.js.html#source-line-9">structures/<wbr>Call.<wbr>js:9</a></p>
<div class="symbol-classdesc">
<p>Represents a Call 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="Call.html#canHandleLocally">canHandleLocally</a></dt>
<dd>
</dd>
<dt><a href="Call.html#from">from</a></dt>
<dd>
</dd>
<dt><a href="Call.html#fromMe">fromMe</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="Call.html#id">id</a></dt>
<dd>
</dd>
<dt><a href="Call.html#isGroup">isGroup</a></dt>
<dd>
</dd>
<dt><a href="Call.html#isVideo">isVideo</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="Call.html#participants">participants</a></dt>
<dd>
</dd>
<dt><a href="Call.html#timestamp">timestamp</a></dt>
<dd>
</dd>
<dt><a href="Call.html#webClientShouldHandle">webClientShouldHandle</a></dt>
<dd>
</dd>
</dl>
</div>
</div>
</div>
</section>
<section>
<h2 id="Call">new&nbsp;<span class="symbol-name">Call</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="canHandleLocally"><span class="symbol-name">canHandleLocally</span><small class="property-type">
&nbsp;boolean</small></h3>
<p>Indicates if the call can be handled in waweb</p>
<dl class="dl-compact">
</dl>
<h3 id="from"><span class="symbol-name">from</span><small class="property-type">
&nbsp;string</small></h3>
<p>From</p>
<dl class="dl-compact">
</dl>
<h3 id="fromMe"><span class="symbol-name">fromMe</span><small class="property-type">
&nbsp;boolean</small></h3>
<p>Indicates if the call was sent by the current user</p>
<dl class="dl-compact">
</dl>
<h3 id="id"><span class="symbol-name">id</span><small class="property-type">
&nbsp;string</small></h3>
<p>Call ID</p>
<dl class="dl-compact">
</dl>
<h3 id="isGroup"><span class="symbol-name">isGroup</span><small class="property-type">
&nbsp;boolean</small></h3>
<p>Is Group</p>
<dl class="dl-compact">
</dl>
<h3 id="isVideo"><span class="symbol-name">isVideo</span><small class="property-type">
&nbsp;boolean</small></h3>
<p>Is video</p>
<dl class="dl-compact">
</dl>
<h3 id="participants"><span class="symbol-name">participants</span><small class="property-type">
&nbsp;object</small></h3>
<p>Object with participants</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 call was created</p>
<dl class="dl-compact">
</dl>
<h3 id="webClientShouldHandle"><span class="symbol-name">webClientShouldHandle</span><small class="property-type">
&nbsp;boolean</small></h3>
<p>Indicates if the call Should be handled in waweb</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 November 26, 2022.
</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

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.3"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.2.3 &raquo; Class: Chat</title> <title>whatsapp-web.js 1.18.4 &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>2.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>18.<wbr>4</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">Chat</span></h1> <h1><small></small><span class="symbol-name">Chat</span></h1>
<p class="source-link">Source: <a href="structures_Chat.js.html#source-line-11">structures/<wbr>Chat.<wbr>js:11</a></p> <p class="source-link">Source: <a href="structures_Chat.js.html#source-line-10">structures/<wbr>Chat.<wbr>js:10</a></p>
<div class="symbol-classdesc"> <div class="symbol-classdesc">
<p>Represents a Chat on WhatsApp</p> <p>Represents a Chat on WhatsApp</p>
</div> </div>
@@ -48,6 +48,9 @@
<dt><a href="Chat.html#isGroup">isGroup</a></dt> <dt><a href="Chat.html#isGroup">isGroup</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Chat.html#isMuted">isMuted</a></dt>
<dd>
</dd>
</dl> </dl>
</div> </div>
<div class="summary-column"> <div class="summary-column">
@@ -55,16 +58,22 @@
<dt><a href="Chat.html#isReadOnly">isReadOnly</a></dt> <dt><a href="Chat.html#isReadOnly">isReadOnly</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Chat.html#muteExpiration">muteExpiration</a></dt>
<dd>
</dd>
<dt><a href="Chat.html#name">name</a></dt> <dt><a href="Chat.html#name">name</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Chat.html#timestamp">timestamp</a></dt> <dt><a href="Chat.html#pinned">pinned</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="Chat.html#timestamp">timestamp</a></dt>
<dd>
</dd>
<dt><a href="Chat.html#unreadCount">unreadCount</a></dt> <dt><a href="Chat.html#unreadCount">unreadCount</a></dt>
<dd> <dd>
</dd> </dd>
@@ -89,32 +98,53 @@
<dt><a href="Chat.html#delete">delete()</a></dt> <dt><a href="Chat.html#delete">delete()</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Chat.html#fetchMessages">fetchMessages(searchOptions)</a></dt>
<dd>
</dd>
<dt><a href="Chat.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="Chat.html#fetchMessages">fetchMessages(searchOptions)</a></dt> <dt><a href="Chat.html#getLabels">getLabels()</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Chat.html#sendMessage">sendMessage(content, options)</a></dt> <dt><a href="Chat.html#markUnread">markUnread()</a></dt>
<dd>
</dd>
<dt><a href="Chat.html#mute">mute(unmuteDate)</a></dt>
<dd>
</dd>
<dt><a href="Chat.html#pin">pin()</a></dt>
<dd>
</dd>
<dt><a href="Chat.html#sendMessage">sendMessage(content[, options])</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Chat.html#sendSeen">sendSeen()</a></dt> <dt><a href="Chat.html#sendSeen">sendSeen()</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Chat.html#sendStateRecording">sendStateRecording()</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="Chat.html#sendStateRecording">sendStateRecording()</a></dt>
<dd>
</dd>
<dt><a href="Chat.html#sendStateTyping">sendStateTyping()</a></dt> <dt><a href="Chat.html#sendStateTyping">sendStateTyping()</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Chat.html#unarchive">unarchive()</a></dt> <dt><a href="Chat.html#unarchive">unarchive()</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Chat.html#unmute">unmute()</a></dt>
<dd>
</dd>
<dt><a href="Chat.html#unpin">unpin()</a></dt>
<dd>
</dd>
</dl> </dl>
</div> </div>
</div> </div>
@@ -145,19 +175,34 @@
<p>Indicates if the Chat is a Group Chat</p> <p>Indicates if the Chat is a Group Chat</p>
<dl class="dl-compact"> <dl class="dl-compact">
</dl> </dl>
<h3 id="isMuted"><span class="symbol-name">isMuted</span><small class="property-type">
&nbsp;boolean</small></h3>
<p>Indicates if the chat is muted or not</p>
<dl class="dl-compact">
</dl>
<h3 id="isReadOnly"><span class="symbol-name">isReadOnly</span><small class="property-type"> <h3 id="isReadOnly"><span class="symbol-name">isReadOnly</span><small class="property-type">
&nbsp;boolean</small></h3> &nbsp;boolean</small></h3>
<p>Indicates if the Chat is readonly</p> <p>Indicates if the Chat is readonly</p>
<dl class="dl-compact"> <dl class="dl-compact">
</dl> </dl>
<h3 id="muteExpiration"><span class="symbol-name">muteExpiration</span><small class="property-type">
&nbsp;number</small></h3>
<p>Unix timestamp for when the mute expires</p>
<dl class="dl-compact">
</dl>
<h3 id="name"><span class="symbol-name">name</span><small class="property-type"> <h3 id="name"><span class="symbol-name">name</span><small class="property-type">
&nbsp;string</small></h3> &nbsp;string</small></h3>
<p>Title of the chat</p> <p>Title of the chat</p>
<dl class="dl-compact"> <dl class="dl-compact">
</dl> </dl>
<h3 id="pinned"><span class="symbol-name">pinned</span><small class="property-type">
&nbsp;boolean</small></h3>
<p>Indicates if the Chat is pinned</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 chat was created</p> <p>Unix timestamp for when the last activity occurred</p>
<dl class="dl-compact"> <dl class="dl-compact">
</dl> </dl>
<h3 id="unreadCount"><span class="symbol-name">unreadCount</span><small class="property-type"> <h3 id="unreadCount"><span class="symbol-name">unreadCount</span><small class="property-type">
@@ -179,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>
@@ -194,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>
@@ -224,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>
@@ -247,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>
@@ -265,7 +325,76 @@
</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="sendMessage"><span class="symbol-name">sendMessage</span><span class="signature"><span class="signature-params">(content, options)</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing <a href="Message.html">Message</a></span></span></h3> <h3 id="getContact"><span class="symbol-name">getContact</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing <a href="Contact.html">Contact</a></span></span></h3>
<p>Returns the Contact that corresponds to this Chat.</p>
<dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code>Promise containing <a href="Contact.html">Contact</a></code> </p>
</dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="getLabels"><span class="symbol-name">getLabels</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing Array of <a href="Label.html">Label</a></span></span></h3>
<p>Returns array of all Labels assigned to this Chat</p>
<dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code>Promise containing Array of <a href="Label.html">Label</a></code> </p>
</dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="markUnread"><span class="symbol-name">markUnread</span><span class="signature"><span class="signature-params">()</span></span></h3>
<p>Mark this chat as unread</p>
<dl class="dl-compact">
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="mute"><span class="symbol-name">mute</span><span class="signature"><span class="signature-params">(unmuteDate)</span></span></h3>
<p>Mutes this chat forever, unless a date is specified</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>unmuteDate</p>
</td>
<td>
<p>Date</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Date at which the Chat will be unmuted, leave as is to mute forever</p>
<p>Value can be null.</p>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="pin"><span class="symbol-name">pin</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing boolean</span></span></h3>
<p>Pins this chat</p>
<dl class="dl-compact">
<dt>Returns</dt>
<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>
</dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="sendMessage"><span class="symbol-name">sendMessage</span><span class="signature"><span class="signature-params">(content[, options])</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing <a href="Message.html">Message</a></span></span></h3>
<p>Send a message to this chat</p> <p>Send a message to this chat</p>
<section> <section>
<h4>Parameters</h4> <h4>Parameters</h4>
@@ -297,10 +426,10 @@
<p>options</p> <p>options</p>
</td> </td>
<td> <td>
<p>object</p> <p><a href="global.html#MessageSendOptions">MessageSendOptions</a></p>
</td> </td>
<td> <td>
<p>&nbsp;</p> <p>Yes</p>
</td> </td>
<td> <td>
</td> </td>
@@ -311,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>
@@ -321,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>
@@ -340,6 +471,22 @@
<p>un-archives this chat</p> <p>un-archives this chat</p>
<dl class="dl-compact"> <dl class="dl-compact">
</dl> </dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="unmute"><span class="symbol-name">unmute</span><span class="signature"><span class="signature-params">()</span></span></h3>
<p>Unmutes this chat</p>
<dl class="dl-compact">
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="unpin"><span class="symbol-name">unpin</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing boolean</span></span></h3>
<p>Unpins this chat</p>
<dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code>Promise containing boolean</code> 
<p>New pin state</p>
</p>
</dd>
</dl>
</section> </section>
</section> </section>
</div> </div>
@@ -350,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.3 on March 13, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on November 26, 2022.
</p> </p>
</div> </div>
</footer> </footer>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.3"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.2.3 &raquo; Class: ClientInfo</title> <title>whatsapp-web.js 1.18.4 &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>2.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>18.<wbr>4</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">ClientInfo</span></h1> <h1><small></small><span class="symbol-name">ClientInfo</span></h1>
<p class="source-link">Source: <a href="structures_ClientInfo.js.html#source-line-10">structures/<wbr>ClientInfo.<wbr>js:10</a></p> <p class="source-link">Source: <a href="structures_ClientInfo.js.html#source-line-9">structures/<wbr>ClientInfo.<wbr>js:9</a></p>
<div class="symbol-classdesc"> <div class="symbol-classdesc">
<p>Current connection information</p> <p>Current connection information</p>
</div> </div>
@@ -57,6 +57,27 @@
</dd> </dd>
</dl> </dl>
</div> </div>
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="ClientInfo.html#wid">wid</a></dt>
<dd>
</dd>
</dl>
</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="ClientInfo.html#getBatteryStatus">getBatteryStatus()</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
</div>
<div class="summary-column"> <div class="summary-column">
</div> </div>
</div> </div>
@@ -74,12 +95,13 @@
<section> <section>
<h3 id="me"><span class="symbol-name">me</span><small class="property-type"> <h3 id="me"><span class="symbol-name">me</span><small class="property-type">
&nbsp;object</small></h3> &nbsp;object</small></h3>
<p>Current user ID</p>
<dl class="dl-compact"> <dl class="dl-compact">
<dt>Deprecated</dt>
<dd>Use .wid instead</dd>
</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">
@@ -166,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">
@@ -177,6 +201,37 @@
<p>Name configured to be shown in push notifications</p> <p>Name configured to be shown in push notifications</p>
<dl class="dl-compact"> <dl class="dl-compact">
</dl> </dl>
<h3 id="wid"><span class="symbol-name">wid</span><small class="property-type">
&nbsp;object</small></h3>
<p>Current user ID</p>
<dl class="dl-compact">
</dl>
</section>
<h2>Method</h2>
<section>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<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>
<dl class="dl-compact">
<dt>Deprecated</dt>
<dd></dd>
<dt>Returns</dt>
<dd>
<p><code>object</code> 
<p>batteryStatus</p>
</p>
</dd>
<dd>
<p><code>number</code> 
<p>batteryStatus.battery - The current battery percentage</p>
</p>
</dd>
<dd>
<p><code>boolean</code> 
<p>batteryStatus.plugged - Indicates if the phone is plugged in (true) or not (false)</p>
</p>
</dd>
</dl>
</section> </section>
</section> </section>
</div> </div>
@@ -187,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.3 on March 13, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on November 26, 2022.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.3"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.2.3 &raquo; Class: Contact</title> <title>whatsapp-web.js 1.18.4 &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>2.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>18.<wbr>4</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">Contact</span></h1> <h1><small></small><span class="symbol-name">Contact</span></h1>
<p class="source-link">Source: <a href="structures_Contact.js.html#source-line-10">structures/<wbr>Contact.<wbr>js:10</a></p> <p class="source-link">Source: <a href="structures_Contact.js.html#source-line-17">structures/<wbr>Contact.<wbr>js:17</a></p>
<div class="symbol-classdesc"> <div class="symbol-classdesc">
<p>Represents a Contact on WhatsApp</p> <p>Represents a Contact on WhatsApp</p>
</div> </div>
@@ -42,6 +42,9 @@
<dt><a href="Contact.html#id">id</a></dt> <dt><a href="Contact.html#id">id</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Contact.html#isBlocked">isBlocked</a></dt>
<dd>
</dd>
<dt><a href="Contact.html#isBusiness">isBusiness</a></dt> <dt><a href="Contact.html#isBusiness">isBusiness</a></dt>
<dd> <dd>
</dd> </dd>
@@ -67,13 +70,13 @@
<dt><a href="Contact.html#isWAContact">isWAContact</a></dt> <dt><a href="Contact.html#isWAContact">isWAContact</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Contact.html#name">name</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#name">name</a></dt>
<dd>
</dd>
<dt><a href="Contact.html#number">number</a></dt> <dt><a href="Contact.html#number">number</a></dt>
<dd> <dd>
</dd> </dd>
@@ -88,18 +91,43 @@
</div> </div>
</div> </div>
<div class="summary-callout"> <div class="summary-callout">
<h2 class="summary-callout-heading">Method</h2> <h2 class="summary-callout-heading">Methods</h2>
<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="Contact.html#getProfilePicUrl">getProfilePicUrl()</a></dt> <dt><a href="Contact.html#block">block()</a></dt>
<dd>
</dd>
<dt><a href="Contact.html#getAbout">getAbout()</a></dt>
<dd>
</dd>
<dt><a href="Contact.html#getChat">getChat()</a></dt>
<dd> <dd>
</dd> </dd>
</dl> </dl>
</div> </div>
<div class="summary-column"> <div class="summary-column">
<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>
<dd>
</dd>
<dt><a href="Contact.html#getFormattedNumber">getFormattedNumber()</a></dt>
<dd>
</dd>
</dl>
</div> </div>
<div class="summary-column"> <div class="summary-column">
<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>
<dd>
</dd>
</dl>
</div> </div>
</div> </div>
</div> </div>
@@ -115,10 +143,15 @@
<h2>Properties</h2> <h2>Properties</h2>
<section> <section>
<h3 id="id"><span class="symbol-name">id</span><small class="property-type"> <h3 id="id"><span class="symbol-name">id</span><small class="property-type">
&nbsp;object</small></h3> &nbsp;<a href="global.html#ContactId">ContactId</a></small></h3>
<p>ID that represents the contact</p> <p>ID that represents the contact</p>
<dl class="dl-compact"> <dl class="dl-compact">
</dl> </dl>
<h3 id="isBlocked"><span class="symbol-name">isBlocked</span><small class="property-type">
&nbsp;boolean</small></h3>
<p>Indicates if you have blocked this contact</p>
<dl class="dl-compact">
</dl>
<h3 id="isBusiness"><span class="symbol-name">isBusiness</span><small class="property-type"> <h3 id="isBusiness"><span class="symbol-name">isBusiness</span><small class="property-type">
&nbsp;boolean</small></h3> &nbsp;boolean</small></h3>
<p>Indicates if the contact is a business contact</p> <p>Indicates if the contact is a business contact</p>
@@ -175,8 +208,63 @@
<dl class="dl-compact"> <dl class="dl-compact">
</dl> </dl>
</section> </section>
<h2>Method</h2> <h2>Methods</h2>
<section> <section>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="block"><span class="symbol-name">block</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing boolean</span></span></h3>
<p>Blocks this contact from WhatsApp</p>
<dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code>Promise containing boolean</code> </p>
</dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="getAbout"><span class="symbol-name">getAbout</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing nullable string</span></span></h3>
<p>Gets the Contact's current &quot;about&quot; info. Returns null if you don't have permission to read their status.</p>
<dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code>Promise containing nullable string</code> </p>
</dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="getChat"><span class="symbol-name">getChat</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing <a href="Chat.html">Chat</a></span></span></h3>
<p>Returns the Chat that corresponds to this Contact.
Will return null when getting chat for currently logged in user.</p>
<dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code>Promise containing <a href="Chat.html">Chat</a></code> </p>
</dd>
</dl>
<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>
<p>Returns the contact's countrycode, (1541859685@c.us) =&gt; (1)</p>
<dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code>Promise containing string</code> </p>
</dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="getFormattedNumber"><span class="symbol-name">getFormattedNumber</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 formatted phone number, (12345678901@c.us) =&gt; (+1 (234) 5678-901)</p>
<dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code>Promise containing string</code> </p>
</dd>
</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="getProfilePicUrl"><span class="symbol-name">getProfilePicUrl</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing string</span></span></h3> <h3 id="getProfilePicUrl"><span class="symbol-name">getProfilePicUrl</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 profile picture URL, if privacy settings allow it</p> <p>Returns the contact's profile picture URL, if privacy settings allow it</p>
@@ -186,6 +274,15 @@
<p><code>Promise containing string</code> </p> <p><code>Promise containing string</code> </p>
</dd> </dd>
</dl> </dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="unblock"><span class="symbol-name">unblock</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing boolean</span></span></h3>
<p>Unblocks this contact from WhatsApp</p>
<dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code>Promise containing boolean</code> </p>
</dd>
</dl>
</section> </section>
</section> </section>
</div> </div>
@@ -196,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.3 on March 13, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on November 26, 2022.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.3"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.2.3 &raquo; Class: GroupChat</title> <title>whatsapp-web.js 1.18.4 &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>2.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>18.<wbr>4</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">GroupChat</span></h1> <h1><small></small><span class="symbol-name">GroupChat</span></h1>
<p class="source-link">Source: <a href="structures_GroupChat.js.html#source-line-9">structures/<wbr>GroupChat.<wbr>js:9</a></p> <p class="source-link">Source: <a href="structures_GroupChat.js.html#source-line-17">structures/<wbr>GroupChat.<wbr>js:17</a></p>
<div class="symbol-classdesc"> <div class="symbol-classdesc">
<p>Represents a Group Chat on WhatsApp</p> <p>Represents a Group Chat on WhatsApp</p>
</div> </div>
@@ -51,16 +51,22 @@
<dt><a href="GroupChat.html#id">id</a></dt> <dt><a href="GroupChat.html#id">id</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="GroupChat.html#isGroup">isGroup</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="GroupChat.html#isGroup">isGroup</a></dt> <dt><a href="GroupChat.html#isMuted">isMuted</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="GroupChat.html#isReadOnly">isReadOnly</a></dt> <dt><a href="GroupChat.html#isReadOnly">isReadOnly</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="GroupChat.html#muteExpiration">muteExpiration</a></dt>
<dd>
</dd>
<dt><a href="GroupChat.html#name">name</a></dt> <dt><a href="GroupChat.html#name">name</a></dt>
<dd> <dd>
</dd> </dd>
@@ -74,6 +80,9 @@
<dt><a href="GroupChat.html#participants">participants</a></dt> <dt><a href="GroupChat.html#participants">participants</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="GroupChat.html#pinned">pinned</a></dt>
<dd>
</dd>
<dt><a href="GroupChat.html#timestamp">timestamp</a></dt> <dt><a href="GroupChat.html#timestamp">timestamp</a></dt>
<dd> <dd>
</dd> </dd>
@@ -89,12 +98,6 @@
<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="GroupChat.html#.getInviteInfo">getInviteInfo(inviteCode)</a></dt>
<dd>
</dd>
<dt><a href="GroupChat.html#.join">join(inviteCode)</a></dt>
<dd>
</dd>
<dt><a href="GroupChat.html#addParticipants">addParticipants(participantIds)</a></dt> <dt><a href="GroupChat.html#addParticipants">addParticipants(participantIds)</a></dt>
<dd> <dd>
</dd> </dd>
@@ -110,22 +113,37 @@
<dt><a href="GroupChat.html#delete">delete()</a></dt> <dt><a href="GroupChat.html#delete">delete()</a></dt>
<dd> <dd>
</dd> </dd>
</dl>
</div>
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="GroupChat.html#demoteParticipants">demoteParticipants(participantIds)</a></dt> <dt><a href="GroupChat.html#demoteParticipants">demoteParticipants(participantIds)</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="GroupChat.html#fetchMessages">fetchMessages(searchOptions)</a></dt> <dt><a href="GroupChat.html#fetchMessages">fetchMessages(searchOptions)</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="GroupChat.html#getContact">getContact()</a></dt>
<dd>
</dd>
<dt><a href="GroupChat.html#getInviteCode">getInviteCode()</a></dt> <dt><a href="GroupChat.html#getInviteCode">getInviteCode()</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="GroupChat.html#getLabels">getLabels()</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="GroupChat.html#leave">leave()</a></dt> <dt><a href="GroupChat.html#leave">leave()</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="GroupChat.html#markUnread">markUnread()</a></dt>
<dd>
</dd>
<dt><a href="GroupChat.html#mute">mute(unmuteDate)</a></dt>
<dd>
</dd>
<dt><a href="GroupChat.html#pin">pin()</a></dt>
<dd>
</dd>
<dt><a href="GroupChat.html#promoteParticipants">promoteParticipants(participantIds)</a></dt> <dt><a href="GroupChat.html#promoteParticipants">promoteParticipants(participantIds)</a></dt>
<dd> <dd>
</dd> </dd>
@@ -135,11 +153,7 @@
<dt><a href="GroupChat.html#revokeInvite">revokeInvite()</a></dt> <dt><a href="GroupChat.html#revokeInvite">revokeInvite()</a></dt>
<dd> <dd>
</dd> </dd>
</dl> <dt><a href="GroupChat.html#sendMessage">sendMessage(content[, options])</a></dt>
</div>
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="GroupChat.html#sendMessage">sendMessage(content, options)</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="GroupChat.html#sendSeen">sendSeen()</a></dt> <dt><a href="GroupChat.html#sendSeen">sendSeen()</a></dt>
@@ -148,18 +162,34 @@
<dt><a href="GroupChat.html#sendStateRecording">sendStateRecording()</a></dt> <dt><a href="GroupChat.html#sendStateRecording">sendStateRecording()</a></dt>
<dd> <dd>
</dd> </dd>
</dl>
</div>
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="GroupChat.html#sendStateTyping">sendStateTyping()</a></dt> <dt><a href="GroupChat.html#sendStateTyping">sendStateTyping()</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="GroupChat.html#setDescription">setDescription(description)</a></dt> <dt><a href="GroupChat.html#setDescription">setDescription(description)</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="GroupChat.html#setInfoAdminsOnly">setInfoAdminsOnly([adminsOnly])</a></dt>
<dd>
</dd>
<dt><a href="GroupChat.html#setMessagesAdminsOnly">setMessagesAdminsOnly([adminsOnly])</a></dt>
<dd>
</dd>
<dt><a href="GroupChat.html#setSubject">setSubject(subject)</a></dt> <dt><a href="GroupChat.html#setSubject">setSubject(subject)</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="GroupChat.html#unarchive">unarchive()</a></dt> <dt><a href="GroupChat.html#unarchive">unarchive()</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="GroupChat.html#unmute">unmute()</a></dt>
<dd>
</dd>
<dt><a href="GroupChat.html#unpin">unpin()</a></dt>
<dd>
</dd>
</dl> </dl>
</div> </div>
</div> </div>
@@ -206,6 +236,13 @@
<dt>Inherited from</dt> <dt>Inherited from</dt>
<dd><a href="Chat.html#isGroup">Chat#isGroup</a></dd> <dd><a href="Chat.html#isGroup">Chat#isGroup</a></dd>
</dl> </dl>
<h3 id="isMuted"><span class="symbol-name">isMuted</span><small class="property-type">
&nbsp;unknown</small></h3>
<p>Indicates if the chat is muted or not</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Chat.html#isMuted">Chat#isMuted</a></dd>
</dl>
<h3 id="isReadOnly"><span class="symbol-name">isReadOnly</span><small class="property-type"> <h3 id="isReadOnly"><span class="symbol-name">isReadOnly</span><small class="property-type">
&nbsp;unknown</small></h3> &nbsp;unknown</small></h3>
<p>Indicates if the Chat is readonly</p> <p>Indicates if the Chat is readonly</p>
@@ -213,6 +250,13 @@
<dt>Inherited from</dt> <dt>Inherited from</dt>
<dd><a href="Chat.html#isReadOnly">Chat#isReadOnly</a></dd> <dd><a href="Chat.html#isReadOnly">Chat#isReadOnly</a></dd>
</dl> </dl>
<h3 id="muteExpiration"><span class="symbol-name">muteExpiration</span><small class="property-type">
&nbsp;unknown</small></h3>
<p>Unix timestamp for when the mute expires</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Chat.html#muteExpiration">Chat#muteExpiration</a></dd>
</dl>
<h3 id="name"><span class="symbol-name">name</span><small class="property-type"> <h3 id="name"><span class="symbol-name">name</span><small class="property-type">
&nbsp;unknown</small></h3> &nbsp;unknown</small></h3>
<p>Title of the chat</p> <p>Title of the chat</p>
@@ -220,18 +264,26 @@
<dt>Inherited from</dt> <dt>Inherited from</dt>
<dd><a href="Chat.html#name">Chat#name</a></dd> <dd><a href="Chat.html#name">Chat#name</a></dd>
</dl> </dl>
<h3 id="owner"><span class="symbol-name">owner</span></h3> <h3 id="owner"><span class="symbol-name">owner</span><small class="property-type">
&nbsp;<a href="global.html#ContactId">ContactId</a></small></h3>
<p>Gets the group owner</p> <p>Gets the group owner</p>
<dl class="dl-compact"> <dl class="dl-compact">
</dl> </dl>
<h3 id="participants"><span class="symbol-name">participants</span><small class="property-type"> <h3 id="participants"><span class="symbol-name">participants</span><small class="property-type">
&nbsp;array</small></h3> &nbsp;Array of <a href="global.html#GroupParticipant">GroupParticipant</a></small></h3>
<p>Gets the group participants</p> <p>Gets the group participants</p>
<dl class="dl-compact"> <dl class="dl-compact">
</dl> </dl>
<h3 id="pinned"><span class="symbol-name">pinned</span><small class="property-type">
&nbsp;unknown</small></h3>
<p>Indicates if the Chat is pinned</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Chat.html#pinned">Chat#pinned</a></dd>
</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;unknown</small></h3> &nbsp;unknown</small></h3>
<p>Unix timestamp for when the chat was created</p> <p>Unix timestamp for when the last activity occurred</p>
<dl class="dl-compact"> <dl class="dl-compact">
<dt>Inherited from</dt> <dt>Inherited from</dt>
<dd><a href="Chat.html#timestamp">Chat#timestamp</a></dd> <dd><a href="Chat.html#timestamp">Chat#timestamp</a></dd>
@@ -246,79 +298,8 @@
</section> </section>
<h2>Methods</h2> <h2>Methods</h2>
<section> <section>
<div class="symbol-detail-labels"><span class="label label-async">async</span>&nbsp;<span class="label label-static">static</span></div>
<h3 id=".getInviteInfo"><span class="symbol-name">getInviteInfo</span><span class="signature"><span class="signature-params">(inviteCode)</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing object</span></span></h3>
<p>Returns an object with information about the invite code's 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>inviteCode</p>
</td>
<td>
<p>string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code>Promise containing object</code> <p>Invite information</p>
</p>
</dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span>&nbsp;<span class="label label-static">static</span></div>
<h3 id=".join"><span class="symbol-name">join</span><span class="signature"><span class="signature-params">(inviteCode)</span></span></h3>
<p>Joins a group with an invite code</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>inviteCode</p>
</td>
<td>
<p>string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
</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="addParticipants"><span class="symbol-name">addParticipants</span><span class="signature"><span class="signature-params">(participantIds)</span></span></h3> <h3 id="addParticipants"><span class="symbol-name">addParticipants</span><span class="signature"><span class="signature-params">(participantIds)</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing Object</span></span></h3>
<p>Adds a list of participants by ID to the group</p> <p>Adds a list of participants by ID to the group</p>
<section> <section>
<h4>Parameter</h4> <h4>Parameter</h4>
@@ -349,6 +330,10 @@
</table> </table>
</section> </section>
<dl class="dl-compact"> <dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code>Promise containing Object</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="archive"><span class="symbol-name">archive</span><span class="signature"><span class="signature-params">()</span></span></h3> <h3 id="archive"><span class="symbol-name">archive</span><span class="signature"><span class="signature-params">()</span></span></h3>
@@ -387,7 +372,7 @@
</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="demoteParticipants"><span class="symbol-name">demoteParticipants</span><span class="signature"><span class="signature-params">(participantIds)</span></span></h3> <h3 id="demoteParticipants"><span class="symbol-name">demoteParticipants</span><span class="signature"><span class="signature-params">(participantIds)</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing {status: number}</span></span></h3>
<p>Demotes participants by IDs to regular users</p> <p>Demotes participants by IDs to regular users</p>
<section> <section>
<h4>Parameter</h4> <h4>Parameter</h4>
@@ -418,6 +403,12 @@
</table> </table>
</section> </section>
<dl class="dl-compact"> <dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code>Promise containing {status: number}</code> 
<p>Object with status code indicating if the operation was successful</p>
</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="fetchMessages"><span class="symbol-name">fetchMessages</span><span class="signature"><span class="signature-params">(searchOptions)</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing Array of <a href="Message.html">Message</a></span></span></h3> <h3 id="fetchMessages"><span class="symbol-name">fetchMessages</span><span class="signature"><span class="signature-params">(searchOptions)</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing Array of <a href="Message.html">Message</a></span></span></h3>
@@ -445,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>
@@ -468,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>
@@ -486,17 +490,100 @@
<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="getInviteCode"><span class="symbol-name">getInviteCode</span><span class="signature"><span class="signature-params">()</span></span></h3> <h3 id="getContact"><span class="symbol-name">getContact</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing <a href="Contact.html">Contact</a></span></span></h3>
<p>Returns the Contact that corresponds to this Chat.</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Chat.html#getContact">Chat#getContact</a></dd>
<dt>Returns</dt>
<dd></dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="getInviteCode"><span class="symbol-name">getInviteCode</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing string</span></span></h3>
<p>Gets the invite code for a specific group</p> <p>Gets the invite code for a specific group</p>
<dl class="dl-compact"> <dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code>Promise containing string</code> 
<p>Group's invite code</p>
</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="leave"><span class="symbol-name">leave</span><span class="signature"><span class="signature-params">()</span></span></h3> <h3 id="getLabels"><span class="symbol-name">getLabels</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing Array of <a href="Label.html">Label</a></span></span></h3>
<p>Returns array of all Labels assigned to this Chat</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Chat.html#getLabels">Chat#getLabels</a></dd>
<dt>Returns</dt>
<dd></dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="leave"><span class="symbol-name">leave</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise</span></span></h3>
<p>Makes the bot leave the group</p> <p>Makes the bot leave the group</p>
<dl class="dl-compact"> <dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code>Promise</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="promoteParticipants"><span class="symbol-name">promoteParticipants</span><span class="signature"><span class="signature-params">(participantIds)</span></span></h3> <h3 id="markUnread"><span class="symbol-name">markUnread</span><span class="signature"><span class="signature-params">()</span></span></h3>
<p>Mark this chat as unread</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Chat.html#markUnread">Chat#markUnread</a></dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="mute"><span class="symbol-name">mute</span><span class="signature"><span class="signature-params">(unmuteDate)</span></span></h3>
<p>Mutes this chat forever, unless a date is specified</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>unmuteDate</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Date at which the Chat will be unmuted, leave as is to mute forever</p>
<p>Value can be null.</p>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Chat.html#mute">Chat#mute</a></dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="pin"><span class="symbol-name">pin</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing boolean</span></span></h3>
<p>Pins this chat</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Chat.html#pin">Chat#pin</a></dd>
<dt>Returns</dt>
<dd>
<p>New pin state. Could be false if the max number of pinned chats was reached.</p>
</dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="promoteParticipants"><span class="symbol-name">promoteParticipants</span><span class="signature"><span class="signature-params">(participantIds)</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing {status: number}</span></span></h3>
<p>Promotes participants by IDs to admins</p> <p>Promotes participants by IDs to admins</p>
<section> <section>
<h4>Parameter</h4> <h4>Parameter</h4>
@@ -527,9 +614,15 @@
</table> </table>
</section> </section>
<dl class="dl-compact"> <dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code>Promise containing {status: number}</code> 
<p>Object with status code indicating if the operation was successful</p>
</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="removeParticipants"><span class="symbol-name">removeParticipants</span><span class="signature"><span class="signature-params">(participantIds)</span></span></h3> <h3 id="removeParticipants"><span class="symbol-name">removeParticipants</span><span class="signature"><span class="signature-params">(participantIds)</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing Object</span></span></h3>
<p>Removes a list of participants by ID to the group</p> <p>Removes a list of participants by ID to the group</p>
<section> <section>
<h4>Parameter</h4> <h4>Parameter</h4>
@@ -560,14 +653,24 @@
</table> </table>
</section> </section>
<dl class="dl-compact"> <dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code>Promise containing Object</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="revokeInvite"><span class="symbol-name">revokeInvite</span><span class="signature"><span class="signature-params">()</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>
<dd>
<p><code>Promise containing string</code> 
<p>New invite code</p>
</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="sendMessage"><span class="symbol-name">sendMessage</span><span class="signature"><span class="signature-params">(content, options)</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing <a href="Message.html">Message</a></span></span></h3> <h3 id="sendMessage"><span class="symbol-name">sendMessage</span><span class="signature"><span class="signature-params">(content[, options])</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing <a href="Message.html">Message</a></span></span></h3>
<p>Send a message to this chat</p> <p>Send a message to this chat</p>
<section> <section>
<h4>Parameters</h4> <h4>Parameters</h4>
@@ -602,7 +705,7 @@
<p>&nbsp;</p> <p>&nbsp;</p>
</td> </td>
<td> <td>
<p>&nbsp;</p> <p>Yes</p>
</td> </td>
<td> <td>
</td> </td>
@@ -644,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></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>
@@ -675,9 +778,97 @@
</table> </table>
</section> </section>
<dl class="dl-compact"> <dl class="dl-compact">
<dt>Returns</dt>
<dd>
<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>
</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></span></h3> <h3 id="setInfoAdminsOnly"><span class="symbol-name">setInfoAdminsOnly</span><span class="signature"><span class="signature-params">([adminsOnly])</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing boolean</span></span></h3>
<p>Updates the group settings to only allow admins to edit group info (title, description, photo).</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>adminsOnly</p>
</td>
<td>
<p>boolean</p>
</td>
<td>
<p>Yes</p>
</td>
<td>
<p>Enable or disable this option</p>
<p>Defaults to <code>true</code>.</p>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
<dt>Returns</dt>
<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>
</dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="setMessagesAdminsOnly"><span class="symbol-name">setMessagesAdminsOnly</span><span class="signature"><span class="signature-params">([adminsOnly])</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing boolean</span></span></h3>
<p>Updates the group settings to only allow admins to send messages.</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>adminsOnly</p>
</td>
<td>
<p>boolean</p>
</td>
<td>
<p>Yes</p>
</td>
<td>
<p>Enable or disable this option</p>
<p>Defaults to <code>true</code>.</p>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
<dt>Returns</dt>
<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>
</dd>
</dl>
<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 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>
@@ -708,6 +899,12 @@
</table> </table>
</section> </section>
<dl class="dl-compact"> <dl class="dl-compact">
<dt>Returns</dt>
<dd>
<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>
</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="unarchive"><span class="symbol-name">unarchive</span><span class="signature"><span class="signature-params">()</span></span></h3> <h3 id="unarchive"><span class="symbol-name">unarchive</span><span class="signature"><span class="signature-params">()</span></span></h3>
@@ -716,6 +913,24 @@
<dt>Inherited from</dt> <dt>Inherited from</dt>
<dd><a href="Chat.html#unarchive">Chat#unarchive</a></dd> <dd><a href="Chat.html#unarchive">Chat#unarchive</a></dd>
</dl> </dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="unmute"><span class="symbol-name">unmute</span><span class="signature"><span class="signature-params">()</span></span></h3>
<p>Unmutes this chat</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Chat.html#unmute">Chat#unmute</a></dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="unpin"><span class="symbol-name">unpin</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing boolean</span></span></h3>
<p>Unpins this chat</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Chat.html#unpin">Chat#unpin</a></dd>
<dt>Returns</dt>
<dd>
<p>New pin state</p>
</dd>
</dl>
</section> </section>
</section> </section>
</div> </div>
@@ -726,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.3 on March 13, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on November 26, 2022.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.3"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.2.3 &raquo; Class: GroupNotification</title> <title>whatsapp-web.js 1.18.4 &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>2.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>18.<wbr>4</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">GroupNotification</span></h1> <h1><small></small><span class="symbol-name">GroupNotification</span></h1>
<p class="source-link">Source: <a href="structures_GroupNotification.js.html#source-line-10">structures/<wbr>GroupNotification.<wbr>js:10</a></p> <p class="source-link">Source: <a href="structures_GroupNotification.js.html#source-line-9">structures/<wbr>GroupNotification.<wbr>js:9</a></p>
<div class="symbol-classdesc"> <div class="symbol-classdesc">
<p>Represents a GroupNotification on WhatsApp</p> <p>Represents a GroupNotification on WhatsApp</p>
</div> </div>
@@ -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.3 on March 13, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on November 26, 2022.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -0,0 +1,397 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.18.4 &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/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>18.<wbr>4</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">InterfaceController</span></h1>
<p class="source-link">Source: <a href="util_InterfaceController.js.html#source-line-6">util/<wbr>InterfaceController.<wbr>js:6</a></p>
<div class="symbol-classdesc">
<p>Interface Controller</p>
</div>
<dl class="dl-compact">
</dl>
</header>
<section id="summary">
<div class="summary-callout">
<h2 class="summary-callout-heading">Methods</h2>
<div class="summary-content">
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="InterfaceController.html#checkFeatureStatus">checkFeatureStatus(feature)</a></dt>
<dd>
</dd>
<dt><a href="InterfaceController.html#closeRightDrawer">closeRightDrawer()</a></dt>
<dd>
</dd>
<dt><a href="InterfaceController.html#disableFeatures">disableFeatures(features)</a></dt>
<dd>
</dd>
<dt><a href="InterfaceController.html#enableFeatures">enableFeatures(features)</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="InterfaceController.html#getFeatures">getFeatures()</a></dt>
<dd>
</dd>
<dt><a href="InterfaceController.html#openChatDrawer">openChatDrawer(chatId)</a></dt>
<dd>
</dd>
<dt><a href="InterfaceController.html#openChatSearch">openChatSearch(chatId)</a></dt>
<dd>
</dd>
<dt><a href="InterfaceController.html#openChatWindow">openChatWindow(chatId)</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="InterfaceController.html#openChatWindowAt">openChatWindowAt(msgId)</a></dt>
<dd>
</dd>
<dt><a href="InterfaceController.html#openMessageDrawer">openMessageDrawer(msgId)</a></dt>
<dd>
</dd>
</dl>
</div>
</div>
</div>
</section>
<section>
<h2 id="InterfaceController">new&nbsp;<span class="symbol-name">InterfaceController</span><span class="signature"><span class="signature-params">()</span></span></h2>
<dl class="dl-compact">
</dl>
</section>
<section>
<h2>Methods</h2>
<section>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="checkFeatureStatus"><span class="symbol-name">checkFeatureStatus</span><span class="signature"><span class="signature-params">(feature)</span></span></h3>
<p>Check if Feature is enabled</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>feature</p>
</td>
<td>
<p>string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>status to check</p>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="closeRightDrawer"><span class="symbol-name">closeRightDrawer</span><span class="signature"><span class="signature-params">()</span></span></h3>
<p>Closes the Right Drawer</p>
<dl class="dl-compact">
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="disableFeatures"><span class="symbol-name">disableFeatures</span><span class="signature"><span class="signature-params">(features)</span></span></h3>
<p>Disable Features</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>features</p>
</td>
<td>
<p>Array of string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>to be disabled</p>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="enableFeatures"><span class="symbol-name">enableFeatures</span><span class="signature"><span class="signature-params">(features)</span></span></h3>
<p>Enable Features</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>features</p>
</td>
<td>
<p>Array of string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>to be enabled</p>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="getFeatures"><span class="symbol-name">getFeatures</span><span class="signature"><span class="signature-params">()</span></span></h3>
<p>Get all Features</p>
<dl class="dl-compact">
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="openChatDrawer"><span class="symbol-name">openChatDrawer</span><span class="signature"><span class="signature-params">(chatId)</span></span></h3>
<p>Opens the Chat Drawer</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>chatId</p>
</td>
<td>
<p>string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>ID of the chat drawer that will be opened</p>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="openChatSearch"><span class="symbol-name">openChatSearch</span><span class="signature"><span class="signature-params">(chatId)</span></span></h3>
<p>Opens the Chat Search</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>chatId</p>
</td>
<td>
<p>string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>ID of the chat search that will be opened</p>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="openChatWindow"><span class="symbol-name">openChatWindow</span><span class="signature"><span class="signature-params">(chatId)</span></span></h3>
<p>Opens the Chat Window</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>chatId</p>
</td>
<td>
<p>string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>ID of the chat window that will be opened</p>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="openChatWindowAt"><span class="symbol-name">openChatWindowAt</span><span class="signature"><span class="signature-params">(msgId)</span></span></h3>
<p>Opens or Scrolls the Chat Window to the position of the message</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>msgId</p>
</td>
<td>
<p>string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>ID of the message that will be scrolled to</p>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="openMessageDrawer"><span class="symbol-name">openMessageDrawer</span><span class="signature"><span class="signature-params">(msgId)</span></span></h3>
<p>Opens the Message Drawer</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>msgId</p>
</td>
<td>
<p>string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>ID of the message drawer that will be opened</p>
</td>
</tr>
</tbody>
</table>
</section>
<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 November 26, 2022.
</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>

178
docs/Label.html Normal file
View File

@@ -0,0 +1,178 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.18.4 &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/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>18.<wbr>4</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">Label</span></h1>
<p class="source-link">Source: <a href="structures_Label.js.html#source-line-10">structures/<wbr>Label.<wbr>js:10</a></p>
<div class="symbol-classdesc">
<p>WhatsApp Business Label information</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="Label.html#hexColor">hexColor</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="Label.html#id">id</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="Label.html#name">name</a></dt>
<dd>
</dd>
</dl>
</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="Label.html#getChats">getChats()</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
</div>
<div class="summary-column">
</div>
</div>
</div>
</section>
<section>
<h2 id="Label">new&nbsp;<span class="symbol-name">Label</span><span class="signature"><span class="signature-params">(client, labelData)</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>client</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>labelData</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
</dl>
</section>
<section>
<h2>Properties</h2>
<section>
<h3 id="hexColor"><span class="symbol-name">hexColor</span><small class="property-type">
&nbsp;string</small></h3>
<p>Label hex color</p>
<dl class="dl-compact">
</dl>
<h3 id="id"><span class="symbol-name">id</span><small class="property-type">
&nbsp;string</small></h3>
<p>Label ID</p>
<dl class="dl-compact">
</dl>
<h3 id="name"><span class="symbol-name">name</span><small class="property-type">
&nbsp;string</small></h3>
<p>Label name</p>
<dl class="dl-compact">
</dl>
</section>
<h2>Method</h2>
<section>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="getChats"><span class="symbol-name">getChats</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing Array of <a href="Chat.html">Chat</a></span></span></h3>
<p>Get all chats that have been assigned this Label</p>
<dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code>Promise containing Array of <a href="Chat.html">Chat</a></code> </p>
</dd>
</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 November 26, 2022.
</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>

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.18.4 &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>18.<wbr>4</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 November 26, 2022.
</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>

271
docs/List.html Normal file
View File

@@ -0,0 +1,271 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.18.4 &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/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>18.<wbr>4</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">List</span></h1>
<p class="source-link">Source: <a href="structures_List.js.html#source-line-8">structures/<wbr>List.<wbr>js:8</a></p>
<div class="symbol-classdesc">
<p>Message type List</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="List.html#buttonText">buttonText</a></dt>
<dd>
</dd>
<dt><a href="List.html#description">description</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="List.html#footer">footer</a></dt>
<dd>
</dd>
<dt><a href="List.html#sections">sections</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="List.html#title">title</a></dt>
<dd>
</dd>
</dl>
</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="List.html#_format">_format(sections)</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
</div>
<div class="summary-column">
</div>
</div>
</div>
</section>
<section>
<h2 id="List">new&nbsp;<span class="symbol-name">List</span><span class="signature"><span class="signature-params">(body, buttonText, sections, title, footer)</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>body</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>buttonText</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>sections</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>title</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Value can be null.</p>
</td>
</tr>
<tr>
<td>
<p>footer</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Value can be null.</p>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
</dl>
</section>
<section>
<h2>Properties</h2>
<section>
<h3 id="buttonText"><span class="symbol-name">buttonText</span><small class="property-type">
&nbsp;string</small></h3>
<p>List button text</p>
<dl class="dl-compact">
</dl>
<h3 id="description"><span class="symbol-name">description</span><small class="property-type">
&nbsp;string</small></h3>
<p>Message body</p>
<dl class="dl-compact">
</dl>
<h3 id="footer"><span class="symbol-name">footer</span><small class="property-type">
&nbsp;string</small></h3>
<p>footer of message</p>
<dl class="dl-compact">
</dl>
<h3 id="sections"><span class="symbol-name">sections</span><small class="property-type">
&nbsp;Array of any</small></h3>
<p>sections of message</p>
<dl class="dl-compact">
</dl>
<h3 id="title"><span class="symbol-name">title</span><small class="property-type">
&nbsp;string</small></h3>
<p>title of message</p>
<dl class="dl-compact">
</dl>
</section>
<h2>Method</h2>
<section>
<h3 id="_format"><span class="symbol-name">_format</span><span class="signature"><span class="signature-params">(sections)</span>&nbsp;&rarr; <span class="signature-returns"> Array of any</span></span></h3>
<p>Creates section array from simple array</p>
<section>
<h4>
Example
</h4>
<div>
<pre class="prettyprint"><code>Input: [{title:&#x27;sectionTitle&#x27;,rows:[{id:&#x27;customId&#x27;, title:&#x27;ListItem2&#x27;, description: &#x27;desc&#x27;},{title:&#x27;ListItem2&#x27;}]}}]
Returns: [{&#x27;title&#x27;:&#x27;sectionTitle&#x27;,&#x27;rows&#x27;:[{&#x27;rowId&#x27;:&#x27;customId&#x27;,&#x27;title&#x27;:&#x27;ListItem1&#x27;,&#x27;description&#x27;:&#x27;desc&#x27;},{&#x27;rowId&#x27;:&#x27;oGSRoD&#x27;,&#x27;title&#x27;:&#x27;ListItem2&#x27;,&#x27;description&#x27;:&#x27;&#x27;}]}]</code></pre>
</div>
</section>
<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>sections</p>
</td>
<td>
<p>Array of any</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code>Array of any</code> </p>
</dd>
</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 November 26, 2022.
</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>

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.18.4 &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>18.<wbr>4</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 November 26, 2022.
</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

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.3"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.2.3 &raquo; Class: Location</title> <title>whatsapp-web.js 1.18.4 &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>2.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>18.<wbr>4</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">Location</span></h1> <h1><small></small><span class="symbol-name">Location</span></h1>
<p class="source-link">Source: <a href="structures_Location.js.html#source-line-12">structures/<wbr>Location.<wbr>js:12</a></p> <p class="source-link">Source: <a href="structures_Location.js.html#source-line-6">structures/<wbr>Location.<wbr>js:6</a></p>
<div class="symbol-classdesc"> <div class="symbol-classdesc">
<p>Location information</p> <p>Location information</p>
</div> </div>
@@ -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.3 on March 13, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on November 26, 2022.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.3"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.2.3 &raquo; Class: Message</title> <title>whatsapp-web.js 1.18.4 &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>2.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>18.<wbr>4</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">Message</span></h1> <h1><small></small><span class="symbol-name">Message</span></h1>
<p class="source-link">Source: <a href="structures_Message.js.html#source-line-13">structures/<wbr>Message.<wbr>js:13</a></p> <p class="source-link">Source: <a href="structures_Message.js.html#source-line-14">structures/<wbr>Message.<wbr>js:14</a></p>
<div class="symbol-classdesc"> <div class="symbol-classdesc">
<p>Represents a Message on WhatsApp</p> <p>Represents a Message on WhatsApp</p>
</div> </div>
@@ -39,6 +39,9 @@
<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="Message.html#ack">ack</a></dt>
<dd>
</dd>
<dt><a href="Message.html#author">author</a></dt> <dt><a href="Message.html#author">author</a></dt>
<dd> <dd>
</dd> </dd>
@@ -48,28 +51,55 @@
<dt><a href="Message.html#broadcast">broadcast</a></dt> <dt><a href="Message.html#broadcast">broadcast</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Message.html#deviceType">deviceType</a></dt>
<dd>
</dd>
<dt><a href="Message.html#duration">duration</a></dt>
<dd>
</dd>
<dt><a href="Message.html#forwardingScore">forwardingScore</a></dt>
<dd>
</dd>
<dt><a href="Message.html#from">from</a></dt> <dt><a href="Message.html#from">from</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Message.html#fromMe">fromMe</a></dt> <dt><a href="Message.html#fromMe">fromMe</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Message.html#hasMedia">hasMedia</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#hasMedia">hasMedia</a></dt>
<dd>
</dd>
<dt><a href="Message.html#hasQuotedMsg">hasQuotedMsg</a></dt> <dt><a href="Message.html#hasQuotedMsg">hasQuotedMsg</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Message.html#id">id</a></dt> <dt><a href="Message.html#id">id</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Message.html#inviteV4">inviteV4</a></dt>
<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>
<dd>
</dd>
<dt><a href="Message.html#isStatus">isStatus</a></dt>
<dd>
</dd>
<dt><a href="Message.html#links">links</a></dt>
<dd>
</dd>
<dt><a href="Message.html#location">location</a></dt> <dt><a href="Message.html#location">location</a></dt>
<dd> <dd>
</dd> </dd>
@@ -77,18 +107,33 @@
</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>
<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>
<dt><a href="Message.html#to">to</a></dt> <dt><a href="Message.html#to">to</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Message.html#token">token</a></dt>
<dd>
</dd>
<dt><a href="Message.html#type">type</a></dt> <dt><a href="Message.html#type">type</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Message.html#vCards">vCards</a></dt>
<dd>
</dd>
</dl> </dl>
</div> </div>
</div> </div>
@@ -98,33 +143,60 @@
<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="Message.html#acceptGroupV4Invite">acceptGroupV4Invite()</a></dt>
<dd>
</dd>
<dt><a href="Message.html#delete">delete(everyone)</a></dt> <dt><a href="Message.html#delete">delete(everyone)</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Message.html#downloadMedia">downloadMedia()</a></dt> <dt><a href="Message.html#downloadMedia">downloadMedia()</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Message.html#forward">forward(chat)</a></dt>
<dd>
</dd>
<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> <dt><a href="Message.html#getInfo">getInfo()</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Message.html#getMentions">getMentions()</a></dt> <dt><a href="Message.html#getMentions">getMentions()</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Message.html#getOrder">getOrder()</a></dt>
<dd>
</dd>
<dt><a href="Message.html#getPayment">getPayment()</a></dt>
<dd>
</dd>
<dt><a href="Message.html#getQuotedMessage">getQuotedMessage()</a></dt> <dt><a href="Message.html#getQuotedMessage">getQuotedMessage()</a></dt>
<dd> <dd>
</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#reply">reply(content, chatId, options)</a></dt> <dt><a href="Message.html#reload">reload()</a></dt>
<dd>
</dd>
<dt><a href="Message.html#reply">reply(content[, chatId][, options])</a></dt>
<dd>
</dd>
<dt><a href="Message.html#star">star()</a></dt>
<dd>
</dd>
<dt><a href="Message.html#unstar">unstar()</a></dt>
<dd> <dd>
</dd> </dd>
</dl> </dl>
@@ -142,6 +214,11 @@
<section> <section>
<h2>Properties</h2> <h2>Properties</h2>
<section> <section>
<h3 id="ack"><span class="symbol-name">ack</span><small class="property-type">
&nbsp;<a href="global.html#MessageAck">MessageAck</a></small></h3>
<p>ACK status for the message</p>
<dl class="dl-compact">
</dl>
<h3 id="author"><span class="symbol-name">author</span><small class="property-type"> <h3 id="author"><span class="symbol-name">author</span><small class="property-type">
&nbsp;string</small></h3> &nbsp;string</small></h3>
<p>If the message was sent to a group, this field will contain the user that sent the message.</p> <p>If the message was sent to a group, this field will contain the user that sent the message.</p>
@@ -157,6 +234,22 @@
<p>Indicates if the message was a broadcast</p> <p>Indicates if the message was a broadcast</p>
<dl class="dl-compact"> <dl class="dl-compact">
</dl> </dl>
<h3 id="deviceType"><span class="symbol-name">deviceType</span><small class="property-type">
&nbsp;string</small></h3>
<p>String that represents from which device type the message was sent</p>
<dl class="dl-compact">
</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">
&nbsp;number</small></h3>
<p>Indicates how many times the message was forwarded.</p>
<p>The maximum value is 127.</p>
<dl class="dl-compact">
</dl>
<h3 id="from"><span class="symbol-name">from</span><small class="property-type"> <h3 id="from"><span class="symbol-name">from</span><small class="property-type">
&nbsp;string</small></h3> &nbsp;string</small></h3>
<p>ID for the Chat that this message was sent to, except if the message was sent by the current user.</p> <p>ID for the Chat that this message was sent to, except if the message was sent by the current user.</p>
@@ -182,21 +275,66 @@
<p>ID that represents the message</p> <p>ID that represents the message</p>
<dl class="dl-compact"> <dl class="dl-compact">
</dl> </dl>
<h3 id="inviteV4"><span class="symbol-name">inviteV4</span><small class="property-type">
&nbsp;object</small></h3>
<p>Group Invite Data</p>
<dl class="dl-compact">
</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">
&nbsp;boolean</small></h3>
<p>Indicates if the message was starred</p>
<dl class="dl-compact">
</dl>
<h3 id="isStatus"><span class="symbol-name">isStatus</span><small class="property-type">
&nbsp;boolean</small></h3>
<p>Indicates if the message is a status update</p>
<dl class="dl-compact">
</dl>
<h3 id="links"><span class="symbol-name">links</span><small class="property-type">
&nbsp;Array of {link: string, isSuspicious: boolean}</small></h3>
<p>Links included in the message.</p>
<dl class="dl-compact">
</dl>
<h3 id="location"><span class="symbol-name">location</span><small class="property-type"> <h3 id="location"><span class="symbol-name">location</span><small class="property-type">
&nbsp;<a href="Location.html">Location</a></small></h3> &nbsp;<a href="Location.html">Location</a></small></h3>
<p>Location information contained in the message, if the message is type &quot;location&quot;</p> <p>Location information contained in the message, if the message is type &quot;location&quot;</p>
<dl class="dl-compact"> <dl class="dl-compact">
</dl> </dl>
<h3 id="mediaKey"><span class="symbol-name">mediaKey</span><small class="property-type">
&nbsp;string</small></h3>
<p>MediaKey that represents the sticker 'ID'</p>
<dl class="dl-compact">
</dl>
<h3 id="mentionedIds"><span class="symbol-name">mentionedIds</span><small class="property-type"> <h3 id="mentionedIds"><span class="symbol-name">mentionedIds</span><small class="property-type">
&nbsp;Array of string</small></h3> &nbsp;Array of string</small></h3>
<p>Indicates the mentions in the message body.</p> <p>Indicates the mentions in the message body.</p>
<dl class="dl-compact"> <dl class="dl-compact">
</dl> </dl>
<h3 id="orderId"><span class="symbol-name">orderId</span><small class="property-type">
&nbsp;string</small></h3>
<p>Order ID for message type ORDER</p>
<dl class="dl-compact">
</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>
@@ -209,14 +347,33 @@
If the message is sent by another user, it will be the ID for the current user.</p> If the message is sent by another user, it will be the ID for the current user.</p>
<dl class="dl-compact"> <dl class="dl-compact">
</dl> </dl>
<h3 id="token"><span class="symbol-name">token</span><small class="property-type">
&nbsp;string</small></h3>
<p>Order Token for message type ORDER</p>
<dl class="dl-compact">
</dl>
<h3 id="type"><span class="symbol-name">type</span><small class="property-type"> <h3 id="type"><span class="symbol-name">type</span><small class="property-type">
&nbsp;<a href="global.html#MessageTypes">MessageTypes</a></small></h3> &nbsp;<a href="global.html#MessageTypes">MessageTypes</a></small></h3>
<p>Message type</p> <p>Message type</p>
<dl class="dl-compact"> <dl class="dl-compact">
</dl> </dl>
<h3 id="vCards"><span class="symbol-name">vCards</span><small class="property-type">
&nbsp;Array of string</small></h3>
<p>List of vCards contained in the message.</p>
<dl class="dl-compact">
</dl>
</section> </section>
<h2>Methods</h2> <h2>Methods</h2>
<section> <section>
<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">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing Object</span></span></h3>
<p>Accept Group V4 Invite</p>
<dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code>Promise containing Object</code> </p>
</dd>
</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="delete"><span class="symbol-name">delete</span><span class="signature"><span class="signature-params">(everyone)</span></span></h3> <h3 id="delete"><span class="symbol-name">delete</span><span class="signature"><span class="signature-params">(everyone)</span></span></h3>
<p>Deletes a message from the chat</p> <p>Deletes a message from the chat</p>
@@ -243,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>
@@ -261,6 +418,44 @@
<p><code>Promise containing <a href="MessageMedia.html">MessageMedia</a></code> </p> <p><code>Promise containing <a href="MessageMedia.html">MessageMedia</a></code> </p>
</dd> </dd>
</dl> </dl>
<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>
<p>Forwards this message to another chat (that you chatted before, otherwise it will fail)</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>chat</p>
</td>
<td>
<p>(string or <a href="Chat.html">Chat</a>)</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Chat model or chat ID to which the message will be forwarded</p>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code>Promise</code> </p>
</dd>
</dl>
<h3 id="getChat"><span class="symbol-name">getChat</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing <a href="Chat.html">Chat</a></span></span></h3> <h3 id="getChat"><span class="symbol-name">getChat</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing <a href="Chat.html">Chat</a></span></span></h3>
<p>Returns the Chat this message was sent in</p> <p>Returns the Chat this message was sent in</p>
<dl class="dl-compact"> <dl class="dl-compact">
@@ -278,6 +473,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="getInfo"><span class="symbol-name">getInfo</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing nullable <a href="global.html#MessageInfo">MessageInfo</a></span></span></h3>
<p>Get information about message delivery status. May return null if the message does not exist or is not sent by you.</p>
<dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code>Promise containing nullable <a href="global.html#MessageInfo">MessageInfo</a></code> </p>
</dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="getMentions"><span class="symbol-name">getMentions</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing Array of <a href="Contact.html">Contact</a></span></span></h3> <h3 id="getMentions"><span class="symbol-name">getMentions</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing Array of <a href="Contact.html">Contact</a></span></span></h3>
<p>Returns the Contacts mentioned in this message</p> <p>Returns the Contacts mentioned in this message</p>
<dl class="dl-compact"> <dl class="dl-compact">
@@ -287,6 +491,24 @@
</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="getOrder"><span class="symbol-name">getOrder</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing <a href="Order.html">Order</a></span></span></h3>
<p>Gets the order associated with a given message</p>
<dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code>Promise containing <a href="Order.html">Order</a></code> </p>
</dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="getPayment"><span class="symbol-name">getPayment</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing <a href="Payment.html">Payment</a></span></span></h3>
<p>Gets the payment details associated with a given message</p>
<dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code>Promise containing <a href="Payment.html">Payment</a></code> </p>
</dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="getQuotedMessage"><span class="symbol-name">getQuotedMessage</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> <h3 id="getQuotedMessage"><span class="symbol-name">getQuotedMessage</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>Returns the quoted message, if any</p> <p>Returns the quoted message, if any</p>
<dl class="dl-compact"> <dl class="dl-compact">
@@ -296,7 +518,55 @@
</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="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="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>
<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
in the same Chat as the original message was sent.</p> in the same Chat as the original message was sent.</p>
@@ -333,10 +603,9 @@
<p>string</p> <p>string</p>
</td> </td>
<td> <td>
<p>&nbsp;</p> <p>Yes</p>
</td> </td>
<td> <td>
<p>Value can be null.</p>
</td> </td>
</tr> </tr>
<tr> <tr>
@@ -344,10 +613,10 @@
<p>options</p> <p>options</p>
</td> </td>
<td> <td>
<p>object</p> <p><a href="global.html#MessageSendOptions">MessageSendOptions</a></p>
</td> </td>
<td> <td>
<p>&nbsp;</p> <p>Yes</p>
</td> </td>
<td> <td>
</td> </td>
@@ -361,6 +630,16 @@
<p><code>Promise containing <a href="Message.html">Message</a></code> </p> <p><code>Promise containing <a href="Message.html">Message</a></code> </p>
</dd> </dd>
</dl> </dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="star"><span class="symbol-name">star</span><span class="signature"><span class="signature-params">()</span></span></h3>
<p>Stars this message</p>
<dl class="dl-compact">
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="unstar"><span class="symbol-name">unstar</span><span class="signature"><span class="signature-params">()</span></span></h3>
<p>Unstars this message</p>
<dl class="dl-compact">
</dl>
</section> </section>
</section> </section>
</div> </div>
@@ -371,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.3 on March 13, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on November 26, 2022.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.3"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.2.3 &raquo; Class: MessageMedia</title> <title>whatsapp-web.js 1.18.4 &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>2.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>18.<wbr>4</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-10">structures/<wbr>MessageMedia.<wbr>js:10</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,16 +49,42 @@
</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 class="summary-callout">
<h2 class="summary-callout-heading">Methods</h2>
<div class="summary-content">
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="MessageMedia.html#.fromFilePath">fromFilePath(filePath)</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="MessageMedia.html#.fromUrl">fromUrl(url[, options])</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
</div>
</div> </div>
</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">
@@ -114,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>
@@ -134,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">
@@ -143,6 +185,176 @@
<dl class="dl-compact"> <dl class="dl-compact">
</dl> </dl>
</section> </section>
<h2>Methods</h2>
<section>
<div class="symbol-detail-labels"><span class="label label-static">static</span></div>
<h3 id=".fromFilePath"><span class="symbol-name">fromFilePath</span><span class="signature"><span class="signature-params">(filePath)</span>&nbsp;&rarr; <span class="signature-returns"> <a href="MessageMedia.html">MessageMedia</a></span></span></h3>
<p>Creates a MessageMedia instance from a local file path</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>filePath</p>
</td>
<td>
<p>string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code><a href="MessageMedia.html">MessageMedia</a></code> </p>
</dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span>&nbsp;<span class="label label-static">static</span></div>
<h3 id=".fromUrl"><span class="symbol-name">fromUrl</span><span class="signature"><span class="signature-params">(url[, options])</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing <a href="MessageMedia.html">MessageMedia</a></span></span></h3>
<p>Creates a MessageMedia instance from a URL</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>url</p>
</td>
<td>
<p>string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>options</p>
</td>
<td>
<p>Object</p>
</td>
<td>
<p>Yes</p>
</td>
<td>
<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>unsafeMime</p>
</td>
<td>
<p>boolean</p>
</td>
<td>
<p>Yes</p>
</td>
<td>
<p>Defaults to <code>false</code>.</p>
</td>
</tr>
<tr>
<td>
<p>filename</p>
</td>
<td>
<p>string</p>
</td>
<td>
<p>Yes</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>client</p>
</td>
<td>
<p>object</p>
</td>
<td>
<p>Yes</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>reqOptions</p>
</td>
<td>
<p>object</p>
</td>
<td>
<p>Yes</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>reqOptions.size</p>
</td>
<td>
<p>number</p>
</td>
<td>
<p>Yes</p>
</td>
<td>
<p>Defaults to <code>0</code>.</p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code>Promise containing <a href="MessageMedia.html">MessageMedia</a></code> </p>
</dd>
</dl>
</section>
</section> </section>
</div> </div>
</div> </div>
@@ -152,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.3 on March 13, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on November 26, 2022.
</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.18.4 &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>18.<wbr>4</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 November 26, 2022.
</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>

117
docs/Order.html Normal file
View File

@@ -0,0 +1,117 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.18.4 &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/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>18.<wbr>4</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">Order</span></h1>
<p class="source-link">Source: <a href="structures_Order.js.html#source-line-10">structures/<wbr>Order.<wbr>js:10</a></p>
<div class="symbol-classdesc">
<p>Represents a Order 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="Order.html#createdAt">createdAt</a></dt>
<dd>
</dd>
<dt><a href="Order.html#currency">currency</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="Order.html#subtotal">subtotal</a></dt>
<dd>
</dd>
<dt><a href="Order.html#total">total</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
</div>
</div>
</div>
</section>
<section>
<h2 id="Order">new&nbsp;<span class="symbol-name">Order</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="createdAt"><span class="symbol-name">createdAt</span><small class="property-type">
&nbsp;number</small></h3>
<p>Order Created At</p>
<dl class="dl-compact">
</dl>
<h3 id="currency"><span class="symbol-name">currency</span><small class="property-type">
&nbsp;string</small></h3>
<p>Order Currency</p>
<dl class="dl-compact">
</dl>
<h3 id="subtotal"><span class="symbol-name">subtotal</span><small class="property-type">
&nbsp;string</small></h3>
<p>Order Subtotal</p>
<dl class="dl-compact">
</dl>
<h3 id="total"><span class="symbol-name">total</span><small class="property-type">
&nbsp;string</small></h3>
<p>Order Total</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 November 26, 2022.
</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

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.3"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.2.3 &raquo; Class: PrivateChat</title> <title>whatsapp-web.js 1.18.4 &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>2.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>18.<wbr>4</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -48,6 +48,9 @@
<dt><a href="PrivateChat.html#isGroup">isGroup</a></dt> <dt><a href="PrivateChat.html#isGroup">isGroup</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="PrivateChat.html#isMuted">isMuted</a></dt>
<dd>
</dd>
</dl> </dl>
</div> </div>
<div class="summary-column"> <div class="summary-column">
@@ -55,16 +58,22 @@
<dt><a href="PrivateChat.html#isReadOnly">isReadOnly</a></dt> <dt><a href="PrivateChat.html#isReadOnly">isReadOnly</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="PrivateChat.html#muteExpiration">muteExpiration</a></dt>
<dd>
</dd>
<dt><a href="PrivateChat.html#name">name</a></dt> <dt><a href="PrivateChat.html#name">name</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="PrivateChat.html#timestamp">timestamp</a></dt> <dt><a href="PrivateChat.html#pinned">pinned</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="PrivateChat.html#timestamp">timestamp</a></dt>
<dd>
</dd>
<dt><a href="PrivateChat.html#unreadCount">unreadCount</a></dt> <dt><a href="PrivateChat.html#unreadCount">unreadCount</a></dt>
<dd> <dd>
</dd> </dd>
@@ -89,32 +98,53 @@
<dt><a href="PrivateChat.html#delete">delete()</a></dt> <dt><a href="PrivateChat.html#delete">delete()</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="PrivateChat.html#fetchMessages">fetchMessages(searchOptions)</a></dt>
<dd>
</dd>
<dt><a href="PrivateChat.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="PrivateChat.html#fetchMessages">fetchMessages(searchOptions)</a></dt> <dt><a href="PrivateChat.html#getLabels">getLabels()</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="PrivateChat.html#sendMessage">sendMessage(content, options)</a></dt> <dt><a href="PrivateChat.html#markUnread">markUnread()</a></dt>
<dd>
</dd>
<dt><a href="PrivateChat.html#mute">mute(unmuteDate)</a></dt>
<dd>
</dd>
<dt><a href="PrivateChat.html#pin">pin()</a></dt>
<dd>
</dd>
<dt><a href="PrivateChat.html#sendMessage">sendMessage(content[, options])</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="PrivateChat.html#sendSeen">sendSeen()</a></dt> <dt><a href="PrivateChat.html#sendSeen">sendSeen()</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="PrivateChat.html#sendStateRecording">sendStateRecording()</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="PrivateChat.html#sendStateRecording">sendStateRecording()</a></dt>
<dd>
</dd>
<dt><a href="PrivateChat.html#sendStateTyping">sendStateTyping()</a></dt> <dt><a href="PrivateChat.html#sendStateTyping">sendStateTyping()</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="PrivateChat.html#unarchive">unarchive()</a></dt> <dt><a href="PrivateChat.html#unarchive">unarchive()</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="PrivateChat.html#unmute">unmute()</a></dt>
<dd>
</dd>
<dt><a href="PrivateChat.html#unpin">unpin()</a></dt>
<dd>
</dd>
</dl> </dl>
</div> </div>
</div> </div>
@@ -151,6 +181,13 @@
<dt>Inherited from</dt> <dt>Inherited from</dt>
<dd><a href="Chat.html#isGroup">Chat#isGroup</a></dd> <dd><a href="Chat.html#isGroup">Chat#isGroup</a></dd>
</dl> </dl>
<h3 id="isMuted"><span class="symbol-name">isMuted</span><small class="property-type">
&nbsp;unknown</small></h3>
<p>Indicates if the chat is muted or not</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Chat.html#isMuted">Chat#isMuted</a></dd>
</dl>
<h3 id="isReadOnly"><span class="symbol-name">isReadOnly</span><small class="property-type"> <h3 id="isReadOnly"><span class="symbol-name">isReadOnly</span><small class="property-type">
&nbsp;unknown</small></h3> &nbsp;unknown</small></h3>
<p>Indicates if the Chat is readonly</p> <p>Indicates if the Chat is readonly</p>
@@ -158,6 +195,13 @@
<dt>Inherited from</dt> <dt>Inherited from</dt>
<dd><a href="Chat.html#isReadOnly">Chat#isReadOnly</a></dd> <dd><a href="Chat.html#isReadOnly">Chat#isReadOnly</a></dd>
</dl> </dl>
<h3 id="muteExpiration"><span class="symbol-name">muteExpiration</span><small class="property-type">
&nbsp;unknown</small></h3>
<p>Unix timestamp for when the mute expires</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Chat.html#muteExpiration">Chat#muteExpiration</a></dd>
</dl>
<h3 id="name"><span class="symbol-name">name</span><small class="property-type"> <h3 id="name"><span class="symbol-name">name</span><small class="property-type">
&nbsp;unknown</small></h3> &nbsp;unknown</small></h3>
<p>Title of the chat</p> <p>Title of the chat</p>
@@ -165,9 +209,16 @@
<dt>Inherited from</dt> <dt>Inherited from</dt>
<dd><a href="Chat.html#name">Chat#name</a></dd> <dd><a href="Chat.html#name">Chat#name</a></dd>
</dl> </dl>
<h3 id="pinned"><span class="symbol-name">pinned</span><small class="property-type">
&nbsp;unknown</small></h3>
<p>Indicates if the Chat is pinned</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Chat.html#pinned">Chat#pinned</a></dd>
</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;unknown</small></h3> &nbsp;unknown</small></h3>
<p>Unix timestamp for when the chat was created</p> <p>Unix timestamp for when the last activity occurred</p>
<dl class="dl-compact"> <dl class="dl-compact">
<dt>Inherited from</dt> <dt>Inherited from</dt>
<dd><a href="Chat.html#timestamp">Chat#timestamp</a></dd> <dd><a href="Chat.html#timestamp">Chat#timestamp</a></dd>
@@ -244,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>
@@ -267,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>
@@ -285,7 +349,80 @@
<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="sendMessage"><span class="symbol-name">sendMessage</span><span class="signature"><span class="signature-params">(content, options)</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing <a href="Message.html">Message</a></span></span></h3> <h3 id="getContact"><span class="symbol-name">getContact</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing <a href="Contact.html">Contact</a></span></span></h3>
<p>Returns the Contact that corresponds to this Chat.</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Chat.html#getContact">Chat#getContact</a></dd>
<dt>Returns</dt>
<dd></dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="getLabels"><span class="symbol-name">getLabels</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing Array of <a href="Label.html">Label</a></span></span></h3>
<p>Returns array of all Labels assigned to this Chat</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Chat.html#getLabels">Chat#getLabels</a></dd>
<dt>Returns</dt>
<dd></dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="markUnread"><span class="symbol-name">markUnread</span><span class="signature"><span class="signature-params">()</span></span></h3>
<p>Mark this chat as unread</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Chat.html#markUnread">Chat#markUnread</a></dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="mute"><span class="symbol-name">mute</span><span class="signature"><span class="signature-params">(unmuteDate)</span></span></h3>
<p>Mutes this chat forever, unless a date is specified</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>unmuteDate</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Date at which the Chat will be unmuted, leave as is to mute forever</p>
<p>Value can be null.</p>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Chat.html#mute">Chat#mute</a></dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="pin"><span class="symbol-name">pin</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing boolean</span></span></h3>
<p>Pins this chat</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Chat.html#pin">Chat#pin</a></dd>
<dt>Returns</dt>
<dd>
<p>New pin state. Could be false if the max number of pinned chats was reached.</p>
</dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="sendMessage"><span class="symbol-name">sendMessage</span><span class="signature"><span class="signature-params">(content[, options])</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing <a href="Message.html">Message</a></span></span></h3>
<p>Send a message to this chat</p> <p>Send a message to this chat</p>
<section> <section>
<h4>Parameters</h4> <h4>Parameters</h4>
@@ -320,7 +457,7 @@
<p>&nbsp;</p> <p>&nbsp;</p>
</td> </td>
<td> <td>
<p>&nbsp;</p> <p>Yes</p>
</td> </td>
<td> <td>
</td> </td>
@@ -368,6 +505,24 @@
<dt>Inherited from</dt> <dt>Inherited from</dt>
<dd><a href="Chat.html#unarchive">Chat#unarchive</a></dd> <dd><a href="Chat.html#unarchive">Chat#unarchive</a></dd>
</dl> </dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="unmute"><span class="symbol-name">unmute</span><span class="signature"><span class="signature-params">()</span></span></h3>
<p>Unmutes this chat</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Chat.html#unmute">Chat#unmute</a></dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="unpin"><span class="symbol-name">unpin</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing boolean</span></span></h3>
<p>Unpins this chat</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Chat.html#unpin">Chat#unpin</a></dd>
<dt>Returns</dt>
<dd>
<p>New pin state</p>
</dd>
</dl>
</section> </section>
</section> </section>
</div> </div>
@@ -378,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.3 on March 13, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on November 26, 2022.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.3"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.2.3 &raquo; Class: PrivateContact</title> <title>whatsapp-web.js 1.18.4 &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>2.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>18.<wbr>4</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -42,6 +42,9 @@
<dt><a href="PrivateContact.html#id">id</a></dt> <dt><a href="PrivateContact.html#id">id</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="PrivateContact.html#isBlocked">isBlocked</a></dt>
<dd>
</dd>
<dt><a href="PrivateContact.html#isBusiness">isBusiness</a></dt> <dt><a href="PrivateContact.html#isBusiness">isBusiness</a></dt>
<dd> <dd>
</dd> </dd>
@@ -67,13 +70,13 @@
<dt><a href="PrivateContact.html#isWAContact">isWAContact</a></dt> <dt><a href="PrivateContact.html#isWAContact">isWAContact</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="PrivateContact.html#name">name</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#name">name</a></dt>
<dd>
</dd>
<dt><a href="PrivateContact.html#number">number</a></dt> <dt><a href="PrivateContact.html#number">number</a></dt>
<dd> <dd>
</dd> </dd>
@@ -88,18 +91,43 @@
</div> </div>
</div> </div>
<div class="summary-callout"> <div class="summary-callout">
<h2 class="summary-callout-heading">Method</h2> <h2 class="summary-callout-heading">Methods</h2>
<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="PrivateContact.html#getProfilePicUrl">getProfilePicUrl()</a></dt> <dt><a href="PrivateContact.html#block">block()</a></dt>
<dd>
</dd>
<dt><a href="PrivateContact.html#getAbout">getAbout()</a></dt>
<dd>
</dd>
<dt><a href="PrivateContact.html#getChat">getChat()</a></dt>
<dd> <dd>
</dd> </dd>
</dl> </dl>
</div> </div>
<div class="summary-column"> <div class="summary-column">
<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>
<dd>
</dd>
<dt><a href="PrivateContact.html#getFormattedNumber">getFormattedNumber()</a></dt>
<dd>
</dd>
</dl>
</div> </div>
<div class="summary-column"> <div class="summary-column">
<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>
<dd>
</dd>
</dl>
</div> </div>
</div> </div>
</div> </div>
@@ -121,6 +149,13 @@
<dt>Inherited from</dt> <dt>Inherited from</dt>
<dd><a href="Contact.html#id">Contact#id</a></dd> <dd><a href="Contact.html#id">Contact#id</a></dd>
</dl> </dl>
<h3 id="isBlocked"><span class="symbol-name">isBlocked</span><small class="property-type">
&nbsp;unknown</small></h3>
<p>Indicates if you have blocked this contact</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Contact.html#isBlocked">Contact#isBlocked</a></dd>
</dl>
<h3 id="isBusiness"><span class="symbol-name">isBusiness</span><small class="property-type"> <h3 id="isBusiness"><span class="symbol-name">isBusiness</span><small class="property-type">
&nbsp;unknown</small></h3> &nbsp;unknown</small></h3>
<p>Indicates if the contact is a business contact</p> <p>Indicates if the contact is a business contact</p>
@@ -199,8 +234,63 @@
<dd><a href="Contact.html#shortName">Contact#shortName</a></dd> <dd><a href="Contact.html#shortName">Contact#shortName</a></dd>
</dl> </dl>
</section> </section>
<h2>Method</h2> <h2>Methods</h2>
<section> <section>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="block"><span class="symbol-name">block</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing boolean</span></span></h3>
<p>Blocks this contact from WhatsApp</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Contact.html#block">Contact#block</a></dd>
<dt>Returns</dt>
<dd></dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="getAbout"><span class="symbol-name">getAbout</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing nullable string</span></span></h3>
<p>Gets the Contact's current &quot;about&quot; info. Returns null if you don't have permission to read their status.</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Contact.html#getAbout">Contact#getAbout</a></dd>
<dt>Returns</dt>
<dd></dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="getChat"><span class="symbol-name">getChat</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing <a href="Chat.html">Chat</a></span></span></h3>
<p>Returns the Chat that corresponds to this Contact.
Will return null when getting chat for currently logged in user.</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Contact.html#getChat">Contact#getChat</a></dd>
<dt>Returns</dt>
<dd></dd>
</dl>
<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>
<p>Returns the contact's countrycode, (1541859685@c.us) =&gt; (1)</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Contact.html#getCountryCode">Contact#getCountryCode</a></dd>
<dt>Returns</dt>
<dd></dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="getFormattedNumber"><span class="symbol-name">getFormattedNumber</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 formatted phone number, (12345678901@c.us) =&gt; (+1 (234) 5678-901)</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Contact.html#getFormattedNumber">Contact#getFormattedNumber</a></dd>
<dt>Returns</dt>
<dd></dd>
</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="getProfilePicUrl"><span class="symbol-name">getProfilePicUrl</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing string</span></span></h3> <h3 id="getProfilePicUrl"><span class="symbol-name">getProfilePicUrl</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 profile picture URL, if privacy settings allow it</p> <p>Returns the contact's profile picture URL, if privacy settings allow it</p>
@@ -210,6 +300,15 @@
<dt>Returns</dt> <dt>Returns</dt>
<dd></dd> <dd></dd>
</dl> </dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="unblock"><span class="symbol-name">unblock</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing boolean</span></span></h3>
<p>Unblocks this contact from WhatsApp</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Contact.html#unblock">Contact#unblock</a></dd>
<dt>Returns</dt>
<dd></dd>
</dl>
</section> </section>
</section> </section>
</div> </div>
@@ -220,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.3 on March 13, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on November 26, 2022.
</p> </p>
</div> </div>
</footer> </footer>

142
docs/Product.html Normal file
View File

@@ -0,0 +1,142 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.18.4 &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/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>18.<wbr>4</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">Product</span></h1>
<p class="source-link">Source: <a href="structures_Product.js.html#source-line-10">structures/<wbr>Product.<wbr>js:10</a></p>
<div class="symbol-classdesc">
<p>Represents a Product on WhatsAppBusiness</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="Product.html#currency">currency</a></dt>
<dd>
</dd>
<dt><a href="Product.html#data">data</a></dt>
<dd>
</dd>
<dt><a href="Product.html#id">id</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="Product.html#name">name</a></dt>
<dd>
</dd>
<dt><a href="Product.html#price">price</a></dt>
<dd>
</dd>
<dt><a href="Product.html#quantity">quantity</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="Product.html#thumbnailUrl">thumbnailUrl</a></dt>
<dd>
</dd>
</dl>
</div>
</div>
</div>
</section>
<section>
<h2 id="Product">new&nbsp;<span class="symbol-name">Product</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="currency"><span class="symbol-name">currency</span><small class="property-type">
&nbsp;string</small></h3>
<p>Currency</p>
<dl class="dl-compact">
</dl>
<h3 id="data"><span class="symbol-name">data</span></h3>
<p>Product metadata</p>
<dl class="dl-compact">
</dl>
<h3 id="id"><span class="symbol-name">id</span><small class="property-type">
&nbsp;string</small></h3>
<p>Product ID</p>
<dl class="dl-compact">
</dl>
<h3 id="name"><span class="symbol-name">name</span><small class="property-type">
&nbsp;string</small></h3>
<p>Product Name</p>
<dl class="dl-compact">
</dl>
<h3 id="price"><span class="symbol-name">price</span><small class="property-type">
&nbsp;string</small></h3>
<p>Price</p>
<dl class="dl-compact">
</dl>
<h3 id="quantity"><span class="symbol-name">quantity</span><small class="property-type">
&nbsp;number</small></h3>
<p>Product Quantity</p>
<dl class="dl-compact">
</dl>
<h3 id="thumbnailUrl"><span class="symbol-name">thumbnailUrl</span><small class="property-type">
&nbsp;string</small></h3>
<p>Product Thumbnail</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 November 26, 2022.
</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>

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.18.4 &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>18.<wbr>4</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 November 26, 2022.
</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.18.4 &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>18.<wbr>4</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 November 26, 2022.
</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

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.3"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.2.3 &raquo; Class: Util</title> <title>whatsapp-web.js 1.18.4 &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>2.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>18.<wbr>4</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-10">util/<wbr>Util.<wbr>js:10</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>
@@ -34,6 +34,33 @@
</dl> </dl>
</header> </header>
<section id="summary"> <section id="summary">
<div class="summary-callout">
<h2 class="summary-callout-heading">Methods</h2>
<div class="summary-content">
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="Util.html#.formatImageToWebpSticker">formatImageToWebpSticker(media)</a></dt>
<dd>
</dd>
<dt><a href="Util.html#.formatToWebpSticker">formatToWebpSticker(media, metadata)</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="Util.html#.formatVideoToWebpSticker">formatVideoToWebpSticker(media)</a></dt>
<dd>
</dd>
<dt><a href="Util.html#.setFfmpegPath">setFfmpegPath(path)</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
</div>
</div>
</div>
</section> </section>
<section> <section>
<h2 id="Util">new&nbsp;<span class="symbol-name">Util</span><span class="signature"><span class="signature-params">()</span></span></h2> <h2 id="Util">new&nbsp;<span class="symbol-name">Util</span><span class="signature"><span class="signature-params">()</span></span></h2>
@@ -41,6 +68,172 @@
</dl> </dl>
</section> </section>
<section> <section>
<h2>Methods</h2>
<section>
<div class="symbol-detail-labels"><span class="label label-async">async</span>&nbsp;<span class="label label-static">static</span></div>
<h3 id=".formatImageToWebpSticker"><span class="symbol-name">formatImageToWebpSticker</span><span class="signature"><span class="signature-params">(media)</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing <a href="MessageMedia.html">MessageMedia</a></span></span></h3>
<p>Formats a image to webp</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>media</p>
</td>
<td>
<p><a href="MessageMedia.html">MessageMedia</a></p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code>Promise containing <a href="MessageMedia.html">MessageMedia</a></code> 
<p>media in webp format</p>
</p>
</dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span>&nbsp;<span class="label label-static">static</span></div>
<h3 id=".formatToWebpSticker"><span class="symbol-name">formatToWebpSticker</span><span class="signature"><span class="signature-params">(media, metadata)</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing <a href="MessageMedia.html">MessageMedia</a></span></span></h3>
<p>Formats a media to webp</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>media</p>
</td>
<td>
<p><a href="MessageMedia.html">MessageMedia</a></p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>metadata</p>
</td>
<td>
<p><a href="global.html#StickerMetadata">StickerMetadata</a></p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code>Promise containing <a href="MessageMedia.html">MessageMedia</a></code> 
<p>media in webp format</p>
</p>
</dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span>&nbsp;<span class="label label-static">static</span></div>
<h3 id=".formatVideoToWebpSticker"><span class="symbol-name">formatVideoToWebpSticker</span><span class="signature"><span class="signature-params">(media)</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing <a href="MessageMedia.html">MessageMedia</a></span></span></h3>
<p>Formats a video to webp</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>media</p>
</td>
<td>
<p><a href="MessageMedia.html">MessageMedia</a></p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code>Promise containing <a href="MessageMedia.html">MessageMedia</a></code> 
<p>media in webp format</p>
</p>
</dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-static">static</span></div>
<h3 id=".setFfmpegPath"><span class="symbol-name">setFfmpegPath</span><span class="signature"><span class="signature-params">(path)</span></span></h3>
<p>Configure ffmpeg path</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>path</p>
</td>
<td>
<p>string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
</dl>
</section>
</section> </section>
</div> </div>
</div> </div>
@@ -50,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.3 on March 13, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on November 26, 2022.
</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.18.4 &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>18.<wbr>4</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 November 26, 2022.
</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.18.4 &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>18.<wbr>4</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 November 26, 2022.
</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.18.4 &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>18.<wbr>4</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 November 26, 2022.
</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.18.4 &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>18.<wbr>4</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 November 26, 2022.
</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.18.4 &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>18.<wbr>4</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 November 26, 2022.
</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>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

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=\"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=\"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=\"PrivateChat.html\">PrivateChat</a>","id":"PrivateChat","children":[]},{"label":"<a href=\"PrivateContact.html\">PrivateContact</a>","id":"PrivateContact","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

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.3"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.2.3 &raquo; Source: structures/Base.js</title> <title>whatsapp-web.js 1.18.4 &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>2.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>18.<wbr>4</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.3 on March 13, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on November 26, 2022.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.3"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.2.3 &raquo; Source: structures/BusinessContact.js</title> <title>whatsapp-web.js 1.18.4 &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>2.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>18.<wbr>4</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.3 on March 13, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on November 26, 2022.
</p> </p>
</div> </div>
</footer> </footer>

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.18.4 &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/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>18.<wbr>4</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/Buttons.js</h1>
</header>
<article>
<pre class="prettyprint linenums"><code>&#x27;use strict&#x27;;
const MessageMedia &#x3D; require(&#x27;./MessageMedia&#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
*/
class Buttons {
/**
* @param {string|MessageMedia} body
* @param {ButtonSpec[]} buttons - See {@link ButtonSpec}
* @param {string?} title
* @param {string?} footer
*/
constructor(body, buttons, title, footer) {
/**
* Message body
* @type {string|MessageMedia}
*/
this.body &#x3D; body;
/**
* title of message
* @type {string}
*/
this.title &#x3D; title;
/**
* footer of message
* @type {string}
*/
this.footer &#x3D; footer;
if (body instanceof MessageMedia) {
this.type &#x3D; &#x27;media&#x27;;
this.title &#x3D; &#x27;&#x27;;
}else{
this.type &#x3D; &#x27;chat&#x27;;
}
/**
* buttons of message
* @type {FormattedButtonSpec[]}
*/
this.buttons &#x3D; this._format(buttons);
if(!this.buttons.length){ throw &#x27;[BT01] No buttons&#x27;;}
}
/**
* Creates button array from simple array
* @param {ButtonSpec[]} buttons
* @returns {FormattedButtonSpec[]}
* @example
* 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}]
*/
_format(buttons){
buttons &#x3D; buttons.slice(0,3); // phone users can only see 3 buttons, so lets limit this
return buttons.map((btn) &#x3D;&gt; {
return {&#x27;buttonId&#x27;:btn.id ? String(btn.id) : Util.generateHash(6),&#x27;buttonText&#x27;:{&#x27;displayText&#x27;:btn.body},&#x27;type&#x27;:1};
});
}
}
module.exports &#x3D; Buttons;</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 November 26, 2022.
</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,121 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.18.4 &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/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>18.<wbr>4</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/Call.js</h1>
</header>
<article>
<pre class="prettyprint linenums"><code>&#x27;use strict&#x27;;
const Base &#x3D; require(&#x27;./Base&#x27;);
/**
* Represents a Call on WhatsApp
* @extends {Base}
*/
class Call extends Base {
constructor(client, data) {
super(client);
if (data) this._patch(data);
}
_patch(data) {
/**
* Call ID
* @type {string}
*/
this.id &#x3D; data.id;
/**
* From
* @type {string}
*/
this.from &#x3D; data.peerJid;
/**
* Unix timestamp for when the call was created
* @type {number}
*/
this.timestamp &#x3D; data.offerTime;
/**
* Is video
* @type {boolean}
*/
this.isVideo &#x3D; data.isVideo;
/**
* Is Group
* @type {boolean}
*/
this.isGroup &#x3D; data.isGroup;
/**
* Indicates if the call was sent by the current user
* @type {boolean}
*/
this.fromMe &#x3D; data.outgoing;
/**
* Indicates if the call can be handled in waweb
* @type {boolean}
*/
this.canHandleLocally &#x3D; data.canHandleLocally;
/**
* Indicates if the call Should be handled in waweb
* @type {boolean}
*/
this.webClientShouldHandle &#x3D; data.webClientShouldHandle;
/**
* Object with participants
* @type {object}
*/
this.participants &#x3D; data.participants;
return super._patch(data);
}
}
module.exports &#x3D; Call;</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 November 26, 2022.
</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

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.3"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.2.3 &raquo; Source: structures/Chat.js</title> <title>whatsapp-web.js 1.18.4 &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>2.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>18.<wbr>4</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -77,7 +77,7 @@ class Chat extends Base {
this.unreadCount &#x3D; data.unreadCount; this.unreadCount &#x3D; data.unreadCount;
/** /**
* Unix timestamp for when the chat was created * Unix timestamp for when the last activity occurred
* @type {number} * @type {number}
*/ */
this.timestamp &#x3D; data.t; this.timestamp &#x3D; data.t;
@@ -88,13 +88,31 @@ class Chat extends Base {
*/ */
this.archived &#x3D; data.archive; this.archived &#x3D; data.archive;
/**
* Indicates if the Chat is pinned
* @type {boolean}
*/
this.pinned &#x3D; !!data.pin;
/**
* Indicates if the chat is muted or not
* @type {boolean}
*/
this.isMuted &#x3D; data.isMuted;
/**
* Unix timestamp for when the mute expires
* @type {number}
*/
this.muteExpiration &#x3D; data.muteExpiration;
return super._patch(data); return super._patch(data);
} }
/** /**
* Send a message to this chat * Send a message to this chat
* @param {string|MessageMedia|Location} content * @param {string|MessageMedia|Location} content
* @param {object} options * @param {MessageSendOptions} [options]
* @returns {Promise&amp;lt;Message&gt;} Message that was just sent * @returns {Promise&amp;lt;Message&gt;} Message that was just sent
*/ */
async sendMessage(content, options) { async sendMessage(content, options) {
@@ -143,36 +161,86 @@ class Chat extends Base {
return this.client.unarchiveChat(this.id._serialized); return this.client.unarchiveChat(this.id._serialized);
} }
/**
* Pins this chat
* @returns {Promise&amp;lt;boolean&gt;} New pin state. Could be false if the max number of pinned chats was reached.
*/
async pin() {
return this.client.pinChat(this.id._serialized);
}
/**
* Unpins this chat
* @returns {Promise&amp;lt;boolean&gt;} New pin state
*/
async unpin() {
return this.client.unpinChat(this.id._serialized);
}
/**
* Mutes this chat forever, unless a date is specified
* @param {?Date} unmuteDate Date at which the Chat will be unmuted, leave as is to mute forever
*/
async mute(unmuteDate) {
return this.client.muteChat(this.id._serialized, unmuteDate);
}
/**
* Unmutes this chat
*/
async unmute() {
return this.client.unmuteChat(this.id._serialized);
}
/**
* Mark this chat as unread
*/
async markUnread(){
return this.client.markChatUnread(this.id._serialized);
}
/** /**
* 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); return msgs.map(m &#x3D;&gt; window.WWebJS.getMessageModel(m));
return msgs.splice(msgs.length - limit).map(m &#x3D;&gt; m.serialize());
}, 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));
} }
/** /**
* Simulate typing in chat. This will last for 25 seconds. * Simulate typing in chat. This will last for 25 seconds.
*/ */
@@ -182,7 +250,7 @@ class Chat extends Base {
return true; return true;
}, this.id._serialized); }, this.id._serialized);
} }
/** /**
* Simulate recording audio in chat. This will last for 25 seconds. * Simulate recording audio in chat. This will last for 25 seconds.
*/ */
@@ -202,6 +270,22 @@ class Chat extends Base {
return true; return true;
}, this.id._serialized); }, this.id._serialized);
} }
/**
* Returns the Contact that corresponds to this Chat.
* @returns {Promise&amp;lt;Contact&gt;}
*/
async getContact() {
return await this.client.getContactById(this.id._serialized);
}
/**
* Returns array of all Labels assigned to this Chat
* @returns {Promise&amp;lt;Array&amp;lt;Label&gt;&gt;}
*/
async getLabels() {
return this.client.getChatLabels(this.id._serialized);
}
} }
module.exports &#x3D; Chat; module.exports &#x3D; Chat;
@@ -215,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.3 on March 13, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on November 26, 2022.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.3"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.2.3 &raquo; Source: structures/ClientInfo.js</title> <title>whatsapp-web.js 1.18.4 &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>2.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>18.<wbr>4</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -41,7 +41,7 @@ class ClientInfo extends Base {
constructor(client, data) { constructor(client, data) {
super(client); super(client);
if(data) this._patch(data); if (data) this._patch(data);
} }
_patch(data) { _patch(data) {
@@ -55,21 +55,28 @@ class ClientInfo extends Base {
* Current user ID * Current user ID
* @type {object} * @type {object}
*/ */
this.me &#x3D; data.me; 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;
@@ -77,6 +84,19 @@ class ClientInfo extends Base {
return super._patch(data); return super._patch(data);
} }
/**
* Get current battery percentage and charging status for the attached device
* @returns {object} batteryStatus
* @returns {number} batteryStatus.battery - The current battery percentage
* @returns {boolean} batteryStatus.plugged - Indicates if the phone is plugged in (true) or not (false)
* @deprecated
*/
async getBatteryStatus() {
return await this.client.pupPage.evaluate(() &#x3D;&gt; {
const { battery, plugged } &#x3D; window.Store.Conn;
return { battery, plugged };
});
}
} }
module.exports &#x3D; ClientInfo;</code></pre> module.exports &#x3D; ClientInfo;</code></pre>
@@ -89,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.3 on March 13, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on November 26, 2022.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.3"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.2.3 &raquo; Source: structures/Contact.js</title> <title>whatsapp-web.js 1.18.4 &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>2.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>18.<wbr>4</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -33,6 +33,14 @@
const Base &#x3D; require(&#x27;./Base&#x27;); const Base &#x3D; require(&#x27;./Base&#x27;);
/**
* ID that represents a contact
* @typedef {Object} ContactId
* @property {string} server
* @property {string} user
* @property {string} _serialized
*/
/** /**
* Represents a Contact on WhatsApp * Represents a Contact on WhatsApp
* @extends {Base} * @extends {Base}
@@ -47,7 +55,7 @@ class Contact extends Base {
_patch(data) { _patch(data) {
/** /**
* ID that represents the contact * ID that represents the contact
* @type {object} * @type {ContactId}
*/ */
this.id &#x3D; data.id; this.id &#x3D; data.id;
@@ -126,6 +134,12 @@ class Contact extends Base {
*/ */
this.isMyContact &#x3D; data.isMyContact; this.isMyContact &#x3D; data.isMyContact;
/**
* Indicates if you have blocked this contact
* @type {boolean}
*/
this.isBlocked &#x3D; data.isBlocked;
return super._patch(data); return super._patch(data);
} }
@@ -134,16 +148,94 @@ class Contact extends Base {
* @returns {Promise&amp;lt;string&gt;} * @returns {Promise&amp;lt;string&gt;}
*/ */
async getProfilePicUrl() { async getProfilePicUrl() {
const profilePic &#x3D; await this.client.pupPage.evaluate((contactId) &#x3D;&gt; { return await this.client.getProfilePicUrl(this.id._serialized);
return window.Store.Wap.profilePicFind(contactId); }
/**
* Returns the contact&#x27;s formatted phone number, (12345678901@c.us) &#x3D;&gt; (+1 (234) 5678-901)
* @returns {Promise&amp;lt;string&gt;}
*/
async getFormattedNumber() {
return await this.client.getFormattedNumber(this.id._serialized);
}
/**
* Returns the contact&#x27;s countrycode, (1541859685@c.us) &#x3D;&gt; (1)
* @returns {Promise&amp;lt;string&gt;}
*/
async getCountryCode() {
return await this.client.getCountryCode(this.id._serialized);
}
/**
* Returns the Chat that corresponds to this Contact.
* Will return null when getting chat for currently logged in user.
* @returns {Promise&amp;lt;Chat&gt;}
*/
async getChat() {
if(this.isMe) return null;
return await this.client.getChatById(this.id._serialized);
}
/**
* Blocks this contact from WhatsApp
* @returns {Promise&amp;lt;boolean&gt;}
*/
async block() {
if(this.isGroup) return false;
await this.client.pupPage.evaluate(async (contactId) &#x3D;&gt; {
const contact &#x3D; window.Store.Contact.get(contactId);
await window.Store.BlockContact.blockContact(contact);
}, this.id._serialized); }, this.id._serialized);
return profilePic ? profilePic.eurl : undefined; return true;
}
/**
* Unblocks this contact from WhatsApp
* @returns {Promise&amp;lt;boolean&gt;}
*/
async unblock() {
if(this.isGroup) return false;
await this.client.pupPage.evaluate(async (contactId) &#x3D;&gt; {
const contact &#x3D; window.Store.Contact.get(contactId);
await window.Store.BlockContact.unblockContact(contact);
}, this.id._serialized);
return true;
}
/**
* Gets the Contact&#x27;s current &quot;about&quot; info. Returns null if you don&#x27;t have permission to read their status.
* @returns {Promise&amp;lt;?string&gt;}
*/
async getAbout() {
const about &#x3D; await this.client.pupPage.evaluate(async (contactId) &#x3D;&gt; {
const wid &#x3D; window.Store.WidFactory.createWid(contactId);
return window.Store.StatusUtils.getStatus(wid);
}, this.id._serialized);
if (typeof about.status !&#x3D;&#x3D; &#x27;string&#x27;)
return null;
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);
} }
} }
module.exports &#x3D; Contact;</code></pre> module.exports &#x3D; Contact;
</code></pre>
</article> </article>
</div> </div>
</div> </div>
@@ -153,7 +245,7 @@ module.exports &#x3D; Contact;</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.3 on March 13, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on November 26, 2022.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.3"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.2.3 &raquo; Source: structures/GroupChat.js</title> <title>whatsapp-web.js 1.18.4 &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>2.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>18.<wbr>4</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -33,6 +33,14 @@
const Chat &#x3D; require(&#x27;./Chat&#x27;); const Chat &#x3D; require(&#x27;./Chat&#x27;);
/**
* Group participant information
* @typedef {Object} GroupParticipant
* @property {ContactId} id
* @property {boolean} isAdmin
* @property {boolean} isSuperAdmin
*/
/** /**
* Represents a Group Chat on WhatsApp * Represents a Group Chat on WhatsApp
* @extends {Chat} * @extends {Chat}
@@ -46,6 +54,7 @@ class GroupChat extends Chat {
/** /**
* Gets the group owner * Gets the group owner
* @type {ContactId}
*/ */
get owner() { get owner() {
return this.groupMetadata.owner; return this.groupMetadata.owner;
@@ -66,9 +75,10 @@ class GroupChat extends Chat {
get description() { get description() {
return this.groupMetadata.desc; return this.groupMetadata.desc;
} }
/** /**
* Gets the group participants * Gets the group participants
* @type {array} * @type {Array&amp;lt;GroupParticipant&gt;}
*/ */
get participants() { get participants() {
return this.groupMetadata.participants; return this.groupMetadata.participants;
@@ -77,123 +87,176 @@ class GroupChat extends Chat {
/** /**
* Adds a list of participants by ID to the group * Adds a list of participants by ID to the group
* @param {Array&amp;lt;string&gt;} participantIds * @param {Array&amp;lt;string&gt;} participantIds
* @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((chatId, participantIds) &#x3D;&gt; {
return window.Store.Wap.addParticipants(chatId, participantIds); const chatWid &#x3D; window.Store.WidFactory.createWid(chatId);
const participantWids &#x3D; participantIds.map(p &#x3D;&gt; window.Store.WidFactory.createWid(p));
return window.Store.GroupParticipants.sendAddParticipants(chatWid, participantWids);
}, this.id._serialized, participantIds); }, this.id._serialized, participantIds);
} }
/** /**
* Removes a list of participants by ID to the group * Removes a list of participants by ID to the group
* @param {Array&amp;lt;string&gt;} participantIds * @param {Array&amp;lt;string&gt;} participantIds
* @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((chatId, participantIds) &#x3D;&gt; {
return window.Store.Wap.removeParticipants(chatId, participantIds); const chatWid &#x3D; window.Store.WidFactory.createWid(chatId);
const participantWids &#x3D; participantIds.map(p &#x3D;&gt; window.Store.WidFactory.createWid(p));
return window.Store.GroupParticipants.sendRemoveParticipants(chatWid, participantWids);
}, this.id._serialized, participantIds); }, this.id._serialized, participantIds);
} }
/** /**
* Promotes participants by IDs to admins * Promotes participants by IDs to admins
* @param {Array&amp;lt;string&gt;} participantIds * @param {Array&amp;lt;string&gt;} participantIds
* @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((chatId, participantIds) &#x3D;&gt; {
return window.Store.Wap.promoteParticipants(chatId, participantIds); const chatWid &#x3D; window.Store.WidFactory.createWid(chatId);
const participantWids &#x3D; participantIds.map(p &#x3D;&gt; window.Store.WidFactory.createWid(p));
return window.Store.GroupParticipants.sendPromoteParticipants(chatWid, participantWids);
}, this.id._serialized, participantIds); }, this.id._serialized, participantIds);
} }
/** /**
* Demotes participants by IDs to regular users * Demotes participants by IDs to regular users
* @param {Array&amp;lt;string&gt;} participantIds * @param {Array&amp;lt;string&gt;} participantIds
* @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((chatId, participantIds) &#x3D;&gt; {
return window.Store.Wap.demoteParticipants(chatId, participantIds); const chatWid &#x3D; window.Store.WidFactory.createWid(chatId);
const participantWids &#x3D; participantIds.map(p &#x3D;&gt; window.Store.WidFactory.createWid(p));
return window.Store.GroupParticipants.sendDemoteParticipants(chatWid, participantWids);
}, this.id._serialized, participantIds); }, this.id._serialized, participantIds);
} }
/** /**
* Updates the group subject * Updates the group subject
* @param {string} subject * @param {string} subject
* @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 {
return await window.Store.GroupUtils.sendSetGroupSubject(chatWid, subject);
} 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&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 {
return await window.Store.GroupUtils.sendSetGroupDescription(chatWid, description, window.Store.MsgKey.newId(), descId);
} 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.
* @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.
*/
async setMessagesAdminsOnly(adminsOnly&#x3D;true) {
const success &#x3D; await this.client.pupPage.evaluate(async (chatId, adminsOnly) &#x3D;&gt; {
const chatWid &#x3D; window.Store.WidFactory.createWid(chatId);
try {
return await window.Store.GroupUtils.sendSetGroupProperty(chatWid, &#x27;announcement&#x27;, adminsOnly ? 1 : 0);
} catch (err) {
if(err.name &#x3D;&#x3D;&#x3D; &#x27;ServerStatusCodeError&#x27;) return false;
throw err;
}
}, this.id._serialized, adminsOnly);
if(!success) return false;
this.groupMetadata.announce &#x3D; adminsOnly;
return true;
}
/**
* Updates the group settings to only allow admins to edit group info (title, description, photo).
* @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.
*/
async setInfoAdminsOnly(adminsOnly&#x3D;true) {
const success &#x3D; await this.client.pupPage.evaluate(async (chatId, adminsOnly) &#x3D;&gt; {
const chatWid &#x3D; window.Store.WidFactory.createWid(chatId);
try {
return await window.Store.GroupUtils.sendSetGroupProperty(chatWid, &#x27;restrict&#x27;, adminsOnly ? 1 : 0);
} catch (err) {
if(err.name &#x3D;&#x3D;&#x3D; &#x27;ServerStatusCodeError&#x27;) return false;
throw err;
}
}, this.id._serialized, adminsOnly);
if(!success) return false;
this.groupMetadata.restrict &#x3D; adminsOnly;
return true;
} }
/** /**
* Gets the invite code for a specific group * Gets the invite code for a specific group
* @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 code &#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.sendQueryGroupInviteCode(chatWid);
}, this.id._serialized); }, this.id._serialized);
if (res.status &#x3D;&#x3D; 200) { return 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&amp;lt;string&gt;} New invite code
*/ */
async revokeInvite() { async revokeInvite() {
return await this.client.pupPage.evaluate(chatId &#x3D;&gt; { const code &#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.sendRevokeGroupInviteCode(chatWid);
}, this.id._serialized); }, this.id._serialized);
}
/** return code;
* Returns an object with information about the invite code&#x27;s group
* @param {string} inviteCode
* @returns {Promise&amp;lt;object&gt;} Invite information
*/
static async getInviteInfo(inviteCode) {
return await this.client.pupPage.evaluate(inviteCode &#x3D;&gt; {
return window.Store.Wap.groupInviteInfo(inviteCode);
}, inviteCode);
}
/**
* Joins a group with an invite code
* @param {string} inviteCode
*/
static async join(inviteCode) {
return await this.client.pupPage.evaluate(inviteCode &#x3D;&gt; {
return window.Store.Wap.acceptGroupInvite(inviteCode);
}, inviteCode);
} }
/** /**
* Makes the bot leave the group * Makes the bot leave the group
* @returns {Promise}
*/ */
async leave() { async leave() {
return await this.client.pupPage.evaluate(chatId &#x3D;&gt; { await this.client.pupPage.evaluate(chatId &#x3D;&gt; {
return window.Store.Wap.leaveGroup(chatId); const chatWid &#x3D; window.Store.WidFactory.createWid(chatId);
return window.Store.GroupUtils.sendExitGroup(chatWid);
}, this.id._serialized); }, this.id._serialized);
} }
@@ -209,7 +272,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.3 on March 13, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on November 26, 2022.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.3"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.2.3 &raquo; Source: structures/GroupNotification.js</title> <title>whatsapp-web.js 1.18.4 &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>2.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>18.<wbr>4</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.3 on March 13, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on November 26, 2022.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -0,0 +1,103 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.18.4 &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/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>18.<wbr>4</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/Label.js</h1>
</header>
<article>
<pre class="prettyprint linenums"><code>&#x27;use strict&#x27;;
const Base &#x3D; require(&#x27;./Base&#x27;);
// eslint-disable-next-line no-unused-vars
const Chat &#x3D; require(&#x27;./Chat&#x27;);
/**
* WhatsApp Business Label information
*/
class Label extends Base {
/**
* @param {Base} client
* @param {object} labelData
*/
constructor(client, labelData){
super(client);
if(labelData) this._patch(labelData);
}
_patch(labelData){
/**
* Label ID
* @type {string}
*/
this.id &#x3D; labelData.id;
/**
* Label name
* @type {string}
*/
this.name &#x3D; labelData.name;
/**
* Label hex color
* @type {string}
*/
this.hexColor &#x3D; labelData.hexColor;
}
/**
* Get all chats that have been assigned this Label
* @returns {Promise&amp;lt;Array&amp;lt;Chat&gt;&gt;}
*/
async getChats(){
return this.client.getChatsByLabelId(this.id);
}
}
module.exports &#x3D; Label;</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 November 26, 2022.
</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,133 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.18.4 &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/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>18.<wbr>4</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/List.js</h1>
</header>
<article>
<pre class="prettyprint linenums"><code>&#x27;use strict&#x27;;
const Util &#x3D; require(&#x27;../util/Util&#x27;);
/**
* Message type List
*/
class List {
/**
* @param {string} body
* @param {string} buttonText
* @param {Array&amp;lt;any&gt;} sections
* @param {string?} title
* @param {string?} footer
*/
constructor(body, buttonText, sections, title, footer) {
/**
* Message body
* @type {string}
*/
this.description &#x3D; body;
/**
* List button text
* @type {string}
*/
this.buttonText &#x3D; buttonText;
/**
* title of message
* @type {string}
*/
this.title &#x3D; title;
/**
* footer of message
* @type {string}
*/
this.footer &#x3D; footer;
/**
* sections of message
* @type {Array&amp;lt;any&gt;}
*/
this.sections &#x3D; this._format(sections);
}
/**
* Creates section array from simple array
* @param {Array&amp;lt;any&gt;} sections
* @returns {Array&amp;lt;any&gt;}
* @example
* Input: [{title:&#x27;sectionTitle&#x27;,rows:[{id:&#x27;customId&#x27;, title:&#x27;ListItem2&#x27;, description: &#x27;desc&#x27;},{title:&#x27;ListItem2&#x27;}]}}]
* Returns: [{&#x27;title&#x27;:&#x27;sectionTitle&#x27;,&#x27;rows&#x27;:[{&#x27;rowId&#x27;:&#x27;customId&#x27;,&#x27;title&#x27;:&#x27;ListItem1&#x27;,&#x27;description&#x27;:&#x27;desc&#x27;},{&#x27;rowId&#x27;:&#x27;oGSRoD&#x27;,&#x27;title&#x27;:&#x27;ListItem2&#x27;,&#x27;description&#x27;:&#x27;&#x27;}]}]
*/
_format(sections){
if(!sections.length){throw &#x27;[LT02] List without sections&#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;{
if(!section.rows.length){throw &#x27;[LT03] Section without rows&#x27;;}
return {
title: section.title ? section.title : undefined,
rows: section.rows.map( (row) &#x3D;&gt; {
if(!row.title){throw &#x27;[LT04] Row without title&#x27;;}
return {
rowId: row.id ? row.id : Util.generateHash(6),
title: row.title,
description: row.description ? row.description : &#x27;&#x27;
};
})
};
});
}
}
module.exports &#x3D; List;
</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 November 26, 2022.
</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

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.3"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.2.3 &raquo; Source: structures/Location.js</title> <title>whatsapp-web.js 1.18.4 &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>2.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>18.<wbr>4</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.3 on March 13, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on November 26, 2022.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.3"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.2.3 &raquo; Source: structures/Message.js</title> <title>whatsapp-web.js 1.18.4 &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>2.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>18.<wbr>4</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -34,6 +34,8 @@
const Base &#x3D; require(&#x27;./Base&#x27;); const Base &#x3D; require(&#x27;./Base&#x27;);
const MessageMedia &#x3D; require(&#x27;./MessageMedia&#x27;); const MessageMedia &#x3D; require(&#x27;./MessageMedia&#x27;);
const Location &#x3D; require(&#x27;./Location&#x27;); const Location &#x3D; require(&#x27;./Location&#x27;);
const Order &#x3D; require(&#x27;./Order&#x27;);
const Payment &#x3D; require(&#x27;./Payment&#x27;);
const { MessageTypes } &#x3D; require(&#x27;../util/Constants&#x27;); const { MessageTypes } &#x3D; require(&#x27;../util/Constants&#x27;);
/** /**
@@ -44,21 +46,35 @@ class Message extends Base {
constructor(client, data) { constructor(client, data) {
super(client); super(client);
if(data) this._patch(data); if (data) this._patch(data);
} }
_patch(data) { _patch(data) {
this._data &#x3D; data;
/**
* MediaKey that represents the sticker &#x27;ID&#x27;
* @type {string}
*/
this.mediaKey &#x3D; data.mediaKey;
/** /**
* ID that represents the message * ID that represents the message
* @type {object} * @type {object}
*/ */
this.id &#x3D; data.id; this.id &#x3D; data.id;
/**
* ACK status for the message
* @type {MessageAck}
*/
this.ack &#x3D; data.ack;
/** /**
* Indicates if the message has media available for download * Indicates if the message has media available for download
* @type {boolean} * @type {boolean}
*/ */
this.hasMedia &#x3D; data.clientUrl ? true : false; this.hasMedia &#x3D; Boolean(data.mediaKey &amp;amp;&amp;amp; data.directPath);
/** /**
* Message content * Message content
@@ -66,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}
*/ */
@@ -82,22 +98,28 @@ class Message extends Base {
* 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.
* @type {string} * @type {string}
*/ */
this.from &#x3D; typeof (data.from) &#x3D;&#x3D;&#x3D; &#x27;object&#x27; ? data.from._serialized : data.from; this.from &#x3D; (typeof (data.from) &#x3D;&#x3D;&#x3D; &#x27;object&#x27; &amp;amp;&amp;amp; data.from !&#x3D;&#x3D; null) ? data.from._serialized : data.from;
/** /**
* 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; ? 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;
/** /**
* 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.
* @type {string} * @type {string}
*/ */
this.author &#x3D; typeof (data.author) &#x3D;&#x3D;&#x3D; &#x27;object&#x27; ? data.author._serialized : data.author; this.author &#x3D; (typeof (data.author) &#x3D;&#x3D;&#x3D; &#x27;object&#x27; &amp;amp;&amp;amp; data.author !&#x3D;&#x3D; null) ? data.author._serialized : data.author;
/**
* String that represents from which device type the message was sent
* @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;;
/** /**
* Indicates if the message was forwarded * Indicates if the message was forwarded
@@ -105,30 +127,75 @@ class Message extends Base {
*/ */
this.isForwarded &#x3D; data.isForwarded; this.isForwarded &#x3D; data.isForwarded;
/**
* Indicates how many times the message was forwarded.
*
* The maximum value is 127.
* @type {number}
*/
this.forwardingScore &#x3D; data.forwardingScore || 0;
/**
* Indicates if the message is a status update
* @type {boolean}
*/
this.isStatus &#x3D; data.isStatusV3;
/**
* Indicates if the message was starred
* @type {boolean}
*/
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}
*/ */
this.fromMe &#x3D; data.id.fromMe; this.fromMe &#x3D; data.id.fromMe;
/** /**
* Indicates if the message was sent as a reply to another message. * Indicates if the message was sent as a reply to another message.
* @type {boolean} * @type {boolean}
*/ */
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}
*/ */
this.location &#x3D; data.type &#x3D;&#x3D;&#x3D; MessageTypes.LOCATION ? new Location(data.lat, data.lng, data.loc) : undefined; this.location &#x3D; data.type &#x3D;&#x3D;&#x3D; MessageTypes.LOCATION ? new Location(data.lat, data.lng, data.loc) : undefined;
/**
* List of vCards contained in the message.
* @type {Array&amp;lt;string&gt;}
*/
this.vCards &#x3D; data.type &#x3D;&#x3D;&#x3D; MessageTypes.CONTACT_CARD_MULTI ? data.vcardList.map((c) &#x3D;&gt; c.vcard) : data.type &#x3D;&#x3D;&#x3D; MessageTypes.CONTACT_CARD ? [data.body] : [];
/**
* Group Invite Data
* @type {object}
*/
this.inviteV4 &#x3D; data.type &#x3D;&#x3D;&#x3D; MessageTypes.GROUP_INVITE ? {
inviteCode: data.inviteCode,
inviteCodeExp: data.inviteCodeExp,
groupId: data.inviteGrp,
groupName: data.inviteGrpName,
fromId: data.from._serialized,
toId: data.to._serialized
} : 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;}
@@ -139,6 +206,71 @@ class Message extends Base {
this.mentionedIds &#x3D; data.mentionedJidList; this.mentionedIds &#x3D; data.mentionedJidList;
} }
/**
* Order ID for message type ORDER
* @type {string}
*/
this.orderId &#x3D; data.orderId ? data.orderId : undefined;
/**
* Order Token for message type ORDER
* @type {string}
*/
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 */
if (data.title) {
this.title &#x3D; data.title;
}
/** Description */
if (data.description) {
this.description &#x3D; data.description;
}
/** Business Owner JID */
if (data.businessOwnerJid) {
this.businessOwnerJid &#x3D; data.businessOwnerJid;
}
/** Product ID */
if (data.productId) {
this.productId &#x3D; data.productId;
}
/**
* Links included in the message.
* @type {Array&amp;lt;{link: string, isSuspicious: boolean}&gt;}
*
*/
this.links &#x3D; data.links;
/** Buttons */
if (data.dynamicReplyButtons) {
this.dynamicReplyButtons &#x3D; data.dynamicReplyButtons;
}
/** Selected Button Id **/
if (data.selectedButtonId) {
this.selectedButtonId &#x3D; data.selectedButtonId;
}
/** Selected List row Id **/
if (data.listResponse &amp;amp;&amp;amp; data.listResponse.singleSelectReply.selectedRowId) {
this.selectedRowId &#x3D; data.listResponse.singleSelectReply.selectedRowId;
}
return super._patch(data); return super._patch(data);
} }
@@ -146,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;}
@@ -178,24 +336,25 @@ 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 {object} options * @param {MessageSendOptions} [options]
* @returns {Promise&amp;lt;Message&gt;} * @returns {Promise&amp;lt;Message&gt;}
*/ */
async reply(content, chatId, options&#x3D;{}) { async reply(content, chatId, options &#x3D; {}) {
if (!chatId) { if (!chatId) {
chatId &#x3D; this._getChatId(); chatId &#x3D; this._getChatId();
} }
@@ -208,6 +367,45 @@ 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
* @returns {Promise&amp;lt;Object&gt;}
*/
async acceptGroupV4Invite() {
return await this.client.acceptGroupV4Invite(this.inviteV4);
}
/**
* 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
* @returns {Promise}
*/
async forward(chat) {
const chatId &#x3D; typeof chat &#x3D;&#x3D;&#x3D; &#x27;string&#x27; ? chat : chat.id._serialized;
await this.client.pupPage.evaluate(async (msgId, chatId) &#x3D;&gt; {
let msg &#x3D; window.Store.Msg.get(msgId);
let chat &#x3D; window.Store.Chat.get(chatId);
return await chat.forwardMessages([msg]);
}, this.id._serialized, chatId);
}
/** /**
* Downloads and returns the attatched message media * Downloads and returns the attatched message media
* @returns {Promise&amp;lt;MessageMedia&gt;} * @returns {Promise&amp;lt;MessageMedia&gt;}
@@ -217,38 +415,149 @@ class Message extends Base {
return undefined; return undefined;
} }
const {data, mimetype, filename} &#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);
const buffer &#x3D; await window.WWebJS.downloadBuffer(msg.clientUrl);
const decrypted &#x3D; await window.Store.CryptoLib.decryptE2EMedia(msg.type, buffer, msg.mediaKey, msg.mimetype);
const data &#x3D; await window.WWebJS.readBlobAsync(decrypted._blob);
return {
data: data.split(&#x27;,&#x27;)[1],
mimetype: msg.mimetype,
filename: msg.filename
};
if (msg.mediaData.mediaStage !&#x3D; &#x27;RESOLVED&#x27;) {
// try to resolve media
await msg.downloadMedia({
downloadEvenIfExpensive: true,
rmrReason: 1
});
}
if (msg.mediaData.mediaStage.includes(&#x27;ERROR&#x27;) || msg.mediaData.mediaStage &#x3D;&#x3D;&#x3D; &#x27;FETCHING&#x27;) {
// media could not be downloaded
return undefined;
}
try {
const decryptedMedia &#x3D; await window.Store.DownloadManager.downloadAndDecrypt({
directPath: msg.directPath,
encFilehash: msg.encFilehash,
filehash: msg.filehash,
mediaKey: msg.mediaKey,
mediaKeyTimestamp: msg.mediaKeyTimestamp,
type: msg.type,
signal: (new AbortController).signal
});
const data &#x3D; await window.WWebJS.arrayBufferToBase64Async(decryptedMedia);
return {
data,
mimetype: msg.mimetype,
filename: msg.filename,
filesize: msg.size
};
} catch (e) {
if(e.status &amp;amp;&amp;amp; e.status &#x3D;&#x3D;&#x3D; 404) return undefined;
throw e;
}
}, this.id._serialized); }, this.id._serialized);
return new MessageMedia(mimetype, data, filename); if (!result) return undefined;
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);
}, this.id._serialized, everyone); }, this.id._serialized, everyone);
} }
/**
* Stars this message
*/
async star() {
await this.client.pupPage.evaluate((msgId) &#x3D;&gt; {
let msg &#x3D; window.Store.Msg.get(msgId);
if (window.Store.MsgActionChecks.canStarMsg(msg)) {
return window.Store.Cmd.sendStarMsgs(msg.chat, [msg], false);
}
}, this.id._serialized);
}
/**
* Unstars this message
*/
async unstar() {
await this.client.pupPage.evaluate((msgId) &#x3D;&gt; {
let msg &#x3D; window.Store.Msg.get(msgId);
if (window.Store.MsgActionChecks.canStarMsg(msg)) {
return window.Store.Cmd.sendUnstarMsgs(msg.chat, [msg], false);
}
}, this.id._serialized);
}
/**
* Message Info
* @typedef {Object} MessageInfo
* @property {Array&amp;lt;{id: ContactId, t: number}&gt;} delivery Contacts to which the message has been delivered to
* @property {number} deliveryRemaining Amount of people to whom the message has not been delivered to
* @property {Array&amp;lt;{id: ContactId, t: number}&gt;} played Contacts who have listened to the voice message
* @property {number} playedRemaining Amount of people who have not listened to the message
* @property {Array&amp;lt;{id: ContactId, t: number}&gt;} read Contacts who have read the message
* @property {number} readRemaining Amount of people who have not read the message
*/
/**
* Get information about message delivery status. May return null if the message does not exist or is not sent by you.
* @returns {Promise&amp;lt;?MessageInfo&gt;}
*/
async getInfo() {
const info &#x3D; await this.client.pupPage.evaluate(async (msgId) &#x3D;&gt; {
const msg &#x3D; window.Store.Msg.get(msgId);
if (!msg) return null;
return await window.Store.MessageInfo.sendQueryMsgInfo(msg);
}, this.id._serialized);
return info;
}
/**
* Gets the order associated with a given message
* @return {Promise&amp;lt;Order&gt;}
*/
async getOrder() {
if (this.type &#x3D;&#x3D;&#x3D; MessageTypes.ORDER) {
const result &#x3D; await this.client.pupPage.evaluate((orderId, token, chatId) &#x3D;&gt; {
return window.WWebJS.getOrderDetail(orderId, token, chatId);
}, this.orderId, this.token, this._getChatId());
if (!result) return undefined;
return new Order(this.client, result);
}
return undefined;
}
/**
* Gets the payment details associated with a given message
* @return {Promise&amp;lt;Payment&gt;}
*/
async getPayment() {
if (this.type &#x3D;&#x3D;&#x3D; MessageTypes.PAYMENT) {
const msg &#x3D; await this.client.pupPage.evaluate(async (msgId) &#x3D;&gt; {
const msg &#x3D; window.Store.Msg.get(msgId);
if(!msg) return null;
return msg.serialize();
}, this.id._serialized);
return new Payment(this.client, msg);
}
return undefined;
}
} }
module.exports &#x3D; Message; module.exports &#x3D; Message;
@@ -262,7 +571,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.3 on March 13, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on November 26, 2022.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.3"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.2.3 &raquo; Source: structures/MessageMedia.js</title> <title>whatsapp-web.js 1.18.4 &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>2.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>18.<wbr>4</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -31,14 +31,21 @@
<article> <article>
<pre class="prettyprint linenums"><code>&#x27;use strict&#x27;; <pre class="prettyprint linenums"><code>&#x27;use strict&#x27;;
const fs &#x3D; require(&#x27;fs&#x27;);
const path &#x3D; require(&#x27;path&#x27;);
const mime &#x3D; require(&#x27;mime&#x27;);
const fetch &#x3D; require(&#x27;node-fetch&#x27;);
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}
@@ -52,14 +59,88 @@ 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;
}
/**
* Creates a MessageMedia instance from a local file path
* @param {string} filePath
* @returns {MessageMedia}
*/
static fromFilePath(filePath) {
const b64data &#x3D; fs.readFileSync(filePath, {encoding: &#x27;base64&#x27;});
const mimetype &#x3D; mime.getType(filePath);
const filename &#x3D; path.basename(filePath);
return new MessageMedia(mimetype, b64data, filename);
}
/**
* Creates a MessageMedia instance from a URL
* @param {string} url
* @param {Object} [options]
* @param {boolean} [options.unsafeMime&#x3D;false]
* @param {string} [options.filename]
* @param {object} [options.client]
* @param {object} [options.reqOptions]
* @param {number} [options.reqOptions.size&#x3D;0]
* @returns {Promise&amp;lt;MessageMedia&gt;}
*/
static async fromUrl(url, options &#x3D; {}) {
const pUrl &#x3D; new URL(url);
let mimetype &#x3D; mime.getType(pUrl.pathname);
if (!mimetype &amp;amp;&amp;amp; !options.unsafeMime)
throw new Error(&#x27;Unable to determine MIME type using URL. Set unsafeMime to true to download it anyway.&#x27;);
async function fetchData (url, options) {
const reqOptions &#x3D; Object.assign({ headers: { accept: &#x27;image/* video/* text/* audio/*&#x27; } }, options);
const response &#x3D; await fetch(url, reqOptions);
const mime &#x3D; response.headers.get(&#x27;Content-Type&#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) {
data &#x3D; (await response.buffer()).toString(&#x27;base64&#x27;);
} else {
const bArray &#x3D; new Uint8Array(await response.arrayBuffer());
bArray.forEach((b) &#x3D;&gt; {
data +&#x3D; String.fromCharCode(b);
});
data &#x3D; btoa(data);
}
return { data, mime, name, size };
}
const res &#x3D; options.client
? (await options.client.pupPage.evaluate(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)
mimetype &#x3D; res.mime;
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>
@@ -69,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.3 on March 13, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on November 26, 2022.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -0,0 +1,105 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.18.4 &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/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>18.<wbr>4</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/Order.js</h1>
</header>
<article>
<pre class="prettyprint linenums"><code>&#x27;use strict&#x27;;
const Base &#x3D; require(&#x27;./Base&#x27;);
const Product &#x3D; require(&#x27;./Product&#x27;);
/**
* Represents a Order on WhatsApp
* @extends {Base}
*/
class Order extends Base {
constructor(client, data) {
super(client);
if (data) this._patch(data);
}
_patch(data) {
/**
* List of products
* @type {Array&amp;lt;Product&gt;}
*/
if (data.products) {
this.products &#x3D; data.products.map(product &#x3D;&gt; new Product(this.client, product));
}
/**
* Order Subtotal
* @type {string}
*/
this.subtotal &#x3D; data.subtotal;
/**
* Order Total
* @type {string}
*/
this.total &#x3D; data.total;
/**
* Order Currency
* @type {string}
*/
this.currency &#x3D; data.currency;
/**
* Order Created At
* @type {number}
*/
this.createdAt &#x3D; data.createdAt;
return super._patch(data);
}
}
module.exports &#x3D; Order;</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 November 26, 2022.
</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,133 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.18.4 &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/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>18.<wbr>4</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/Payment.js</h1>
</header>
<article>
<pre class="prettyprint linenums"><code>const Base &#x3D; require(&#x27;./Base&#x27;);
class Payment extends Base {
constructor(client, data) {
super(client);
if (data) this._patch(data);
}
_patch(data) {
/**
* The payment Id
* @type {object}
*/
this.id &#x3D; data.id;
/**
* The payment currency
* @type {string}
*/
this.paymentCurrency &#x3D; data.paymentCurrency;
/**
* The payment ammount ( R$ 1.00 &#x3D; 1000 )
* @type {number}
*/
this.paymentAmount1000 &#x3D; data.paymentAmount1000;
/**
* The payment receiver
* @type {object}
*/
this.paymentMessageReceiverJid &#x3D; data.paymentMessageReceiverJid;
/**
* The payment transaction timestamp
* @type {number}
*/
this.paymentTransactionTimestamp &#x3D; data.paymentTransactionTimestamp;
/**
* The paymentStatus
*
* Possible Status
* 0:UNKNOWN_STATUS
* 1:PROCESSING
* 2:SENT
* 3:NEED_TO_ACCEPT
* 4:COMPLETE
* 5:COULD_NOT_COMPLETE
* 6:REFUNDED
* 7:EXPIRED
* 8:REJECTED
* 9:CANCELLED
* 10:WAITING_FOR_PAYER
* 11:WAITING
*
* @type {number}
*/
this.paymentStatus &#x3D; data.paymentStatus;
/**
* Integer that represents the payment Text
* @type {number}
*/
this.paymentTxnStatus &#x3D; data.paymentTxnStatus;
/**
* The note sent with the payment
* @type {string}
*/
this.paymentNote &#x3D; !data.paymentNoteMsg ? undefined : data.paymentNoteMsg.body ? data.paymentNoteMsg.body : undefined ;
return super._patch(data);
}
}
module.exports &#x3D; Payment;
</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 November 26, 2022.
</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

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.3"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.2.3 &raquo; Source: structures/PrivateChat.js</title> <title>whatsapp-web.js 1.18.4 &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>2.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>18.<wbr>4</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.3 on March 13, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on November 26, 2022.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.3"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.2.3 &raquo; Source: structures/PrivateContact.js</title> <title>whatsapp-web.js 1.18.4 &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>2.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>18.<wbr>4</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.3 on March 13, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on November 26, 2022.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -0,0 +1,121 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.18.4 &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/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>18.<wbr>4</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/Product.js</h1>
</header>
<article>
<pre class="prettyprint linenums"><code>&#x27;use strict&#x27;;
const Base &#x3D; require(&#x27;./Base&#x27;);
const ProductMetadata &#x3D; require(&#x27;./ProductMetadata&#x27;);
/**
* Represents a Product on WhatsAppBusiness
* @extends {Base}
*/
class Product extends Base {
constructor(client, data) {
super(client);
if (data) this._patch(data);
}
_patch(data) {
/**
* Product ID
* @type {string}
*/
this.id &#x3D; data.id;
/**
* Price
* @type {string}
*/
this.price &#x3D; data.price ? data.price : &#x27;&#x27;;
/**
* Product Thumbnail
* @type {string}
*/
this.thumbnailUrl &#x3D; data.thumbnailUrl;
/**
* Currency
* @type {string}
*/
this.currency &#x3D; data.currency;
/**
* Product Name
* @type {string}
*/
this.name &#x3D; data.name;
/**
* Product Quantity
* @type {number}
*/
this.quantity &#x3D; data.quantity;
/** Product metadata */
this.data &#x3D; null;
return super._patch(data);
}
async getData() {
if (this.data &#x3D;&#x3D;&#x3D; null) {
let result &#x3D; await this.client.pupPage.evaluate((productId) &#x3D;&gt; {
return window.WWebJS.getProductMetadata(productId);
}, this.id);
if (!result) {
this.data &#x3D; undefined;
} else {
this.data &#x3D; new ProductMetadata(this.client, result);
}
}
return this.data;
}
}
module.exports &#x3D; Product;</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 November 26, 2022.
</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,78 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.18.4 &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/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>18.<wbr>4</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/ProductMetadata.js</h1>
</header>
<article>
<pre class="prettyprint linenums"><code>const Base &#x3D; require(&#x27;./Base&#x27;);
class ProductMetadata extends Base {
constructor(client, data) {
super(client);
if (data) this._patch(data);
}
_patch(data) {
/** Product ID */
this.id &#x3D; data.id;
/** Retailer ID */
this.retailer_id &#x3D; data.retailer_id;
/** Product Name */
this.name &#x3D; data.name;
/** Product Description */
this.description &#x3D; data.description;
return super._patch(data);
}
}
module.exports &#x3D; ProductMetadata;</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 November 26, 2022.
</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,122 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.18.4 &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>18.<wbr>4</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 November 26, 2022.
</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

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.3"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.2.3 &raquo; Source: util/Constants.js</title> <title>whatsapp-web.js 1.18.4 &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>2.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>18.<wbr>4</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -33,13 +33,18 @@
exports.WhatsWebURL &#x3D; &#x27;https://web.whatsapp.com/&#x27;; exports.WhatsWebURL &#x3D; &#x27;https://web.whatsapp.com/&#x27;;
exports.UserAgent &#x3D; &#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;;
exports.DefaultOptions &#x3D; { exports.DefaultOptions &#x3D; {
puppeteer: { puppeteer: {
headless: true headless: true,
defaultViewport: null
}, },
session: false authTimeoutMs: 0,
qrMaxRetries: 0,
takeoverOnConflict: false,
takeoverTimeoutMs: 0,
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;,
bypassCSP: false
}; };
/** /**
@@ -67,12 +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;,
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;,
INCOMING_CALL: &#x27;incoming_call&#x27;,
REMOTE_SESSION_SAVED: &#x27;remote_session_saved&#x27;
}; };
/** /**
@@ -91,8 +102,31 @@ exports.MessageTypes &#x3D; {
LOCATION: &#x27;location&#x27;, LOCATION: &#x27;location&#x27;,
CONTACT_CARD: &#x27;vcard&#x27;, CONTACT_CARD: &#x27;vcard&#x27;,
CONTACT_CARD_MULTI: &#x27;multi_vcard&#x27;, CONTACT_CARD_MULTI: &#x27;multi_vcard&#x27;,
ORDER: &#x27;order&#x27;,
REVOKED: &#x27;revoked&#x27;, REVOKED: &#x27;revoked&#x27;,
UNKNOWN: &#x27;unknown&#x27; PRODUCT: &#x27;product&#x27;,
UNKNOWN: &#x27;unknown&#x27;,
GROUP_INVITE: &#x27;groups_v4_invite&#x27;,
LIST: &#x27;list&#x27;,
LIST_RESPONSE: &#x27;list_response&#x27;,
BUTTONS_RESPONSE: &#x27;buttons_response&#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;,
}; };
/** /**
@@ -166,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.3 on March 13, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on November 26, 2022.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -0,0 +1,175 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.18.4 &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/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>18.<wbr>4</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: util/InterfaceController.js</h1>
</header>
<article>
<pre class="prettyprint linenums"><code>&#x27;use strict&#x27;;
/**
* Interface Controller
*/
class InterfaceController {
constructor(props) {
this.pupPage &#x3D; props.pupPage;
}
/**
* Opens the Chat Window
* @param {string} chatId ID of the chat window that will be opened
*/
async openChatWindow(chatId) {
await this.pupPage.evaluate(async chatId &#x3D;&gt; {
let chatWid &#x3D; window.Store.WidFactory.createWid(chatId);
let chat &#x3D; await window.Store.Chat.find(chatWid);
await window.Store.Cmd.openChatAt(chat);
}, chatId);
}
/**
* Opens the Chat Drawer
* @param {string} chatId ID of the chat drawer that will be opened
*/
async openChatDrawer(chatId) {
await this.pupPage.evaluate(async chatId &#x3D;&gt; {
let chat &#x3D; await window.Store.Chat.get(chatId);
await window.Store.Cmd.openDrawerMid(chat);
}, chatId);
}
/**
* Opens the Chat Search
* @param {string} chatId ID of the chat search that will be opened
*/
async openChatSearch(chatId) {
await this.pupPage.evaluate(async chatId &#x3D;&gt; {
let chat &#x3D; await window.Store.Chat.get(chatId);
await window.Store.Cmd.chatSearch(chat);
}, chatId);
}
/**
* Opens or Scrolls the Chat Window to the position of the message
* @param {string} msgId ID of the message that will be scrolled to
*/
async openChatWindowAt(msgId) {
await this.pupPage.evaluate(async msgId &#x3D;&gt; {
let msg &#x3D; await window.Store.Msg.get(msgId);
await window.Store.Cmd.openChatAt(msg.chat, msg.chat.getSearchContext(msg));
}, msgId);
}
/**
* Opens the Message Drawer
* @param {string} msgId ID of the message drawer that will be opened
*/
async openMessageDrawer(msgId) {
await this.pupPage.evaluate(async msgId &#x3D;&gt; {
let msg &#x3D; await window.Store.Msg.get(msgId);
await window.Store.Cmd.msgInfoDrawer(msg);
}, msgId);
}
/**
* Closes the Right Drawer
*/
async closeRightDrawer() {
await this.pupPage.evaluate(async () &#x3D;&gt; {
await window.Store.Cmd.closeDrawerRight();
});
}
/**
* Get all Features
*/
async getFeatures() {
return await this.pupPage.evaluate(() &#x3D;&gt; {
return window.Store.Features.F;
});
}
/**
* Check if Feature is enabled
* @param {string} feature status to check
*/
async checkFeatureStatus(feature) {
return await this.pupPage.evaluate((feature) &#x3D;&gt; {
return window.Store.Features.supportsFeature(feature);
}, feature);
}
/**
* Enable Features
* @param {string[]} features to be enabled
*/
async enableFeatures(features) {
await this.pupPage.evaluate((features) &#x3D;&gt; {
for (const feature in features) {
window.Store.Features.setFeature(features[feature], true);
}
}, features);
}
/**
* Disable Features
* @param {string[]} features to be disabled
*/
async disableFeatures(features) {
await this.pupPage.evaluate((features) &#x3D;&gt; {
for (const feature in features) {
window.Store.Features.setFeature(features[feature], false);
}
}, features);
}
}
module.exports &#x3D; InterfaceController;
</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 November 26, 2022.
</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

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.3"> <meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.2.3 &raquo; Source: util/Util.js</title> <title>whatsapp-web.js 1.18.4 &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>2.<wbr>3</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>18.<wbr>4</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -31,17 +31,32 @@
<article> <article>
<pre class="prettyprint linenums"><code>&#x27;use strict&#x27;; <pre class="prettyprint linenums"><code>&#x27;use strict&#x27;;
const path &#x3D; require(&#x27;path&#x27;);
const Crypto &#x3D; require(&#x27;crypto&#x27;);
const { tmpdir } &#x3D; require(&#x27;os&#x27;);
const ffmpeg &#x3D; require(&#x27;fluent-ffmpeg&#x27;);
const webp &#x3D; require(&#x27;node-webpmux&#x27;);
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;);
} }
static generateHash(length) {
var result &#x3D; &#x27;&#x27;;
var characters &#x3D; &#x27;ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789&#x27;;
var charactersLength &#x3D; characters.length;
for (var i &#x3D; 0; i &amp;lt; length; i++) {
result +&#x3D; characters.charAt(Math.floor(Math.random() * charactersLength));
}
return result;
}
/** /**
* Sets default properties on an object that aren&#x27;t already specified. * Sets default properties on an object that aren&#x27;t already specified.
* @param {Object} def Default properties * @param {Object} def Default properties
@@ -61,9 +76,146 @@ class Util {
return given; return given;
} }
/**
* Formats a image to webp
* @param {MessageMedia} media
*
* @returns {Promise&amp;lt;MessageMedia&gt;} media in webp format
*/
static async formatImageToWebpSticker(media, pupPage) {
if (!media.mimetype.includes(&#x27;image&#x27;))
throw new Error(&#x27;media is not a image&#x27;);
if (media.mimetype.includes(&#x27;webp&#x27;)) {
return media;
}
return pupPage.evaluate((media) &#x3D;&gt; {
return window.WWebJS.toStickerData(media);
}, media);
}
/**
* Formats a video to webp
* @param {MessageMedia} media
*
* @returns {Promise&amp;lt;MessageMedia&gt;} media in webp format
*/
static async formatVideoToWebpSticker(media) {
if (!media.mimetype.includes(&#x27;video&#x27;))
throw new Error(&#x27;media is not a video&#x27;);
const videoType &#x3D; media.mimetype.split(&#x27;/&#x27;)[1];
const tempFile &#x3D; path.join(
tmpdir(),
&#x60;${Crypto.randomBytes(6).readUIntLE(0, 6).toString(36)}.webp&#x60;
);
const stream &#x3D; new (require(&#x27;stream&#x27;).Readable)();
const buffer &#x3D; Buffer.from(
media.data.replace(&#x60;data:${media.mimetype};base64,&#x60;, &#x27;&#x27;),
&#x27;base64&#x27;
);
stream.push(buffer);
stream.push(null);
await new Promise((resolve, reject) &#x3D;&gt; {
ffmpeg(stream)
.inputFormat(videoType)
.on(&#x27;error&#x27;, reject)
.on(&#x27;end&#x27;, () &#x3D;&gt; resolve(true))
.addOutputOptions([
&#x27;-vcodec&#x27;,
&#x27;libwebp&#x27;,
&#x27;-vf&#x27;,
// eslint-disable-next-line no-useless-escape
&#x27;scale&#x3D;\&#x27;iw*min(300/iw\,300/ih)\&#x27;:\&#x27;ih*min(300/iw\,300/ih)\&#x27;,format&#x3D;rgba,pad&#x3D;300:300:\&#x27;(300-iw)/2\&#x27;:\&#x27;(300-ih)/2\&#x27;:\&#x27;#00000000\&#x27;,setsar&#x3D;1,fps&#x3D;10&#x27;,
&#x27;-loop&#x27;,
&#x27;0&#x27;,
&#x27;-ss&#x27;,
&#x27;00:00:00.0&#x27;,
&#x27;-t&#x27;,
&#x27;00:00:05.0&#x27;,
&#x27;-preset&#x27;,
&#x27;default&#x27;,
&#x27;-an&#x27;,
&#x27;-vsync&#x27;,
&#x27;0&#x27;,
&#x27;-s&#x27;,
&#x27;512:512&#x27;,
])
.toFormat(&#x27;webp&#x27;)
.save(tempFile);
});
const data &#x3D; await fs.readFile(tempFile, &#x27;base64&#x27;);
await fs.unlink(tempFile);
return {
mimetype: &#x27;image/webp&#x27;,
data: data,
filename: media.filename,
};
}
/**
* Sticker metadata.
* @typedef {Object} StickerMetadata
* @property {string} [name]
* @property {string} [author]
* @property {string[]} [categories]
*/
/**
* Formats a media to webp
* @param {MessageMedia} media
* @param {StickerMetadata} metadata
*
* @returns {Promise&amp;lt;MessageMedia&gt;} media in webp format
*/
static async formatToWebpSticker(media, metadata, pupPage) {
let webpMedia;
if (media.mimetype.includes(&#x27;image&#x27;))
webpMedia &#x3D; await this.formatImageToWebpSticker(media, pupPage);
else if (media.mimetype.includes(&#x27;video&#x27;))
webpMedia &#x3D; await this.formatVideoToWebpSticker(media);
else
throw new Error(&#x27;Invalid media format&#x27;);
if (metadata.name || metadata.author) {
const img &#x3D; new webp.Image();
const hash &#x3D; this.generateHash(32);
const stickerPackId &#x3D; hash;
const packname &#x3D; metadata.name;
const author &#x3D; metadata.author;
const categories &#x3D; metadata.categories || [&#x27;&#x27;];
const json &#x3D; { &#x27;sticker-pack-id&#x27;: stickerPackId, &#x27;sticker-pack-name&#x27;: packname, &#x27;sticker-pack-publisher&#x27;: author, &#x27;emojis&#x27;: categories };
let exifAttr &#x3D; Buffer.from([0x49, 0x49, 0x2A, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x41, 0x57, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00]);
let jsonBuffer &#x3D; Buffer.from(JSON.stringify(json), &#x27;utf8&#x27;);
let exif &#x3D; Buffer.concat([exifAttr, jsonBuffer]);
exif.writeUIntLE(jsonBuffer.length, 14, 4);
await img.load(Buffer.from(webpMedia.data, &#x27;base64&#x27;));
img.exif &#x3D; exif;
webpMedia.data &#x3D; (await img.save(null)).toString(&#x27;base64&#x27;);
}
return webpMedia;
}
/**
* Configure ffmpeg path
* @param {string} path
*/
static setFfmpegPath(path) {
ffmpeg.setFfmpegPath(path);
}
} }
module.exports &#x3D; Util;</code></pre> module.exports &#x3D; Util;
</code></pre>
</article> </article>
</div> </div>
</div> </div>
@@ -73,7 +225,7 @@ module.exports &#x3D; Util;</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.3 on March 13, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on November 26, 2022.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -1,35 +1,27 @@
const fs = require('fs'); const { Client, Location, List, Buttons, LocalAuth} = require('./index');
const { Client, Location } = 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.
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);
}); });
@@ -40,11 +32,11 @@ client.on('ready', () => {
client.on('message', async msg => { client.on('message', async msg => {
console.log('MESSAGE RECEIVED', msg); console.log('MESSAGE RECEIVED', msg);
if (msg.body == '!ping reply') { if (msg.body === '!ping reply') {
// Send a new message as a reply to the current one // Send a new message as a reply to the current one
msg.reply('pong'); msg.reply('pong');
} else if (msg.body == '!ping') { } else if (msg.body === '!ping') {
// Send a new message to the same chat // Send a new message to the same chat
client.sendMessage(msg.from, 'pong'); client.sendMessage(msg.from, 'pong');
@@ -79,7 +71,7 @@ client.on('message', async msg => {
} else { } else {
msg.reply('This command can only be used in a group!'); msg.reply('This command can only be used in a group!');
} }
} else if (msg.body == '!leave') { } else if (msg.body === '!leave') {
// Leave the group // Leave the group
let chat = await msg.getChat(); let chat = await msg.getChat();
if (chat.isGroup) { if (chat.isGroup) {
@@ -95,7 +87,7 @@ client.on('message', async msg => {
} catch (e) { } catch (e) {
msg.reply('That invite code seems to be invalid.'); msg.reply('That invite code seems to be invalid.');
} }
} else if (msg.body == '!groupinfo') { } else if (msg.body === '!groupinfo') {
let chat = await msg.getChat(); let chat = await msg.getChat();
if (chat.isGroup) { if (chat.isGroup) {
msg.reply(` msg.reply(`
@@ -109,19 +101,18 @@ client.on('message', async msg => {
} else { } else {
msg.reply('This command can only be used in a group!'); msg.reply('This command can only be used in a group!');
} }
} else if (msg.body == '!chats') { } else if (msg.body === '!chats') {
const chats = await client.getChats(); const chats = await client.getChats();
client.sendMessage(msg.from, `The bot has ${chats.length} chats open.`); client.sendMessage(msg.from, `The bot has ${chats.length} chats open.`);
} else if (msg.body == '!info') { } else if (msg.body === '!info') {
let info = client.info; let info = client.info;
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();
msg.reply(` msg.reply(`
*Media info* *Media info*
@@ -129,7 +120,7 @@ client.on('message', async msg => {
Filename: ${attachmentData.filename} Filename: ${attachmentData.filename}
Data (length): ${attachmentData.data.length} Data (length): ${attachmentData.data.length}
`); `);
} else if (msg.body == '!quoteinfo' && msg.hasQuotedMsg) { } else if (msg.body === '!quoteinfo' && msg.hasQuotedMsg) {
const quotedMsg = await msg.getQuotedMessage(); const quotedMsg = await msg.getQuotedMessage();
quotedMsg.reply(` quotedMsg.reply(`
@@ -139,13 +130,13 @@ client.on('message', async msg => {
Timestamp: ${quotedMsg.timestamp} Timestamp: ${quotedMsg.timestamp}
Has Media? ${quotedMsg.hasMedia} Has Media? ${quotedMsg.hasMedia}
`); `);
} else if (msg.body == '!resendmedia' && msg.hasQuotedMsg) { } else if (msg.body === '!resendmedia' && msg.hasQuotedMsg) {
const quotedMsg = await msg.getQuotedMessage(); const quotedMsg = await msg.getQuotedMessage();
if (quotedMsg.hasMedia) { if (quotedMsg.hasMedia) {
const attachmentData = await quotedMsg.downloadMedia(); const attachmentData = await quotedMsg.downloadMedia();
client.sendMessage(msg.from, attachmentData, { caption: 'Here\'s your requested media.' }); client.sendMessage(msg.from, attachmentData, { caption: 'Here\'s your requested media.' });
} }
} else if (msg.body == '!location') { } else if (msg.body === '!location') {
msg.reply(new Location(37.422, -122.084, 'Googleplex\nGoogle Headquarters')); msg.reply(new Location(37.422, -122.084, 'Googleplex\nGoogle Headquarters'));
} else if (msg.location) { } else if (msg.location) {
msg.reply(msg.location); msg.reply(msg.location);
@@ -153,34 +144,59 @@ client.on('message', async msg => {
const newStatus = msg.body.split(' ')[1]; const newStatus = msg.body.split(' ')[1];
await client.setStatus(newStatus); await client.setStatus(newStatus);
msg.reply(`Status was updated to *${newStatus}*`); msg.reply(`Status was updated to *${newStatus}*`);
} else if (msg.body == '!mention') { } else if (msg.body === '!mention') {
const contact = await msg.getContact(); const contact = await msg.getContact();
const chat = await msg.getChat(); const chat = await msg.getChat();
chat.sendMessage(`Hi @${contact.number}!`, { chat.sendMessage(`Hi @${contact.number}!`, {
mentions: [contact] mentions: [contact]
}); });
} else if (msg.body == '!delete' && msg.hasQuotedMsg) { } else if (msg.body === '!delete') {
const quotedMsg = await msg.getQuotedMessage(); if (msg.hasQuotedMsg) {
if (quotedMsg.fromMe) { const quotedMsg = await msg.getQuotedMessage();
quotedMsg.delete(true); if (quotedMsg.fromMe) {
} else { quotedMsg.delete(true);
msg.reply('I can only delete my own messages'); } else {
msg.reply('I can only delete my own messages');
}
} }
} else if (msg.body === '!pin') {
const chat = await msg.getChat();
await chat.pin();
} else if (msg.body === '!archive') { } else if (msg.body === '!archive') {
const chat = await msg.getChat(); const chat = await msg.getChat();
chat.archive(); await chat.archive();
} else if (msg.body === '!mute') {
const chat = await msg.getChat();
// mute the chat for 20 seconds
const unmuteDate = new Date();
unmuteDate.setSeconds(unmuteDate.getSeconds() + 20);
await chat.mute(unmuteDate);
} else if (msg.body === '!typing') { } else if (msg.body === '!typing') {
const chat = await msg.getChat(); const chat = await msg.getChat();
// simulates typing in the chat // simulates typing in the chat
chat.sendStateTyping(); chat.sendStateTyping();
} else if (msg.body === '!recording') { } else if (msg.body === '!recording') {
const chat = await msg.getChat(); const chat = await msg.getChat();
// simulates recording audio in the chat // simulates recording audio in the chat
chat.sendStateRecording(); chat.sendStateRecording();
} else if (msg.body === '!clearstate') { } else if (msg.body === '!clearstate') {
const chat = await msg.getChat(); const chat = await msg.getChat();
// stops typing or recording in the chat // stops typing or recording in the chat
chat.clearState(); chat.clearState();
} else if (msg.body === '!jumpto') {
if (msg.hasQuotedMsg) {
const quotedMsg = await msg.getQuotedMessage();
client.interface.openChatWindowAt(quotedMsg.id._serialized);
}
} else if (msg.body === '!buttons') {
let button = new Buttons('Button body',[{body:'bt1'},{body:'bt2'},{body:'bt3'}],'title','footer');
client.sendMessage(msg.from, button);
} else if (msg.body === '!list') {
let sections = [{title:'sectionTitle',rows:[{title:'ListItem1', description: 'desc'},{title:'ListItem2'}]}];
let list = new List('List body','btnText',sections,'Title','footer');
client.sendMessage(msg.from, list);
} else if (msg.body === '!reaction') {
msg.react('👍');
} }
}); });
@@ -237,6 +253,19 @@ client.on('group_update', (notification) => {
console.log('update', notification); console.log('update', notification);
}); });
client.on('change_state', state => {
console.log('CHANGE STATE', state );
});
// Change to false if you don't want to reject incoming calls
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);
}); });

1369
index.d.ts vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,7 @@
'use strict'; 'use strict';
const Constants = require('./src/util/Constants');
module.exports = { module.exports = {
Client: require('./src/Client'), Client: require('./src/Client'),
@@ -15,5 +17,16 @@ module.exports = {
PrivateContact: require('./src/structures/PrivateContact'), PrivateContact: require('./src/structures/PrivateContact'),
BusinessContact: require('./src/structures/BusinessContact'), BusinessContact: require('./src/structures/BusinessContact'),
ClientInfo: require('./src/structures/ClientInfo'), ClientInfo: require('./src/structures/ClientInfo'),
Location: require('./src/structures/Location') Location: require('./src/structures/Location'),
}; ProductMetadata: require('./src/structures/ProductMetadata'),
List: require('./src/structures/List'),
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
};

1617
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,10 +1,13 @@
{ {
"name": "whatsapp-web.js", "name": "whatsapp-web.js",
"version": "1.2.3", "version": "1.18.4",
"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",
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1", "test": "mocha tests --recursive --timeout 5000",
"test-single": "mocha",
"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"
}, },
"repository": { "repository": {
@@ -24,15 +27,34 @@
"bugs": { "bugs": {
"url": "https://github.com/pedroslopez/whatsapp-web.js/issues" "url": "https://github.com/pedroslopez/whatsapp-web.js/issues"
}, },
"homepage": "https://github.com/pedroslopez/whatsapp-web.js#readme", "homepage": "https://wwebjs.dev/",
"dependencies": { "dependencies": {
"jsqr": "^1.2.0", "@pedroslopez/moduleraid": "^5.0.2",
"moduleraid": "git+https://github.com/pixeldesu/moduleRaid.git", "fluent-ffmpeg": "^2.1.2",
"puppeteer": "^2.1.1" "jsqr": "^1.3.1",
"mime": "^3.0.0",
"node-fetch": "^2.6.5",
"node-webpmux": "^3.1.0",
"puppeteer": "^13.0.0"
}, },
"devDependencies": { "devDependencies": {
"eslint": "^6.8.0", "@types/node-fetch": "^2.5.12",
"jsdoc": "^3.6.3", "chai": "^4.3.4",
"jsdoc-baseline": "^0.1.5" "chai-as-promised": "^7.1.1",
"dotenv": "^16.0.0",
"eslint": "^8.4.1",
"eslint-plugin-mocha": "^10.0.3",
"jsdoc": "^3.6.4",
"jsdoc-baseline": "^0.1.5",
"mocha": "^9.0.2",
"sinon": "^13.0.1"
},
"engines": {
"node": ">=12.0.0"
},
"optionalDependencies": {
"archiver": "^5.3.1",
"fs-extra": "^10.1.0",
"unzipper": "^0.10.11"
} }
} }

36
shell.js Normal file
View File

@@ -0,0 +1,36 @@
/**
* ==== wwebjs-shell ====
* Used for quickly testing library features
*
* Running `npm run shell` will start WhatsApp Web with headless=false
* and then drop you into Node REPL with `client` in its context.
*/
const repl = require('repl');
const { Client, LocalAuth } = require('./index');
const client = new Client({
puppeteer: { headless: false },
authStrategy: new LocalAuth()
});
console.log('Initializing...');
client.initialize();
client.on('qr', () => {
console.log('Please scan the QR code on the browser.');
});
client.on('authenticated', (session) => {
console.log(JSON.stringify(session));
});
client.on('ready', () => {
const shell = repl.start('wwebjs> ');
shell.context.client = client;
shell.on('exit', async () => {
await client.destroy();
});
});

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;

82
src/structures/Buttons.js Normal file
View File

@@ -0,0 +1,82 @@
'use strict';
const MessageMedia = require('./MessageMedia');
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
*/
class Buttons {
/**
* @param {string|MessageMedia} body
* @param {ButtonSpec[]} buttons - See {@link ButtonSpec}
* @param {string?} title
* @param {string?} footer
*/
constructor(body, buttons, title, footer) {
/**
* Message body
* @type {string|MessageMedia}
*/
this.body = body;
/**
* title of message
* @type {string}
*/
this.title = title;
/**
* footer of message
* @type {string}
*/
this.footer = footer;
if (body instanceof MessageMedia) {
this.type = 'media';
this.title = '';
}else{
this.type = 'chat';
}
/**
* buttons of message
* @type {FormattedButtonSpec[]}
*/
this.buttons = this._format(buttons);
if(!this.buttons.length){ throw '[BT01] No buttons';}
}
/**
* Creates button array from simple array
* @param {ButtonSpec[]} buttons
* @returns {FormattedButtonSpec[]}
* @example
* 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}]
*/
_format(buttons){
buttons = buttons.slice(0,3); // phone users can only see 3 buttons, so lets limit this
return buttons.map((btn) => {
return {'buttonId':btn.id ? String(btn.id) : Util.generateHash(6),'buttonText':{'displayText':btn.body},'type':1};
});
}
}
module.exports = Buttons;

76
src/structures/Call.js Normal file
View File

@@ -0,0 +1,76 @@
'use strict';
const Base = require('./Base');
/**
* Represents a Call on WhatsApp
* @extends {Base}
*/
class Call extends Base {
constructor(client, data) {
super(client);
if (data) this._patch(data);
}
_patch(data) {
/**
* Call ID
* @type {string}
*/
this.id = data.id;
/**
* From
* @type {string}
*/
this.from = data.peerJid;
/**
* Unix timestamp for when the call was created
* @type {number}
*/
this.timestamp = data.offerTime;
/**
* Is video
* @type {boolean}
*/
this.isVideo = data.isVideo;
/**
* Is Group
* @type {boolean}
*/
this.isGroup = data.isGroup;
/**
* Indicates if the call was sent by the current user
* @type {boolean}
*/
this.fromMe = data.outgoing;
/**
* Indicates if the call can be handled in waweb
* @type {boolean}
*/
this.canHandleLocally = data.canHandleLocally;
/**
* Indicates if the call Should be handled in waweb
* @type {boolean}
*/
this.webClientShouldHandle = data.webClientShouldHandle;
/**
* Object with participants
* @type {object}
*/
this.participants = data.participants;
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;

View File

@@ -46,7 +46,7 @@ class Chat extends Base {
this.unreadCount = data.unreadCount; this.unreadCount = data.unreadCount;
/** /**
* Unix timestamp for when the chat was created * Unix timestamp for when the last activity occurred
* @type {number} * @type {number}
*/ */
this.timestamp = data.t; this.timestamp = data.t;
@@ -57,13 +57,31 @@ class Chat extends Base {
*/ */
this.archived = data.archive; this.archived = data.archive;
/**
* Indicates if the Chat is pinned
* @type {boolean}
*/
this.pinned = !!data.pin;
/**
* Indicates if the chat is muted or not
* @type {boolean}
*/
this.isMuted = data.isMuted;
/**
* Unix timestamp for when the mute expires
* @type {number}
*/
this.muteExpiration = data.muteExpiration;
return super._patch(data); return super._patch(data);
} }
/** /**
* Send a message to this chat * Send a message to this chat
* @param {string|MessageMedia|Location} content * @param {string|MessageMedia|Location} content
* @param {object} options * @param {MessageSendOptions} [options]
* @returns {Promise<Message>} Message that was just sent * @returns {Promise<Message>} Message that was just sent
*/ */
async sendMessage(content, options) { async sendMessage(content, options) {
@@ -112,36 +130,86 @@ class Chat extends Base {
return this.client.unarchiveChat(this.id._serialized); return this.client.unarchiveChat(this.id._serialized);
} }
/**
* Pins this chat
* @returns {Promise<boolean>} New pin state. Could be false if the max number of pinned chats was reached.
*/
async pin() {
return this.client.pinChat(this.id._serialized);
}
/**
* Unpins this chat
* @returns {Promise<boolean>} New pin state
*/
async unpin() {
return this.client.unpinChat(this.id._serialized);
}
/**
* Mutes this chat forever, unless a date is specified
* @param {?Date} unmuteDate Date at which the Chat will be unmuted, leave as is to mute forever
*/
async mute(unmuteDate) {
return this.client.muteChat(this.id._serialized, unmuteDate);
}
/**
* Unmutes this chat
*/
async unmute() {
return this.client.unmuteChat(this.id._serialized);
}
/**
* Mark this chat as unread
*/
async markUnread(){
return this.client.markChatUnread(this.id._serialized);
}
/** /**
* 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); return msgs.map(m => window.WWebJS.getMessageModel(m));
return msgs.splice(msgs.length - limit).map(m => m.serialize());
}, 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));
} }
/** /**
* Simulate typing in chat. This will last for 25 seconds. * Simulate typing in chat. This will last for 25 seconds.
*/ */
@@ -151,7 +219,7 @@ class Chat extends Base {
return true; return true;
}, this.id._serialized); }, this.id._serialized);
} }
/** /**
* Simulate recording audio in chat. This will last for 25 seconds. * Simulate recording audio in chat. This will last for 25 seconds.
*/ */
@@ -171,6 +239,22 @@ class Chat extends Base {
return true; return true;
}, this.id._serialized); }, this.id._serialized);
} }
/**
* Returns the Contact that corresponds to this Chat.
* @returns {Promise<Contact>}
*/
async getContact() {
return await this.client.getContactById(this.id._serialized);
}
/**
* Returns array of all Labels assigned to this Chat
* @returns {Promise<Array<Label>>}
*/
async getLabels() {
return this.client.getChatLabels(this.id._serialized);
}
} }
module.exports = Chat; module.exports = Chat;

View File

@@ -10,7 +10,7 @@ class ClientInfo extends Base {
constructor(client, data) { constructor(client, data) {
super(client); super(client);
if(data) this._patch(data); if (data) this._patch(data);
} }
_patch(data) { _patch(data) {
@@ -24,21 +24,28 @@ class ClientInfo extends Base {
* Current user ID * Current user ID
* @type {object} * @type {object}
*/ */
this.me = data.me; 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;
@@ -46,6 +53,19 @@ class ClientInfo extends Base {
return super._patch(data); return super._patch(data);
} }
/**
* Get current battery percentage and charging status for the attached device
* @returns {object} batteryStatus
* @returns {number} batteryStatus.battery - The current battery percentage
* @returns {boolean} batteryStatus.plugged - Indicates if the phone is plugged in (true) or not (false)
* @deprecated
*/
async getBatteryStatus() {
return await this.client.pupPage.evaluate(() => {
const { battery, plugged } = window.Store.Conn;
return { battery, plugged };
});
}
} }
module.exports = ClientInfo; module.exports = ClientInfo;

View File

@@ -2,6 +2,14 @@
const Base = require('./Base'); const Base = require('./Base');
/**
* ID that represents a contact
* @typedef {Object} ContactId
* @property {string} server
* @property {string} user
* @property {string} _serialized
*/
/** /**
* Represents a Contact on WhatsApp * Represents a Contact on WhatsApp
* @extends {Base} * @extends {Base}
@@ -16,7 +24,7 @@ class Contact extends Base {
_patch(data) { _patch(data) {
/** /**
* ID that represents the contact * ID that represents the contact
* @type {object} * @type {ContactId}
*/ */
this.id = data.id; this.id = data.id;
@@ -95,6 +103,12 @@ class Contact extends Base {
*/ */
this.isMyContact = data.isMyContact; this.isMyContact = data.isMyContact;
/**
* Indicates if you have blocked this contact
* @type {boolean}
*/
this.isBlocked = data.isBlocked;
return super._patch(data); return super._patch(data);
} }
@@ -103,13 +117,90 @@ class Contact extends Base {
* @returns {Promise<string>} * @returns {Promise<string>}
*/ */
async getProfilePicUrl() { async getProfilePicUrl() {
const profilePic = await this.client.pupPage.evaluate((contactId) => { return await this.client.getProfilePicUrl(this.id._serialized);
return window.Store.Wap.profilePicFind(contactId); }
/**
* Returns the contact's formatted phone number, (12345678901@c.us) => (+1 (234) 5678-901)
* @returns {Promise<string>}
*/
async getFormattedNumber() {
return await this.client.getFormattedNumber(this.id._serialized);
}
/**
* Returns the contact's countrycode, (1541859685@c.us) => (1)
* @returns {Promise<string>}
*/
async getCountryCode() {
return await this.client.getCountryCode(this.id._serialized);
}
/**
* Returns the Chat that corresponds to this Contact.
* Will return null when getting chat for currently logged in user.
* @returns {Promise<Chat>}
*/
async getChat() {
if(this.isMe) return null;
return await this.client.getChatById(this.id._serialized);
}
/**
* Blocks this contact from WhatsApp
* @returns {Promise<boolean>}
*/
async block() {
if(this.isGroup) return false;
await this.client.pupPage.evaluate(async (contactId) => {
const contact = window.Store.Contact.get(contactId);
await window.Store.BlockContact.blockContact(contact);
}, this.id._serialized); }, this.id._serialized);
return profilePic ? profilePic.eurl : undefined; return true;
}
/**
* Unblocks this contact from WhatsApp
* @returns {Promise<boolean>}
*/
async unblock() {
if(this.isGroup) return false;
await this.client.pupPage.evaluate(async (contactId) => {
const contact = window.Store.Contact.get(contactId);
await window.Store.BlockContact.unblockContact(contact);
}, this.id._serialized);
return true;
}
/**
* Gets the Contact's current "about" info. Returns null if you don't have permission to read their status.
* @returns {Promise<?string>}
*/
async getAbout() {
const about = await this.client.pupPage.evaluate(async (contactId) => {
const wid = window.Store.WidFactory.createWid(contactId);
return window.Store.StatusUtils.getStatus(wid);
}, this.id._serialized);
if (typeof about.status !== 'string')
return null;
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);
} }
} }
module.exports = Contact; module.exports = Contact;

View File

@@ -2,6 +2,14 @@
const Chat = require('./Chat'); const Chat = require('./Chat');
/**
* Group participant information
* @typedef {Object} GroupParticipant
* @property {ContactId} id
* @property {boolean} isAdmin
* @property {boolean} isSuperAdmin
*/
/** /**
* Represents a Group Chat on WhatsApp * Represents a Group Chat on WhatsApp
* @extends {Chat} * @extends {Chat}
@@ -15,6 +23,7 @@ class GroupChat extends Chat {
/** /**
* Gets the group owner * Gets the group owner
* @type {ContactId}
*/ */
get owner() { get owner() {
return this.groupMetadata.owner; return this.groupMetadata.owner;
@@ -35,9 +44,10 @@ class GroupChat extends Chat {
get description() { get description() {
return this.groupMetadata.desc; return this.groupMetadata.desc;
} }
/** /**
* Gets the group participants * Gets the group participants
* @type {array} * @type {Array<GroupParticipant>}
*/ */
get participants() { get participants() {
return this.groupMetadata.participants; return this.groupMetadata.participants;
@@ -46,123 +56,176 @@ class GroupChat extends Chat {
/** /**
* Adds a list of participants by ID to the group * Adds a list of participants by ID to the group
* @param {Array<string>} participantIds * @param {Array<string>} participantIds
* @returns {Promise<Object>}
*/ */
async addParticipants(participantIds) { async addParticipants(participantIds) {
return await this.client.pupPage.evaluate((chatId, participantIds) => { return await this.client.pupPage.evaluate((chatId, participantIds) => {
return window.Store.Wap.addParticipants(chatId, participantIds); const chatWid = window.Store.WidFactory.createWid(chatId);
const participantWids = participantIds.map(p => window.Store.WidFactory.createWid(p));
return window.Store.GroupParticipants.sendAddParticipants(chatWid, participantWids);
}, this.id._serialized, participantIds); }, this.id._serialized, participantIds);
} }
/** /**
* Removes a list of participants by ID to the group * Removes a list of participants by ID to the group
* @param {Array<string>} participantIds * @param {Array<string>} participantIds
* @returns {Promise<Object>}
*/ */
async removeParticipants(participantIds) { async removeParticipants(participantIds) {
return await this.client.pupPage.evaluate((chatId, participantIds) => { return await this.client.pupPage.evaluate((chatId, participantIds) => {
return window.Store.Wap.removeParticipants(chatId, participantIds); const chatWid = window.Store.WidFactory.createWid(chatId);
const participantWids = participantIds.map(p => window.Store.WidFactory.createWid(p));
return window.Store.GroupParticipants.sendRemoveParticipants(chatWid, participantWids);
}, this.id._serialized, participantIds); }, this.id._serialized, participantIds);
} }
/** /**
* Promotes participants by IDs to admins * Promotes participants by IDs to admins
* @param {Array<string>} participantIds * @param {Array<string>} participantIds
* @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((chatId, participantIds) => {
return window.Store.Wap.promoteParticipants(chatId, participantIds); const chatWid = window.Store.WidFactory.createWid(chatId);
const participantWids = participantIds.map(p => window.Store.WidFactory.createWid(p));
return window.Store.GroupParticipants.sendPromoteParticipants(chatWid, participantWids);
}, this.id._serialized, participantIds); }, this.id._serialized, participantIds);
} }
/** /**
* Demotes participants by IDs to regular users * Demotes participants by IDs to regular users
* @param {Array<string>} participantIds * @param {Array<string>} participantIds
* @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((chatId, participantIds) => {
return window.Store.Wap.demoteParticipants(chatId, participantIds); const chatWid = window.Store.WidFactory.createWid(chatId);
const participantWids = participantIds.map(p => window.Store.WidFactory.createWid(p));
return window.Store.GroupParticipants.sendDemoteParticipants(chatWid, participantWids);
}, this.id._serialized, participantIds); }, this.id._serialized, participantIds);
} }
/** /**
* Updates the group subject * Updates the group subject
* @param {string} subject * @param {string} subject
* @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 {
return await window.Store.GroupUtils.sendSetGroupSubject(chatWid, subject);
} 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<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 {
return await window.Store.GroupUtils.sendSetGroupDescription(chatWid, description, window.Store.MsgKey.newId(), descId);
} 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.
* @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.
*/
async setMessagesAdminsOnly(adminsOnly=true) {
const success = await this.client.pupPage.evaluate(async (chatId, adminsOnly) => {
const chatWid = window.Store.WidFactory.createWid(chatId);
try {
return await window.Store.GroupUtils.sendSetGroupProperty(chatWid, 'announcement', adminsOnly ? 1 : 0);
} catch (err) {
if(err.name === 'ServerStatusCodeError') return false;
throw err;
}
}, this.id._serialized, adminsOnly);
if(!success) return false;
this.groupMetadata.announce = adminsOnly;
return true;
}
/**
* Updates the group settings to only allow admins to edit group info (title, description, photo).
* @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.
*/
async setInfoAdminsOnly(adminsOnly=true) {
const success = await this.client.pupPage.evaluate(async (chatId, adminsOnly) => {
const chatWid = window.Store.WidFactory.createWid(chatId);
try {
return await window.Store.GroupUtils.sendSetGroupProperty(chatWid, 'restrict', adminsOnly ? 1 : 0);
} catch (err) {
if(err.name === 'ServerStatusCodeError') return false;
throw err;
}
}, this.id._serialized, adminsOnly);
if(!success) return false;
this.groupMetadata.restrict = adminsOnly;
return true;
} }
/** /**
* Gets the invite code for a specific group * Gets the invite code for a specific group
* @returns {Promise<string>} Group's invite code
*/ */
async getInviteCode() { async getInviteCode() {
let res = await this.client.pupPage.evaluate(chatId => { const code = await this.client.pupPage.evaluate(async chatId => {
return window.Store.Wap.groupInviteCode(chatId); const chatWid = window.Store.WidFactory.createWid(chatId);
return window.Store.Invite.sendQueryGroupInviteCode(chatWid);
}, this.id._serialized); }, this.id._serialized);
if (res.status == 200) { return 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<string>} New invite code
*/ */
async revokeInvite() { async revokeInvite() {
return await this.client.pupPage.evaluate(chatId => { const code = await this.client.pupPage.evaluate(chatId => {
return window.Store.Wap.revokeGroupInvite(chatId); const chatWid = window.Store.WidFactory.createWid(chatId);
return window.Store.Invite.sendRevokeGroupInviteCode(chatWid);
}, this.id._serialized); }, this.id._serialized);
}
/** return code;
* Returns an object with information about the invite code's group
* @param {string} inviteCode
* @returns {Promise<object>} Invite information
*/
static async getInviteInfo(inviteCode) {
return await this.client.pupPage.evaluate(inviteCode => {
return window.Store.Wap.groupInviteInfo(inviteCode);
}, inviteCode);
}
/**
* Joins a group with an invite code
* @param {string} inviteCode
*/
static async join(inviteCode) {
return await this.client.pupPage.evaluate(inviteCode => {
return window.Store.Wap.acceptGroupInvite(inviteCode);
}, inviteCode);
} }
/** /**
* Makes the bot leave the group * Makes the bot leave the group
* @returns {Promise}
*/ */
async leave() { async leave() {
return await this.client.pupPage.evaluate(chatId => { await this.client.pupPage.evaluate(chatId => {
return window.Store.Wap.leaveGroup(chatId); const chatWid = window.Store.WidFactory.createWid(chatId);
return window.Store.GroupUtils.sendExitGroup(chatWid);
}, 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.

50
src/structures/Label.js Normal file
View File

@@ -0,0 +1,50 @@
'use strict';
const Base = require('./Base');
// eslint-disable-next-line no-unused-vars
const Chat = require('./Chat');
/**
* WhatsApp Business Label information
*/
class Label extends Base {
/**
* @param {Base} client
* @param {object} labelData
*/
constructor(client, labelData){
super(client);
if(labelData) this._patch(labelData);
}
_patch(labelData){
/**
* Label ID
* @type {string}
*/
this.id = labelData.id;
/**
* Label name
* @type {string}
*/
this.name = labelData.name;
/**
* Label hex color
* @type {string}
*/
this.hexColor = labelData.hexColor;
}
/**
* Get all chats that have been assigned this Label
* @returns {Promise<Array<Chat>>}
*/
async getChats(){
return this.client.getChatsByLabelId(this.id);
}
}
module.exports = Label;

79
src/structures/List.js Normal file
View File

@@ -0,0 +1,79 @@
'use strict';
const Util = require('../util/Util');
/**
* Message type List
*/
class List {
/**
* @param {string} body
* @param {string} buttonText
* @param {Array<any>} sections
* @param {string?} title
* @param {string?} footer
*/
constructor(body, buttonText, sections, title, footer) {
/**
* Message body
* @type {string}
*/
this.description = body;
/**
* List button text
* @type {string}
*/
this.buttonText = buttonText;
/**
* title of message
* @type {string}
*/
this.title = title;
/**
* footer of message
* @type {string}
*/
this.footer = footer;
/**
* sections of message
* @type {Array<any>}
*/
this.sections = this._format(sections);
}
/**
* Creates section array from simple array
* @param {Array<any>} sections
* @returns {Array<any>}
* @example
* Input: [{title:'sectionTitle',rows:[{id:'customId', title:'ListItem2', description: 'desc'},{title:'ListItem2'}]}}]
* Returns: [{'title':'sectionTitle','rows':[{'rowId':'customId','title':'ListItem1','description':'desc'},{'rowId':'oGSRoD','title':'ListItem2','description':''}]}]
*/
_format(sections){
if(!sections.length){throw '[LT02] List without sections';}
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) =>{
if(!section.rows.length){throw '[LT03] Section without rows';}
return {
title: section.title ? section.title : undefined,
rows: section.rows.map( (row) => {
if(!row.title){throw '[LT04] Row without title';}
return {
rowId: row.id ? row.id : Util.generateHash(6),
title: row.title,
description: row.description ? row.description : ''
};
})
};
});
}
}
module.exports = List;

View File

@@ -3,6 +3,8 @@
const Base = require('./Base'); const Base = require('./Base');
const MessageMedia = require('./MessageMedia'); const MessageMedia = require('./MessageMedia');
const Location = require('./Location'); const Location = require('./Location');
const Order = require('./Order');
const Payment = require('./Payment');
const { MessageTypes } = require('../util/Constants'); const { MessageTypes } = require('../util/Constants');
/** /**
@@ -13,21 +15,35 @@ class Message extends Base {
constructor(client, data) { constructor(client, data) {
super(client); super(client);
if(data) this._patch(data); if (data) this._patch(data);
} }
_patch(data) { _patch(data) {
this._data = data;
/**
* MediaKey that represents the sticker 'ID'
* @type {string}
*/
this.mediaKey = data.mediaKey;
/** /**
* ID that represents the message * ID that represents the message
* @type {object} * @type {object}
*/ */
this.id = data.id; this.id = data.id;
/**
* ACK status for the message
* @type {MessageAck}
*/
this.ack = data.ack;
/** /**
* Indicates if the message has media available for download * Indicates if the message has media available for download
* @type {boolean} * @type {boolean}
*/ */
this.hasMedia = data.clientUrl ? true : false; this.hasMedia = Boolean(data.mediaKey && data.directPath);
/** /**
* Message content * Message content
@@ -35,7 +51,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}
*/ */
@@ -51,22 +67,28 @@ class Message extends Base {
* 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.
* @type {string} * @type {string}
*/ */
this.from = typeof (data.from) === 'object' ? data.from._serialized : data.from; this.from = (typeof (data.from) === 'object' && data.from !== null) ? data.from._serialized : data.from;
/** /**
* 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._serialized : data.to; this.to = (typeof (data.to) === 'object' && data.to !== null) ? data.to._serialized : data.to;
/** /**
* 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.
* @type {string} * @type {string}
*/ */
this.author = typeof (data.author) === 'object' ? data.author._serialized : data.author; this.author = (typeof (data.author) === 'object' && data.author !== null) ? data.author._serialized : data.author;
/**
* String that represents from which device type the message was sent
* @type {string}
*/
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
@@ -74,30 +96,75 @@ class Message extends Base {
*/ */
this.isForwarded = data.isForwarded; this.isForwarded = data.isForwarded;
/**
* Indicates how many times the message was forwarded.
*
* The maximum value is 127.
* @type {number}
*/
this.forwardingScore = data.forwardingScore || 0;
/**
* Indicates if the message is a status update
* @type {boolean}
*/
this.isStatus = data.isStatusV3;
/**
* Indicates if the message was starred
* @type {boolean}
*/
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}
*/ */
this.fromMe = data.id.fromMe; this.fromMe = data.id.fromMe;
/** /**
* Indicates if the message was sent as a reply to another message. * Indicates if the message was sent as a reply to another message.
* @type {boolean} * @type {boolean}
*/ */
this.hasQuotedMsg = data.quotedMsg ? true : false; this.hasQuotedMsg = data.quotedMsg ? 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}
*/ */
this.location = data.type === MessageTypes.LOCATION ? new Location(data.lat, data.lng, data.loc) : undefined; this.location = data.type === MessageTypes.LOCATION ? new Location(data.lat, data.lng, data.loc) : undefined;
/**
* List of vCards contained in the message.
* @type {Array<string>}
*/
this.vCards = data.type === MessageTypes.CONTACT_CARD_MULTI ? data.vcardList.map((c) => c.vcard) : data.type === MessageTypes.CONTACT_CARD ? [data.body] : [];
/**
* Group Invite Data
* @type {object}
*/
this.inviteV4 = data.type === MessageTypes.GROUP_INVITE ? {
inviteCode: data.inviteCode,
inviteCodeExp: data.inviteCodeExp,
groupId: data.inviteGrp,
groupName: data.inviteGrpName,
fromId: data.from._serialized,
toId: data.to._serialized
} : undefined;
/** /**
* Indicates the mentions in the message body. * Indicates the mentions in the message body.
* @type {Array<string>} * @type {Array<string>}
@@ -108,6 +175,71 @@ class Message extends Base {
this.mentionedIds = data.mentionedJidList; this.mentionedIds = data.mentionedJidList;
} }
/**
* Order ID for message type ORDER
* @type {string}
*/
this.orderId = data.orderId ? data.orderId : undefined;
/**
* Order Token for message type ORDER
* @type {string}
*/
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 */
if (data.title) {
this.title = data.title;
}
/** Description */
if (data.description) {
this.description = data.description;
}
/** Business Owner JID */
if (data.businessOwnerJid) {
this.businessOwnerJid = data.businessOwnerJid;
}
/** Product ID */
if (data.productId) {
this.productId = data.productId;
}
/**
* Links included in the message.
* @type {Array<{link: string, isSuspicious: boolean}>}
*
*/
this.links = data.links;
/** Buttons */
if (data.dynamicReplyButtons) {
this.dynamicReplyButtons = data.dynamicReplyButtons;
}
/** Selected Button Id **/
if (data.selectedButtonId) {
this.selectedButtonId = data.selectedButtonId;
}
/** Selected List row Id **/
if (data.listResponse && data.listResponse.singleSelectReply.selectedRowId) {
this.selectedRowId = data.listResponse.singleSelectReply.selectedRowId;
}
return super._patch(data); return super._patch(data);
} }
@@ -115,6 +247,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>}
@@ -147,24 +305,25 @@ 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 {object} options * @param {MessageSendOptions} [options]
* @returns {Promise<Message>} * @returns {Promise<Message>}
*/ */
async reply(content, chatId, options={}) { async reply(content, chatId, options = {}) {
if (!chatId) { if (!chatId) {
chatId = this._getChatId(); chatId = this._getChatId();
} }
@@ -177,6 +336,45 @@ 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
* @returns {Promise<Object>}
*/
async acceptGroupV4Invite() {
return await this.client.acceptGroupV4Invite(this.inviteV4);
}
/**
* 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
* @returns {Promise}
*/
async forward(chat) {
const chatId = typeof chat === 'string' ? chat : chat.id._serialized;
await this.client.pupPage.evaluate(async (msgId, chatId) => {
let msg = window.Store.Msg.get(msgId);
let chat = window.Store.Chat.get(chatId);
return await chat.forwardMessages([msg]);
}, this.id._serialized, chatId);
}
/** /**
* Downloads and returns the attatched message media * Downloads and returns the attatched message media
* @returns {Promise<MessageMedia>} * @returns {Promise<MessageMedia>}
@@ -186,38 +384,149 @@ class Message extends Base {
return undefined; return undefined;
} }
const {data, mimetype, filename} = 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);
const buffer = await window.WWebJS.downloadBuffer(msg.clientUrl);
const decrypted = await window.Store.CryptoLib.decryptE2EMedia(msg.type, buffer, msg.mediaKey, msg.mimetype);
const data = await window.WWebJS.readBlobAsync(decrypted._blob);
return {
data: data.split(',')[1],
mimetype: msg.mimetype,
filename: msg.filename
};
if (msg.mediaData.mediaStage != 'RESOLVED') {
// try to resolve media
await msg.downloadMedia({
downloadEvenIfExpensive: true,
rmrReason: 1
});
}
if (msg.mediaData.mediaStage.includes('ERROR') || msg.mediaData.mediaStage === 'FETCHING') {
// media could not be downloaded
return undefined;
}
try {
const decryptedMedia = await window.Store.DownloadManager.downloadAndDecrypt({
directPath: msg.directPath,
encFilehash: msg.encFilehash,
filehash: msg.filehash,
mediaKey: msg.mediaKey,
mediaKeyTimestamp: msg.mediaKeyTimestamp,
type: msg.type,
signal: (new AbortController).signal
});
const data = await window.WWebJS.arrayBufferToBase64Async(decryptedMedia);
return {
data,
mimetype: msg.mimetype,
filename: msg.filename,
filesize: msg.size
};
} catch (e) {
if(e.status && e.status === 404) return undefined;
throw e;
}
}, this.id._serialized); }, this.id._serialized);
return new MessageMedia(mimetype, data, filename); if (!result) return undefined;
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);
}, this.id._serialized, everyone); }, this.id._serialized, everyone);
} }
/**
* Stars this message
*/
async star() {
await this.client.pupPage.evaluate((msgId) => {
let msg = window.Store.Msg.get(msgId);
if (window.Store.MsgActionChecks.canStarMsg(msg)) {
return window.Store.Cmd.sendStarMsgs(msg.chat, [msg], false);
}
}, this.id._serialized);
}
/**
* Unstars this message
*/
async unstar() {
await this.client.pupPage.evaluate((msgId) => {
let msg = window.Store.Msg.get(msgId);
if (window.Store.MsgActionChecks.canStarMsg(msg)) {
return window.Store.Cmd.sendUnstarMsgs(msg.chat, [msg], false);
}
}, this.id._serialized);
}
/**
* Message Info
* @typedef {Object} MessageInfo
* @property {Array<{id: ContactId, t: number}>} delivery Contacts to which the message has been delivered to
* @property {number} deliveryRemaining Amount of people to whom the message has not been delivered to
* @property {Array<{id: ContactId, t: number}>} played Contacts who have listened to the voice message
* @property {number} playedRemaining Amount of people who have not listened to the message
* @property {Array<{id: ContactId, t: number}>} read Contacts who have read the message
* @property {number} readRemaining Amount of people who have not read the message
*/
/**
* Get information about message delivery status. May return null if the message does not exist or is not sent by you.
* @returns {Promise<?MessageInfo>}
*/
async getInfo() {
const info = await this.client.pupPage.evaluate(async (msgId) => {
const msg = window.Store.Msg.get(msgId);
if (!msg) return null;
return await window.Store.MessageInfo.sendQueryMsgInfo(msg);
}, this.id._serialized);
return info;
}
/**
* Gets the order associated with a given message
* @return {Promise<Order>}
*/
async getOrder() {
if (this.type === MessageTypes.ORDER) {
const result = await this.client.pupPage.evaluate((orderId, token, chatId) => {
return window.WWebJS.getOrderDetail(orderId, token, chatId);
}, this.orderId, this.token, this._getChatId());
if (!result) return undefined;
return new Order(this.client, result);
}
return undefined;
}
/**
* Gets the payment details associated with a given message
* @return {Promise<Payment>}
*/
async getPayment() {
if (this.type === MessageTypes.PAYMENT) {
const msg = await this.client.pupPage.evaluate(async (msgId) => {
const msg = window.Store.Msg.get(msgId);
if(!msg) return null;
return msg.serialize();
}, this.id._serialized);
return new Payment(this.client, msg);
}
return undefined;
}
} }
module.exports = Message; module.exports = Message;

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