Compare commits

...

95 Commits

Author SHA1 Message Date
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
56 changed files with 5591 additions and 1140 deletions

6
.gitignore vendored
View File

@@ -63,3 +63,9 @@ typings/
# next.js build output # next.js build output
.next .next
# macOS Thumbnails
._*
# Test sessions
*session.json

14
.npmignore Normal file
View File

@@ -0,0 +1,14 @@
docs/*
.github/*
.eslintrc.json
.jsdoc.json
.editorconfig
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
*session.json

View File

@@ -1,4 +1,4 @@
[![npm](https://img.shields.io/npm/v/whatsapp-web.js.svg)](https://www.npmjs.com/package/whatsapp-web.js) [![Depfu](https://badges.depfu.com/badges/4a65a0de96ece65fdf39e294e0c8dcba/overview.svg)](https://depfu.com/github/pedroslopez/whatsapp-web.js?project_id=9765) ![WhatsApp_Web 2.2023.2](https://img.shields.io/badge/WhatsApp_Web-2.2023.2-brightgreen.svg) [![Discord Chat](https://img.shields.io/discord/698610475432411196.svg?logo=discord)](https://discord.gg/H7DqQs4) [![npm](https://img.shields.io/npm/v/whatsapp-web.js.svg)](https://www.npmjs.com/package/whatsapp-web.js) [![Depfu](https://badges.depfu.com/badges/4a65a0de96ece65fdf39e294e0c8dcba/overview.svg)](https://depfu.com/github/pedroslopez/whatsapp-web.js?project_id=9765) ![WhatsApp_Web 2.2104.6](https://img.shields.io/badge/WhatsApp_Web-2.2104.6-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
@@ -46,21 +46,23 @@ Take a look at [example.js](https://github.com/pedroslopez/whatsapp-web.js/blob/
| Send messages | ✅ | | Send messages | ✅ |
| Receive messages | ✅ | | Receive messages | ✅ |
| Send media (images/audio/documents) | ✅ | | Send media (images/audio/documents) | ✅ |
| Send media (video) | ✅ [(requires google chrome)](https://github.com/pedroslopez/whatsapp-web.js/issues/78#issuecomment-592723583) | | Send media (video) | ✅ [(requires google chrome)](https://waguide.pedroslopez.me/features/handling-attachments#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 | ✅ |
| 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 | ✅ | | 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 | ✅ |

View File

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.4"> <meta name="generator" content="JSDoc 3.6.6">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.7.0 &raquo; Class: Base</title> <title>whatsapp-web.js 1.12.3 &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>7.<wbr>0</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>12.<wbr>3</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.4 on June 18, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.6 on February 9, 2021.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.4"> <meta name="generator" content="JSDoc 3.6.6">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.7.0 &raquo; Class: BusinessContact</title> <title>whatsapp-web.js 1.12.3 &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>7.<wbr>0</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>12.<wbr>3</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,34 @@
</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#block">block()</a></dt>
<dd>
</dd>
<dt><a href="BusinessContact.html#getAbout">getAbout()</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="BusinessContact.html#getChat">getChat()</a></dt>
<dd>
</dd>
<dt><a href="BusinessContact.html#getProfilePicUrl">getProfilePicUrl()</a></dt> <dt><a href="BusinessContact.html#getProfilePicUrl">getProfilePicUrl()</a></dt>
<dd> <dd>
</dd> </dd>
</dl> </dl>
</div> </div>
<div class="summary-column"> <div class="summary-column">
</div> <dl class="dl-summary-callout">
<div class="summary-column"> <dt><a href="BusinessContact.html#unblock">unblock()</a></dt>
<dd>
</dd>
</dl>
</div> </div>
</div> </div>
</div> </div>
@@ -128,6 +147,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 +232,36 @@
<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> <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 +271,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 +290,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.4 on June 18, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.6 on February 9, 2021.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.4"> <meta name="generator" content="JSDoc 3.6.6">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.7.0 &raquo; Class: Chat</title> <title>whatsapp-web.js 1.12.3 &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>7.<wbr>0</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>12.<wbr>3</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,17 +98,29 @@
<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>
<dt><a href="Chat.html#markUnread">markUnread()</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Chat.html#mute">mute(unmuteDate)</a></dt> <dt><a href="Chat.html#mute">mute(unmuteDate)</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Chat.html#sendMessage">sendMessage(content, options)</a></dt> <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>
@@ -121,6 +142,9 @@
<dt><a href="Chat.html#unmute">unmute()</a></dt> <dt><a href="Chat.html#unmute">unmute()</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Chat.html#unpin">unpin()</a></dt>
<dd>
</dd>
</dl> </dl>
</div> </div>
</div> </div>
@@ -151,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;number</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">
@@ -185,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>
@@ -200,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>
@@ -271,6 +312,29 @@
</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="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> <h3 id="mute"><span class="symbol-name">mute</span><span class="signature"><span class="signature-params">(unmuteDate)</span></span></h3>
<p>Mutes this chat until a specified date</p> <p>Mutes this chat until a specified date</p>
<section> <section>
@@ -305,7 +369,18 @@
<dl class="dl-compact"> <dl class="dl-compact">
</dl> </dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div> <div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="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="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>
@@ -337,10 +412,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>
@@ -351,7 +426,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>
@@ -361,7 +437,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>
@@ -385,6 +462,17 @@
<p>Unmutes this chat</p> <p>Unmutes 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="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>
@@ -395,7 +483,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.4 on June 18, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.6 on February 9, 2021.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.4"> <meta name="generator" content="JSDoc 3.6.6">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.7.0 &raquo; Class: Client</title> <title>whatsapp-web.js 1.12.3 &raquo; Class: Client</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar"> <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container"> <div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content"> <div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>7.<wbr>0</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>12.<wbr>3</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -26,7 +26,7 @@
<header class="page-header"> <header class="page-header">
<div class="symbol-detail-labels"><span class="label label-kind">class</span></div> <div class="symbol-detail-labels"><span class="label label-kind">class</span></div>
<h1><small></small><span class="symbol-name">Client</span></h1> <h1><small></small><span class="symbol-name">Client</span></h1>
<p class="source-link">Source: <a href="Client.js.html#source-line-36">Client.<wbr>js:36</a></p> <p class="source-link">Source: <a href="Client.js.html#source-line-51">Client.<wbr>js:51</a></p>
<div class="symbol-classdesc"> <div class="symbol-classdesc">
<p>Starting point for interacting with the WhatsApp Web API</p> <p>Starting point for interacting with the WhatsApp Web API</p>
</div> </div>
@@ -34,6 +34,22 @@
</dl> </dl>
</header> </header>
<section id="summary"> <section id="summary">
<div class="summary-callout">
<h2 class="summary-callout-heading">Property</h2>
<div class="summary-content">
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="Client.html#info">info</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
</div>
<div class="summary-column">
</div>
</div>
</div>
<div class="summary-callout"> <div class="summary-callout">
<h2 class="summary-callout-heading">Methods</h2> <h2 class="summary-callout-heading">Methods</h2>
<div class="summary-content"> <div class="summary-content">
@@ -54,20 +70,35 @@
<dt><a href="Client.html#getChatById">getChatById(chatId)</a></dt> <dt><a href="Client.html#getChatById">getChatById(chatId)</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Client.html#getChatLabels">getChatLabels(chatId)</a></dt>
<dd>
</dd>
<dt><a href="Client.html#getChats">getChats()</a></dt> <dt><a href="Client.html#getChats">getChats()</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Client.html#getChatsByLabelId">getChatsByLabelId(labelId)</a></dt>
<dd>
</dd>
<dt><a href="Client.html#getContactById">getContactById(contactId)</a></dt> <dt><a href="Client.html#getContactById">getContactById(contactId)</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Client.html#getContacts">getContacts()</a></dt> <dt><a href="Client.html#getContacts">getContacts()</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Client.html#getInviteInfo">getInviteInfo(inviteCode)</a></dt>
<dd>
</dd>
</dl> </dl>
</div> </div>
<div class="summary-column"> <div class="summary-column">
<dl class="dl-summary-callout"> <dl class="dl-summary-callout">
<dt><a href="Client.html#getInviteInfo">getInviteInfo(inviteCode)</a></dt> <dt><a href="Client.html#getLabelById">getLabelById(labelId)</a></dt>
<dd>
</dd>
<dt><a href="Client.html#getLabels">getLabels()</a></dt>
<dd>
</dd>
<dt><a href="Client.html#getNumberId">getNumberId(number)</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Client.html#getProfilePicUrl">getProfilePicUrl(contactId)</a></dt> <dt><a href="Client.html#getProfilePicUrl">getProfilePicUrl(contactId)</a></dt>
@@ -82,12 +113,15 @@
<dt><a href="Client.html#initialize">initialize()</a></dt> <dt><a href="Client.html#initialize">initialize()</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Client.html#isRegisteredUser">isRegisteredUser()</a></dt> <dt><a href="Client.html#isRegisteredUser">isRegisteredUser(id)</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Client.html#logout">logout()</a></dt> <dt><a href="Client.html#logout">logout()</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Client.html#markChatUnread">markChatUnread(chatId)</a></dt>
<dd>
</dd>
<dt><a href="Client.html#muteChat">muteChat(chatId, unmuteDate)</a></dt> <dt><a href="Client.html#muteChat">muteChat(chatId, unmuteDate)</a></dt>
<dd> <dd>
</dd> </dd>
@@ -95,10 +129,13 @@
</div> </div>
<div class="summary-column"> <div class="summary-column">
<dl class="dl-summary-callout"> <dl class="dl-summary-callout">
<dt><a href="Client.html#pinChat">pinChat()</a></dt>
<dd>
</dd>
<dt><a href="Client.html#resetState">resetState()</a></dt> <dt><a href="Client.html#resetState">resetState()</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Client.html#sendMessage">sendMessage(chatId, content, options)</a></dt> <dt><a href="Client.html#sendMessage">sendMessage(chatId, content[, options])</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Client.html#sendPresenceAvailable">sendPresenceAvailable()</a></dt> <dt><a href="Client.html#sendPresenceAvailable">sendPresenceAvailable()</a></dt>
@@ -107,6 +144,9 @@
<dt><a href="Client.html#sendSeen">sendSeen(chatId)</a></dt> <dt><a href="Client.html#sendSeen">sendSeen(chatId)</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Client.html#setDisplayName">setDisplayName(displayName)</a></dt>
<dd>
</dd>
<dt><a href="Client.html#setStatus">setStatus(status)</a></dt> <dt><a href="Client.html#setStatus">setStatus(status)</a></dt>
<dd> <dd>
</dd> </dd>
@@ -116,6 +156,9 @@
<dt><a href="Client.html#unmuteChat">unmuteChat(chatId)</a></dt> <dt><a href="Client.html#unmuteChat">unmuteChat(chatId)</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Client.html#unpinChat">unpinChat()</a></dt>
<dd>
</dd>
</dl> </dl>
</div> </div>
</div> </div>
@@ -187,7 +230,241 @@
</div> </div>
</section> </section>
<section> <section>
<h2 id="Client">new&nbsp;<span class="symbol-name">Client</span><span class="signature"><span class="signature-params">()</span></span></h2> <h2 id="Client">new&nbsp;<span class="symbol-name">Client</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>Client 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>authTimeoutMs</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Timeout for authentication selector in puppeteer</p>
</td>
</tr>
<tr>
<td>
<p>puppeteer</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Puppeteer launch options. View docs here: https://github.com/puppeteer/puppeteer/</p>
</td>
</tr>
<tr>
<td>
<p>qrRefreshIntervalMs</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Refresh interval for qr code (how much time to wait before checking if the qr code has changed)</p>
</td>
</tr>
<tr>
<td>
<p>qrTimeoutMs</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Timeout for qr code selector in puppeteer</p>
</td>
</tr>
<tr>
<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>
<tr>
<td>
<p>takeoverOnConflict</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>If another whatsapp web session is detected (another browser), take over the session in the current browser</p>
</td>
</tr>
<tr>
<td>
<p>takeoverTimeoutMs</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>How much time to wait before taking over the session</p>
</td>
</tr>
<tr>
<td>
<p>userAgent</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>User agent to use in puppeteer</p>
</td>
</tr>
<tr>
<td>
<p>ffmpegPath</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Ffmpeg path to use when formating videos to webp while sending stickers</p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact"> <dl class="dl-compact">
<dt>Extends</dt> <dt>Extends</dt>
<dd>EventEmitter</dd> <dd>EventEmitter</dd>
@@ -211,10 +488,18 @@
</dl> </dl>
</section> </section>
<section> <section>
<h2>Property</h2>
<section>
<h3 id="info"><span class="symbol-name">info</span><small class="property-type">
&nbsp;<a href="ClientInfo.html">ClientInfo</a></small></h3>
<p>Current connection information</p>
<dl class="dl-compact">
</dl>
</section>
<h2>Methods</h2> <h2>Methods</h2>
<section> <section>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div> <div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="acceptInvite"><span class="symbol-name">acceptInvite</span><span class="signature"><span class="signature-params">(inviteCode)</span></span></h3> <h3 id="acceptInvite"><span class="symbol-name">acceptInvite</span><span class="signature"><span class="signature-params">(inviteCode)</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing string</span></span></h3>
<p>Accepts an invitation to join a group</p> <p>Accepts an invitation to join a group</p>
<section> <section>
<h4>Parameter</h4> <h4>Parameter</h4>
@@ -246,6 +531,12 @@
</table> </table>
</section> </section>
<dl class="dl-compact"> <dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code>Promise containing string</code> 
<p>Id of the joined Chat</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="archiveChat"><span class="symbol-name">archiveChat</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> boolean</span></span></h3> <h3 id="archiveChat"><span class="symbol-name">archiveChat</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> boolean</span></span></h3>
@@ -305,15 +596,18 @@
<dl class="dl-compact"> <dl class="dl-compact">
<dt>Returns</dt> <dt>Returns</dt>
<dd> <dd>
<p><code>Object</code> <p>createRes</p> <p><code>Object</code> 
<p>createRes</p>
</p> </p>
</dd> </dd>
<dd> <dd>
<p><code>string</code> <p>createRes.gid - ID for the group that was just created</p> <p><code>string</code> 
<p>createRes.gid - ID for the group that was just created</p>
</p> </p>
</dd> </dd>
<dd> <dd>
<p><code>Object with string properties</code> <p>createRes.missingParticipants - participants that were not added to the group. Keys represent the ID for participant that was not added and its value is a status code that represents the reason why participant could not be added. This is usually 403 if the user's privacy settings don't allow you to add them to groups.</p> <p><code>Object with string properties</code> 
<p>createRes.missingParticipants - participants that were not added to the group. Keys represent the ID for participant that was not added and its value is a status code that represents the reason why participant could not be added. This is usually 403 if the user's privacy settings don't allow you to add them to groups.</p>
</p> </p>
</dd> </dd>
</dl> </dl>
@@ -360,6 +654,43 @@
</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="getChatLabels"><span class="symbol-name">getChatLabels</span><span class="signature"><span class="signature-params">(chatId)</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing Array of <a href="Label.html">Label</a></span></span></h3>
<p>Get all Labels assigned to a chat</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>
</td>
</tr>
</tbody>
</table>
</section>
<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="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> <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 current chat instances</p> <p>Get all current chat instances</p>
<dl class="dl-compact"> <dl class="dl-compact">
@@ -369,6 +700,43 @@
</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="getChatsByLabelId"><span class="symbol-name">getChatsByLabelId</span><span class="signature"><span class="signature-params">(labelId)</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing Array of <a href="Chat.html">Chat</a></span></span></h3>
<p>Get all Chats for a specific Label</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>labelId</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 Array of <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="getContactById"><span class="symbol-name">getContactById</span><span class="signature"><span class="signature-params">(contactId)</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing <a href="Contact.html">Contact</a></span></span></h3> <h3 id="getContactById"><span class="symbol-name">getContactById</span><span class="signature"><span class="signature-params">(contactId)</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing <a href="Contact.html">Contact</a></span></span></h3>
<p>Get contact instance by ID</p> <p>Get contact instance by ID</p>
<section> <section>
@@ -448,11 +816,97 @@
<dl class="dl-compact"> <dl class="dl-compact">
<dt>Returns</dt> <dt>Returns</dt>
<dd> <dd>
<p><code>Promise containing object</code> <p>Invite information</p> <p><code>Promise containing object</code> 
<p>Invite information</p>
</p> </p>
</dd> </dd>
</dl> </dl>
<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="getLabelById"><span class="symbol-name">getLabelById</span><span class="signature"><span class="signature-params">(labelId)</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing <a href="Label.html">Label</a></span></span></h3>
<p>Get Label instance by ID</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>labelId</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 <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="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>Get all current Labels</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="getNumberId"><span class="symbol-name">getNumberId</span><span class="signature"><span class="signature-params">(number)</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing (Object or null)</span></span></h3>
<p>Get the registered WhatsApp ID for a number.
Will return null if the number is not registered on WhatsApp.</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>number</p>
</td>
<td>
<p>string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Number or ID (&quot;@c.us&quot; will be automatically appended if not specified)</p>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code>Promise containing (Object or null)</code> </p>
</dd>
</dl>
<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">(contactId)</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">(contactId)</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing string</span></span></h3>
<p>Returns the contact ID's profile picture URL, if privacy settings allow it</p> <p>Returns the contact ID's profile picture URL, if privacy settings allow it</p>
<section> <section>
@@ -500,13 +954,12 @@
</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="getWWebVersion"><span class="symbol-name">getWWebVersion</span><span class="signature"><span class="signature-params">()</span></span></h3> <h3 id="getWWebVersion"><span class="symbol-name">getWWebVersion</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing string</span></span></h3>
<p>Returns the version of WhatsApp Web currently being run</p> <p>Returns the version of WhatsApp Web currently being run</p>
<dl class="dl-compact"> <dl class="dl-compact">
<dt>Returns</dt> <dt>Returns</dt>
<dd> <dd>
<p>Promise<string> <p><code>Promise containing string</code> </p>
</p>
</dd> </dd>
</dl> </dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div> <div class="symbol-detail-labels"><span class="label label-async">async</span></div>
@@ -515,8 +968,37 @@
<dl class="dl-compact"> <dl class="dl-compact">
</dl> </dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div> <div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="isRegisteredUser"><span class="symbol-name">isRegisteredUser</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing Boolean</span></span></h3> <h3 id="isRegisteredUser"><span class="symbol-name">isRegisteredUser</span><span class="signature"><span class="signature-params">(id)</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing Boolean</span></span></h3>
<p>Check if a given ID is registered in whatsapp</p> <p>Check if a given ID is registered in whatsapp</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>id</p>
</td>
<td>
<p>string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>the whatsapp user's ID</p>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact"> <dl class="dl-compact">
<dt>Returns</dt> <dt>Returns</dt>
<dd> <dd>
@@ -529,6 +1011,40 @@
<dl class="dl-compact"> <dl class="dl-compact">
</dl> </dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div> <div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="markChatUnread"><span class="symbol-name">markChatUnread</span><span class="signature"><span class="signature-params">(chatId)</span></span></h3>
<p>Mark the Chat as unread</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 that will be marked as unread</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="muteChat"><span class="symbol-name">muteChat</span><span class="signature"><span class="signature-params">(chatId, unmuteDate)</span></span></h3> <h3 id="muteChat"><span class="symbol-name">muteChat</span><span class="signature"><span class="signature-params">(chatId, unmuteDate)</span></span></h3>
<p>Mutes the Chat until a specified date</p> <p>Mutes the Chat until a specified date</p>
<section> <section>
@@ -577,12 +1093,23 @@
<dl class="dl-compact"> <dl class="dl-compact">
</dl> </dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div> <div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="pinChat"><span class="symbol-name">pinChat</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing boolean</span></span></h3>
<p>Pins the 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="resetState"><span class="symbol-name">resetState</span><span class="signature"><span class="signature-params">()</span></span></h3> <h3 id="resetState"><span class="symbol-name">resetState</span><span class="signature"><span class="signature-params">()</span></span></h3>
<p>Force reset of connection state for the client</p> <p>Force reset of connection state for the client</p>
<dl class="dl-compact"> <dl class="dl-compact">
</dl> </dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div> <div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="sendMessage"><span class="symbol-name">sendMessage</span><span class="signature"><span class="signature-params">(chatId, 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">(chatId, 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 a specific chatId</p> <p>Send a message to a specific chatId</p>
<section> <section>
<h4>Parameters</h4> <h4>Parameters</h4>
@@ -614,7 +1141,7 @@
<p>content</p> <p>content</p>
</td> </td>
<td> <td>
<p>(string, <a href="MessageMedia.html">MessageMedia</a>, or <a href="Location.html">Location</a>)</p> <p>(string, <a href="MessageMedia.html">MessageMedia</a>, <a href="Location.html">Location</a>, <a href="Contact.html">Contact</a>, or Array of <a href="Contact.html">Contact</a>)</p>
</td> </td>
<td> <td>
<p>&nbsp;</p> <p>&nbsp;</p>
@@ -627,12 +1154,13 @@
<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>
<p>Options used when sending the message</p>
</td> </td>
</tr> </tr>
</tbody> </tbody>
@@ -641,7 +1169,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>
@@ -684,11 +1213,47 @@
<dl class="dl-compact"> <dl class="dl-compact">
<dt>Returns</dt> <dt>Returns</dt>
<dd> <dd>
<p><code>Promise containing boolean</code> <p>result</p> <p><code>Promise containing boolean</code> 
<p>result</p>
</p> </p>
</dd> </dd>
</dl> </dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div> <div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="setDisplayName"><span class="symbol-name">setDisplayName</span><span class="signature"><span class="signature-params">(displayName)</span></span></h3>
<p>Sets the current user's display name.
This is the name shown to WhatsApp users that have not added you as a contact beside your number in groups and in your profile.</p>
<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>displayName</p>
</td>
<td>
<p>string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>New display name</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="setStatus"><span class="symbol-name">setStatus</span><span class="signature"><span class="signature-params">(status)</span></span></h3> <h3 id="setStatus"><span class="symbol-name">setStatus</span><span class="signature"><span class="signature-params">(status)</span></span></h3>
<p>Sets the current user's status message</p> <p>Sets the current user's status message</p>
<section> <section>
@@ -765,6 +1330,17 @@
</section> </section>
<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="unpinChat"><span class="symbol-name">unpinChat</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing boolean</span></span></h3>
<p>Unpins the 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>
<h2>Events</h2> <h2>Events</h2>
<section> <section>
@@ -803,7 +1379,7 @@
<h3 id="event:authenticated"><span class="symbol-name">authenticated</span></h3> <h3 id="event:authenticated"><span class="symbol-name">authenticated</span></h3>
<p>Emitted when authentication is successful</p> <p>Emitted when authentication is successful</p>
<section> <section>
<h4>Parameter</h4> <h4>Parameters</h4>
<table class="jsdoc-details-table"> <table class="jsdoc-details-table">
<thead> <thead>
<tr> <tr>
@@ -826,6 +1402,71 @@
</td> </td>
<td> <td>
<p>Object containing session information. Can be used to restore the session.</p> <p>Object containing session information. Can be used to restore the session.</p>
<p>Values in <code>session</code> have the following properties:</p>
<table class="jsdoc-details-table">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Optional</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<p>WABrowserId</p>
</td>
<td>
<p>string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>WASecretBundle</p>
</td>
<td>
<p>string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>WAToken1</p>
</td>
<td>
<p>string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>WAToken2</p>
</td>
<td>
<p>string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
</tbody>
</table>
</td> </td>
</tr> </tr>
</tbody> </tbody>
@@ -1346,7 +1987,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.4 on June 18, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.6 on February 9, 2021.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.4"> <meta name="generator" content="JSDoc 3.6.6">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.7.0 &raquo; Source: Client.js</title> <title>whatsapp-web.js 1.12.3 &raquo; Source: Client.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar"> <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container"> <div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content"> <div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>7.<wbr>0</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>12.<wbr>3</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -38,14 +38,30 @@ const jsQR &#x3D; require(&#x27;jsqr&#x27;);
const Util &#x3D; require(&#x27;./util/Util&#x27;); const Util &#x3D; require(&#x27;./util/Util&#x27;);
const InterfaceController &#x3D; require(&#x27;./util/InterfaceController&#x27;); const InterfaceController &#x3D; require(&#x27;./util/InterfaceController&#x27;);
const { WhatsWebURL, UserAgent, DefaultOptions, Events, WAState } &#x3D; require(&#x27;./util/Constants&#x27;); const { WhatsWebURL, DefaultOptions, Events, WAState } &#x3D; require(&#x27;./util/Constants&#x27;);
const { ExposeStore, LoadUtils } &#x3D; require(&#x27;./util/Injected&#x27;); const { ExposeStore, LoadUtils } &#x3D; require(&#x27;./util/Injected&#x27;);
const ChatFactory &#x3D; require(&#x27;./factories/ChatFactory&#x27;); const ChatFactory &#x3D; require(&#x27;./factories/ChatFactory&#x27;);
const ContactFactory &#x3D; require(&#x27;./factories/ContactFactory&#x27;); const ContactFactory &#x3D; require(&#x27;./factories/ContactFactory&#x27;);
const { ClientInfo, Message, MessageMedia, Contact, Location, GroupNotification } &#x3D; require(&#x27;./structures&#x27;); const { ClientInfo, Message, MessageMedia, Contact, Location, GroupNotification , Label } &#x3D; require(&#x27;./structures&#x27;);
/** /**
* Starting point for interacting with the WhatsApp Web API * Starting point for interacting with the WhatsApp Web API
* @extends {EventEmitter} * @extends {EventEmitter}
* @param {object} options - Client options
* @param {number} options.authTimeoutMs - Timeout for authentication selector in puppeteer
* @param {object} options.puppeteer - Puppeteer launch options. View docs here: https://github.com/puppeteer/puppeteer/
* @param {number} options.qrRefreshIntervalMs - Refresh interval for qr code (how much time to wait before checking if the qr code has changed)
* @param {number} options.qrTimeoutMs - Timeout for qr code selector in puppeteer
* @param {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
* @param {number} options.takeoverOnConflict - If another whatsapp web session is detected (another browser), take over the session in the current browser
* @param {number} options.takeoverTimeoutMs - How much time to wait before taking over the session
* @param {string} options.userAgent - User agent to use in puppeteer
* @param {string} options.ffmpegPath - Ffmpeg path to use when formating videos to webp while sending stickers
*
* @fires Client#qr * @fires Client#qr
* @fires Client#authenticated * @fires Client#authenticated
* @fires Client#auth_failure * @fires Client#auth_failure
@@ -71,6 +87,8 @@ class Client extends EventEmitter {
this.pupBrowser &#x3D; null; this.pupBrowser &#x3D; null;
this.pupPage &#x3D; null; this.pupPage &#x3D; null;
Util.setFfmpegPath(this.options.ffmpegPath);
} }
/** /**
@@ -79,11 +97,11 @@ class Client extends EventEmitter {
async initialize() { async initialize() {
const browser &#x3D; await puppeteer.launch(this.options.puppeteer); const browser &#x3D; await puppeteer.launch(this.options.puppeteer);
const page &#x3D; (await browser.pages())[0]; const page &#x3D; (await browser.pages())[0];
page.setUserAgent(UserAgent); page.setUserAgent(this.options.userAgent);
this.pupBrowser &#x3D; browser; this.pupBrowser &#x3D; browser;
this.pupPage &#x3D; page; this.pupPage &#x3D; page;
if (this.options.session) { if (this.options.session) {
await page.evaluateOnNewDocument( await page.evaluateOnNewDocument(
session &#x3D;&gt; { session &#x3D;&gt; {
@@ -99,8 +117,8 @@ class Client extends EventEmitter {
waitUntil: &#x27;load&#x27;, waitUntil: &#x27;load&#x27;,
timeout: 0, timeout: 0,
}); });
const KEEP_PHONE_CONNECTED_IMG_SELECTOR &#x3D; &#x27;[data-asset-intro-image-light&#x3D;&quot;true&quot;]&#x27;; const KEEP_PHONE_CONNECTED_IMG_SELECTOR &#x3D; &#x27;[data-asset-intro-image-light&#x3D;&quot;true&quot;], [data-asset-intro-image-dark&#x3D;&quot;true&quot;]&#x27;;
if (this.options.session) { if (this.options.session) {
// Check if session restore was successfull // Check if session restore was successfull
@@ -176,6 +194,10 @@ class Client extends EventEmitter {
* Emitted when authentication is successful * Emitted when authentication is successful
* @event Client#authenticated * @event Client#authenticated
* @param {object} session Object containing session information. Can be used to restore the session. * @param {object} session Object containing session information. Can be used to restore the session.
* @param {string} session.WABrowserId
* @param {string} session.WASecretBundle
* @param {string} session.WAToken1
* @param {string} session.WAToken2
*/ */
this.emit(Events.AUTHENTICATED, session); this.emit(Events.AUTHENTICATED, session);
@@ -186,6 +208,10 @@ class Client extends EventEmitter {
await page.evaluate(LoadUtils); await page.evaluate(LoadUtils);
// Expose client info // Expose client info
/**
* Current connection information
* @type {ClientInfo}
*/
this.info &#x3D; new ClientInfo(this, await page.evaluate(() &#x3D;&gt; { this.info &#x3D; new ClientInfo(this, await page.evaluate(() &#x3D;&gt; {
return window.Store.Conn.serialize(); return window.Store.Conn.serialize();
})); }));
@@ -223,7 +249,7 @@ class Client extends EventEmitter {
} }
return; return;
} }
const message &#x3D; new Message(this, msg); const message &#x3D; new Message(this, msg);
/** /**
@@ -292,7 +318,7 @@ class Client extends EventEmitter {
await page.exposeFunction(&#x27;onMessageAckEvent&#x27;, (msg, ack) &#x3D;&gt; { await page.exposeFunction(&#x27;onMessageAckEvent&#x27;, (msg, ack) &#x3D;&gt; {
const message &#x3D; new Message(this, msg); const message &#x3D; new Message(this, msg);
/** /**
* Emitted when an ack event occurrs on message type. * Emitted when an ack event occurrs on message type.
* @event Client#message_ack * @event Client#message_ack
@@ -306,7 +332,7 @@ class Client extends EventEmitter {
await page.exposeFunction(&#x27;onMessageMediaUploadedEvent&#x27;, (msg) &#x3D;&gt; { await page.exposeFunction(&#x27;onMessageMediaUploadedEvent&#x27;, (msg) &#x3D;&gt; {
const message &#x3D; new Message(this, msg); const message &#x3D; new Message(this, msg);
/** /**
* Emitted when media has been uploaded for a message sent by the client. * Emitted when media has been uploaded for a message sent by the client.
* @event Client#media_uploaded * @event Client#media_uploaded
@@ -326,10 +352,10 @@ class Client extends EventEmitter {
const ACCEPTED_STATES &#x3D; [WAState.CONNECTED, WAState.OPENING, WAState.PAIRING, WAState.TIMEOUT]; const ACCEPTED_STATES &#x3D; [WAState.CONNECTED, WAState.OPENING, WAState.PAIRING, WAState.TIMEOUT];
if(this.options.takeoverOnConflict) { if (this.options.takeoverOnConflict) {
ACCEPTED_STATES.push(WAState.CONFLICT); ACCEPTED_STATES.push(WAState.CONFLICT);
if(state &#x3D;&#x3D;&#x3D; WAState.CONFLICT) { if (state &#x3D;&#x3D;&#x3D; WAState.CONFLICT) {
setTimeout(() &#x3D;&gt; { setTimeout(() &#x3D;&gt; {
this.pupPage.evaluate(() &#x3D;&gt; window.Store.AppState.takeover()); this.pupPage.evaluate(() &#x3D;&gt; window.Store.AppState.takeover());
}, this.options.takeoverTimeoutMs); }, this.options.takeoverTimeoutMs);
@@ -350,7 +376,7 @@ class Client extends EventEmitter {
await page.exposeFunction(&#x27;onBatteryStateChangedEvent&#x27;, (state) &#x3D;&gt; { await page.exposeFunction(&#x27;onBatteryStateChangedEvent&#x27;, (state) &#x3D;&gt; {
const { battery, plugged } &#x3D; state; const { battery, plugged } &#x3D; state;
if(battery &#x3D;&#x3D;&#x3D; undefined) return; if (battery &#x3D;&#x3D;&#x3D; undefined) return;
/** /**
* Emitted when the battery percentage for the attached device changes * Emitted when the battery percentage for the attached device changes
@@ -363,12 +389,12 @@ class Client extends EventEmitter {
}); });
await page.evaluate(() &#x3D;&gt; { await page.evaluate(() &#x3D;&gt; {
window.Store.Msg.on(&#x27;add&#x27;, (msg) &#x3D;&gt; { if(msg.isNewMsg) window.onAddMessageEvent(msg); }); window.Store.Msg.on(&#x27;add&#x27;, (msg) &#x3D;&gt; { if (msg.isNewMsg) window.onAddMessageEvent(window.WWebJS.getMessageModel(msg)); });
window.Store.Msg.on(&#x27;change&#x27;, (msg) &#x3D;&gt; { window.onChangeMessageEvent(msg); }); window.Store.Msg.on(&#x27;change&#x27;, (msg) &#x3D;&gt; { window.onChangeMessageEvent(window.WWebJS.getMessageModel(msg)); });
window.Store.Msg.on(&#x27;change:type&#x27;, (msg) &#x3D;&gt; { window.onChangeMessageTypeEvent(msg); }); window.Store.Msg.on(&#x27;change:type&#x27;, (msg) &#x3D;&gt; { window.onChangeMessageTypeEvent(window.WWebJS.getMessageModel(msg)); });
window.Store.Msg.on(&#x27;change:ack&#x27;, (msg, ack) &#x3D;&gt; { window.onMessageAckEvent(msg, ack); }); window.Store.Msg.on(&#x27;change:ack&#x27;, (msg,ack) &#x3D;&gt; { window.onMessageAckEvent(window.WWebJS.getMessageModel(msg), ack); });
window.Store.Msg.on(&#x27;change:isUnsentMedia&#x27;, (msg, unsent) &#x3D;&gt; { if(msg.id.fromMe &amp;amp;&amp;amp; !unsent) window.onMessageMediaUploadedEvent(msg); }); window.Store.Msg.on(&#x27;change:isUnsentMedia&#x27;, (msg, unsent) &#x3D;&gt; { if (msg.id.fromMe &amp;amp;&amp;amp; !unsent) window.onMessageMediaUploadedEvent(window.WWebJS.getMessageModel(msg)); });
window.Store.Msg.on(&#x27;remove&#x27;, (msg) &#x3D;&gt; { if(msg.isNewMsg) window.onRemoveMessageEvent(msg); }); window.Store.Msg.on(&#x27;remove&#x27;, (msg) &#x3D;&gt; { if (msg.isNewMsg) window.onRemoveMessageEvent(window.WWebJS.getMessageModel(msg)); });
window.Store.AppState.on(&#x27;change:state&#x27;, (_AppState, state) &#x3D;&gt; { window.onAppStateChangedEvent(state); }); window.Store.AppState.on(&#x27;change:state&#x27;, (_AppState, state) &#x3D;&gt; { window.onAppStateChangedEvent(state); });
window.Store.Conn.on(&#x27;change:battery&#x27;, (state) &#x3D;&gt; { window.onBatteryStateChangedEvent(state); }); window.Store.Conn.on(&#x27;change:battery&#x27;, (state) &#x3D;&gt; { window.onBatteryStateChangedEvent(state); });
}); });
@@ -401,7 +427,7 @@ class Client extends EventEmitter {
/** /**
* Returns the version of WhatsApp Web currently being run * Returns the version of WhatsApp Web currently being run
* @returns Promise&amp;lt;string&gt; * @returns {Promise&amp;lt;string&gt;}
*/ */
async getWWebVersion() { async getWWebVersion() {
return await this.pupPage.evaluate(() &#x3D;&gt; { return await this.pupPage.evaluate(() &#x3D;&gt; {
@@ -423,22 +449,41 @@ class Client extends EventEmitter {
return result; return result;
} }
/**
* Message options.
* @typedef {Object} MessageSendOptions
* @property {boolean} [linkPreview&#x3D;true] - Show links preview
* @property {boolean} [sendAudioAsVoice&#x3D;false] - Send audio as voice message
* @property {boolean} [sendMediaAsSticker&#x3D;false] - Send media as a sticker
* @property {boolean} [sendMediaAsDocument&#x3D;false] - Send media as a document
* @property {boolean} [parseVCards&#x3D;true] - Automatically parse vCards and send them as contacts
* @property {string} [caption] - Image or video caption
* @property {string} [quotedMessageId] - Id of the message that is being quoted (or replied to)
* @property {Contact[]} [mentions] - Contacts that are being mentioned in the message
* @property {boolean} [sendSeen&#x3D;true] - Mark the conversation as seen after sending the message
* @property {boolean} [media] - Media to be sent
*/
/** /**
* Send a message to a specific chatId * Send a message to a specific chatId
* @param {string} chatId * @param {string} chatId
* @param {string|MessageMedia|Location} content * @param {string|MessageMedia|Location|Contact|Array&amp;lt;Contact&gt;} content
* @param {object} options * @param {MessageSendOptions} [options] - Options used when sending the message
*
* @returns {Promise&amp;lt;Message&gt;} Message that was just sent * @returns {Promise&amp;lt;Message&gt;} Message that was just sent
*/ */
async sendMessage(chatId, content, options &#x3D; {}) { async sendMessage(chatId, content, options &#x3D; {}) {
let internalOptions &#x3D; { let internalOptions &#x3D; {
linkPreview: options.linkPreview &#x3D;&#x3D;&#x3D; false ? undefined : true, linkPreview: options.linkPreview &#x3D;&#x3D;&#x3D; false ? undefined : true,
sendAudioAsVoice: options.sendAudioAsVoice, sendAudioAsVoice: options.sendAudioAsVoice,
sendMediaAsSticker: options.sendMediaAsSticker,
sendMediaAsDocument: options.sendMediaAsDocument,
caption: options.caption, caption: options.caption,
quotedMessageId: options.quotedMessageId, quotedMessageId: options.quotedMessageId,
parseVCards: options.parseVCards &#x3D;&#x3D;&#x3D; false ? false : true,
mentionedJidList: Array.isArray(options.mentions) ? options.mentions.map(contact &#x3D;&gt; contact.id._serialized) : [] mentionedJidList: Array.isArray(options.mentions) ? options.mentions.map(contact &#x3D;&gt; contact.id._serialized) : []
}; };
const sendSeen &#x3D; typeof options.sendSeen &#x3D;&#x3D;&#x3D; &#x27;undefined&#x27; ? true : options.sendSeen; const sendSeen &#x3D; typeof options.sendSeen &#x3D;&#x3D;&#x3D; &#x27;undefined&#x27; ? true : options.sendSeen;
if (content instanceof MessageMedia) { if (content instanceof MessageMedia) {
@@ -451,13 +496,23 @@ class Client extends EventEmitter {
} else if (content instanceof Location) { } else if (content instanceof Location) {
internalOptions.location &#x3D; content; internalOptions.location &#x3D; content;
content &#x3D; &#x27;&#x27;; content &#x3D; &#x27;&#x27;;
} else if(content instanceof Contact) {
internalOptions.contactCard &#x3D; content.id._serialized;
content &#x3D; &#x27;&#x27;;
} else if(Array.isArray(content) &amp;amp;&amp;amp; content.length &gt; 0 &amp;amp;&amp;amp; content[0] instanceof Contact) {
internalOptions.contactCardList &#x3D; content.map(contact &#x3D;&gt; contact.id._serialized);
content &#x3D; &#x27;&#x27;;
}
if (internalOptions.sendMediaAsSticker &amp;amp;&amp;amp; internalOptions.attachment) {
internalOptions.attachment &#x3D; await Util.formatToWebpSticker(internalOptions.attachment);
} }
const newMessage &#x3D; await this.pupPage.evaluate(async (chatId, message, options, sendSeen) &#x3D;&gt; { const newMessage &#x3D; await this.pupPage.evaluate(async (chatId, message, options, sendSeen) &#x3D;&gt; {
const chatWid &#x3D; window.Store.WidFactory.createWid(chatId); const chatWid &#x3D; window.Store.WidFactory.createWid(chatId);
const chat &#x3D; await window.Store.Chat.find(chatWid); const chat &#x3D; await window.Store.Chat.find(chatWid);
if(sendSeen) { if (sendSeen) {
window.WWebJS.sendSeen(chatId); window.WWebJS.sendSeen(chatId);
} }
@@ -473,8 +528,8 @@ class Client extends EventEmitter {
* @returns {Promise&amp;lt;Array&amp;lt;Chat&gt;&gt;} * @returns {Promise&amp;lt;Array&amp;lt;Chat&gt;&gt;}
*/ */
async getChats() { async getChats() {
let chats &#x3D; await this.pupPage.evaluate(() &#x3D;&gt; { let chats &#x3D; await this.pupPage.evaluate(async () &#x3D;&gt; {
return window.WWebJS.getChats(); return await window.WWebJS.getChats();
}); });
return chats.map(chat &#x3D;&gt; ChatFactory.create(this, chat)); return chats.map(chat &#x3D;&gt; ChatFactory.create(this, chat));
@@ -486,8 +541,8 @@ class Client extends EventEmitter {
* @returns {Promise&amp;lt;Chat&gt;} * @returns {Promise&amp;lt;Chat&gt;}
*/ */
async getChatById(chatId) { async getChatById(chatId) {
let chat &#x3D; await this.pupPage.evaluate(chatId &#x3D;&gt; { let chat &#x3D; await this.pupPage.evaluate(async chatId &#x3D;&gt; {
return window.WWebJS.getChat(chatId); return await window.WWebJS.getChat(chatId);
}, chatId); }, chatId);
return ChatFactory.create(this, chat); return ChatFactory.create(this, chat);
@@ -532,6 +587,7 @@ class Client extends EventEmitter {
/** /**
* Accepts an invitation to join a group * Accepts an invitation to join a group
* @param {string} inviteCode Invitation code * @param {string} inviteCode Invitation code
* @returns {Promise&amp;lt;string&gt;} Id of the joined Chat
*/ */
async acceptInvite(inviteCode) { async acceptInvite(inviteCode) {
const chatId &#x3D; await this.pupPage.evaluate(async inviteCode &#x3D;&gt; { const chatId &#x3D; await this.pupPage.evaluate(async inviteCode &#x3D;&gt; {
@@ -551,6 +607,17 @@ class Client extends EventEmitter {
}, status); }, status);
} }
/**
* Sets the current user&#x27;s display name.
* This is the name shown to WhatsApp users that have not added you as a contact beside your number in groups and in your profile.
* @param {string} displayName New display name
*/
async setDisplayName(displayName) {
await this.pupPage.evaluate(async displayName &#x3D;&gt; {
return await window.Store.Wap.setPushname(displayName);
}, displayName);
}
/** /**
* Gets the current connection state for the client * Gets the current connection state for the client
* @returns {WAState} * @returns {WAState}
@@ -594,6 +661,43 @@ class Client extends EventEmitter {
}, chatId); }, chatId);
} }
/**
* Pins the Chat
* @returns {Promise&amp;lt;boolean&gt;} New pin state. Could be false if the max number of pinned chats was reached.
*/
async pinChat(chatId) {
return this.pupPage.evaluate(async chatId &#x3D;&gt; {
let chat &#x3D; window.Store.Chat.get(chatId);
if (chat.pin) {
return true;
}
const MAX_PIN_COUNT &#x3D; 3;
if (window.Store.Chat.models.length &gt; MAX_PIN_COUNT) {
let maxPinned &#x3D; window.Store.Chat.models[MAX_PIN_COUNT - 1].pin;
if (maxPinned) {
return false;
}
}
await window.Store.Cmd.pinChat(chat, true);
return true;
}, chatId);
}
/**
* Unpins the Chat
* @returns {Promise&amp;lt;boolean&gt;} New pin state
*/
async unpinChat(chatId) {
return this.pupPage.evaluate(async chatId &#x3D;&gt; {
let chat &#x3D; window.Store.Chat.get(chatId);
if (!chat.pin) {
return false;
}
await window.Store.Cmd.pinChat(chat, false);
return false;
}, chatId);
}
/** /**
* Mutes the Chat until a specified date * Mutes the Chat until a specified date
* @param {string} chatId ID of the chat that will be muted * @param {string} chatId ID of the chat that will be muted
@@ -605,7 +709,7 @@ class Client extends EventEmitter {
await chat.mute.mute(timestamp, !0); await chat.mute.mute(timestamp, !0);
}, chatId, unmuteDate.getTime() / 1000); }, chatId, unmuteDate.getTime() / 1000);
} }
/** /**
* Unmutes the Chat * Unmutes the Chat
* @param {string} chatId ID of the chat that will be unmuted * @param {string} chatId ID of the chat that will be unmuted
@@ -616,7 +720,18 @@ class Client extends EventEmitter {
await window.Store.Cmd.muteChat(chat, false); await window.Store.Cmd.muteChat(chat, false);
}, chatId); }, chatId);
} }
/**
* Mark the Chat as unread
* @param {string} chatId ID of the chat that will be marked as unread
*/
async markChatUnread(chatId) {
await this.pupPage.evaluate(async chatId &#x3D;&gt; {
let chat &#x3D; await window.Store.Chat.get(chatId);
await window.Store.Cmd.markChatUnread(chat, true);
}, chatId);
}
/** /**
* Returns the contact ID&#x27;s profile picture URL, if privacy settings allow it * Returns the contact ID&#x27;s profile picture URL, if privacy settings allow it
* @param {string} contactId the whatsapp user&#x27;s ID * @param {string} contactId the whatsapp user&#x27;s ID
@@ -633,7 +748,7 @@ class Client extends EventEmitter {
/** /**
* Force reset of connection state for the client * Force reset of connection state for the client
*/ */
async resetState(){ async resetState() {
await this.pupPage.evaluate(() &#x3D;&gt; { await this.pupPage.evaluate(() &#x3D;&gt; {
window.Store.AppState.phoneWatchdog.shiftTimer.forceRunNow(); window.Store.AppState.phoneWatchdog.shiftTimer.forceRunNow();
}); });
@@ -641,6 +756,7 @@ class Client extends EventEmitter {
/** /**
* Check if a given ID is registered in whatsapp * Check if a given ID is registered in whatsapp
* @param {string} id the whatsapp user&#x27;s ID
* @returns {Promise&amp;lt;Boolean&gt;} * @returns {Promise&amp;lt;Boolean&gt;}
*/ */
async isRegisteredUser(id) { async isRegisteredUser(id) {
@@ -650,6 +766,26 @@ class Client extends EventEmitter {
}, id); }, id);
} }
/**
* Get the registered WhatsApp ID for a number.
* Will return null if the number is not registered on WhatsApp.
* @param {string} number Number or ID (&quot;@c.us&quot; will be automatically appended if not specified)
* @returns {Promise&amp;lt;Object|null&gt;}
*/
async getNumberId(number) {
if(!number.endsWith(&#x27;@c.us&#x27;)) {
number +&#x3D; &#x27;@c.us&#x27;;
}
try {
return await this.pupPage.evaluate(async numberId &#x3D;&gt; {
return window.WWebJS.getNumberId(numberId);
}, number);
} catch(_) {
return null;
}
}
/** /**
* Create a new group * Create a new group
* @param {string} name group title * @param {string} name group title
@@ -659,18 +795,18 @@ class Client extends EventEmitter {
* @returns {Object.&amp;lt;string,string&gt;} createRes.missingParticipants - participants that were not added to the group. Keys represent the ID for participant that was not added and its value is a status code that represents the reason why participant could not be added. This is usually 403 if the user&#x27;s privacy settings don&#x27;t allow you to add them to groups. * @returns {Object.&amp;lt;string,string&gt;} createRes.missingParticipants - participants that were not added to the group. Keys represent the ID for participant that was not added and its value is a status code that represents the reason why participant could not be added. This is usually 403 if the user&#x27;s privacy settings don&#x27;t allow you to add them to groups.
*/ */
async createGroup(name, participants) { async createGroup(name, participants) {
if(!Array.isArray(participants) || participants.length &#x3D;&#x3D; 0) { if (!Array.isArray(participants) || participants.length &#x3D;&#x3D; 0) {
throw &#x27;You need to add at least one other participant to the group&#x27;; throw &#x27;You need to add at least one other participant to the group&#x27;;
} }
if(participants.every(c &#x3D;&gt; c instanceof Contact)) { if (participants.every(c &#x3D;&gt; c instanceof Contact)) {
participants &#x3D; participants.map(c &#x3D;&gt; c.id._serialized); participants &#x3D; participants.map(c &#x3D;&gt; c.id._serialized);
} }
const createRes &#x3D; await this.pupPage.evaluate(async (name, participantIds) &#x3D;&gt; { const createRes &#x3D; await this.pupPage.evaluate(async (name, participantIds) &#x3D;&gt; {
const res &#x3D; await window.Store.Wap.createGroup(name, participantIds); const res &#x3D; await window.Store.Wap.createGroup(name, participantIds);
console.log(res); console.log(res);
if(!res.status &#x3D;&#x3D;&#x3D; 200) { if (!res.status &#x3D;&#x3D;&#x3D; 200) {
throw &#x27;An error occurred while creating the group!&#x27;; throw &#x27;An error occurred while creating the group!&#x27;;
} }
@@ -680,13 +816,70 @@ class Client extends EventEmitter {
const missingParticipants &#x3D; createRes.participants.reduce(((missing, c) &#x3D;&gt; { const missingParticipants &#x3D; createRes.participants.reduce(((missing, c) &#x3D;&gt; {
const id &#x3D; Object.keys(c)[0]; const id &#x3D; Object.keys(c)[0];
const statusCode &#x3D; c[id].code; const statusCode &#x3D; c[id].code;
if(statusCode !&#x3D; 200) return Object.assign(missing, {[id]: statusCode}); if (statusCode !&#x3D; 200) return Object.assign(missing, { [id]: statusCode });
return missing; return missing;
}), {}); }), {});
return { gid: createRes.gid, missingParticipants}; return { gid: createRes.gid, missingParticipants };
} }
/**
* Get all current Labels
* @returns {Promise&amp;lt;Array&amp;lt;Label&gt;&gt;}
*/
async getLabels() {
const labels &#x3D; await this.pupPage.evaluate(async () &#x3D;&gt; {
return window.WWebJS.getLabels();
});
return labels.map(data &#x3D;&gt; new Label(this , data));
}
/**
* Get Label instance by ID
* @param {string} labelId
* @returns {Promise&amp;lt;Label&gt;}
*/
async getLabelById(labelId) {
const label &#x3D; await this.pupPage.evaluate(async (labelId) &#x3D;&gt; {
return window.WWebJS.getLabel(labelId);
}, labelId);
return new Label(this, label);
}
/**
* Get all Labels assigned to a chat
* @param {string} chatId
* @returns {Promise&amp;lt;Array&amp;lt;Label&gt;&gt;}
*/
async getChatLabels(chatId){
const labels &#x3D; await this.pupPage.evaluate(async (chatId) &#x3D;&gt; {
return window.WWebJS.getChatLabels(chatId);
}, chatId);
return labels.map(data &#x3D;&gt; new Label(this, data));
}
/**
* Get all Chats for a specific Label
* @param {string} labelId
* @returns {Promise&amp;lt;Array&amp;lt;Chat&gt;&gt;}
*/
async getChatsByLabelId(labelId){
const chatIds &#x3D; await this.pupPage.evaluate(async (labelId) &#x3D;&gt; {
const label &#x3D; window.Store.Label.get(labelId);
const labelItems &#x3D; label.labelItemCollection.models;
return labelItems.reduce((result, item) &#x3D;&gt; {
if(item.parentType &#x3D;&#x3D;&#x3D; &#x27;Chat&#x27;){
result.push(item.parentId);
}
return result;
},[]);
}, labelId);
return Promise.all(chatIds.map(id &#x3D;&gt; this.getChatById(id)));
}
} }
module.exports &#x3D; Client; module.exports &#x3D; Client;
@@ -700,7 +893,7 @@ module.exports &#x3D; Client;
<footer id="jsdoc-footer" class="jsdoc-footer"> <footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container"> <div id="jsdoc-footer-container">
<p> <p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.4 on June 18, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.6 on February 9, 2021.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.4"> <meta name="generator" content="JSDoc 3.6.6">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.7.0 &raquo; Class: ClientInfo</title> <title>whatsapp-web.js 1.12.3 &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>7.<wbr>0</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>12.<wbr>3</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>
@@ -58,6 +58,11 @@
</dl> </dl>
</div> </div>
<div class="summary-column"> <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>
</div> </div>
@@ -90,8 +95,9 @@
<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>
@@ -193,6 +199,11 @@
<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> </section>
<h2>Method</h2> <h2>Method</h2>
<section> <section>
@@ -202,15 +213,18 @@
<dl class="dl-compact"> <dl class="dl-compact">
<dt>Returns</dt> <dt>Returns</dt>
<dd> <dd>
<p><code>object</code> <p>batteryStatus</p> <p><code>object</code> 
<p>batteryStatus</p>
</p> </p>
</dd> </dd>
<dd> <dd>
<p><code>number</code> <p>batteryStatus.battery - The current battery percentage</p> <p><code>number</code> 
<p>batteryStatus.battery - The current battery percentage</p>
</p> </p>
</dd> </dd>
<dd> <dd>
<p><code>boolean</code> <p>batteryStatus.plugged - Indicates if the phone is plugged in (true) or not (false)</p> <p><code>boolean</code> 
<p>batteryStatus.plugged - Indicates if the phone is plugged in (true) or not (false)</p>
</p> </p>
</dd> </dd>
</dl> </dl>
@@ -224,7 +238,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.4 on June 18, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.6 on February 9, 2021.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.4"> <meta name="generator" content="JSDoc 3.6.6">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.7.0 &raquo; Class: Contact</title> <title>whatsapp-web.js 1.12.3 &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>7.<wbr>0</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>12.<wbr>3</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,34 @@
</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#block">block()</a></dt>
<dd>
</dd>
<dt><a href="Contact.html#getAbout">getAbout()</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="Contact.html#getChat">getChat()</a></dt>
<dd>
</dd>
<dt><a href="Contact.html#getProfilePicUrl">getProfilePicUrl()</a></dt> <dt><a href="Contact.html#getProfilePicUrl">getProfilePicUrl()</a></dt>
<dd> <dd>
</dd> </dd>
</dl> </dl>
</div> </div>
<div class="summary-column"> <div class="summary-column">
</div> <dl class="dl-summary-callout">
<div class="summary-column"> <dt><a href="Contact.html#unblock">unblock()</a></dt>
<dd>
</dd>
</dl>
</div> </div>
</div> </div>
</div> </div>
@@ -115,10 +134,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 +199,36 @@
<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> <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 +238,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 +257,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.4 on June 18, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.6 on February 9, 2021.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.4"> <meta name="generator" content="JSDoc 3.6.6">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.7.0 &raquo; Class: GroupChat</title> <title>whatsapp-web.js 1.12.3 &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>7.<wbr>0</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>12.<wbr>3</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>
@@ -110,19 +119,31 @@
<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>
<dd>
</dd>
<dt><a href="GroupChat.html#getLabels">getLabels()</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#getInviteCode">getInviteCode()</a></dt>
<dd>
</dd>
<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> <dt><a href="GroupChat.html#mute">mute(unmuteDate)</a></dt>
<dd> <dd>
</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>
@@ -132,25 +153,31 @@
<dt><a href="GroupChat.html#revokeInvite">revokeInvite()</a></dt> <dt><a href="GroupChat.html#revokeInvite">revokeInvite()</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="GroupChat.html#sendMessage">sendMessage(content, options)</a></dt> <dt><a href="GroupChat.html#sendMessage">sendMessage(content[, options])</a></dt>
<dd> <dd>
</dd> </dd>
</dl>
</div>
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="GroupChat.html#sendSeen">sendSeen()</a></dt> <dt><a href="GroupChat.html#sendSeen">sendSeen()</a></dt>
<dd> <dd>
</dd> </dd>
<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>
@@ -160,6 +187,9 @@
<dt><a href="GroupChat.html#unmute">unmute()</a></dt> <dt><a href="GroupChat.html#unmute">unmute()</a></dt>
<dd> <dd>
</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>
@@ -247,7 +299,7 @@
<h2>Methods</h2> <h2>Methods</h2>
<section> <section>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div> <div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="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>
@@ -278,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>
@@ -316,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>
@@ -347,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>
@@ -415,14 +477,49 @@
<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>Gets the invite code for a specific group</p> <p>Returns the Contact that corresponds to this Chat.</p>
<dl class="dl-compact"> <dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Chat.html#getContact">Chat#getContact</a></dd>
<dt>Returns</dt>
<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="leave"><span class="symbol-name">leave</span><span class="signature"><span class="signature-params">()</span></span></h3> <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>
<dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code>Promise containing string</code> 
<p>Group's invite code</p>
</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>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>
<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> </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="mute"><span class="symbol-name">mute</span><span class="signature"><span class="signature-params">(unmuteDate)</span></span></h3> <h3 id="mute"><span class="symbol-name">mute</span><span class="signature"><span class="signature-params">(unmuteDate)</span></span></h3>
@@ -461,7 +558,18 @@
<dd><a href="Chat.html#mute">Chat#mute</a></dd> <dd><a href="Chat.html#mute">Chat#mute</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="promoteParticipants"><span class="symbol-name">promoteParticipants</span><span class="signature"><span class="signature-params">(participantIds)</span></span></h3> <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>
@@ -492,9 +600,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>
@@ -525,14 +639,22 @@
</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</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</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="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>
@@ -567,7 +689,7 @@
<p>&nbsp;</p> <p>&nbsp;</p>
</td> </td>
<td> <td>
<p>&nbsp;</p> <p>Yes</p>
</td> </td>
<td> <td>
</td> </td>
@@ -609,7 +731,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</span></span></h3>
<p>Updates the group description</p> <p>Updates the group description</p>
<section> <section>
<h4>Parameter</h4> <h4>Parameter</h4>
@@ -640,9 +762,95 @@
</table> </table>
</section> </section>
<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="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</span></span></h3>
<p>Updates the group subject</p> <p>Updates the group subject</p>
<section> <section>
<h4>Parameter</h4> <h4>Parameter</h4>
@@ -673,6 +881,10 @@
</table> </table>
</section> </section>
<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="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>
@@ -688,6 +900,17 @@
<dt>Inherited from</dt> <dt>Inherited from</dt>
<dd><a href="Chat.html#unmute">Chat#unmute</a></dd> <dd><a href="Chat.html#unmute">Chat#unmute</a></dd>
</dl> </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>
@@ -698,7 +921,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.4 on June 18, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.6 on February 9, 2021.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.4"> <meta name="generator" content="JSDoc 3.6.6">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.7.0 &raquo; Class: GroupNotification</title> <title>whatsapp-web.js 1.12.3 &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>7.<wbr>0</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>12.<wbr>3</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.4 on June 18, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.6 on February 9, 2021.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.4"> <meta name="generator" content="JSDoc 3.6.6">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.7.0 &raquo; Class: InterfaceController</title> <title>whatsapp-web.js 1.12.3 &raquo; Class: InterfaceController</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar"> <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container"> <div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content"> <div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>7.<wbr>0</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>12.<wbr>3</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">InterfaceController</span></h1> <h1><small></small><span class="symbol-name">InterfaceController</span></h1>
<p class="source-link">Source: <a href="util_InterfaceController.js.html#source-line-8">util/<wbr>InterfaceController.<wbr>js:8</a></p> <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"> <div class="symbol-classdesc">
<p>Interface Controller</p> <p>Interface Controller</p>
</div> </div>
@@ -49,16 +49,24 @@
</div> </div>
<div class="summary-column"> <div class="summary-column">
<dl class="dl-summary-callout"> <dl class="dl-summary-callout">
<dt><a href="InterfaceController.html#openChatSearch">openChatSearch(chatId)</a></dt>
<dd>
</dd>
<dt><a href="InterfaceController.html#openChatWindow">openChatWindow(chatId)</a></dt> <dt><a href="InterfaceController.html#openChatWindow">openChatWindow(chatId)</a></dt>
<dd> <dd>
</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> <dt><a href="InterfaceController.html#openMessageDrawer">openMessageDrawer(msgId)</a></dt>
<dd> <dd>
</dd> </dd>
</dl> </dl>
</div> </div>
<div class="summary-column">
</div>
</div> </div>
</div> </div>
</section> </section>
@@ -110,6 +118,40 @@
<dl class="dl-compact"> <dl class="dl-compact">
</dl> </dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div> <div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="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> <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> <p>Opens the Chat Window</p>
<section> <section>
@@ -144,6 +186,40 @@
<dl class="dl-compact"> <dl class="dl-compact">
</dl> </dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div> <div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="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> <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> <p>Opens the Message Drawer</p>
<section> <section>
@@ -187,7 +263,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.4 on June 18, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.6 on February 9, 2021.
</p> </p>
</div> </div>
</footer> </footer>

178
docs/Label.html Normal file
View File

@@ -0,0 +1,178 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.6">
<meta charset="utf-8">
<title>whatsapp-web.js 1.12.3 &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>12.<wbr>3</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.6 on February 9, 2021.
</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.4"> <meta name="generator" content="JSDoc 3.6.6">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.7.0 &raquo; Class: Location</title> <title>whatsapp-web.js 1.12.3 &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>7.<wbr>0</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>12.<wbr>3</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.4 on June 18, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.6 on February 9, 2021.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.4"> <meta name="generator" content="JSDoc 3.6.6">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.7.0 &raquo; Class: Message</title> <title>whatsapp-web.js 1.12.3 &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>7.<wbr>0</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>12.<wbr>3</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-12">structures/<wbr>Message.<wbr>js:12</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>
@@ -57,13 +57,13 @@
<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>
@@ -73,16 +73,25 @@
<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#location">location</a></dt> <dt><a href="Message.html#isStarred">isStarred</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Message.html#mediaKey">mediaKey</a></dt> <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>
<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="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>
@@ -95,6 +104,9 @@
<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>
@@ -110,6 +122,9 @@
<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>
@@ -120,6 +135,9 @@
<dt><a href="Message.html#getContact">getContact()</a></dt> <dt><a href="Message.html#getContact">getContact()</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="Message.html#getInfo">getInfo()</a></dt>
<dd>
</dd>
<dt><a href="Message.html#getMentions">getMentions()</a></dt> <dt><a href="Message.html#getMentions">getMentions()</a></dt>
<dd> <dd>
</dd> </dd>
@@ -130,7 +148,13 @@
</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#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>
@@ -198,6 +222,21 @@
<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="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 string</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>
@@ -230,6 +269,11 @@
<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>
@@ -277,6 +321,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</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">
@@ -294,6 +376,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">
@@ -312,7 +403,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="reply"><span class="symbol-name">reply</span><span class="signature"><span class="signature-params">(content, chatId, options)</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing <a href="Message.html">Message</a></span></span></h3> <h3 id="reply"><span class="symbol-name">reply</span><span class="signature"><span class="signature-params">(content[, chatId][, options])</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing <a href="Message.html">Message</a></span></span></h3>
<p>Sends a message as a reply to this message. If chatId is specified, it will be sent <p>Sends a message as a reply to this message. If chatId is specified, it will be sent
through the specified Chat. If not, it will send the message through the specified Chat. If not, it will send the message
in the same Chat as the original message was sent.</p> in the same Chat as the original message was sent.</p>
@@ -349,10 +440,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>
@@ -360,10 +450,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>
@@ -377,6 +467,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>
@@ -387,7 +487,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.4 on June 18, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.6 on February 9, 2021.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.4"> <meta name="generator" content="JSDoc 3.6.6">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.7.0 &raquo; Class: MessageMedia</title> <title>whatsapp-web.js 1.12.3 &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>7.<wbr>0</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>12.<wbr>3</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-14">structures/<wbr>MessageMedia.<wbr>js:14</a></p> <p class="source-link">Source: <a href="structures_MessageMedia.js.html#source-line-13">structures/<wbr>MessageMedia.<wbr>js:13</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>
@@ -208,7 +208,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.4 on June 18, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.6 on February 9, 2021.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.4"> <meta name="generator" content="JSDoc 3.6.6">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.7.0 &raquo; Class: PrivateChat</title> <title>whatsapp-web.js 1.12.3 &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>7.<wbr>0</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>12.<wbr>3</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,17 +98,29 @@
<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>
<dt><a href="PrivateChat.html#markUnread">markUnread()</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="PrivateChat.html#mute">mute(unmuteDate)</a></dt> <dt><a href="PrivateChat.html#mute">mute(unmuteDate)</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="PrivateChat.html#sendMessage">sendMessage(content, options)</a></dt> <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>
@@ -121,6 +142,9 @@
<dt><a href="PrivateChat.html#unmute">unmute()</a></dt> <dt><a href="PrivateChat.html#unmute">unmute()</a></dt>
<dd> <dd>
</dd> </dd>
<dt><a href="PrivateChat.html#unpin">unpin()</a></dt>
<dd>
</dd>
</dl> </dl>
</div> </div>
</div> </div>
@@ -157,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>
@@ -164,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>
@@ -171,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>
@@ -291,6 +336,31 @@
<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="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> <h3 id="mute"><span class="symbol-name">mute</span><span class="signature"><span class="signature-params">(unmuteDate)</span></span></h3>
<p>Mutes this chat until a specified date</p> <p>Mutes this chat until a specified date</p>
<section> <section>
@@ -327,7 +397,18 @@
<dd><a href="Chat.html#mute">Chat#mute</a></dd> <dd><a href="Chat.html#mute">Chat#mute</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="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="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>
@@ -362,7 +443,7 @@
<p>&nbsp;</p> <p>&nbsp;</p>
</td> </td>
<td> <td>
<p>&nbsp;</p> <p>Yes</p>
</td> </td>
<td> <td>
</td> </td>
@@ -417,6 +498,17 @@
<dt>Inherited from</dt> <dt>Inherited from</dt>
<dd><a href="Chat.html#unmute">Chat#unmute</a></dd> <dd><a href="Chat.html#unmute">Chat#unmute</a></dd>
</dl> </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>
@@ -427,7 +519,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.4 on June 18, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.6 on February 9, 2021.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.4"> <meta name="generator" content="JSDoc 3.6.6">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.7.0 &raquo; Class: PrivateContact</title> <title>whatsapp-web.js 1.12.3 &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>7.<wbr>0</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>12.<wbr>3</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,34 @@
</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#block">block()</a></dt>
<dd>
</dd>
<dt><a href="PrivateContact.html#getAbout">getAbout()</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="PrivateContact.html#getChat">getChat()</a></dt>
<dd>
</dd>
<dt><a href="PrivateContact.html#getProfilePicUrl">getProfilePicUrl()</a></dt> <dt><a href="PrivateContact.html#getProfilePicUrl">getProfilePicUrl()</a></dt>
<dd> <dd>
</dd> </dd>
</dl> </dl>
</div> </div>
<div class="summary-column"> <div class="summary-column">
</div> <dl class="dl-summary-callout">
<div class="summary-column"> <dt><a href="PrivateContact.html#unblock">unblock()</a></dt>
<dd>
</dd>
</dl>
</div> </div>
</div> </div>
</div> </div>
@@ -121,6 +140,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 +225,36 @@
<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> <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 +264,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 +283,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.4 on June 18, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.6 on February 9, 2021.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.4"> <meta name="generator" content="JSDoc 3.6.6">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.7.0 &raquo; Class: Util</title> <title>whatsapp-web.js 1.12.3 &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>7.<wbr>0</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>12.<wbr>3</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-15">util/<wbr>Util.<wbr>js:15</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)</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,159 @@
</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)</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>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=".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 +230,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.4 on June 18, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.6 on February 9, 2021.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.4"> <meta name="generator" content="JSDoc 3.6.6">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.7.0 &raquo; Globals</title> <title>whatsapp-web.js 1.12.3 &raquo; Globals</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar"> <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container"> <div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content"> <div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>7.<wbr>0</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>12.<wbr>3</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -63,6 +63,33 @@
</div> </div>
</div> </div>
</div> </div>
<div class="summary-callout">
<h2 class="summary-callout-heading">Abstract types</h2>
<div class="summary-content">
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="global.html#ContactId">ContactId</a></dt>
<dd>
</dd>
<dt><a href="global.html#GroupParticipant">GroupParticipant</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="global.html#MessageInfo">MessageInfo</a></dt>
<dd>
</dd>
<dt><a href="global.html#MessageSendOptions">MessageSendOptions</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
</div>
</div>
</div>
</section> </section>
<section> <section>
<h2>Properties</h2> <h2>Properties</h2>
@@ -1008,6 +1035,397 @@
<dl class="dl-compact"> <dl class="dl-compact">
</dl> </dl>
</section> </section>
<h2>Abstract types</h2>
<section>
<h3 id="ContactId"><span class="symbol-name">ContactId</span><small class="property-type">
&nbsp;Object</small></h3>
<p>ID that represents a contact</p>
<section>
<h4>Properties</h4>
<table class="jsdoc-details-table">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Optional</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<p>server</p>
</td>
<td>
<p>string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>user</p>
</td>
<td>
<p>string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>_serialized</p>
</td>
<td>
<p>string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
</dl>
<h3 id="GroupParticipant"><span class="symbol-name">GroupParticipant</span><small class="property-type">
&nbsp;Object</small></h3>
<p>Group participant information</p>
<section>
<h4>Properties</h4>
<table class="jsdoc-details-table">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Optional</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<p>id</p>
</td>
<td>
<p><a href="global.html#ContactId">ContactId</a></p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>isAdmin</p>
</td>
<td>
<p>boolean</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>isSuperAdmin</p>
</td>
<td>
<p>boolean</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
</dl>
<h3 id="MessageInfo"><span class="symbol-name">MessageInfo</span><small class="property-type">
&nbsp;Object</small></h3>
<p>Message Info</p>
<section>
<h4>Properties</h4>
<table class="jsdoc-details-table">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Optional</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<p>delivery</p>
</td>
<td>
<p>Array of {id: <a href="global.html#ContactId">ContactId</a>, t: number}</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Contacts to which the message has been delivered to</p>
</td>
</tr>
<tr>
<td>
<p>deliveryRemaining</p>
</td>
<td>
<p>number</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Amount of people to whom the message has not been delivered to</p>
</td>
</tr>
<tr>
<td>
<p>played</p>
</td>
<td>
<p>Array of {id: <a href="global.html#ContactId">ContactId</a>, t: number}</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Contacts who have listened to the voice message</p>
</td>
</tr>
<tr>
<td>
<p>playedRemaining</p>
</td>
<td>
<p>number</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Amount of people who have not listened to the message</p>
</td>
</tr>
<tr>
<td>
<p>read</p>
</td>
<td>
<p>Array of {id: <a href="global.html#ContactId">ContactId</a>, t: number}</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Contacts who have read the message</p>
</td>
</tr>
<tr>
<td>
<p>readRemaining</p>
</td>
<td>
<p>number</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Amount of people who have not read the message</p>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
</dl>
<h3 id="MessageSendOptions"><span class="symbol-name">MessageSendOptions</span><small class="property-type">
&nbsp;Object</small></h3>
<p>Message options.</p>
<section>
<h4>Properties</h4>
<table class="jsdoc-details-table">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Optional</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<p>linkPreview</p>
</td>
<td>
<p>boolean</p>
</td>
<td>
<p>Yes</p>
</td>
<td>
<p>Show links preview</p>
<p>Defaults to <code>true</code>.</p>
</td>
</tr>
<tr>
<td>
<p>sendAudioAsVoice</p>
</td>
<td>
<p>boolean</p>
</td>
<td>
<p>Yes</p>
</td>
<td>
<p>Send audio as voice message</p>
<p>Defaults to <code>false</code>.</p>
</td>
</tr>
<tr>
<td>
<p>sendMediaAsSticker</p>
</td>
<td>
<p>boolean</p>
</td>
<td>
<p>Yes</p>
</td>
<td>
<p>Send media as a sticker</p>
<p>Defaults to <code>false</code>.</p>
</td>
</tr>
<tr>
<td>
<p>sendMediaAsDocument</p>
</td>
<td>
<p>boolean</p>
</td>
<td>
<p>Yes</p>
</td>
<td>
<p>Send media as a document</p>
<p>Defaults to <code>false</code>.</p>
</td>
</tr>
<tr>
<td>
<p>parseVCards</p>
</td>
<td>
<p>boolean</p>
</td>
<td>
<p>Yes</p>
</td>
<td>
<p>Automatically parse vCards and send them as contacts</p>
<p>Defaults to <code>true</code>.</p>
</td>
</tr>
<tr>
<td>
<p>caption</p>
</td>
<td>
<p>string</p>
</td>
<td>
<p>Yes</p>
</td>
<td>
<p>Image or video caption</p>
</td>
</tr>
<tr>
<td>
<p>quotedMessageId</p>
</td>
<td>
<p>string</p>
</td>
<td>
<p>Yes</p>
</td>
<td>
<p>Id of the message that is being quoted (or replied to)</p>
</td>
</tr>
<tr>
<td>
<p>mentions</p>
</td>
<td>
<p>Array of <a href="Contact.html">Contact</a></p>
</td>
<td>
<p>Yes</p>
</td>
<td>
<p>Contacts that are being mentioned in the message</p>
</td>
</tr>
<tr>
<td>
<p>sendSeen</p>
</td>
<td>
<p>boolean</p>
</td>
<td>
<p>Yes</p>
</td>
<td>
<p>Mark the conversation as seen after sending the message</p>
<p>Defaults to <code>true</code>.</p>
</td>
</tr>
<tr>
<td>
<p>media</p>
</td>
<td>
<p>boolean</p>
</td>
<td>
<p>Yes</p>
</td>
<td>
<p>Media to be sent</p>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
</dl>
</section>
</section> </section>
</div> </div>
</div> </div>
@@ -1017,7 +1435,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.4 on June 18, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.6 on February 9, 2021.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.4"> <meta name="generator" content="JSDoc 3.6.6">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.7.0 &raquo; Home</title> <title>whatsapp-web.js 1.12.3 &raquo; Home</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar"> <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container"> <div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content"> <div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>7.<wbr>0</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>12.<wbr>3</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -27,11 +27,11 @@
<div id="jsdoc-main" role="main"> <div id="jsdoc-main" role="main">
<header class="page-header"> <header class="page-header">
<h1> <h1>
whatsapp-web.js 1.7.0 whatsapp-web.js 1.12.3
</h1> </h1>
</header> </header>
<article> <article>
<p><a href="https://www.npmjs.com/package/whatsapp-web.js"><img src="https://img.shields.io/npm/v/whatsapp-web.js.svg" alt="npm"></a> <a href="https://depfu.com/github/pedroslopez/whatsapp-web.js?project_id=9765"><img src="https://badges.depfu.com/badges/4a65a0de96ece65fdf39e294e0c8dcba/overview.svg" alt="Depfu"></a> <img src="https://img.shields.io/badge/WhatsApp_Web-2.2023.2-brightgreen.svg" alt="WhatsApp_Web 2.2023.2"> <a href="https://discord.gg/H7DqQs4"><img src="https://img.shields.io/discord/698610475432411196.svg?logo=discord" alt="Discord Chat"></a></p> <p><a href="https://www.npmjs.com/package/whatsapp-web.js"><img src="https://img.shields.io/npm/v/whatsapp-web.js.svg" alt="npm"></a> <a href="https://depfu.com/github/pedroslopez/whatsapp-web.js?project_id=9765"><img src="https://badges.depfu.com/badges/4a65a0de96ece65fdf39e294e0c8dcba/overview.svg" alt="Depfu"></a> <img src="https://img.shields.io/badge/WhatsApp_Web-2.2104.6-brightgreen.svg" alt="WhatsApp_Web 2.2104.6"> <a href="https://discord.gg/H7DqQs4"><img src="https://img.shields.io/discord/698610475432411196.svg?logo=discord" alt="Discord Chat"></a></p>
<h1>whatsapp-web.js</h1> <h1>whatsapp-web.js</h1>
<p>A WhatsApp API client that connects through the WhatsApp Web browser app</p> <p>A WhatsApp API client that connects through the WhatsApp Web browser app</p>
<p>It uses Puppeteer to run a real instance of Whatsapp Web to avoid getting blocked.</p> <p>It uses Puppeteer to run a real instance of Whatsapp Web to avoid getting blocked.</p>
@@ -84,11 +84,11 @@ client.initialize();
</tr> </tr>
<tr> <tr>
<td>Send media (video)</td> <td>Send media (video)</td>
<td><a href="https://github.com/pedroslopez/whatsapp-web.js/issues/78#issuecomment-592723583">(requires google chrome)</a></td> <td><a href="https://waguide.pedroslopez.me/features/handling-attachments#caveat-for-sending-videos-and-gifs">(requires google chrome)</a></td>
</tr> </tr>
<tr> <tr>
<td>Send stickers</td> <td>Send stickers</td>
<td><em>pending</em></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>Receive media (images/audio/video/documents)</td> <td>Receive media (images/audio/video/documents)</td>
@@ -96,7 +96,7 @@ client.initialize();
</tr> </tr>
<tr> <tr>
<td>Send contact cards</td> <td>Send contact cards</td>
<td><em>pending</em></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>Send location</td> <td>Send location</td>
@@ -122,6 +122,10 @@ client.initialize();
<td>Modify group info (subject, description)</td> <td>Modify group info (subject, description)</td>
<td></td> <td></td>
</tr> </tr>
<tr>
<td>Modify group settings (send messages, edit info)</td>
<td></td>
</tr>
<tr> <tr>
<td>Add group participants</td> <td>Add group participants</td>
<td></td> <td></td>
@@ -142,6 +146,10 @@ client.initialize();
<td>Mute/unmute chats</td> <td>Mute/unmute chats</td>
<td></td> <td></td>
</tr> </tr>
<tr>
<td>Block/unblock contacts</td>
<td></td>
</tr>
<tr> <tr>
<td>Get contact info</td> <td>Get contact info</td>
<td></td> <td></td>
@@ -217,11 +225,26 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="BusinessContact.html#block" class="!symbol-index-name">BusinessContact#<wbr>block()</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="BusinessContact.html#businessProfile" class="!symbol-index-name">BusinessContact#<wbr>businessProfile</a> <a href="BusinessContact.html#businessProfile" class="!symbol-index-name">BusinessContact#<wbr>businessProfile</a>
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="BusinessContact.html#getAbout" class="!symbol-index-name">BusinessContact#<wbr>getAbout()</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="BusinessContact.html#getChat" class="!symbol-index-name">BusinessContact#<wbr>getChat()</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="BusinessContact.html#getProfilePicUrl" class="!symbol-index-name">BusinessContact#<wbr>getProfilePicUrl()</a> <a href="BusinessContact.html#getProfilePicUrl" class="!symbol-index-name">BusinessContact#<wbr>getProfilePicUrl()</a>
</dt> </dt>
@@ -232,15 +255,20 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name">
<a href="BusinessContact.html#isBlocked" class="!symbol-index-name">BusinessContact#<wbr>isBlocked</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="BusinessContact.html#isBusiness" class="!symbol-index-name">BusinessContact#<wbr>isBusiness</a> <a href="BusinessContact.html#isBusiness" class="!symbol-index-name">BusinessContact#<wbr>isBusiness</a>
</dt> </dt>
<dd> <dd>
</dd> </dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="BusinessContact.html#isEnterprise" class="!symbol-index-name">BusinessContact#<wbr>isEnterprise</a> <a href="BusinessContact.html#isEnterprise" class="!symbol-index-name">BusinessContact#<wbr>isEnterprise</a>
</dt> </dt>
@@ -295,6 +323,11 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="BusinessContact.html#unblock" class="!symbol-index-name">BusinessContact#<wbr>unblock()</a>
</dt>
<dd>
</dd>
</dl> </dl>
</div> </div>
</div> </div>
@@ -341,42 +374,72 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
</dl> <dt class="symbol-index-name">
</div> <a href="Chat.html#getContact" class="!symbol-index-name">Chat#<wbr>getContact()</a>
<div class="symbol-index-column"> </dt>
<dl class="symbol-index-list"> <dd>
</dd>
<dt class="symbol-index-name">
<a href="Chat.html#getLabels" class="!symbol-index-name">Chat#<wbr>getLabels()</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="Chat.html#id" class="!symbol-index-name">Chat#<wbr>id</a> <a href="Chat.html#id" class="!symbol-index-name">Chat#<wbr>id</a>
</dt> </dt>
<dd> <dd>
</dd> </dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="Chat.html#isGroup" class="!symbol-index-name">Chat#<wbr>isGroup</a> <a href="Chat.html#isGroup" class="!symbol-index-name">Chat#<wbr>isGroup</a>
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="Chat.html#isMuted" class="!symbol-index-name">Chat#<wbr>isMuted</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="Chat.html#isReadOnly" class="!symbol-index-name">Chat#<wbr>isReadOnly</a> <a href="Chat.html#isReadOnly" class="!symbol-index-name">Chat#<wbr>isReadOnly</a>
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="Chat.html#markUnread" class="!symbol-index-name">Chat#<wbr>markUnread()</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="Chat.html#mute" class="!symbol-index-name">Chat#<wbr>mute(unmuteDate)</a> <a href="Chat.html#mute" class="!symbol-index-name">Chat#<wbr>mute(unmuteDate)</a>
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="Chat.html#muteExpiration" class="!symbol-index-name">Chat#<wbr>muteExpiration</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="Chat.html#name" class="!symbol-index-name">Chat#<wbr>name</a> <a href="Chat.html#name" class="!symbol-index-name">Chat#<wbr>name</a>
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="Chat.html#sendMessage" class="!symbol-index-name">Chat#<wbr>sendMessage(content, options)</a> <a href="Chat.html#pin" class="!symbol-index-name">Chat#<wbr>pin()</a>
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="Chat.html#sendSeen" class="!symbol-index-name">Chat#<wbr>sendSeen()</a> <a href="Chat.html#pinned" class="!symbol-index-name">Chat#<wbr>pinned</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="Chat.html#sendMessage" class="!symbol-index-name">Chat#<wbr>sendMessage(content[, options])</a>
</dt> </dt>
<dd> <dd>
</dd> </dd>
@@ -384,6 +447,11 @@ client.initialize();
</div> </div>
<div class="symbol-index-column"> <div class="symbol-index-column">
<dl class="symbol-index-list"> <dl class="symbol-index-list">
<dt class="symbol-index-name">
<a href="Chat.html#sendSeen" class="!symbol-index-name">Chat#<wbr>sendSeen()</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="Chat.html#sendStateRecording" class="!symbol-index-name">Chat#<wbr>sendStateRecording()</a> <a href="Chat.html#sendStateRecording" class="!symbol-index-name">Chat#<wbr>sendStateRecording()</a>
</dt> </dt>
@@ -409,6 +477,11 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="Chat.html#unpin" class="!symbol-index-name">Chat#<wbr>unpin()</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="Chat.html#unreadCount" class="!symbol-index-name">Chat#<wbr>unreadCount</a> <a href="Chat.html#unreadCount" class="!symbol-index-name">Chat#<wbr>unreadCount</a>
</dt> </dt>
@@ -460,7 +533,7 @@ client.initialize();
<div class="symbol-index-column"> <div class="symbol-index-column">
<dl class="symbol-index-list"> <dl class="symbol-index-list">
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="Client.html" class="!symbol-index-name">Client()</a> <a href="Client.html" class="!symbol-index-name">Client(options)</a>
</dt> </dt>
<dd> <dd>
</dd> </dd>
@@ -529,10 +602,6 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="Client.html#event:message" class="!symbol-index-name">Client#<wbr>event:message</a> <a href="Client.html#event:message" class="!symbol-index-name">Client#<wbr>event:message</a>
</dt> </dt>
@@ -548,6 +617,10 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="Client.html#event:message_revoke_everyone" class="!symbol-index-name">Client#<wbr>event:message_revoke_everyone</a> <a href="Client.html#event:message_revoke_everyone" class="!symbol-index-name">Client#<wbr>event:message_revoke_everyone</a>
</dt> </dt>
@@ -573,11 +646,21 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="Client.html#getChatLabels" class="!symbol-index-name">Client#<wbr>getChatLabels(chatId)</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="Client.html#getChats" class="!symbol-index-name">Client#<wbr>getChats()</a> <a href="Client.html#getChats" class="!symbol-index-name">Client#<wbr>getChats()</a>
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="Client.html#getChatsByLabelId" class="!symbol-index-name">Client#<wbr>getChatsByLabelId(labelId)</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="Client.html#getContactById" class="!symbol-index-name">Client#<wbr>getContactById(contactId)</a> <a href="Client.html#getContactById" class="!symbol-index-name">Client#<wbr>getContactById(contactId)</a>
</dt> </dt>
@@ -593,6 +676,21 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="Client.html#getLabelById" class="!symbol-index-name">Client#<wbr>getLabelById(labelId)</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="Client.html#getLabels" class="!symbol-index-name">Client#<wbr>getLabels()</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="Client.html#getNumberId" class="!symbol-index-name">Client#<wbr>getNumberId(number)</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="Client.html#getProfilePicUrl" class="!symbol-index-name">Client#<wbr>getProfilePicUrl(contactId)</a> <a href="Client.html#getProfilePicUrl" class="!symbol-index-name">Client#<wbr>getProfilePicUrl(contactId)</a>
</dt> </dt>
@@ -603,12 +701,17 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="Client.html#getWWebVersion" class="!symbol-index-name">Client#<wbr>getWWebVersion()</a>
</dt>
<dd>
</dd>
</dl> </dl>
</div> </div>
<div class="symbol-index-column"> <div class="symbol-index-column">
<dl class="symbol-index-list"> <dl class="symbol-index-list">
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="Client.html#getWWebVersion" class="!symbol-index-name">Client#<wbr>getWWebVersion()</a> <a href="Client.html#info" class="!symbol-index-name">Client#<wbr>info</a>
</dt> </dt>
<dd> <dd>
</dd> </dd>
@@ -618,7 +721,7 @@ client.initialize();
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="Client.html#isRegisteredUser" class="!symbol-index-name">Client#<wbr>isRegisteredUser()</a> <a href="Client.html#isRegisteredUser" class="!symbol-index-name">Client#<wbr>isRegisteredUser(id)</a>
</dt> </dt>
<dd> <dd>
</dd> </dd>
@@ -627,18 +730,28 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="Client.html#markChatUnread" class="!symbol-index-name">Client#<wbr>markChatUnread(chatId)</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="Client.html#muteChat" class="!symbol-index-name">Client#<wbr>muteChat(chatId, unmuteDate)</a> <a href="Client.html#muteChat" class="!symbol-index-name">Client#<wbr>muteChat(chatId, unmuteDate)</a>
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="Client.html#pinChat" class="!symbol-index-name">Client#<wbr>pinChat()</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="Client.html#resetState" class="!symbol-index-name">Client#<wbr>resetState()</a> <a href="Client.html#resetState" class="!symbol-index-name">Client#<wbr>resetState()</a>
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="Client.html#sendMessage" class="!symbol-index-name">Client#<wbr>sendMessage(chatId, content, options)</a> <a href="Client.html#sendMessage" class="!symbol-index-name">Client#<wbr>sendMessage(chatId, content[, options])</a>
</dt> </dt>
<dd> <dd>
</dd> </dd>
@@ -652,6 +765,11 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="Client.html#setDisplayName" class="!symbol-index-name">Client#<wbr>setDisplayName(displayName)</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="Client.html#setStatus" class="!symbol-index-name">Client#<wbr>setStatus(status)</a> <a href="Client.html#setStatus" class="!symbol-index-name">Client#<wbr>setStatus(status)</a>
</dt> </dt>
@@ -667,6 +785,11 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="Client.html#unpinChat" class="!symbol-index-name">Client#<wbr>unpinChat()</a>
</dt>
<dd>
</dd>
</dl> </dl>
</div> </div>
</div> </div>
@@ -688,24 +811,20 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="ClientInfo.html#me" class="!symbol-index-name">ClientInfo#<wbr>me</a> <a href="ClientInfo.html#me" class="!symbol-index-name">ClientInfo#<wbr>me</a>
</dt> </dt>
<dd> <dd>
</dd> </dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="ClientInfo.html#phone" class="!symbol-index-name">ClientInfo#<wbr>phone</a> <a href="ClientInfo.html#phone" class="!symbol-index-name">ClientInfo#<wbr>phone</a>
</dt> </dt>
<dd> <dd>
</dd> </dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="ClientInfo.html#platform" class="!symbol-index-name">ClientInfo#<wbr>platform</a> <a href="ClientInfo.html#platform" class="!symbol-index-name">ClientInfo#<wbr>platform</a>
</dt> </dt>
@@ -718,6 +837,15 @@ client.initialize();
</dd> </dd>
</dl> </dl>
</div> </div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name">
<a href="ClientInfo.html#wid" class="!symbol-index-name">ClientInfo#<wbr>wid</a>
</dt>
<dd>
</dd>
</dl>
</div>
</div> </div>
</div> </div>
</section> </section>
@@ -732,6 +860,21 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="Contact.html#block" class="!symbol-index-name">Contact#<wbr>block()</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="Contact.html#getAbout" class="!symbol-index-name">Contact#<wbr>getAbout()</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="Contact.html#getChat" class="!symbol-index-name">Contact#<wbr>getChat()</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="Contact.html#getProfilePicUrl" class="!symbol-index-name">Contact#<wbr>getProfilePicUrl()</a> <a href="Contact.html#getProfilePicUrl" class="!symbol-index-name">Contact#<wbr>getProfilePicUrl()</a>
</dt> </dt>
@@ -742,6 +885,15 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="Contact.html#isBlocked" class="!symbol-index-name">Contact#<wbr>isBlocked</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="Contact.html#isBusiness" class="!symbol-index-name">Contact#<wbr>isBusiness</a> <a href="Contact.html#isBusiness" class="!symbol-index-name">Contact#<wbr>isBusiness</a>
</dt> </dt>
@@ -752,10 +904,6 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="Contact.html#isGroup" class="!symbol-index-name">Contact#<wbr>isGroup</a> <a href="Contact.html#isGroup" class="!symbol-index-name">Contact#<wbr>isGroup</a>
</dt> </dt>
@@ -805,6 +953,11 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="Contact.html#unblock" class="!symbol-index-name">Contact#<wbr>unblock()</a>
</dt>
<dd>
</dd>
</dl> </dl>
</div> </div>
</div> </div>
@@ -970,25 +1123,40 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
</dl> <dt class="symbol-index-name">
</div> <a href="GroupChat.html#getContact" class="!symbol-index-name">GroupChat#<wbr>getContact()</a>
<div class="symbol-index-column"> </dt>
<dl class="symbol-index-list"> <dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="GroupChat.html#getInviteCode" class="!symbol-index-name">GroupChat#<wbr>getInviteCode()</a> <a href="GroupChat.html#getInviteCode" class="!symbol-index-name">GroupChat#<wbr>getInviteCode()</a>
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="GroupChat.html#getLabels" class="!symbol-index-name">GroupChat#<wbr>getLabels()</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="GroupChat.html#id" class="!symbol-index-name">GroupChat#<wbr>id</a> <a href="GroupChat.html#id" class="!symbol-index-name">GroupChat#<wbr>id</a>
</dt> </dt>
<dd> <dd>
</dd> </dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="GroupChat.html#isGroup" class="!symbol-index-name">GroupChat#<wbr>isGroup</a> <a href="GroupChat.html#isGroup" class="!symbol-index-name">GroupChat#<wbr>isGroup</a>
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="GroupChat.html#isMuted" class="!symbol-index-name">GroupChat#<wbr>isMuted</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="GroupChat.html#isReadOnly" class="!symbol-index-name">GroupChat#<wbr>isReadOnly</a> <a href="GroupChat.html#isReadOnly" class="!symbol-index-name">GroupChat#<wbr>isReadOnly</a>
</dt> </dt>
@@ -999,11 +1167,21 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="GroupChat.html#markUnread" class="!symbol-index-name">GroupChat#<wbr>markUnread()</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="GroupChat.html#mute" class="!symbol-index-name">GroupChat#<wbr>mute(unmuteDate)</a> <a href="GroupChat.html#mute" class="!symbol-index-name">GroupChat#<wbr>mute(unmuteDate)</a>
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="GroupChat.html#muteExpiration" class="!symbol-index-name">GroupChat#<wbr>muteExpiration</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="GroupChat.html#name" class="!symbol-index-name">GroupChat#<wbr>name</a> <a href="GroupChat.html#name" class="!symbol-index-name">GroupChat#<wbr>name</a>
</dt> </dt>
@@ -1019,6 +1197,16 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="GroupChat.html#pin" class="!symbol-index-name">GroupChat#<wbr>pin()</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="GroupChat.html#pinned" class="!symbol-index-name">GroupChat#<wbr>pinned</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="GroupChat.html#promoteParticipants" class="!symbol-index-name">GroupChat#<wbr>promoteParticipants(participantIds)</a> <a href="GroupChat.html#promoteParticipants" class="!symbol-index-name">GroupChat#<wbr>promoteParticipants(participantIds)</a>
</dt> </dt>
@@ -1029,17 +1217,17 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="GroupChat.html#revokeInvite" class="!symbol-index-name">GroupChat#<wbr>revokeInvite()</a> <a href="GroupChat.html#revokeInvite" class="!symbol-index-name">GroupChat#<wbr>revokeInvite()</a>
</dt> </dt>
<dd> <dd>
</dd> </dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="GroupChat.html#sendMessage" class="!symbol-index-name">GroupChat#<wbr>sendMessage(content, options)</a> <a href="GroupChat.html#sendMessage" class="!symbol-index-name">GroupChat#<wbr>sendMessage(content[, options])</a>
</dt> </dt>
<dd> <dd>
</dd> </dd>
@@ -1063,6 +1251,16 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="GroupChat.html#setInfoAdminsOnly" class="!symbol-index-name">GroupChat#<wbr>setInfoAdminsOnly([adminsOnly])</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="GroupChat.html#setMessagesAdminsOnly" class="!symbol-index-name">GroupChat#<wbr>setMessagesAdminsOnly([adminsOnly])</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="GroupChat.html#setSubject" class="!symbol-index-name">GroupChat#<wbr>setSubject(subject)</a> <a href="GroupChat.html#setSubject" class="!symbol-index-name">GroupChat#<wbr>setSubject(subject)</a>
</dt> </dt>
@@ -1083,6 +1281,11 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="GroupChat.html#unpin" class="!symbol-index-name">GroupChat#<wbr>unpin()</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="GroupChat.html#unreadCount" class="!symbol-index-name">GroupChat#<wbr>unreadCount</a> <a href="GroupChat.html#unreadCount" class="!symbol-index-name">GroupChat#<wbr>unreadCount</a>
</dt> </dt>
@@ -1252,20 +1455,30 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="InterfaceController.html#openChatDrawer" class="!symbol-index-name">InterfaceController#<wbr>openChatDrawer(chatId)</a> <a href="InterfaceController.html#openChatDrawer" class="!symbol-index-name">InterfaceController#<wbr>openChatDrawer(chatId)</a>
</dt> </dt>
<dd> <dd>
</dd> </dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name">
<a href="InterfaceController.html#openChatSearch" class="!symbol-index-name">InterfaceController#<wbr>openChatSearch(chatId)</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="InterfaceController.html#openChatWindow" class="!symbol-index-name">InterfaceController#<wbr>openChatWindow(chatId)</a> <a href="InterfaceController.html#openChatWindow" class="!symbol-index-name">InterfaceController#<wbr>openChatWindow(chatId)</a>
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="InterfaceController.html#openChatWindowAt" class="!symbol-index-name">InterfaceController#<wbr>openChatWindowAt(msgId)</a>
</dt>
<dd>
</dd>
</dl> </dl>
</div> </div>
<div class="symbol-index-column"> <div class="symbol-index-column">
@@ -1280,6 +1493,50 @@ client.initialize();
</div> </div>
</div> </div>
</section> </section>
<section>
<div class="symbol-index-content">
<h2 id="Label">Label</h2>
<div class="symbol-index-section">
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name">
<a href="Label.html" class="!symbol-index-name">Label(client, labelData)</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="Label.html#getChats" class="!symbol-index-name">Label#<wbr>getChats()</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name">
<a href="Label.html#hexColor" class="!symbol-index-name">Label#<wbr>hexColor</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="Label.html#id" class="!symbol-index-name">Label#<wbr>id</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name">
<a href="Label.html#name" class="!symbol-index-name">Label#<wbr>name</a>
</dt>
<dd>
</dd>
</dl>
</div>
</div>
</div>
</section>
<section> <section>
<div class="symbol-index-content"> <div class="symbol-index-content">
<h2 id="Location">Location</h2> <h2 id="Location">Location</h2>
@@ -1360,15 +1617,16 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="Message.html#forward" class="!symbol-index-name">Message#<wbr>forward(chat)</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="Message.html#from" class="!symbol-index-name">Message#<wbr>from</a> <a href="Message.html#from" class="!symbol-index-name">Message#<wbr>from</a>
</dt> </dt>
<dd> <dd>
</dd> </dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="Message.html#fromMe" class="!symbol-index-name">Message#<wbr>fromMe</a> <a href="Message.html#fromMe" class="!symbol-index-name">Message#<wbr>fromMe</a>
</dt> </dt>
@@ -1379,11 +1637,20 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="Message.html#getContact" class="!symbol-index-name">Message#<wbr>getContact()</a> <a href="Message.html#getContact" class="!symbol-index-name">Message#<wbr>getContact()</a>
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="Message.html#getInfo" class="!symbol-index-name">Message#<wbr>getInfo()</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="Message.html#getMentions" class="!symbol-index-name">Message#<wbr>getMentions()</a> <a href="Message.html#getMentions" class="!symbol-index-name">Message#<wbr>getMentions()</a>
</dt> </dt>
@@ -1409,15 +1676,30 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="Message.html#isForwarded" class="!symbol-index-name">Message#<wbr>isForwarded</a> <a href="Message.html#isForwarded" class="!symbol-index-name">Message#<wbr>isForwarded</a>
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="Message.html#isStarred" class="!symbol-index-name">Message#<wbr>isStarred</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="Message.html#isStatus" class="!symbol-index-name">Message#<wbr>isStatus</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="Message.html#links" class="!symbol-index-name">Message#<wbr>links</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="Message.html#location" class="!symbol-index-name">Message#<wbr>location</a> <a href="Message.html#location" class="!symbol-index-name">Message#<wbr>location</a>
</dt> </dt>
@@ -1434,7 +1716,12 @@ client.initialize();
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="Message.html#reply" class="!symbol-index-name">Message#<wbr>reply(content, chatId, options)</a> <a href="Message.html#reply" class="!symbol-index-name">Message#<wbr>reply(content[, chatId][, options])</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="Message.html#star" class="!symbol-index-name">Message#<wbr>star()</a>
</dt> </dt>
<dd> <dd>
</dd> </dd>
@@ -1453,6 +1740,16 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="Message.html#unstar" class="!symbol-index-name">Message#<wbr>unstar()</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="Message.html#vCards" class="!symbol-index-name">Message#<wbr>vCards</a>
</dt>
<dd>
</dd>
</dl> </dl>
</div> </div>
</div> </div>
@@ -1671,42 +1968,72 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
</dl> <dt class="symbol-index-name">
</div> <a href="PrivateChat.html#getContact" class="!symbol-index-name">PrivateChat#<wbr>getContact()</a>
<div class="symbol-index-column"> </dt>
<dl class="symbol-index-list"> <dd>
</dd>
<dt class="symbol-index-name">
<a href="PrivateChat.html#getLabels" class="!symbol-index-name">PrivateChat#<wbr>getLabels()</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="PrivateChat.html#id" class="!symbol-index-name">PrivateChat#<wbr>id</a> <a href="PrivateChat.html#id" class="!symbol-index-name">PrivateChat#<wbr>id</a>
</dt> </dt>
<dd> <dd>
</dd> </dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="PrivateChat.html#isGroup" class="!symbol-index-name">PrivateChat#<wbr>isGroup</a> <a href="PrivateChat.html#isGroup" class="!symbol-index-name">PrivateChat#<wbr>isGroup</a>
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="PrivateChat.html#isMuted" class="!symbol-index-name">PrivateChat#<wbr>isMuted</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="PrivateChat.html#isReadOnly" class="!symbol-index-name">PrivateChat#<wbr>isReadOnly</a> <a href="PrivateChat.html#isReadOnly" class="!symbol-index-name">PrivateChat#<wbr>isReadOnly</a>
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="PrivateChat.html#markUnread" class="!symbol-index-name">PrivateChat#<wbr>markUnread()</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="PrivateChat.html#mute" class="!symbol-index-name">PrivateChat#<wbr>mute(unmuteDate)</a> <a href="PrivateChat.html#mute" class="!symbol-index-name">PrivateChat#<wbr>mute(unmuteDate)</a>
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="PrivateChat.html#muteExpiration" class="!symbol-index-name">PrivateChat#<wbr>muteExpiration</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="PrivateChat.html#name" class="!symbol-index-name">PrivateChat#<wbr>name</a> <a href="PrivateChat.html#name" class="!symbol-index-name">PrivateChat#<wbr>name</a>
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="PrivateChat.html#sendMessage" class="!symbol-index-name">PrivateChat#<wbr>sendMessage(content, options)</a> <a href="PrivateChat.html#pin" class="!symbol-index-name">PrivateChat#<wbr>pin()</a>
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="PrivateChat.html#sendSeen" class="!symbol-index-name">PrivateChat#<wbr>sendSeen()</a> <a href="PrivateChat.html#pinned" class="!symbol-index-name">PrivateChat#<wbr>pinned</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="PrivateChat.html#sendMessage" class="!symbol-index-name">PrivateChat#<wbr>sendMessage(content[, options])</a>
</dt> </dt>
<dd> <dd>
</dd> </dd>
@@ -1714,6 +2041,11 @@ client.initialize();
</div> </div>
<div class="symbol-index-column"> <div class="symbol-index-column">
<dl class="symbol-index-list"> <dl class="symbol-index-list">
<dt class="symbol-index-name">
<a href="PrivateChat.html#sendSeen" class="!symbol-index-name">PrivateChat#<wbr>sendSeen()</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="PrivateChat.html#sendStateRecording" class="!symbol-index-name">PrivateChat#<wbr>sendStateRecording()</a> <a href="PrivateChat.html#sendStateRecording" class="!symbol-index-name">PrivateChat#<wbr>sendStateRecording()</a>
</dt> </dt>
@@ -1739,6 +2071,11 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="PrivateChat.html#unpin" class="!symbol-index-name">PrivateChat#<wbr>unpin()</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="PrivateChat.html#unreadCount" class="!symbol-index-name">PrivateChat#<wbr>unreadCount</a> <a href="PrivateChat.html#unreadCount" class="!symbol-index-name">PrivateChat#<wbr>unreadCount</a>
</dt> </dt>
@@ -1760,6 +2097,21 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="PrivateContact.html#block" class="!symbol-index-name">PrivateContact#<wbr>block()</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="PrivateContact.html#getAbout" class="!symbol-index-name">PrivateContact#<wbr>getAbout()</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="PrivateContact.html#getChat" class="!symbol-index-name">PrivateContact#<wbr>getChat()</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="PrivateContact.html#getProfilePicUrl" class="!symbol-index-name">PrivateContact#<wbr>getProfilePicUrl()</a> <a href="PrivateContact.html#getProfilePicUrl" class="!symbol-index-name">PrivateContact#<wbr>getProfilePicUrl()</a>
</dt> </dt>
@@ -1770,6 +2122,15 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="PrivateContact.html#isBlocked" class="!symbol-index-name">PrivateContact#<wbr>isBlocked</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="PrivateContact.html#isBusiness" class="!symbol-index-name">PrivateContact#<wbr>isBusiness</a> <a href="PrivateContact.html#isBusiness" class="!symbol-index-name">PrivateContact#<wbr>isBusiness</a>
</dt> </dt>
@@ -1780,10 +2141,6 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name"> <dt class="symbol-index-name">
<a href="PrivateContact.html#isGroup" class="!symbol-index-name">PrivateContact#<wbr>isGroup</a> <a href="PrivateContact.html#isGroup" class="!symbol-index-name">PrivateContact#<wbr>isGroup</a>
</dt> </dt>
@@ -1833,6 +2190,11 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="PrivateContact.html#unblock" class="!symbol-index-name">PrivateContact#<wbr>unblock()</a>
</dt>
<dd>
</dd>
</dl> </dl>
</div> </div>
</div> </div>
@@ -1883,14 +2245,34 @@ client.initialize();
</dt> </dt>
<dd> <dd>
</dd> </dd>
<dt class="symbol-index-name">
<a href="Util.html#.formatImageToWebpSticker" class="!symbol-index-name">Util.<wbr>formatImageToWebpSticker(media)</a>
</dt>
<dd>
</dd>
</dl> </dl>
</div> </div>
<div class="symbol-index-column"> <div class="symbol-index-column">
<dl class="symbol-index-list"> <dl class="symbol-index-list">
<dt class="symbol-index-name">
<a href="Util.html#.formatToWebpSticker" class="!symbol-index-name">Util.<wbr>formatToWebpSticker(media)</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="Util.html#.formatVideoToWebpSticker" class="!symbol-index-name">Util.<wbr>formatVideoToWebpSticker(media)</a>
</dt>
<dd>
</dd>
</dl> </dl>
</div> </div>
<div class="symbol-index-column"> <div class="symbol-index-column">
<dl class="symbol-index-list"> <dl class="symbol-index-list">
<dt class="symbol-index-name">
<a href="Util.html#.setFfmpegPath" class="!symbol-index-name">Util.<wbr>setFfmpegPath(path)</a>
</dt>
<dd>
</dd>
</dl> </dl>
</div> </div>
</div> </div>
@@ -1984,7 +2366,7 @@ client.initialize();
<footer id="jsdoc-footer" class="jsdoc-footer"> <footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container"> <div id="jsdoc-footer-container">
<p> <p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.4 on June 18, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.6 on February 9, 2021.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -6,7 +6,7 @@
treeNode.tree({ treeNode.tree({
autoEscape: false, autoEscape: false,
closedIcon: '&#x21e2;', closedIcon: '&#x21e2;',
data: [{"label":"<a href=\"global.html\">Globals</a>","id":"global","children":[]},{"label":"<a href=\"Base.html\">Base</a>","id":"Base","children":[]},{"label":"<a href=\"BusinessContact.html\">BusinessContact</a>","id":"BusinessContact","children":[]},{"label":"<a href=\"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=\"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=\"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=\"InterfaceController.html\">InterfaceController</a>","id":"InterfaceController","children":[]},{"label":"<a href=\"Label.html\">Label</a>","id":"Label","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":[]}],
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.4"> <meta name="generator" content="JSDoc 3.6.6">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.7.0 &raquo; Source: structures/Base.js</title> <title>whatsapp-web.js 1.12.3 &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>7.<wbr>0</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>12.<wbr>3</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.4 on June 18, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.6 on February 9, 2021.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.4"> <meta name="generator" content="JSDoc 3.6.6">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.7.0 &raquo; Source: structures/BusinessContact.js</title> <title>whatsapp-web.js 1.12.3 &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>7.<wbr>0</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>12.<wbr>3</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.4 on June 18, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.6 on February 9, 2021.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.4"> <meta name="generator" content="JSDoc 3.6.6">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.7.0 &raquo; Source: structures/Chat.js</title> <title>whatsapp-web.js 1.12.3 &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>7.<wbr>0</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>12.<wbr>3</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 {number}
*/
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,6 +161,22 @@ 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 until a specified date * Mutes this chat until a specified date
* @param {Date} unmuteDate Date at which the Chat will be unmuted * @param {Date} unmuteDate Date at which the Chat will be unmuted
@@ -150,7 +184,7 @@ class Chat extends Base {
async mute(unmuteDate) { async mute(unmuteDate) {
return this.client.muteChat(this.id._serialized, unmuteDate); return this.client.muteChat(this.id._serialized, unmuteDate);
} }
/** /**
* Unmutes this chat * Unmutes this chat
*/ */
@@ -158,6 +192,13 @@ class Chat extends Base {
return this.client.unmuteChat(this.id._serialized); 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 is supported.
@@ -165,29 +206,30 @@ class Chat extends Base {
* @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) { if (!searchOptions || !searchOptions.limit) {
searchOptions &#x3D; {limit: 50}; searchOptions &#x3D; { limit: 50 };
} }
let messages &#x3D; await this.client.pupPage.evaluate(async (chatId, limit) &#x3D;&gt; { let messages &#x3D; await this.client.pupPage.evaluate(async (chatId, limit) &#x3D;&gt; {
const msgFilter &#x3D; m &#x3D;&gt; !m.isNotification; // dont include notification messages const msgFilter &#x3D; m &#x3D;&gt; !m.isNotification; // dont include notification messages
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.models.filter(msgFilter);
while(msgs.length &amp;lt; limit) { while (msgs.length &amp;lt; limit) {
const loadedMessages &#x3D; await chat.loadEarlierMsgs(); const loadedMessages &#x3D; await chat.loadEarlierMsgs();
if(!loadedMessages) break; if (!loadedMessages) break;
msgs &#x3D; [...loadedMessages.filter(msgFilter), ...msgs]; msgs &#x3D; [...loadedMessages.filter(msgFilter), ...msgs];
} }
msgs.sort((a, b) &#x3D;&gt; (a.t &gt; b.t) ? 1 : -1); msgs.sort((a, b) &#x3D;&gt; (a.t &gt; b.t) ? 1 : -1);
return msgs.splice(msgs.length - limit).map(m &#x3D;&gt; m.serialize()); if (msgs.length &gt; limit) msgs &#x3D; msgs.splice(msgs.length - limit);
return msgs.map(m &#x3D;&gt; window.WWebJS.getMessageModel(m));
}, this.id._serialized, searchOptions.limit); }, this.id._serialized, searchOptions.limit);
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.
*/ */
@@ -197,7 +239,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.
*/ */
@@ -207,7 +249,7 @@ class Chat extends Base {
return true; return true;
}, this.id._serialized); }, this.id._serialized);
} }
/** /**
* Stops typing or recording in chat immediately. * Stops typing or recording in chat immediately.
*/ */
@@ -217,6 +259,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;
@@ -230,7 +288,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.4 on June 18, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.6 on February 9, 2021.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.4"> <meta name="generator" content="JSDoc 3.6.6">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.7.0 &raquo; Source: structures/ClientInfo.js</title> <title>whatsapp-web.js 1.12.3 &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>7.<wbr>0</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>12.<wbr>3</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) {
@@ -51,11 +51,17 @@ class ClientInfo extends Base {
*/ */
this.pushname &#x3D; data.pushname; this.pushname &#x3D; data.pushname;
/**
* @type {object}
* @deprecated Use .wid instead
*/
this.me &#x3D; data.wid;
/** /**
* Current user ID * Current user ID
* @type {object} * @type {object}
*/ */
this.me &#x3D; data.me; this.wid &#x3D; data.wid;
/** /**
* Information about the phone this client is connected to * Information about the phone this client is connected to
@@ -102,7 +108,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.4 on June 18, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.6 on February 9, 2021.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.4"> <meta name="generator" content="JSDoc 3.6.6">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.7.0 &raquo; Source: structures/Contact.js</title> <title>whatsapp-web.js 1.12.3 &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>7.<wbr>0</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>12.<wbr>3</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);
} }
@@ -136,6 +150,62 @@ class Contact extends Base {
async getProfilePicUrl() { async getProfilePicUrl() {
return await this.client.getProfilePicUrl(this.id._serialized); return await this.client.getProfilePicUrl(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);
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; {
return window.Store.Wap.statusFind(contactId);
}, this.id._serialized);
if (typeof about.status !&#x3D;&#x3D; &#x27;string&#x27;)
return null;
return about.status;
}
} }
@@ -149,7 +219,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.4 on June 18, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.6 on February 9, 2021.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.4"> <meta name="generator" content="JSDoc 3.6.6">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.7.0 &raquo; Source: structures/GroupChat.js</title> <title>whatsapp-web.js 1.12.3 &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>7.<wbr>0</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>12.<wbr>3</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,6 +87,7 @@ 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; {
@@ -87,6 +98,7 @@ class GroupChat extends Chat {
/** /**
* 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; {
@@ -97,6 +109,7 @@ class GroupChat extends Chat {
/** /**
* 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; {
@@ -107,6 +120,7 @@ class GroupChat extends Chat {
/** /**
* 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; {
@@ -117,6 +131,7 @@ class GroupChat extends Chat {
/** /**
* Updates the group subject * Updates the group subject
* @param {string} subject * @param {string} subject
* @returns {Promise}
*/ */
async setSubject(subject) { async setSubject(subject) {
let res &#x3D; await this.client.pupPage.evaluate((chatId, subject) &#x3D;&gt; { let res &#x3D; await this.client.pupPage.evaluate((chatId, subject) &#x3D;&gt; {
@@ -131,6 +146,7 @@ class GroupChat extends Chat {
/** /**
* Updates the group description * Updates the group description
* @param {string} description * @param {string} description
* @returns {Promise}
*/ */
async setDescription(description) { async setDescription(description) {
let res &#x3D; await this.client.pupPage.evaluate((chatId, description) &#x3D;&gt; { let res &#x3D; await this.client.pupPage.evaluate((chatId, description) &#x3D;&gt; {
@@ -143,8 +159,41 @@ class GroupChat extends Chat {
} }
} }
/**
* 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) {
let res &#x3D; await this.client.pupPage.evaluate((chatId, value) &#x3D;&gt; {
return window.Store.Wap.setGroupProperty(chatId, &#x27;announcement&#x27;, value);
}, this.id._serialized, adminsOnly);
if (res.status !&#x3D;&#x3D; 200) 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) {
let res &#x3D; await this.client.pupPage.evaluate((chatId, value) &#x3D;&gt; {
return window.Store.Wap.setGroupProperty(chatId, &#x27;restrict&#x27;, value);
}, this.id._serialized, adminsOnly);
if (res.status !&#x3D;&#x3D; 200) 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; { let res &#x3D; await this.client.pupPage.evaluate(chatId &#x3D;&gt; {
@@ -160,6 +209,7 @@ class GroupChat extends Chat {
/** /**
* Invalidates the current group invite code and generates a new one * Invalidates the current group invite code and generates a new one
* @returns {Promise}
*/ */
async revokeInvite() { async revokeInvite() {
return await this.client.pupPage.evaluate(chatId &#x3D;&gt; { return await this.client.pupPage.evaluate(chatId &#x3D;&gt; {
@@ -169,6 +219,7 @@ class GroupChat extends Chat {
/** /**
* 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; { return await this.client.pupPage.evaluate(chatId &#x3D;&gt; {
@@ -188,7 +239,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.4 on June 18, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.6 on February 9, 2021.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.4"> <meta name="generator" content="JSDoc 3.6.6">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.7.0 &raquo; Source: structures/GroupNotification.js</title> <title>whatsapp-web.js 1.12.3 &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>7.<wbr>0</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>12.<wbr>3</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -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.4 on June 18, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.6 on February 9, 2021.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -0,0 +1,103 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.6">
<meta charset="utf-8">
<title>whatsapp-web.js 1.12.3 &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>12.<wbr>3</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.6 on February 9, 2021.
</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.4"> <meta name="generator" content="JSDoc 3.6.6">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.7.0 &raquo; Source: structures/Location.js</title> <title>whatsapp-web.js 1.12.3 &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>7.<wbr>0</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>12.<wbr>3</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.4 on June 18, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.6 on February 9, 2021.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.4"> <meta name="generator" content="JSDoc 3.6.6">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.7.0 &raquo; Source: structures/Message.js</title> <title>whatsapp-web.js 1.12.3 &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>7.<wbr>0</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>12.<wbr>3</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -44,7 +44,7 @@ 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) {
@@ -71,7 +71,7 @@ class Message extends Base {
* 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; data.clientUrl || data.deprecatedMms3Url ? true : false;
/** /**
* Message content * Message content
@@ -118,6 +118,18 @@ class Message extends Base {
*/ */
this.isForwarded &#x3D; data.isForwarded; this.isForwarded &#x3D; data.isForwarded;
/**
* 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}
@@ -129,7 +141,7 @@ class Message extends Base {
* @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}
@@ -142,6 +154,12 @@ class Message extends Base {
*/ */
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] : [];
/** /**
* 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;}
@@ -152,6 +170,12 @@ class Message extends Base {
this.mentionedIds &#x3D; data.mentionedJidList; this.mentionedIds &#x3D; data.mentionedJidList;
} }
/**
* Links included in the message.
* @type {Array&amp;lt;string&gt;}
*/
this.links &#x3D; data.links;
return super._patch(data); return super._patch(data);
} }
@@ -204,11 +228,11 @@ class Message extends Base {
* 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();
} }
@@ -221,6 +245,23 @@ class Message extends Base {
return this.client.sendMessage(chatId, content, options); return this.client.sendMessage(chatId, content, options);
} }
/**
* Forwards this message to another chat
*
* @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;}
@@ -232,21 +273,23 @@ class Message extends Base {
const result &#x3D; await this.client.pupPage.evaluate(async (msgId) &#x3D;&gt; { const result &#x3D; await this.client.pupPage.evaluate(async (msgId) &#x3D;&gt; {
const msg &#x3D; window.Store.Msg.get(msgId); const msg &#x3D; window.Store.Msg.get(msgId);
if(msg.mediaData.mediaStage !&#x3D; &#x27;RESOLVED&#x27;) { if (msg.mediaData.mediaStage !&#x3D; &#x27;RESOLVED&#x27;) {
// try to resolve media // try to resolve media
await msg.downloadMedia(true, 1); await msg.downloadMedia(true, 1);
} }
if(msg.mediaData.mediaStage.includes(&#x27;ERROR&#x27;)) { if (msg.mediaData.mediaStage.includes(&#x27;ERROR&#x27;)) {
// media could not be downloaded // media could not be downloaded
return undefined; return undefined;
} }
const buffer &#x3D; await window.WWebJS.downloadBuffer(msg.clientUrl); const mediaUrl &#x3D; msg.clientUrl || msg.deprecatedMms3Url;
const buffer &#x3D; await window.WWebJS.downloadBuffer(mediaUrl);
const decrypted &#x3D; await window.Store.CryptoLib.decryptE2EMedia(msg.type, buffer, msg.mediaKey, msg.mimetype); const decrypted &#x3D; await window.Store.CryptoLib.decryptE2EMedia(msg.type, buffer, msg.mediaKey, msg.mimetype);
const data &#x3D; await window.WWebJS.readBlobAsync(decrypted._blob); const data &#x3D; await window.WWebJS.readBlobAsync(decrypted._blob);
return { return {
data: data.split(&#x27;,&#x27;)[1], data: data.split(&#x27;,&#x27;)[1],
mimetype: msg.mimetype, mimetype: msg.mimetype,
@@ -255,7 +298,7 @@ class Message extends Base {
}, this.id._serialized); }, this.id._serialized);
if(!result) return undefined; if (!result) return undefined;
return new MessageMedia(result.mimetype, result.data, result.filename); return new MessageMedia(result.mimetype, result.data, result.filename);
} }
@@ -267,13 +310,69 @@ class Message extends Base {
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()) { if (everyone &amp;amp;&amp;amp; msg.id.fromMe &amp;amp;&amp;amp; msg.canRevoke()) {
return window.Store.Cmd.sendRevokeMsgs(msg.chat, [msg], true); return window.Store.Cmd.sendRevokeMsgs(msg.chat, [msg], true);
} }
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.pupPage.evaluate((msgId) &#x3D;&gt; {
let msg &#x3D; window.Store.Msg.get(msgId);
if (msg.canStar()) {
return msg.chat.sendStarMsgs([msg], true);
}
}, this.id._serialized);
}
/**
* Unstars this message
*/
async unstar() {
await this.pupPage.evaluate((msgId) &#x3D;&gt; {
let msg &#x3D; window.Store.Msg.get(msgId);
if (msg.canStar()) {
return msg.chat.sendStarMsgs([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.Wap.queryMsgInfo(msg.id);
}, this.id._serialized);
if(info.status) {
return null;
}
return info;
}
} }
module.exports &#x3D; Message; module.exports &#x3D; Message;
@@ -287,7 +386,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.4 on June 18, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.6 on February 9, 2021.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.4"> <meta name="generator" content="JSDoc 3.6.6">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.7.0 &raquo; Source: structures/MessageMedia.js</title> <title>whatsapp-web.js 1.12.3 &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>7.<wbr>0</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>12.<wbr>3</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -86,7 +86,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.4 on June 18, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.6 on February 9, 2021.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.4"> <meta name="generator" content="JSDoc 3.6.6">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.7.0 &raquo; Source: structures/PrivateChat.js</title> <title>whatsapp-web.js 1.12.3 &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>7.<wbr>0</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>12.<wbr>3</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.4 on June 18, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.6 on February 9, 2021.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.4"> <meta name="generator" content="JSDoc 3.6.6">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.7.0 &raquo; Source: structures/PrivateContact.js</title> <title>whatsapp-web.js 1.12.3 &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>7.<wbr>0</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>12.<wbr>3</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.4 on June 18, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.6 on February 9, 2021.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.4"> <meta name="generator" content="JSDoc 3.6.6">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.7.0 &raquo; Source: util/Constants.js</title> <title>whatsapp-web.js 1.12.3 &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>7.<wbr>0</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>12.<wbr>3</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -33,8 +33,6 @@
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,
@@ -45,7 +43,9 @@ exports.DefaultOptions &#x3D; {
qrRefreshIntervalMs: 20000, qrRefreshIntervalMs: 20000,
authTimeoutMs: 45000, authTimeoutMs: 45000,
takeoverOnConflict: false, takeoverOnConflict: false,
takeoverTimeoutMs: 0 takeoverTimeoutMs: 0,
userAgent: &#x27;Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.109 Safari/537.36&#x27;,
ffmpegPath: &#x27;ffmpeg&#x27;
}; };
/** /**
@@ -174,7 +174,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.4 on June 18, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.6 on February 9, 2021.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.4"> <meta name="generator" content="JSDoc 3.6.6">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.7.0 &raquo; Source: util/InterfaceController.js</title> <title>whatsapp-web.js 1.12.3 &raquo; Source: util/InterfaceController.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar"> <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container"> <div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content"> <div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>7.<wbr>0</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>12.<wbr>3</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -62,6 +62,28 @@ class InterfaceController {
}, chatId); }, 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 * Opens the Message Drawer
* @param {string} msgId ID of the message drawer that will be opened * @param {string} msgId ID of the message drawer that will be opened
@@ -94,7 +116,7 @@ module.exports &#x3D; InterfaceController;</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.4 on June 18, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.6 on February 9, 2021.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<meta name="generator" content="JSDoc 3.6.4"> <meta name="generator" content="JSDoc 3.6.6">
<meta charset="utf-8"> <meta charset="utf-8">
<title>whatsapp-web.js 1.7.0 &raquo; Source: util/Util.js</title> <title>whatsapp-web.js 1.12.3 &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>7.<wbr>0</a> <a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>12.<wbr>3</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -31,6 +31,13 @@
<article> <article>
<pre class="prettyprint linenums"><code>&#x27;use strict&#x27;; <pre class="prettyprint linenums"><code>&#x27;use strict&#x27;;
const sharp &#x3D; require(&#x27;sharp&#x27;);
const path &#x3D; require(&#x27;path&#x27;);
const Crypto &#x3D; require(&#x27;crypto&#x27;);
const { tmpdir } &#x3D; require(&#x27;os&#x27;);
const ffmpeg &#x3D; require(&#x27;fluent-ffmpeg&#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);
/** /**
@@ -61,6 +68,123 @@ 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) {
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;
}
const buff &#x3D; Buffer.from(media.data, &#x27;base64&#x27;);
let sharpImg &#x3D; sharp(buff);
sharpImg &#x3D; sharpImg.webp();
sharpImg &#x3D; sharpImg.resize(512, 512, {
fit: &#x27;contain&#x27;,
background: { r: 0, g: 0, b: 0, alpha: 0 },
});
let webpBase64 &#x3D; (await sharpImg.toBuffer()).toString(&#x27;base64&#x27;);
return {
mimetype: &#x27;image/webp&#x27;,
data: webpBase64,
filename: media.filename,
};
}
/**
* Formats a video to webp
* @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,
};
}
/**
* Formats a media to webp
* @param {MessageMedia} media
*
* @returns {Promise&amp;lt;MessageMedia&gt;} media in webp format
*/
static async formatToWebpSticker(media) {
if (media.mimetype.includes(&#x27;image&#x27;)) return this.formatImageToWebpSticker(media);
else if (media.mimetype.includes(&#x27;video&#x27;)) return this.formatVideoToWebpSticker(media);
else throw new Error(&#x27;Invalid media format&#x27;);
}
/**
* Configure ffmpeg path
* @param {string} path
*/
static setFfmpegPath(path) {
ffmpeg.setFfmpegPath(path);
}
} }
module.exports &#x3D; Util;</code></pre> module.exports &#x3D; Util;</code></pre>
@@ -73,7 +197,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.4 on June 18, 2020. Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.6 on February 9, 2021.
</p> </p>
</div> </div>
</footer> </footer>

View File

@@ -40,11 +40,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 +79,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 +95,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,10 +109,10 @@ 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*
@@ -121,7 +121,7 @@ client.on('message', async msg => {
Platform: ${info.platform} Platform: ${info.platform}
WhatsApp version: ${info.phone.wa_version} 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 +129,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 +139,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,22 +153,27 @@ 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') { } else if (msg.body === '!mute') {
const chat = await msg.getChat(); const chat = await msg.getChat();
// mute the chat for 20 seconds // mute the chat for 20 seconds
@@ -178,15 +183,20 @@ client.on('message', async msg => {
} 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);
}
} }
}); });

1483
index.d.ts vendored

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,7 @@ 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'),
};
...Constants
};

View File

@@ -1,11 +1,12 @@
{ {
"name": "whatsapp-web.js", "name": "whatsapp-web.js",
"version": "1.7.0", "version": "1.12.3",
"description": "Library for interacting with the WhatsApp Web API ", "description": "Library for interacting with the WhatsApp Web API ",
"main": "./index.js", "main": "./index.js",
"typings": "./index.d.ts", "typings": "./index.d.ts",
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1", "test": "echo \"Error: no test specified\" && exit 1",
"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": {
@@ -25,12 +26,14 @@
"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://waguide.pedroslopez.me/",
"dependencies": { "dependencies": {
"@pedroslopez/moduleraid": "^4.1.0", "@pedroslopez/moduleraid": "^4.1.0",
"fluent-ffmpeg": "^2.1.2",
"jsqr": "^1.3.1", "jsqr": "^1.3.1",
"mime": "^2.4.5", "mime": "^2.4.5",
"puppeteer": "^3.0.4" "puppeteer": "^5.2.1",
"sharp": "^0.26.3"
}, },
"devDependencies": { "devDependencies": {
"eslint": "^6.8.0", "eslint": "^6.8.0",

39
shell.js Normal file
View File

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

View File

@@ -7,14 +7,30 @@ const jsQR = require('jsqr');
const Util = require('./util/Util'); const Util = require('./util/Util');
const InterfaceController = require('./util/InterfaceController'); const InterfaceController = require('./util/InterfaceController');
const { WhatsWebURL, UserAgent, DefaultOptions, Events, WAState } = require('./util/Constants'); const { WhatsWebURL, DefaultOptions, Events, WAState } = require('./util/Constants');
const { ExposeStore, LoadUtils } = require('./util/Injected'); const { ExposeStore, LoadUtils } = require('./util/Injected');
const ChatFactory = require('./factories/ChatFactory'); const ChatFactory = require('./factories/ChatFactory');
const ContactFactory = require('./factories/ContactFactory'); const ContactFactory = require('./factories/ContactFactory');
const { ClientInfo, Message, MessageMedia, Contact, Location, GroupNotification } = require('./structures'); const { ClientInfo, Message, MessageMedia, Contact, Location, GroupNotification , Label } = require('./structures');
/** /**
* Starting point for interacting with the WhatsApp Web API * Starting point for interacting with the WhatsApp Web API
* @extends {EventEmitter} * @extends {EventEmitter}
* @param {object} options - Client options
* @param {number} options.authTimeoutMs - Timeout for authentication selector in puppeteer
* @param {object} options.puppeteer - Puppeteer launch options. View docs here: https://github.com/puppeteer/puppeteer/
* @param {number} options.qrRefreshIntervalMs - Refresh interval for qr code (how much time to wait before checking if the qr code has changed)
* @param {number} options.qrTimeoutMs - Timeout for qr code selector in puppeteer
* @param {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
* @param {number} options.takeoverOnConflict - If another whatsapp web session is detected (another browser), take over the session in the current browser
* @param {number} options.takeoverTimeoutMs - How much time to wait before taking over the session
* @param {string} options.userAgent - User agent to use in puppeteer
* @param {string} options.ffmpegPath - Ffmpeg path to use when formating videos to webp while sending stickers
*
* @fires Client#qr * @fires Client#qr
* @fires Client#authenticated * @fires Client#authenticated
* @fires Client#auth_failure * @fires Client#auth_failure
@@ -40,6 +56,8 @@ class Client extends EventEmitter {
this.pupBrowser = null; this.pupBrowser = null;
this.pupPage = null; this.pupPage = null;
Util.setFfmpegPath(this.options.ffmpegPath);
} }
/** /**
@@ -48,11 +66,11 @@ class Client extends EventEmitter {
async initialize() { async initialize() {
const browser = await puppeteer.launch(this.options.puppeteer); const browser = await puppeteer.launch(this.options.puppeteer);
const page = (await browser.pages())[0]; const page = (await browser.pages())[0];
page.setUserAgent(UserAgent); page.setUserAgent(this.options.userAgent);
this.pupBrowser = browser; this.pupBrowser = browser;
this.pupPage = page; this.pupPage = page;
if (this.options.session) { if (this.options.session) {
await page.evaluateOnNewDocument( await page.evaluateOnNewDocument(
session => { session => {
@@ -68,8 +86,8 @@ class Client extends EventEmitter {
waitUntil: 'load', waitUntil: 'load',
timeout: 0, timeout: 0,
}); });
const KEEP_PHONE_CONNECTED_IMG_SELECTOR = '[data-asset-intro-image-light="true"]'; const KEEP_PHONE_CONNECTED_IMG_SELECTOR = '[data-asset-intro-image-light="true"], [data-asset-intro-image-dark="true"]';
if (this.options.session) { if (this.options.session) {
// Check if session restore was successfull // Check if session restore was successfull
@@ -145,6 +163,10 @@ class Client extends EventEmitter {
* Emitted when authentication is successful * Emitted when authentication is successful
* @event Client#authenticated * @event Client#authenticated
* @param {object} session Object containing session information. Can be used to restore the session. * @param {object} session Object containing session information. Can be used to restore the session.
* @param {string} session.WABrowserId
* @param {string} session.WASecretBundle
* @param {string} session.WAToken1
* @param {string} session.WAToken2
*/ */
this.emit(Events.AUTHENTICATED, session); this.emit(Events.AUTHENTICATED, session);
@@ -155,6 +177,10 @@ class Client extends EventEmitter {
await page.evaluate(LoadUtils); await page.evaluate(LoadUtils);
// Expose client info // Expose client info
/**
* Current connection information
* @type {ClientInfo}
*/
this.info = new ClientInfo(this, await page.evaluate(() => { this.info = new ClientInfo(this, await page.evaluate(() => {
return window.Store.Conn.serialize(); return window.Store.Conn.serialize();
})); }));
@@ -192,7 +218,7 @@ class Client extends EventEmitter {
} }
return; return;
} }
const message = new Message(this, msg); const message = new Message(this, msg);
/** /**
@@ -261,7 +287,7 @@ class Client extends EventEmitter {
await page.exposeFunction('onMessageAckEvent', (msg, ack) => { await page.exposeFunction('onMessageAckEvent', (msg, ack) => {
const message = new Message(this, msg); const message = new Message(this, msg);
/** /**
* Emitted when an ack event occurrs on message type. * Emitted when an ack event occurrs on message type.
* @event Client#message_ack * @event Client#message_ack
@@ -275,7 +301,7 @@ class Client extends EventEmitter {
await page.exposeFunction('onMessageMediaUploadedEvent', (msg) => { await page.exposeFunction('onMessageMediaUploadedEvent', (msg) => {
const message = new Message(this, msg); const message = new Message(this, msg);
/** /**
* Emitted when media has been uploaded for a message sent by the client. * Emitted when media has been uploaded for a message sent by the client.
* @event Client#media_uploaded * @event Client#media_uploaded
@@ -295,10 +321,10 @@ class Client extends EventEmitter {
const ACCEPTED_STATES = [WAState.CONNECTED, WAState.OPENING, WAState.PAIRING, WAState.TIMEOUT]; const ACCEPTED_STATES = [WAState.CONNECTED, WAState.OPENING, WAState.PAIRING, WAState.TIMEOUT];
if(this.options.takeoverOnConflict) { if (this.options.takeoverOnConflict) {
ACCEPTED_STATES.push(WAState.CONFLICT); ACCEPTED_STATES.push(WAState.CONFLICT);
if(state === WAState.CONFLICT) { if (state === WAState.CONFLICT) {
setTimeout(() => { setTimeout(() => {
this.pupPage.evaluate(() => window.Store.AppState.takeover()); this.pupPage.evaluate(() => window.Store.AppState.takeover());
}, this.options.takeoverTimeoutMs); }, this.options.takeoverTimeoutMs);
@@ -319,7 +345,7 @@ class Client extends EventEmitter {
await page.exposeFunction('onBatteryStateChangedEvent', (state) => { await page.exposeFunction('onBatteryStateChangedEvent', (state) => {
const { battery, plugged } = state; const { battery, plugged } = state;
if(battery === undefined) return; if (battery === undefined) return;
/** /**
* Emitted when the battery percentage for the attached device changes * Emitted when the battery percentage for the attached device changes
@@ -332,12 +358,12 @@ class Client extends EventEmitter {
}); });
await page.evaluate(() => { await page.evaluate(() => {
window.Store.Msg.on('add', (msg) => { if(msg.isNewMsg) window.onAddMessageEvent(msg); }); window.Store.Msg.on('add', (msg) => { if (msg.isNewMsg) window.onAddMessageEvent(window.WWebJS.getMessageModel(msg)); });
window.Store.Msg.on('change', (msg) => { window.onChangeMessageEvent(msg); }); window.Store.Msg.on('change', (msg) => { window.onChangeMessageEvent(window.WWebJS.getMessageModel(msg)); });
window.Store.Msg.on('change:type', (msg) => { window.onChangeMessageTypeEvent(msg); }); window.Store.Msg.on('change:type', (msg) => { window.onChangeMessageTypeEvent(window.WWebJS.getMessageModel(msg)); });
window.Store.Msg.on('change:ack', (msg, ack) => { window.onMessageAckEvent(msg, ack); }); window.Store.Msg.on('change:ack', (msg,ack) => { window.onMessageAckEvent(window.WWebJS.getMessageModel(msg), ack); });
window.Store.Msg.on('change:isUnsentMedia', (msg, unsent) => { if(msg.id.fromMe && !unsent) window.onMessageMediaUploadedEvent(msg); }); window.Store.Msg.on('change:isUnsentMedia', (msg, unsent) => { if (msg.id.fromMe && !unsent) window.onMessageMediaUploadedEvent(window.WWebJS.getMessageModel(msg)); });
window.Store.Msg.on('remove', (msg) => { if(msg.isNewMsg) window.onRemoveMessageEvent(msg); }); window.Store.Msg.on('remove', (msg) => { if (msg.isNewMsg) window.onRemoveMessageEvent(window.WWebJS.getMessageModel(msg)); });
window.Store.AppState.on('change:state', (_AppState, state) => { window.onAppStateChangedEvent(state); }); window.Store.AppState.on('change:state', (_AppState, state) => { window.onAppStateChangedEvent(state); });
window.Store.Conn.on('change:battery', (state) => { window.onBatteryStateChangedEvent(state); }); window.Store.Conn.on('change:battery', (state) => { window.onBatteryStateChangedEvent(state); });
}); });
@@ -370,7 +396,7 @@ class Client extends EventEmitter {
/** /**
* Returns the version of WhatsApp Web currently being run * Returns the version of WhatsApp Web currently being run
* @returns Promise<string> * @returns {Promise<string>}
*/ */
async getWWebVersion() { async getWWebVersion() {
return await this.pupPage.evaluate(() => { return await this.pupPage.evaluate(() => {
@@ -392,22 +418,41 @@ class Client extends EventEmitter {
return result; return result;
} }
/**
* Message options.
* @typedef {Object} MessageSendOptions
* @property {boolean} [linkPreview=true] - Show links preview
* @property {boolean} [sendAudioAsVoice=false] - Send audio as voice message
* @property {boolean} [sendMediaAsSticker=false] - Send media as a sticker
* @property {boolean} [sendMediaAsDocument=false] - Send media as a document
* @property {boolean} [parseVCards=true] - Automatically parse vCards and send them as contacts
* @property {string} [caption] - Image or video caption
* @property {string} [quotedMessageId] - Id of the message that is being quoted (or replied to)
* @property {Contact[]} [mentions] - Contacts that are being mentioned in the message
* @property {boolean} [sendSeen=true] - Mark the conversation as seen after sending the message
* @property {boolean} [media] - Media to be sent
*/
/** /**
* Send a message to a specific chatId * Send a message to a specific chatId
* @param {string} chatId * @param {string} chatId
* @param {string|MessageMedia|Location} content * @param {string|MessageMedia|Location|Contact|Array<Contact>} content
* @param {object} options * @param {MessageSendOptions} [options] - Options used when sending the message
*
* @returns {Promise<Message>} Message that was just sent * @returns {Promise<Message>} Message that was just sent
*/ */
async sendMessage(chatId, content, options = {}) { async sendMessage(chatId, content, options = {}) {
let internalOptions = { let internalOptions = {
linkPreview: options.linkPreview === false ? undefined : true, linkPreview: options.linkPreview === false ? undefined : true,
sendAudioAsVoice: options.sendAudioAsVoice, sendAudioAsVoice: options.sendAudioAsVoice,
sendMediaAsSticker: options.sendMediaAsSticker,
sendMediaAsDocument: options.sendMediaAsDocument,
caption: options.caption, caption: options.caption,
quotedMessageId: options.quotedMessageId, quotedMessageId: options.quotedMessageId,
parseVCards: options.parseVCards === false ? false : true,
mentionedJidList: Array.isArray(options.mentions) ? options.mentions.map(contact => contact.id._serialized) : [] mentionedJidList: Array.isArray(options.mentions) ? options.mentions.map(contact => contact.id._serialized) : []
}; };
const sendSeen = typeof options.sendSeen === 'undefined' ? true : options.sendSeen; const sendSeen = typeof options.sendSeen === 'undefined' ? true : options.sendSeen;
if (content instanceof MessageMedia) { if (content instanceof MessageMedia) {
@@ -420,13 +465,23 @@ class Client extends EventEmitter {
} else if (content instanceof Location) { } else if (content instanceof Location) {
internalOptions.location = content; internalOptions.location = content;
content = ''; content = '';
} else if(content instanceof Contact) {
internalOptions.contactCard = content.id._serialized;
content = '';
} else if(Array.isArray(content) && content.length > 0 && content[0] instanceof Contact) {
internalOptions.contactCardList = content.map(contact => contact.id._serialized);
content = '';
}
if (internalOptions.sendMediaAsSticker && internalOptions.attachment) {
internalOptions.attachment = await Util.formatToWebpSticker(internalOptions.attachment);
} }
const newMessage = await this.pupPage.evaluate(async (chatId, message, options, sendSeen) => { const newMessage = await this.pupPage.evaluate(async (chatId, message, options, sendSeen) => {
const chatWid = window.Store.WidFactory.createWid(chatId); const chatWid = window.Store.WidFactory.createWid(chatId);
const chat = await window.Store.Chat.find(chatWid); const chat = await window.Store.Chat.find(chatWid);
if(sendSeen) { if (sendSeen) {
window.WWebJS.sendSeen(chatId); window.WWebJS.sendSeen(chatId);
} }
@@ -442,8 +497,8 @@ class Client extends EventEmitter {
* @returns {Promise<Array<Chat>>} * @returns {Promise<Array<Chat>>}
*/ */
async getChats() { async getChats() {
let chats = await this.pupPage.evaluate(() => { let chats = await this.pupPage.evaluate(async () => {
return window.WWebJS.getChats(); return await window.WWebJS.getChats();
}); });
return chats.map(chat => ChatFactory.create(this, chat)); return chats.map(chat => ChatFactory.create(this, chat));
@@ -455,8 +510,8 @@ class Client extends EventEmitter {
* @returns {Promise<Chat>} * @returns {Promise<Chat>}
*/ */
async getChatById(chatId) { async getChatById(chatId) {
let chat = await this.pupPage.evaluate(chatId => { let chat = await this.pupPage.evaluate(async chatId => {
return window.WWebJS.getChat(chatId); return await window.WWebJS.getChat(chatId);
}, chatId); }, chatId);
return ChatFactory.create(this, chat); return ChatFactory.create(this, chat);
@@ -501,6 +556,7 @@ class Client extends EventEmitter {
/** /**
* Accepts an invitation to join a group * Accepts an invitation to join a group
* @param {string} inviteCode Invitation code * @param {string} inviteCode Invitation code
* @returns {Promise<string>} Id of the joined Chat
*/ */
async acceptInvite(inviteCode) { async acceptInvite(inviteCode) {
const chatId = await this.pupPage.evaluate(async inviteCode => { const chatId = await this.pupPage.evaluate(async inviteCode => {
@@ -520,6 +576,17 @@ class Client extends EventEmitter {
}, status); }, status);
} }
/**
* Sets the current user's display name.
* This is the name shown to WhatsApp users that have not added you as a contact beside your number in groups and in your profile.
* @param {string} displayName New display name
*/
async setDisplayName(displayName) {
await this.pupPage.evaluate(async displayName => {
return await window.Store.Wap.setPushname(displayName);
}, displayName);
}
/** /**
* Gets the current connection state for the client * Gets the current connection state for the client
* @returns {WAState} * @returns {WAState}
@@ -563,6 +630,43 @@ class Client extends EventEmitter {
}, chatId); }, chatId);
} }
/**
* Pins the Chat
* @returns {Promise<boolean>} New pin state. Could be false if the max number of pinned chats was reached.
*/
async pinChat(chatId) {
return this.pupPage.evaluate(async chatId => {
let chat = window.Store.Chat.get(chatId);
if (chat.pin) {
return true;
}
const MAX_PIN_COUNT = 3;
if (window.Store.Chat.models.length > MAX_PIN_COUNT) {
let maxPinned = window.Store.Chat.models[MAX_PIN_COUNT - 1].pin;
if (maxPinned) {
return false;
}
}
await window.Store.Cmd.pinChat(chat, true);
return true;
}, chatId);
}
/**
* Unpins the Chat
* @returns {Promise<boolean>} New pin state
*/
async unpinChat(chatId) {
return this.pupPage.evaluate(async chatId => {
let chat = window.Store.Chat.get(chatId);
if (!chat.pin) {
return false;
}
await window.Store.Cmd.pinChat(chat, false);
return false;
}, chatId);
}
/** /**
* Mutes the Chat until a specified date * Mutes the Chat until a specified date
* @param {string} chatId ID of the chat that will be muted * @param {string} chatId ID of the chat that will be muted
@@ -574,7 +678,7 @@ class Client extends EventEmitter {
await chat.mute.mute(timestamp, !0); await chat.mute.mute(timestamp, !0);
}, chatId, unmuteDate.getTime() / 1000); }, chatId, unmuteDate.getTime() / 1000);
} }
/** /**
* Unmutes the Chat * Unmutes the Chat
* @param {string} chatId ID of the chat that will be unmuted * @param {string} chatId ID of the chat that will be unmuted
@@ -585,7 +689,18 @@ class Client extends EventEmitter {
await window.Store.Cmd.muteChat(chat, false); await window.Store.Cmd.muteChat(chat, false);
}, chatId); }, chatId);
} }
/**
* Mark the Chat as unread
* @param {string} chatId ID of the chat that will be marked as unread
*/
async markChatUnread(chatId) {
await this.pupPage.evaluate(async chatId => {
let chat = await window.Store.Chat.get(chatId);
await window.Store.Cmd.markChatUnread(chat, true);
}, chatId);
}
/** /**
* Returns the contact ID's profile picture URL, if privacy settings allow it * Returns the contact ID's profile picture URL, if privacy settings allow it
* @param {string} contactId the whatsapp user's ID * @param {string} contactId the whatsapp user's ID
@@ -602,7 +717,7 @@ class Client extends EventEmitter {
/** /**
* Force reset of connection state for the client * Force reset of connection state for the client
*/ */
async resetState(){ async resetState() {
await this.pupPage.evaluate(() => { await this.pupPage.evaluate(() => {
window.Store.AppState.phoneWatchdog.shiftTimer.forceRunNow(); window.Store.AppState.phoneWatchdog.shiftTimer.forceRunNow();
}); });
@@ -610,6 +725,7 @@ class Client extends EventEmitter {
/** /**
* Check if a given ID is registered in whatsapp * Check if a given ID is registered in whatsapp
* @param {string} id the whatsapp user's ID
* @returns {Promise<Boolean>} * @returns {Promise<Boolean>}
*/ */
async isRegisteredUser(id) { async isRegisteredUser(id) {
@@ -619,6 +735,26 @@ class Client extends EventEmitter {
}, id); }, id);
} }
/**
* Get the registered WhatsApp ID for a number.
* Will return null if the number is not registered on WhatsApp.
* @param {string} number Number or ID ("@c.us" will be automatically appended if not specified)
* @returns {Promise<Object|null>}
*/
async getNumberId(number) {
if(!number.endsWith('@c.us')) {
number += '@c.us';
}
try {
return await this.pupPage.evaluate(async numberId => {
return window.WWebJS.getNumberId(numberId);
}, number);
} catch(_) {
return null;
}
}
/** /**
* Create a new group * Create a new group
* @param {string} name group title * @param {string} name group title
@@ -628,18 +764,18 @@ class Client extends EventEmitter {
* @returns {Object.<string,string>} createRes.missingParticipants - participants that were not added to the group. Keys represent the ID for participant that was not added and its value is a status code that represents the reason why participant could not be added. This is usually 403 if the user's privacy settings don't allow you to add them to groups. * @returns {Object.<string,string>} createRes.missingParticipants - participants that were not added to the group. Keys represent the ID for participant that was not added and its value is a status code that represents the reason why participant could not be added. This is usually 403 if the user's privacy settings don't allow you to add them to groups.
*/ */
async createGroup(name, participants) { async createGroup(name, participants) {
if(!Array.isArray(participants) || participants.length == 0) { if (!Array.isArray(participants) || participants.length == 0) {
throw 'You need to add at least one other participant to the group'; throw 'You need to add at least one other participant to the group';
} }
if(participants.every(c => c instanceof Contact)) { if (participants.every(c => c instanceof Contact)) {
participants = participants.map(c => c.id._serialized); participants = participants.map(c => c.id._serialized);
} }
const createRes = await this.pupPage.evaluate(async (name, participantIds) => { const createRes = await this.pupPage.evaluate(async (name, participantIds) => {
const res = await window.Store.Wap.createGroup(name, participantIds); const res = await window.Store.Wap.createGroup(name, participantIds);
console.log(res); console.log(res);
if(!res.status === 200) { if (!res.status === 200) {
throw 'An error occurred while creating the group!'; throw 'An error occurred while creating the group!';
} }
@@ -649,13 +785,70 @@ class Client extends EventEmitter {
const missingParticipants = createRes.participants.reduce(((missing, c) => { const missingParticipants = createRes.participants.reduce(((missing, c) => {
const id = Object.keys(c)[0]; const id = Object.keys(c)[0];
const statusCode = c[id].code; const statusCode = c[id].code;
if(statusCode != 200) return Object.assign(missing, {[id]: statusCode}); if (statusCode != 200) return Object.assign(missing, { [id]: statusCode });
return missing; return missing;
}), {}); }), {});
return { gid: createRes.gid, missingParticipants}; return { gid: createRes.gid, missingParticipants };
} }
/**
* Get all current Labels
* @returns {Promise<Array<Label>>}
*/
async getLabels() {
const labels = await this.pupPage.evaluate(async () => {
return window.WWebJS.getLabels();
});
return labels.map(data => new Label(this , data));
}
/**
* Get Label instance by ID
* @param {string} labelId
* @returns {Promise<Label>}
*/
async getLabelById(labelId) {
const label = await this.pupPage.evaluate(async (labelId) => {
return window.WWebJS.getLabel(labelId);
}, labelId);
return new Label(this, label);
}
/**
* Get all Labels assigned to a chat
* @param {string} chatId
* @returns {Promise<Array<Label>>}
*/
async getChatLabels(chatId){
const labels = await this.pupPage.evaluate(async (chatId) => {
return window.WWebJS.getChatLabels(chatId);
}, chatId);
return labels.map(data => new Label(this, data));
}
/**
* Get all Chats for a specific Label
* @param {string} labelId
* @returns {Promise<Array<Chat>>}
*/
async getChatsByLabelId(labelId){
const chatIds = await this.pupPage.evaluate(async (labelId) => {
const label = window.Store.Label.get(labelId);
const labelItems = label.labelItemCollection.models;
return labelItems.reduce((result, item) => {
if(item.parentType === 'Chat'){
result.push(item.parentId);
}
return result;
},[]);
}, labelId);
return Promise.all(chatIds.map(id => this.getChatById(id)));
}
} }
module.exports = Client; module.exports = Client;

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 {number}
*/
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,6 +130,22 @@ 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 until a specified date * Mutes this chat until a specified date
* @param {Date} unmuteDate Date at which the Chat will be unmuted * @param {Date} unmuteDate Date at which the Chat will be unmuted
@@ -119,7 +153,7 @@ class Chat extends Base {
async mute(unmuteDate) { async mute(unmuteDate) {
return this.client.muteChat(this.id._serialized, unmuteDate); return this.client.muteChat(this.id._serialized, unmuteDate);
} }
/** /**
* Unmutes this chat * Unmutes this chat
*/ */
@@ -127,6 +161,13 @@ class Chat extends Base {
return this.client.unmuteChat(this.id._serialized); 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 is supported.
@@ -134,29 +175,30 @@ class Chat extends Base {
* @returns {Promise<Array<Message>>} * @returns {Promise<Array<Message>>}
*/ */
async fetchMessages(searchOptions) { async fetchMessages(searchOptions) {
if(!searchOptions || !searchOptions.limit) { if (!searchOptions || !searchOptions.limit) {
searchOptions = {limit: 50}; searchOptions = { limit: 50 };
} }
let messages = await this.client.pupPage.evaluate(async (chatId, limit) => { let messages = await this.client.pupPage.evaluate(async (chatId, limit) => {
const msgFilter = m => !m.isNotification; // dont include notification messages const msgFilter = m => !m.isNotification; // dont include notification messages
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.models.filter(msgFilter);
while(msgs.length < limit) { while (msgs.length < limit) {
const loadedMessages = await chat.loadEarlierMsgs(); const loadedMessages = await chat.loadEarlierMsgs();
if(!loadedMessages) break; if (!loadedMessages) break;
msgs = [...loadedMessages.filter(msgFilter), ...msgs]; msgs = [...loadedMessages.filter(msgFilter), ...msgs];
} }
msgs.sort((a, b) => (a.t > b.t) ? 1 : -1); msgs.sort((a, b) => (a.t > b.t) ? 1 : -1);
return msgs.splice(msgs.length - limit).map(m => m.serialize()); if (msgs.length > limit) msgs = msgs.splice(msgs.length - limit);
return msgs.map(m => window.WWebJS.getMessageModel(m));
}, this.id._serialized, searchOptions.limit); }, this.id._serialized, searchOptions.limit);
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.
*/ */
@@ -166,7 +208,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.
*/ */
@@ -176,7 +218,7 @@ class Chat extends Base {
return true; return true;
}, this.id._serialized); }, this.id._serialized);
} }
/** /**
* Stops typing or recording in chat immediately. * Stops typing or recording in chat immediately.
*/ */
@@ -186,6 +228,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) {
@@ -20,11 +20,17 @@ class ClientInfo extends Base {
*/ */
this.pushname = data.pushname; this.pushname = data.pushname;
/**
* @type {object}
* @deprecated Use .wid instead
*/
this.me = data.wid;
/** /**
* Current user ID * Current user ID
* @type {object} * @type {object}
*/ */
this.me = data.me; this.wid = data.wid;
/** /**
* Information about the phone this client is connected to * Information about the phone this client is connected to

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);
} }
@@ -105,6 +119,62 @@ class Contact extends Base {
async getProfilePicUrl() { async getProfilePicUrl() {
return await this.client.getProfilePicUrl(this.id._serialized); return await this.client.getProfilePicUrl(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);
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) => {
return window.Store.Wap.statusFind(contactId);
}, this.id._serialized);
if (typeof about.status !== 'string')
return null;
return about.status;
}
} }

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,6 +56,7 @@ 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) => {
@@ -56,6 +67,7 @@ class GroupChat extends Chat {
/** /**
* 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) => {
@@ -66,6 +78,7 @@ class GroupChat extends Chat {
/** /**
* 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) => {
@@ -76,6 +89,7 @@ class GroupChat extends Chat {
/** /**
* 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) => {
@@ -86,6 +100,7 @@ class GroupChat extends Chat {
/** /**
* Updates the group subject * Updates the group subject
* @param {string} subject * @param {string} subject
* @returns {Promise}
*/ */
async setSubject(subject) { async setSubject(subject) {
let res = await this.client.pupPage.evaluate((chatId, subject) => { let res = await this.client.pupPage.evaluate((chatId, subject) => {
@@ -100,6 +115,7 @@ class GroupChat extends Chat {
/** /**
* Updates the group description * Updates the group description
* @param {string} description * @param {string} description
* @returns {Promise}
*/ */
async setDescription(description) { async setDescription(description) {
let res = await this.client.pupPage.evaluate((chatId, description) => { let res = await this.client.pupPage.evaluate((chatId, description) => {
@@ -112,8 +128,41 @@ class GroupChat extends Chat {
} }
} }
/**
* 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) {
let res = await this.client.pupPage.evaluate((chatId, value) => {
return window.Store.Wap.setGroupProperty(chatId, 'announcement', value);
}, this.id._serialized, adminsOnly);
if (res.status !== 200) 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) {
let res = await this.client.pupPage.evaluate((chatId, value) => {
return window.Store.Wap.setGroupProperty(chatId, 'restrict', value);
}, this.id._serialized, adminsOnly);
if (res.status !== 200) 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 => { let res = await this.client.pupPage.evaluate(chatId => {
@@ -129,6 +178,7 @@ class GroupChat extends Chat {
/** /**
* Invalidates the current group invite code and generates a new one * Invalidates the current group invite code and generates a new one
* @returns {Promise}
*/ */
async revokeInvite() { async revokeInvite() {
return await this.client.pupPage.evaluate(chatId => { return await this.client.pupPage.evaluate(chatId => {
@@ -138,6 +188,7 @@ class GroupChat extends Chat {
/** /**
* 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 => { return await this.client.pupPage.evaluate(chatId => {

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;

View File

@@ -13,7 +13,7 @@ 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) {
@@ -40,7 +40,7 @@ class Message extends Base {
* 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 = data.clientUrl || data.deprecatedMms3Url ? true : false;
/** /**
* Message content * Message content
@@ -87,6 +87,18 @@ class Message extends Base {
*/ */
this.isForwarded = data.isForwarded; this.isForwarded = data.isForwarded;
/**
* 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}
@@ -98,7 +110,7 @@ class Message extends Base {
* @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}
@@ -111,6 +123,12 @@ class Message extends Base {
*/ */
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] : [];
/** /**
* Indicates the mentions in the message body. * Indicates the mentions in the message body.
* @type {Array<string>} * @type {Array<string>}
@@ -121,6 +139,12 @@ class Message extends Base {
this.mentionedIds = data.mentionedJidList; this.mentionedIds = data.mentionedJidList;
} }
/**
* Links included in the message.
* @type {Array<string>}
*/
this.links = data.links;
return super._patch(data); return super._patch(data);
} }
@@ -173,11 +197,11 @@ class Message extends Base {
* 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();
} }
@@ -190,6 +214,23 @@ class Message extends Base {
return this.client.sendMessage(chatId, content, options); return this.client.sendMessage(chatId, content, options);
} }
/**
* Forwards this message to another chat
*
* @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>}
@@ -201,21 +242,23 @@ class Message extends Base {
const result = await this.client.pupPage.evaluate(async (msgId) => { const result = await this.client.pupPage.evaluate(async (msgId) => {
const msg = window.Store.Msg.get(msgId); const msg = window.Store.Msg.get(msgId);
if(msg.mediaData.mediaStage != 'RESOLVED') { if (msg.mediaData.mediaStage != 'RESOLVED') {
// try to resolve media // try to resolve media
await msg.downloadMedia(true, 1); await msg.downloadMedia(true, 1);
} }
if(msg.mediaData.mediaStage.includes('ERROR')) { if (msg.mediaData.mediaStage.includes('ERROR')) {
// media could not be downloaded // media could not be downloaded
return undefined; return undefined;
} }
const buffer = await window.WWebJS.downloadBuffer(msg.clientUrl); const mediaUrl = msg.clientUrl || msg.deprecatedMms3Url;
const buffer = await window.WWebJS.downloadBuffer(mediaUrl);
const decrypted = await window.Store.CryptoLib.decryptE2EMedia(msg.type, buffer, msg.mediaKey, msg.mimetype); const decrypted = await window.Store.CryptoLib.decryptE2EMedia(msg.type, buffer, msg.mediaKey, msg.mimetype);
const data = await window.WWebJS.readBlobAsync(decrypted._blob); const data = await window.WWebJS.readBlobAsync(decrypted._blob);
return { return {
data: data.split(',')[1], data: data.split(',')[1],
mimetype: msg.mimetype, mimetype: msg.mimetype,
@@ -224,7 +267,7 @@ class Message extends Base {
}, this.id._serialized); }, this.id._serialized);
if(!result) return undefined; if (!result) return undefined;
return new MessageMedia(result.mimetype, result.data, result.filename); return new MessageMedia(result.mimetype, result.data, result.filename);
} }
@@ -236,13 +279,69 @@ class Message extends Base {
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()) { if (everyone && msg.id.fromMe && msg.canRevoke()) {
return window.Store.Cmd.sendRevokeMsgs(msg.chat, [msg], true); return window.Store.Cmd.sendRevokeMsgs(msg.chat, [msg], true);
} }
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.pupPage.evaluate((msgId) => {
let msg = window.Store.Msg.get(msgId);
if (msg.canStar()) {
return msg.chat.sendStarMsgs([msg], true);
}
}, this.id._serialized);
}
/**
* Unstars this message
*/
async unstar() {
await this.pupPage.evaluate((msgId) => {
let msg = window.Store.Msg.get(msgId);
if (msg.canStar()) {
return msg.chat.sendStarMsgs([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.Wap.queryMsgInfo(msg.id);
}, this.id._serialized);
if(info.status) {
return null;
}
return info;
}
} }
module.exports = Message; module.exports = Message;

View File

@@ -10,5 +10,6 @@ module.exports = {
MessageMedia: require('./MessageMedia'), MessageMedia: require('./MessageMedia'),
PrivateChat: require('./PrivateChat'), PrivateChat: require('./PrivateChat'),
PrivateContact: require('./PrivateContact'), PrivateContact: require('./PrivateContact'),
GroupNotification: require('./GroupNotification') GroupNotification: require('./GroupNotification'),
Label: require('./Label.js')
}; };

View File

@@ -2,8 +2,6 @@
exports.WhatsWebURL = 'https://web.whatsapp.com/'; exports.WhatsWebURL = 'https://web.whatsapp.com/';
exports.UserAgent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.109 Safari/537.36';
exports.DefaultOptions = { exports.DefaultOptions = {
puppeteer: { puppeteer: {
headless: true, headless: true,
@@ -14,7 +12,9 @@ exports.DefaultOptions = {
qrRefreshIntervalMs: 20000, qrRefreshIntervalMs: 20000,
authTimeoutMs: 45000, authTimeoutMs: 45000,
takeoverOnConflict: false, takeoverOnConflict: false,
takeoverTimeoutMs: 0 takeoverTimeoutMs: 0,
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.109 Safari/537.36',
ffmpegPath: 'ffmpeg'
}; };
/** /**

View File

@@ -5,7 +5,7 @@ exports.ExposeStore = (moduleRaidStr) => {
eval('var moduleRaid = ' + moduleRaidStr); eval('var moduleRaid = ' + moduleRaidStr);
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
window.mR = moduleRaid(); window.mR = moduleRaid();
window.Store = window.mR.findModule('Chat')[1].default; window.Store = window.mR.findModule('Chat')[0].default;
window.Store.AppState = window.mR.findModule('STREAM')[0].default; window.Store.AppState = window.mR.findModule('STREAM')[0].default;
window.Store.Conn = window.mR.findModule('Conn')[0].default; window.Store.Conn = window.mR.findModule('Conn')[0].default;
window.Store.CryptoLib = window.mR.findModule('decryptE2EMedia')[0]; window.Store.CryptoLib = window.mR.findModule('decryptE2EMedia')[0];
@@ -17,19 +17,26 @@ exports.ExposeStore = (moduleRaidStr) => {
window.Store.SendMessage = window.mR.findModule('addAndSendMsgToChat')[0]; window.Store.SendMessage = window.mR.findModule('addAndSendMsgToChat')[0];
window.Store.MsgKey = window.mR.findModule((module) => module.default && module.default.fromString)[0].default; window.Store.MsgKey = window.mR.findModule((module) => module.default && module.default.fromString)[0].default;
window.Store.Invite = window.mR.findModule('sendJoinGroupViaInvite')[0]; window.Store.Invite = window.mR.findModule('sendJoinGroupViaInvite')[0];
window.Store.OpaqueData = window.mR.findModule('getOrCreateOpaqueDataForPath')[0]; window.Store.OpaqueData = window.mR.findModule(module => module.default && module.default.createFromData)[0].default;
window.Store.MediaPrep = window.mR.findModule('MediaPrep')[0]; window.Store.MediaPrep = window.mR.findModule('MediaPrep')[0];
window.Store.MediaObject = window.mR.findModule('getOrCreateMediaObject')[0]; window.Store.MediaObject = window.mR.findModule('getOrCreateMediaObject')[0];
window.Store.MediaUpload = window.mR.findModule('uploadMedia')[0]; window.Store.MediaUpload = window.mR.findModule('uploadMedia')[0];
window.Store.Cmd = window.mR.findModule('Cmd')[0].default; window.Store.Cmd = window.mR.findModule('Cmd')[0].default;
window.Store.MediaTypes = window.mR.findModule('msgToMediaType')[0]; window.Store.MediaTypes = window.mR.findModule('msgToMediaType')[0];
window.Store.VCard = window.mR.findModule('vcardFromContactModel')[0];
window.Store.UserConstructor = window.mR.findModule((module) => (module.default && module.default.prototype && module.default.prototype.isServer && module.default.prototype.isUser) ? module.default : null)[0].default; window.Store.UserConstructor = window.mR.findModule((module) => (module.default && module.default.prototype && module.default.prototype.isServer && module.default.prototype.isUser) ? module.default : null)[0].default;
window.Store.Validators = window.mR.findModule('findLinks')[0]; window.Store.Validators = window.mR.findModule('findLinks')[0];
window.Store.WidFactory = window.mR.findModule('createWid')[0]; window.Store.WidFactory = window.mR.findModule('createWid')[0];
window.Store.BlockContact = window.mR.findModule('blockContact')[0];
window.Store.GroupMetadata = window.mR.findModule((module) => module.default && module.default.handlePendingInvite)[0].default;
window.Store.Sticker = window.mR.findModule('Sticker')[0].default.Sticker;
window.Store.UploadUtils = window.mR.findModule((module) => (module.default && module.default.encryptAndUpload) ? module.default : null)[0].default;
window.Store.Label = window.mR.findModule('LabelCollection')[0].default;
}; };
exports.LoadUtils = () => { exports.LoadUtils = () => {
window.WWebJS = {}; window.WWebJS = {};
window.WWebJS.getNumberId = async (id) => { window.WWebJS.getNumberId = async (id) => {
let result = await window.Store.Wap.queryExist(id); let result = await window.Store.Wap.queryExist(id);
@@ -37,6 +44,7 @@ exports.LoadUtils = () => {
throw 'The number provided is not a registered whatsapp user'; throw 'The number provided is not a registered whatsapp user';
return result.jid; return result.jid;
}; };
window.WWebJS.sendSeen = async (chatId) => { window.WWebJS.sendSeen = async (chatId) => {
let chat = window.Store.Chat.get(chatId); let chat = window.Store.Chat.get(chatId);
if (chat !== undefined) { if (chat !== undefined) {
@@ -46,12 +54,21 @@ exports.LoadUtils = () => {
return false; return false;
}; };
window.WWebJS.sendMessage = async (chat, content, options = {}) => { window.WWebJS.sendMessage = async (chat, content, options = {}) => {
let attOptions = {}; let attOptions = {};
if (options.attachment) { if (options.attachment) {
attOptions = await window.WWebJS.processMediaData(options.attachment, options.sendAudioAsVoice); attOptions = options.sendMediaAsSticker
content = attOptions.preview; ? await window.WWebJS.processStickerData(options.attachment)
: await window.WWebJS.processMediaData(options.attachment, {
forceVoice: options.sendAudioAsVoice,
forceDocument: options.sendMediaAsDocument
});
content = options.sendMediaAsSticker ? undefined : attOptions.preview;
delete options.attachment; delete options.attachment;
delete options.sendMediaAsSticker;
} }
let quotedMsgOptions = {}; let quotedMsgOptions = {};
@@ -78,6 +95,39 @@ exports.LoadUtils = () => {
delete options.location; delete options.location;
} }
let vcardOptions = {};
if (options.contactCard) {
let contact = window.Store.Contact.get(options.contactCard);
vcardOptions = {
body: window.Store.VCard.vcardFromContactModel(contact).vcard,
type: 'vcard',
vcardFormattedName: contact.formattedName
};
delete options.contactCard;
} else if (options.contactCardList) {
let contacts = options.contactCardList.map(c => window.Store.Contact.get(c));
let vcards = contacts.map(c => window.Store.VCard.vcardFromContactModel(c));
vcardOptions = {
type: 'multi_vcard',
vcardList: vcards,
body: undefined
};
delete options.contactCardList;
} else if (options.parseVCards && typeof (content) === 'string' && content.startsWith('BEGIN:VCARD')) {
delete options.parseVCards;
try {
const parsed = window.Store.VCard.parseVcard(content);
if (parsed) {
vcardOptions = {
type: 'vcard',
vcardFormattedName: window.Store.VCard.vcardGetNameFromParsed(parsed)
};
}
} catch (_) {
// not a vcard
}
}
if (options.linkPreview) { if (options.linkPreview) {
delete options.linkPreview; delete options.linkPreview;
const link = window.Store.Validators.findLink(content); const link = window.Store.Validators.findLink(content);
@@ -90,8 +140,8 @@ exports.LoadUtils = () => {
} }
const newMsgId = new window.Store.MsgKey({ const newMsgId = new window.Store.MsgKey({
from: window.Store.Conn.me, fromMe: true,
to: chat.id, remote: chat.id,
id: window.Store.genId(), id: window.Store.genId(),
}); });
@@ -100,7 +150,7 @@ exports.LoadUtils = () => {
id: newMsgId, id: newMsgId,
ack: 0, ack: 0,
body: content, body: content,
from: window.Store.Conn.me, from: window.Store.Conn.wid,
to: chat.id, to: chat.id,
local: true, local: true,
self: 'out', self: 'out',
@@ -109,17 +159,45 @@ exports.LoadUtils = () => {
type: 'chat', type: 'chat',
...locationOptions, ...locationOptions,
...attOptions, ...attOptions,
...quotedMsgOptions ...quotedMsgOptions,
...vcardOptions
}; };
await window.Store.SendMessage.addAndSendMsgToChat(chat, message); await window.Store.SendMessage.addAndSendMsgToChat(chat, message);
return window.Store.Msg.get(newMsgId._serialized); return window.Store.Msg.get(newMsgId._serialized);
}; };
window.WWebJS.processMediaData = async (mediaInfo, forceVoice) => { window.WWebJS.processStickerData = async (mediaInfo) => {
if (mediaInfo.mimetype !== 'image/webp') throw new Error('Invalid media type');
const file = window.WWebJS.mediaInfoToFile(mediaInfo); const file = window.WWebJS.mediaInfoToFile(mediaInfo);
const mData = await window.Store.OpaqueData.default.createFromData(file, file.type); let filehash = await window.WWebJS.getFileHash(file);
const mediaPrep = window.Store.MediaPrep.prepRawMedia(mData, {}); let mediaKey = await window.WWebJS.generateHash(32);
const controller = new AbortController();
const uploadedInfo = await window.Store.UploadUtils.encryptAndUpload({
blob: file,
type: 'sticker',
signal: controller.signal,
mediaKey
});
const stickerInfo = {
...uploadedInfo,
clientUrl: uploadedInfo.url,
uploadhash: uploadedInfo.encFilehash,
size: file.size,
type: 'sticker',
filehash
};
return stickerInfo;
};
window.WWebJS.processMediaData = async (mediaInfo, { forceVoice, forceDocument }) => {
const file = window.WWebJS.mediaInfoToFile(mediaInfo);
const mData = await window.Store.OpaqueData.createFromData(file, file.type);
const mediaPrep = window.Store.MediaPrep.prepRawMedia(mData, { asDocument: forceDocument });
const mediaData = await mediaPrep.waitForPrep(); const mediaData = await mediaPrep.waitForPrep();
const mediaObject = window.Store.MediaObject.getOrCreateMediaObject(mediaData.filehash); const mediaObject = window.Store.MediaObject.getOrCreateMediaObject(mediaData.filehash);
@@ -128,58 +206,93 @@ exports.LoadUtils = () => {
isGif: mediaData.isGif isGif: mediaData.isGif
}); });
if(forceVoice && mediaData.type === 'audio') { if (forceVoice && mediaData.type === 'audio') {
mediaData.type = 'ptt'; mediaData.type = 'ptt';
} }
if (!(mediaData.mediaBlob instanceof window.Store.OpaqueData.default)) { if (forceDocument) {
mediaData.mediaBlob = await window.Store.OpaqueData.default.createFromData(mediaData.mediaBlob, mediaData.mediaBlob.type); mediaData.type = 'document';
}
if (!(mediaData.mediaBlob instanceof window.Store.OpaqueData)) {
mediaData.mediaBlob = await window.Store.OpaqueData.createFromData(mediaData.mediaBlob, mediaData.mediaBlob.type);
} }
mediaData.renderableUrl = mediaData.mediaBlob.url(); mediaData.renderableUrl = mediaData.mediaBlob.url();
mediaObject.consolidate(mediaData.toJSON()); mediaObject.consolidate(mediaData.toJSON());
mediaData.mediaBlob.autorelease(); mediaData.mediaBlob.autorelease();
const uploadedMedia = await window.Store.MediaUpload.uploadMedia({ mimetype: mediaData.mimetype, mediaObject, mediaType }); const uploadedMedia = await window.Store.MediaUpload.uploadMedia({
if (!uploadedMedia) { mimetype: mediaData.mimetype,
mediaObject,
mediaType
});
const mediaEntry = uploadedMedia.mediaEntry;
if (!mediaEntry) {
throw new Error('upload failed: media entry was not created'); throw new Error('upload failed: media entry was not created');
} }
mediaData.set({ mediaData.set({
clientUrl: uploadedMedia.mmsUrl, clientUrl: mediaEntry.mmsUrl,
directPath: uploadedMedia.directPath, deprecatedMms3Url: mediaEntry.deprecatedMms3Url,
mediaKey: uploadedMedia.mediaKey, directPath: mediaEntry.directPath,
mediaKeyTimestamp: uploadedMedia.mediaKeyTimestamp, mediaKey: mediaEntry.mediaKey,
mediaKeyTimestamp: mediaEntry.mediaKeyTimestamp,
filehash: mediaObject.filehash, filehash: mediaObject.filehash,
uploadhash: uploadedMedia.uploadHash, encFilehash: mediaEntry.encFilehash,
uploadhash: mediaEntry.uploadHash,
size: mediaObject.size, size: mediaObject.size,
streamingSidecar: uploadedMedia.sidecar, streamingSidecar: mediaEntry.sidecar,
firstFrameSidecar: uploadedMedia.firstFrameSidecar firstFrameSidecar: mediaEntry.firstFrameSidecar
}); });
return mediaData; return mediaData;
}; };
window.WWebJS.getChatModel = chat => { window.WWebJS.getMessageModel = message => {
const msg = message.serialize();
msg.isStatusV3 = message.isStatusV3;
msg.links = (message.getLinks()).map(link => link.href);
if (msg.buttons) {
msg.buttons = msg.buttons.serialize();
}
delete msg.pendingAckUpdate;
return msg;
};
window.WWebJS.getChatModel = async chat => {
let res = chat.serialize(); let res = chat.serialize();
res.isGroup = chat.isGroup; res.isGroup = chat.isGroup;
res.formattedTitle = chat.formattedTitle; res.formattedTitle = chat.formattedTitle;
res.isMuted = chat.mute && chat.mute.isMuted;
if (chat.groupMetadata) { if (chat.groupMetadata) {
await window.Store.GroupMetadata.update(chat.id._serialized);
res.groupMetadata = chat.groupMetadata.serialize(); res.groupMetadata = chat.groupMetadata.serialize();
} }
delete res.msgs;
delete res.msgUnsyncedButtonReplyMsgs;
delete res.unsyncedButtonReplies;
return res; return res;
}; };
window.WWebJS.getChat = chatId => { window.WWebJS.getChat = async chatId => {
const chat = window.Store.Chat.get(chatId); const chat = window.Store.Chat.get(chatId);
return window.WWebJS.getChatModel(chat); return await window.WWebJS.getChatModel(chat);
}; };
window.WWebJS.getChats = () => { window.WWebJS.getChats = async () => {
const chats = window.Store.Chat.models; const chats = window.Store.Chat.models;
return chats.map(chat => window.WWebJS.getChatModel(chat));
const chatPromises = chats.map(chat => window.WWebJS.getChatModel(chat));
return await Promise.all(chatPromises);
}; };
window.WWebJS.getContactModel = contact => { window.WWebJS.getContactModel = contact => {
@@ -195,6 +308,7 @@ exports.LoadUtils = () => {
res.isGroup = contact.isGroup; res.isGroup = contact.isGroup;
res.isWAContact = contact.isWAContact; res.isWAContact = contact.isWAContact;
res.isMyContact = contact.isMyContact; res.isMyContact = contact.isMyContact;
res.isBlocked = contact.isContactBlocked;
res.userid = contact.userid; res.userid = contact.userid;
return res; return res;
@@ -265,6 +379,22 @@ exports.LoadUtils = () => {
}); });
}; };
window.WWebJS.getFileHash = async (data) => {
let buffer = await data.arrayBuffer();
const hashBuffer = await crypto.subtle.digest('SHA-256', buffer);
return btoa(String.fromCharCode(...new Uint8Array(hashBuffer)));
};
window.WWebJS.generateHash = async (length) => {
var result = '';
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
var charactersLength = characters.length;
for ( var i = 0; i < length; i++ ) {
result += characters.charAt(Math.floor(Math.random() * charactersLength));
}
return result;
};
window.WWebJS.sendClearChat = async (chatId) => { window.WWebJS.sendClearChat = async (chatId) => {
let chat = window.Store.Chat.get(chatId); let chat = window.Store.Chat.get(chatId);
if (chat !== undefined) { if (chat !== undefined) {
@@ -284,7 +414,7 @@ exports.LoadUtils = () => {
}; };
window.WWebJS.sendChatstate = async (state, chatId) => { window.WWebJS.sendChatstate = async (state, chatId) => {
switch(state) { switch (state) {
case 'typing': case 'typing':
await window.Store.Wap.sendChatstateComposing(chatId); await window.Store.Wap.sendChatstateComposing(chatId);
break; break;
@@ -297,10 +427,31 @@ exports.LoadUtils = () => {
default: default:
throw 'Invalid chatstate'; throw 'Invalid chatstate';
} }
return true; return true;
}; };
window.WWebJS.getLabelModel = label => {
let res = label.serialize();
res.hexColor = label.hexColor;
return res;
};
window.WWebJS.getLabels = () => {
const labels = window.Store.Label.models;
return labels.map(label => window.WWebJS.getLabelModel(label));
};
window.WWebJS.getLabel = (labelId) => {
const label = window.Store.Label.get(labelId);
return window.WWebJS.getLabelModel(label);
};
window.WWebJS.getChatLabels = async (chatId) => {
const chat = await window.WWebJS.getChat(chatId);
return (chat.labels || []).map(id => window.WWebJS.getLabel(id));
};
}; };
exports.MarkAllRead = () => { exports.MarkAllRead = () => {

View File

@@ -31,6 +31,28 @@ class InterfaceController {
}, chatId); }, 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 => {
let chat = 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 => {
let msg = await window.Store.Msg.get(msgId);
await window.Store.Cmd.openChatAt(msg.chat, msg.chat.getSearchContext(msg));
}, msgId);
}
/** /**
* Opens the Message Drawer * Opens the Message Drawer
* @param {string} msgId ID of the message drawer that will be opened * @param {string} msgId ID of the message drawer that will be opened

View File

@@ -1,5 +1,12 @@
'use strict'; 'use strict';
const sharp = require('sharp');
const path = require('path');
const Crypto = require('crypto');
const { tmpdir } = require('os');
const ffmpeg = require('fluent-ffmpeg');
const fs = require('fs').promises;
const has = (o, k) => Object.prototype.hasOwnProperty.call(o, k); const has = (o, k) => Object.prototype.hasOwnProperty.call(o, k);
/** /**
@@ -30,6 +37,123 @@ class Util {
return given; return given;
} }
/**
* Formats a image to webp
* @param {MessageMedia} media
*
* @returns {Promise<MessageMedia>} media in webp format
*/
static async formatImageToWebpSticker(media) {
if (!media.mimetype.includes('image'))
throw new Error('media is not a image');
if (media.mimetype.includes('webp')) {
return media;
}
const buff = Buffer.from(media.data, 'base64');
let sharpImg = sharp(buff);
sharpImg = sharpImg.webp();
sharpImg = sharpImg.resize(512, 512, {
fit: 'contain',
background: { r: 0, g: 0, b: 0, alpha: 0 },
});
let webpBase64 = (await sharpImg.toBuffer()).toString('base64');
return {
mimetype: 'image/webp',
data: webpBase64,
filename: media.filename,
};
}
/**
* Formats a video to webp
* @param {MessageMedia} media
*
* @returns {Promise<MessageMedia>} media in webp format
*/
static async formatVideoToWebpSticker(media) {
if (!media.mimetype.includes('video'))
throw new Error('media is not a video');
const videoType = media.mimetype.split('/')[1];
const tempFile = path.join(
tmpdir(),
`${Crypto.randomBytes(6).readUIntLE(0, 6).toString(36)}.webp`
);
const stream = new (require('stream').Readable)();
const buffer = Buffer.from(
media.data.replace(`data:${media.mimetype};base64,`, ''),
'base64'
);
stream.push(buffer);
stream.push(null);
await new Promise((resolve, reject) => {
ffmpeg(stream)
.inputFormat(videoType)
.on('error', reject)
.on('end', () => resolve(true))
.addOutputOptions([
'-vcodec',
'libwebp',
'-vf',
// eslint-disable-next-line no-useless-escape
'scale=\'iw*min(300/iw\,300/ih)\':\'ih*min(300/iw\,300/ih)\',format=rgba,pad=300:300:\'(300-iw)/2\':\'(300-ih)/2\':\'#00000000\',setsar=1,fps=10',
'-loop',
'0',
'-ss',
'00:00:00.0',
'-t',
'00:00:05.0',
'-preset',
'default',
'-an',
'-vsync',
'0',
'-s',
'512:512',
])
.toFormat('webp')
.save(tempFile);
});
const data = await fs.readFile(tempFile, 'base64');
await fs.unlink(tempFile);
return {
mimetype: 'image/webp',
data: data,
filename: media.filename,
};
}
/**
* Formats a media to webp
* @param {MessageMedia} media
*
* @returns {Promise<MessageMedia>} media in webp format
*/
static async formatToWebpSticker(media) {
if (media.mimetype.includes('image')) return this.formatImageToWebpSticker(media);
else if (media.mimetype.includes('video')) return this.formatVideoToWebpSticker(media);
else throw new Error('Invalid media format');
}
/**
* Configure ffmpeg path
* @param {string} path
*/
static setFfmpegPath(path) {
ffmpeg.setFfmpegPath(path);
}
} }
module.exports = Util; module.exports = Util;