Compare commits

..

43 Commits

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

* use content-type as fallback

* set filename based on url

* fix empty filename

* wrap expression in parentheses

* hotfix

* JSDoc fix

* fix for jsdog

* eslint gets retirement home

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

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

Add isGif to the message data

* add typings

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

* singleQuotes

* Update src/structures/List.js

Co-authored-by: Rajeh Taher <rajeh@reforward.dev>
2021-12-10 20:47:07 +01:00
Pedro Lopez
c55db82f73 mark version v1.15.3 2021-12-07 23:06:53 -04:00
github-actions[bot]
4e837b00f9 Update supported WhatsApp Web version to v2.2147.14 (#1033)
Co-authored-by: pedroslopez <pedroslopez@users.noreply.github.com>
2021-12-07 23:05:54 -04:00
tuyuribr
89a06b15a8 Hot Fix WA 2.2147.14 (#1035)
* Hot Fix WA 2.2147.14

* Update Injected.js

* Update Client.js

* sendPresence1

* Update Client.js

* queryLinkPreview

* openChatDrawer

* revert back to using Wap

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

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

* to singleQuotes

* Update Injected.js

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

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

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

* Update src/Client.js

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

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

* 📝 Add client.js functionality

* 🚨 eslint just admires singlequote strings

* 📝 Add shortcuts to using client method

*  Adding parity between the ids

*  Same method name parity

* 🚨 ESLint indentation error.

* 🚨 ESLint doublequote string error.

* 🎨 Proposed changes

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

*  fixed calling the wrong function (sigh)

*  Fixed missing try-catch code.

* 🚨 Fixes ESLint indentation errors.

*  fix the documentation issues.

* 🏷️ typescript

* 🏷️ Typo in function name

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

* Updated types to include (#868)

* Update index.d.ts

* fix list type

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

* Update src/Client.js

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

* Update src/Client.js

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

* date fix

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

* Change getBlockedList to getBlockedIds

* getBlockedIds to getBlockedContacts

* typo

* ESLint & other changes

* 🏷️ types

* fix: no `this.client`

* add tests

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

* 🥅 Fixed .reply method too

* revert + fix
2021-10-29 23:00:10 -04:00
Pedro Lopez
1f38b762ed add warning for multidevice, keep working for forced upgrade 2021-10-29 22:58:57 -04:00
66 changed files with 2022 additions and 335 deletions

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.2126.14](https://img.shields.io/badge/WhatsApp_Web-2.2126.14-brightgreen.svg) [![Discord Chat](https://img.shields.io/discord/698610475432411196.svg?logo=discord)](https://discord.gg/H7DqQs4)
[![npm](https://img.shields.io/npm/v/whatsapp-web.js.svg)](https://www.npmjs.com/package/whatsapp-web.js) [![Depfu](https://badges.depfu.com/badges/4a65a0de96ece65fdf39e294e0c8dcba/overview.svg)](https://depfu.com/github/pedroslopez/whatsapp-web.js?project_id=9765) ![WhatsApp_Web 2.2202.8](https://img.shields.io/badge/WhatsApp_Web-2.2202.8-brightgreen.svg) [![Discord Chat](https://img.shields.io/discord/698610475432411196.svg?logo=discord)](https://discord.gg/H7DqQs4)
# whatsapp-web.js
A WhatsApp API client that connects through the WhatsApp Web browser app
@@ -7,6 +7,13 @@ It uses Puppeteer to run a real instance of Whatsapp Web to avoid getting blocke
**NOTE:** I can't guarantee you will not be blocked by using this method, although it has worked for me. WhatsApp does not allow bots or unofficial clients on their platform, so this shouldn't be considered totally safe.
## Quick Links
* [Guide / Getting Started](https://wwebjs.dev/guide) _(work in progress)_
* [Reference documentation](https://docs.wwebjs.dev/)
* [GitHub](https://github.com/pedroslopez/whatsapp-web.js)
* [npm](https://npmjs.org/package/whatsapp-web.js)
## Installation
The module is now available on npm! `npm i whatsapp-web.js`
@@ -80,11 +87,13 @@ After that check the following webpage and check http://127.0.0.1:9220/json and
| Send messages | ✅ |
| Receive messages | ✅ |
| Send media (images/audio/documents) | ✅ |
| Send media (video) | ✅ [(requires google chrome)](https://guide.wwebjs.dev/features/handling-attachments#caveat-for-sending-videos-and-gifs) |
| Send media (video) | ✅ [(requires google chrome)](https://wwebjs.dev/guide/handling-attachments.html#caveat-for-sending-videos-and-gifs) |
| Send stickers | ✅ |
| Receive media (images/audio/video/documents) | ✅ |
| Send contact cards | ✅ |
| Send location | ✅ |
| Send buttons | ✅ |
| Send lists | ✅ (business accounts not supported) |
| Receive location | ✅ |
| Message replies | ✅ |
| Join groups by invite | ✅ |
@@ -103,13 +112,6 @@ After that check the following webpage and check http://127.0.0.1:9220/json and
Something missing? Make an issue and let us know!
## Links
* [Reference](https://docs.wwebjs.dev/)
* [Guide](https://guide.wwebjs.dev/) _(work in progress)_
* [GitHub](https://github.com/pedroslopez/whatsapp-web.js)
* [npm](https://npmjs.org/package/whatsapp-web.js)
## Contributing
Pull requests are welcome! If you see something you'd like to add, please do. For drastic changes, please open an issue first.

View File

@@ -4,7 +4,7 @@
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.14.1 &raquo; Class: Base</title>
<title>whatsapp-web.js 1.15.4 &raquo; Class: Base</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" 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">
<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>14.<wbr>1</a>
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>4</a>
</div>
</div>
</nav>
@@ -50,7 +50,7 @@
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on September 1, 2021.
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on January 25, 2022.
</p>
</div>
</footer>

View File

@@ -4,7 +4,7 @@
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.14.1 &raquo; Class: BusinessContact</title>
<title>whatsapp-web.js 1.15.4 &raquo; Class: BusinessContact</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" 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">
<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>14.<wbr>1</a>
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>4</a>
</div>
</div>
</nav>
@@ -104,11 +104,17 @@
<dt><a href="BusinessContact.html#getAbout">getAbout()</a></dt>
<dd>
</dd>
<dt><a href="BusinessContact.html#getChat">getChat()</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="BusinessContact.html#getChat">getChat()</a></dt>
<dt><a href="BusinessContact.html#getCountryCode">getCountryCode()</a></dt>
<dd>
</dd>
<dt><a href="BusinessContact.html#getFormattedNumber">getFormattedNumber()</a></dt>
<dd>
</dd>
<dt><a href="BusinessContact.html#getProfilePicUrl">getProfilePicUrl()</a></dt>
@@ -263,6 +269,24 @@
<dd></dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="getCountryCode"><span class="symbol-name">getCountryCode</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing string</span></span></h3>
<p>Returns the contact's countrycode, (1541859685@c.us) =&gt; (1)</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Contact.html#getCountryCode">Contact#getCountryCode</a></dd>
<dt>Returns</dt>
<dd></dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="getFormattedNumber"><span class="symbol-name">getFormattedNumber</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing string</span></span></h3>
<p>Returns the contact's formatted phone number, (12345678901@c.us) =&gt; (+1 (234) 5678-901)</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Contact.html#getFormattedNumber">Contact#getFormattedNumber</a></dd>
<dt>Returns</dt>
<dd></dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<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>
<dl class="dl-compact">
@@ -290,7 +314,7 @@
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on September 1, 2021.
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on January 25, 2022.
</p>
</div>
</footer>

248
docs/Buttons.html Normal file
View File

@@ -0,0 +1,248 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.15.4 &raquo; Class: Buttons</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
<link href="css/baseline.css" rel="stylesheet">
</head>
<body onload="prettyPrint()">
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>4</a>
</div>
</div>
</nav>
<div id="jsdoc-body-container">
<div id="jsdoc-content">
<div id="jsdoc-content-container">
<div id="jsdoc-main" role="main">
<header class="page-header">
<div class="symbol-detail-labels"><span class="label label-kind">class</span></div>
<h1><small></small><span class="symbol-name">Buttons</span></h1>
<p class="source-link">Source: <a href="structures_Buttons.js.html#source-line-9">structures/<wbr>Buttons.<wbr>js:9</a></p>
<div class="symbol-classdesc">
<p>Message type buttons</p>
</div>
<dl class="dl-compact">
</dl>
</header>
<section id="summary">
<div class="summary-callout">
<h2 class="summary-callout-heading">Properties</h2>
<div class="summary-content">
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="Buttons.html#body">body</a></dt>
<dd>
</dd>
<dt><a href="Buttons.html#buttons">buttons</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="Buttons.html#footer">footer</a></dt>
<dd>
</dd>
<dt><a href="Buttons.html#title">title</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
</div>
</div>
</div>
<div class="summary-callout">
<h2 class="summary-callout-heading">Method</h2>
<div class="summary-content">
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="Buttons.html#_format">_format(buttons)</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
</div>
<div class="summary-column">
</div>
</div>
</div>
</section>
<section>
<h2 id="Buttons">new&nbsp;<span class="symbol-name">Buttons</span><span class="signature"><span class="signature-params">(body, buttons, title, footer)</span></span></h2>
<section>
<h3>Parameters</h3>
<table class="jsdoc-details-table">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Optional</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<p>body</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>buttons</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>title</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Value can be null.</p>
</td>
</tr>
<tr>
<td>
<p>footer</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Value can be null.</p>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
</dl>
</section>
<section>
<h2>Properties</h2>
<section>
<h3 id="body"><span class="symbol-name">body</span><small class="property-type">
&nbsp;(string or <a href="MessageMedia.html">MessageMedia</a>)</small></h3>
<p>Message body</p>
<dl class="dl-compact">
</dl>
<h3 id="buttons"><span class="symbol-name">buttons</span><small class="property-type">
&nbsp;Array of Array of string</small></h3>
<p>buttons of message</p>
<dl class="dl-compact">
</dl>
<h3 id="footer"><span class="symbol-name">footer</span><small class="property-type">
&nbsp;string</small></h3>
<p>footer of message</p>
<dl class="dl-compact">
</dl>
<h3 id="title"><span class="symbol-name">title</span><small class="property-type">
&nbsp;string</small></h3>
<p>title of message</p>
<dl class="dl-compact">
</dl>
</section>
<h2>Method</h2>
<section>
<h3 id="_format"><span class="symbol-name">_format</span><span class="signature"><span class="signature-params">(buttons)</span>&nbsp;&rarr; <span class="signature-returns"> Array of Array of string</span></span></h3>
<p>Creates button array from simple array</p>
<section>
<h4>
Example
</h4>
<div>
<pre class="prettyprint"><code>Input: [{id:&#x27;customId&#x27;,body:&#x27;button1&#x27;},{body:&#x27;button2&#x27;},{body:&#x27;button3&#x27;},{body:&#x27;button4&#x27;}]
Returns: [{ buttonId:&#x27;customId&#x27;,buttonText:{&#x27;displayText&#x27;:&#x27;button1&#x27;},type: 1 },{buttonId:&#x27;n3XKsL&#x27;,buttonText:{&#x27;displayText&#x27;:&#x27;button2&#x27;},type:1},{buttonId:&#x27;NDJk0a&#x27;,buttonText:{&#x27;displayText&#x27;:&#x27;button3&#x27;},type:1}]</code></pre>
</div>
</section>
<section>
<h4>Parameter</h4>
<table class="jsdoc-details-table">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Optional</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<p>buttons</p>
</td>
<td>
<p>Array of Array of string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code>Array of Array of string</code> </p>
</dd>
</dl>
</section>
</section>
</div>
</div>
<nav id="jsdoc-toc-nav" role="navigation"></nav>
</div>
</div>
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on January 25, 2022.
</p>
</div>
</footer>
<script src="scripts/jquery.min.js"></script>
<script src="scripts/tree.jquery.js"></script>
<script src="scripts/prettify.js"></script>
<script src="scripts/jsdoc-toc.js"></script>
<script src="scripts/linenumber.js"></script>
<script src="scripts/scrollanchor.js"></script>
</body>
</html>

View File

@@ -4,7 +4,7 @@
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.14.1 &raquo; Class: Call</title>
<title>whatsapp-web.js 1.15.4 &raquo; Class: Call</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<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>14.<wbr>1</a>
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>4</a>
</div>
</div>
</nav>
@@ -144,7 +144,7 @@
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on September 1, 2021.
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on January 25, 2022.
</p>
</div>
</footer>

View File

@@ -4,7 +4,7 @@
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.14.1 &raquo; Class: Chat</title>
<title>whatsapp-web.js 1.15.4 &raquo; Class: Chat</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" 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">
<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>14.<wbr>1</a>
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>4</a>
</div>
</div>
</nav>
@@ -334,7 +334,7 @@
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="mute"><span class="symbol-name">mute</span><span class="signature"><span class="signature-params">(unmuteDate)</span></span></h3>
<p>Mutes this chat until a specified date</p>
<p>Mutes this chat forever, unless a date is specified</p>
<section>
<h4>Parameter</h4>
<table class="jsdoc-details-table">
@@ -358,7 +358,8 @@
<p>&nbsp;</p>
</td>
<td>
<p>Date at which the Chat will be unmuted</p>
<p>Date at which the Chat will be unmuted, leave as is to mute forever</p>
<p>Value can be null.</p>
</td>
</tr>
</tbody>
@@ -477,7 +478,7 @@
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on September 1, 2021.
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on January 25, 2022.
</p>
</div>
</footer>

View File

@@ -4,7 +4,7 @@
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.14.1 &raquo; Class: Client</title>
<title>whatsapp-web.js 1.15.4 &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/Noto+Serif:400,400i,700,700i" 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">
<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>14.<wbr>1</a>
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>4</a>
</div>
</div>
</nav>
@@ -26,7 +26,7 @@
<header class="page-header">
<div class="symbol-detail-labels"><span class="label label-kind">class</span></div>
<h1><small></small><span class="symbol-name">Client</span></h1>
<p class="source-link">Source: <a href="Client.js.html#source-line-52">Client.<wbr>js:52</a></p>
<p class="source-link">Source: <a href="Client.js.html#source-line-53">Client.<wbr>js:53</a></p>
<div class="symbol-classdesc">
<p>Starting point for interacting with the WhatsApp Web API</p>
</div>
@@ -70,6 +70,9 @@
<dt><a href="Client.html#destroy">destroy()</a></dt>
<dd>
</dd>
<dt><a href="Client.html#getBlockedContacts">getBlockedContacts()</a></dt>
<dd>
</dd>
<dt><a href="Client.html#getChatById">getChatById(chatId)</a></dt>
<dd>
</dd>
@@ -88,13 +91,19 @@
<dt><a href="Client.html#getContacts">getContacts()</a></dt>
<dd>
</dd>
<dt><a href="Client.html#getInviteInfo">getInviteInfo(inviteCode)</a></dt>
<dt><a href="Client.html#getCountryCode">getCountryCode(number)</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="Client.html#getFormattedNumber">getFormattedNumber(number)</a></dt>
<dd>
</dd>
<dt><a href="Client.html#getInviteInfo">getInviteInfo(inviteCode)</a></dt>
<dd>
</dd>
<dt><a href="Client.html#getLabelById">getLabelById(labelId)</a></dt>
<dd>
</dd>
@@ -128,13 +137,13 @@
<dt><a href="Client.html#muteChat">muteChat(chatId, unmuteDate)</a></dt>
<dd>
</dd>
<dt><a href="Client.html#pinChat">pinChat()</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
<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>
<dd>
</dd>
@@ -331,6 +340,20 @@
<p>Timeout for qr code selector in puppeteer</p>
</td>
</tr>
<tr>
<td>
<p>qrMaxRetries</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>How many times should the qrcode be refreshed before giving up</p>
</td>
</tr>
<tr>
<td>
<p>restartOnAuthFail</p>
@@ -674,6 +697,15 @@
<dl class="dl-compact">
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="getBlockedContacts"><span class="symbol-name">getBlockedContacts</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>Gets all blocked contacts by host account</p>
<dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code>Promise containing Array of <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="getChatById"><span class="symbol-name">getChatById</span><span class="signature"><span class="signature-params">(chatId)</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing <a href="Chat.html">Chat</a></span></span></h3>
<p>Get chat instance by ID</p>
<section>
@@ -840,6 +872,82 @@
</dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="getCountryCode"><span class="symbol-name">getCountryCode</span><span class="signature"><span class="signature-params">(number)</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing string</span></span></h3>
<p>Get the country code of a WhatsApp 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>number</p>
</td>
<td>
<p>string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Number or ID</p>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code>Promise containing string</code> </p>
</dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="getFormattedNumber"><span class="symbol-name">getFormattedNumber</span><span class="signature"><span class="signature-params">(number)</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing string</span></span></h3>
<p>Get the formatted number of a WhatsApp 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>number</p>
</td>
<td>
<p>string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Number or ID</p>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code>Promise containing string</code> </p>
</dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="getInviteInfo"><span class="symbol-name">getInviteInfo</span><span class="signature"><span class="signature-params">(inviteCode)</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing object</span></span></h3>
<p>Returns an object with information about the invite code's group</p>
<section>
@@ -1102,7 +1210,7 @@
</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>
<p>Mutes the Chat until a specified date</p>
<p>Mutes this chat forever, unless a date is specified</p>
<section>
<h4>Parameters</h4>
<table class="jsdoc-details-table">
@@ -1140,7 +1248,8 @@
<p>&nbsp;</p>
</td>
<td>
<p>Date when the chat will be unmuted</p>
<p>Date when the chat will be unmuted, leave as is to mute forever</p>
<p>Value can be null.</p>
</td>
</tr>
</tbody>
@@ -1298,7 +1407,7 @@
<p>content</p>
</td>
<td>
<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>
<p>(string, <a href="MessageMedia.html">MessageMedia</a>, <a href="Location.html">Location</a>, <a href="Contact.html">Contact</a>, Array of <a href="Contact.html">Contact</a>, <a href="Buttons.html">Buttons</a>, or <a href="List.html">List</a>)</p>
</td>
<td>
<p>&nbsp;</p>
@@ -2298,7 +2407,7 @@
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on September 1, 2021.
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on January 25, 2022.
</p>
</div>
</footer>

View File

@@ -4,7 +4,7 @@
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.14.1 &raquo; Source: Client.js</title>
<title>whatsapp-web.js 1.15.4 &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/Noto+Serif:400,400i,700,700i" 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">
<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>14.<wbr>1</a>
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>4</a>
</div>
</div>
</nav>
@@ -42,7 +42,7 @@ const { WhatsWebURL, DefaultOptions, Events, WAState } &#x3D; require(&#x27;./ut
const { ExposeStore, LoadUtils } &#x3D; require(&#x27;./util/Injected&#x27;);
const ChatFactory &#x3D; require(&#x27;./factories/ChatFactory&#x27;);
const ContactFactory &#x3D; require(&#x27;./factories/ContactFactory&#x27;);
const { ClientInfo, Message, MessageMedia, Contact, Location, GroupNotification , Label, Call } &#x3D; require(&#x27;./structures&#x27;);
const { ClientInfo, Message, MessageMedia, Contact, Location, GroupNotification , Label, Call, Buttons, List} &#x3D; require(&#x27;./structures&#x27;);
/**
* Starting point for interacting with the WhatsApp Web API
* @extends {EventEmitter}
@@ -51,6 +51,7 @@ const { ClientInfo, Message, MessageMedia, Contact, Location, GroupNotification
* @param {object} options.puppeteer - Puppeteer launch options. View docs here: https://github.com/puppeteer/puppeteer/
* @param {number} options.qrRefreshIntervalMs - Refresh interval for qr code (how much time to wait before checking if the qr code has changed)
* @param {number} options.qrTimeoutMs - Timeout for qr code selector in puppeteer
* @param {number} options.qrMaxRetries - How many times should the qrcode be refreshed before giving up
* @param {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
@@ -111,6 +112,11 @@ class Client extends EventEmitter {
this.pupBrowser &#x3D; browser;
this.pupPage &#x3D; page;
// remember me
await page.evaluateOnNewDocument(() &#x3D;&gt; {
localStorage.setItem(&#x27;remember-me&#x27;, &#x27;true&#x27;);
});
if (this.options.session) {
await page.evaluateOnNewDocument(
session &#x3D;&gt; {
@@ -131,7 +137,7 @@ class Client extends EventEmitter {
timeout: 0,
});
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;;
const KEEP_PHONE_CONNECTED_IMG_SELECTOR &#x3D; &#x27;[data-icon&#x3D;&quot;intro-md-beta-logo-dark&quot;], [data-icon&#x3D;&quot;intro-md-beta-logo-light&quot;], [data-asset-intro-image-light&#x3D;&quot;true&quot;], [data-asset-intro-image-dark&#x3D;&quot;true&quot;]&#x27;;
if (this.options.session) {
// Check if session restore was successfull
@@ -158,6 +164,8 @@ class Client extends EventEmitter {
}
} else {
let qrRetries &#x3D; 0;
const getQrCode &#x3D; async () &#x3D;&gt; {
// Check if retry button is present
var QR_RETRY_SELECTOR &#x3D; &#x27;div[data-ref] &gt; span &gt; button&#x27;;
@@ -178,6 +186,14 @@ class Client extends EventEmitter {
* @param {string} qr QR Code
*/
this.emit(Events.QR_RECEIVED, qr);
if (this.options.qrMaxRetries &gt; 0) {
qrRetries++;
if (qrRetries &gt; this.options.qrMaxRetries) {
this.emit(Events.DISCONNECTED, &#x27;Max qrcode retries reached&#x27;);
await this.destroy();
}
}
};
getQrCode();
this._qrRefreshInterval &#x3D; setInterval(getQrCode, this.options.qrRefreshIntervalMs);
@@ -190,7 +206,7 @@ class Client extends EventEmitter {
}
await page.evaluate(ExposeStore, moduleRaid.toString());
// Get session tokens
const localStorage &#x3D; JSON.parse(await page.evaluate(() &#x3D;&gt; {
return JSON.stringify(window.localStorage);
@@ -217,6 +233,14 @@ class Client extends EventEmitter {
// Check window.Store Injection
await page.waitForFunction(&#x27;window.Store !&#x3D; undefined&#x27;);
const isMD &#x3D; await page.evaluate(() &#x3D;&gt; {
return window.Store.Features.features.MD_BACKEND;
});
if(isMD) {
throw new Error(&#x27;Multi-device is not yet supported by whatsapp-web.js. Please check out https://github.com/pedroslopez/whatsapp-web.js/pull/889 to follow the progress.&#x27;);
}
//Load util functions (serializers, helper functions)
await page.evaluate(LoadUtils);
@@ -510,7 +534,7 @@ class Client extends EventEmitter {
/**
* Send a message to a specific chatId
* @param {string} chatId
* @param {string|MessageMedia|Location|Contact|Array&amp;lt;Contact&gt;} content
* @param {string|MessageMedia|Location|Contact|Array&amp;lt;Contact&gt;|Buttons|List} content
* @param {MessageSendOptions} [options] - Options used when sending the message
*
* @returns {Promise&amp;lt;Message&gt;} Message that was just sent
@@ -547,6 +571,13 @@ class Client extends EventEmitter {
} 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;;
} else if(content instanceof Buttons){
if(content.type !&#x3D;&#x3D; &#x27;chat&#x27;){internalOptions.attachment &#x3D; content.body;}
internalOptions.buttons &#x3D; content;
content &#x3D; &#x27;&#x27;;
} else if(content instanceof List){
internalOptions.list &#x3D; content;
content &#x3D; &#x27;&#x27;;
}
if (internalOptions.sendMediaAsSticker &amp;amp;&amp;amp; internalOptions.attachment) {
@@ -781,15 +812,16 @@ class Client extends EventEmitter {
}
/**
* Mutes the Chat until a specified date
* Mutes this chat forever, unless a date is specified
* @param {string} chatId ID of the chat that will be muted
* @param {Date} unmuteDate Date when the chat will be unmuted
* @param {?Date} unmuteDate Date when the chat will be unmuted, leave as is to mute forever
*/
async muteChat(chatId, unmuteDate) {
unmuteDate &#x3D; unmuteDate ? unmuteDate.getTime() / 1000 : -1;
await this.pupPage.evaluate(async (chatId, timestamp) &#x3D;&gt; {
let chat &#x3D; await window.Store.Chat.get(chatId);
await chat.mute.mute(timestamp, !0);
}, chatId, unmuteDate.getTime() / 1000);
}, chatId, unmuteDate || -1);
}
/**
@@ -855,10 +887,7 @@ class Client extends EventEmitter {
* @returns {Promise&amp;lt;Object|null&gt;}
*/
async getNumberId(number) {
if(!number.endsWith(&#x27;@c.us&#x27;)) {
number +&#x3D; &#x27;@c.us&#x27;;
}
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);
@@ -868,6 +897,33 @@ class Client extends EventEmitter {
}
}
/**
* Get the formatted number of a WhatsApp ID.
* @param {string} number Number or ID
* @returns {Promise&amp;lt;string&gt;}
*/
async getFormattedNumber(number) {
if(!number.endsWith(&#x27;@s.whatsapp.net&#x27;)) number &#x3D; number.replace(&#x27;c.us&#x27;, &#x27;s.whatsapp.net&#x27;);
if(!number.includes(&#x27;@s.whatsapp.net&#x27;)) number &#x3D; &#x60;${number}@s.whatsapp.net&#x60;;
return await this.pupPage.evaluate(async numberId &#x3D;&gt; {
return window.Store.NumberInfo.formattedPhoneNumber(numberId);
}, number);
}
/**
* Get the country code of a WhatsApp ID.
* @param {string} number Number or ID
* @returns {Promise&amp;lt;string&gt;}
*/
async getCountryCode(number) {
number &#x3D; number.replace(&#x27; &#x27;, &#x27;&#x27;).replace(&#x27;+&#x27;, &#x27;&#x27;).replace(&#x27;@c.us&#x27;, &#x27;&#x27;);
return await this.pupPage.evaluate(async numberId &#x3D;&gt; {
return window.Store.NumberInfo.findCC(numberId);
}, number);
}
/**
* Create a new group
* @param {string} name group title
@@ -962,6 +1018,19 @@ class Client extends EventEmitter {
return Promise.all(chatIds.map(id &#x3D;&gt; this.getChatById(id)));
}
/**
* Gets all blocked contacts by host account
* @returns {Promise&amp;lt;Array&amp;lt;Contact&gt;&gt;}
*/
async getBlockedContacts() {
const blockedContacts &#x3D; await this.pupPage.evaluate(() &#x3D;&gt; {
let chatIds &#x3D; window.Store.Blocklist.models.map(a &#x3D;&gt; a.id._serialized);
return Promise.all(chatIds.map(id &#x3D;&gt; window.WWebJS.getContact(id)));
});
return blockedContacts.map(contact &#x3D;&gt; ContactFactory.create(this.client, contact));
}
}
module.exports &#x3D; Client;
@@ -975,7 +1044,7 @@ module.exports &#x3D; Client;
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on September 1, 2021.
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on January 25, 2022.
</p>
</div>
</footer>

View File

@@ -4,7 +4,7 @@
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.14.1 &raquo; Class: ClientInfo</title>
<title>whatsapp-web.js 1.15.4 &raquo; Class: ClientInfo</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" 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">
<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>14.<wbr>1</a>
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>4</a>
</div>
</div>
</nav>
@@ -235,7 +235,7 @@
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on September 1, 2021.
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on January 25, 2022.
</p>
</div>
</footer>

View File

@@ -4,7 +4,7 @@
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.14.1 &raquo; Class: Contact</title>
<title>whatsapp-web.js 1.15.4 &raquo; Class: Contact</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" 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">
<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>14.<wbr>1</a>
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>4</a>
</div>
</div>
</nav>
@@ -101,11 +101,17 @@
<dt><a href="Contact.html#getAbout">getAbout()</a></dt>
<dd>
</dd>
<dt><a href="Contact.html#getChat">getChat()</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="Contact.html#getChat">getChat()</a></dt>
<dt><a href="Contact.html#getCountryCode">getCountryCode()</a></dt>
<dd>
</dd>
<dt><a href="Contact.html#getFormattedNumber">getFormattedNumber()</a></dt>
<dd>
</dd>
<dt><a href="Contact.html#getProfilePicUrl">getProfilePicUrl()</a></dt>
@@ -230,6 +236,24 @@
</dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="getCountryCode"><span class="symbol-name">getCountryCode</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing string</span></span></h3>
<p>Returns the contact's countrycode, (1541859685@c.us) =&gt; (1)</p>
<dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code>Promise containing string</code> </p>
</dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="getFormattedNumber"><span class="symbol-name">getFormattedNumber</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing string</span></span></h3>
<p>Returns the contact's formatted phone number, (12345678901@c.us) =&gt; (+1 (234) 5678-901)</p>
<dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code>Promise containing string</code> </p>
</dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<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>
<dl class="dl-compact">
@@ -257,7 +281,7 @@
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on September 1, 2021.
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on January 25, 2022.
</p>
</div>
</footer>

View File

@@ -4,7 +4,7 @@
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.14.1 &raquo; Class: GroupChat</title>
<title>whatsapp-web.js 1.15.4 &raquo; Class: GroupChat</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" 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">
<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>14.<wbr>1</a>
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>4</a>
</div>
</div>
</nav>
@@ -521,7 +521,7 @@
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="mute"><span class="symbol-name">mute</span><span class="signature"><span class="signature-params">(unmuteDate)</span></span></h3>
<p>Mutes this chat until a specified date</p>
<p>Mutes this chat forever, unless a date is specified</p>
<section>
<h4>Parameter</h4>
<table class="jsdoc-details-table">
@@ -545,7 +545,8 @@
<p>&nbsp;</p>
</td>
<td>
<p>Date at which the Chat will be unmuted</p>
<p>Date at which the Chat will be unmuted, leave as is to mute forever</p>
<p>Value can be null.</p>
</td>
</tr>
</tbody>
@@ -916,7 +917,7 @@
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on September 1, 2021.
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on January 25, 2022.
</p>
</div>
</footer>

View File

@@ -4,7 +4,7 @@
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.14.1 &raquo; Class: GroupNotification</title>
<title>whatsapp-web.js 1.15.4 &raquo; Class: GroupNotification</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" 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">
<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>14.<wbr>1</a>
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>4</a>
</div>
</div>
</nav>
@@ -233,7 +233,7 @@
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on September 1, 2021.
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on January 25, 2022.
</p>
</div>
</footer>

View File

@@ -4,7 +4,7 @@
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.14.1 &raquo; Class: InterfaceController</title>
<title>whatsapp-web.js 1.15.4 &raquo; Class: InterfaceController</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<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>14.<wbr>1</a>
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>4</a>
</div>
</div>
</nav>
@@ -382,7 +382,7 @@
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on September 1, 2021.
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on January 25, 2022.
</p>
</div>
</footer>

View File

@@ -4,7 +4,7 @@
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.14.1 &raquo; Class: Label</title>
<title>whatsapp-web.js 1.15.4 &raquo; Class: Label</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<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>14.<wbr>1</a>
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>4</a>
</div>
</div>
</nav>
@@ -163,7 +163,7 @@
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on September 1, 2021.
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on January 25, 2022.
</p>
</div>
</footer>

271
docs/List.html Normal file
View File

@@ -0,0 +1,271 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.15.4 &raquo; Class: List</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
<link href="css/baseline.css" rel="stylesheet">
</head>
<body onload="prettyPrint()">
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>4</a>
</div>
</div>
</nav>
<div id="jsdoc-body-container">
<div id="jsdoc-content">
<div id="jsdoc-content-container">
<div id="jsdoc-main" role="main">
<header class="page-header">
<div class="symbol-detail-labels"><span class="label label-kind">class</span></div>
<h1><small></small><span class="symbol-name">List</span></h1>
<p class="source-link">Source: <a href="structures_List.js.html#source-line-8">structures/<wbr>List.<wbr>js:8</a></p>
<div class="symbol-classdesc">
<p>Message type List</p>
</div>
<dl class="dl-compact">
</dl>
</header>
<section id="summary">
<div class="summary-callout">
<h2 class="summary-callout-heading">Properties</h2>
<div class="summary-content">
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="List.html#buttonText">buttonText</a></dt>
<dd>
</dd>
<dt><a href="List.html#description">description</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="List.html#footer">footer</a></dt>
<dd>
</dd>
<dt><a href="List.html#sections">sections</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="List.html#title">title</a></dt>
<dd>
</dd>
</dl>
</div>
</div>
</div>
<div class="summary-callout">
<h2 class="summary-callout-heading">Method</h2>
<div class="summary-content">
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="List.html#_format">_format(sections)</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
</div>
<div class="summary-column">
</div>
</div>
</div>
</section>
<section>
<h2 id="List">new&nbsp;<span class="symbol-name">List</span><span class="signature"><span class="signature-params">(body, buttonText, sections, title, footer)</span></span></h2>
<section>
<h3>Parameters</h3>
<table class="jsdoc-details-table">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Optional</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<p>body</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>buttonText</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>sections</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>title</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Value can be null.</p>
</td>
</tr>
<tr>
<td>
<p>footer</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Value can be null.</p>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
</dl>
</section>
<section>
<h2>Properties</h2>
<section>
<h3 id="buttonText"><span class="symbol-name">buttonText</span><small class="property-type">
&nbsp;string</small></h3>
<p>List button text</p>
<dl class="dl-compact">
</dl>
<h3 id="description"><span class="symbol-name">description</span><small class="property-type">
&nbsp;string</small></h3>
<p>Message body</p>
<dl class="dl-compact">
</dl>
<h3 id="footer"><span class="symbol-name">footer</span><small class="property-type">
&nbsp;string</small></h3>
<p>footer of message</p>
<dl class="dl-compact">
</dl>
<h3 id="sections"><span class="symbol-name">sections</span><small class="property-type">
&nbsp;Array of any</small></h3>
<p>sections of message</p>
<dl class="dl-compact">
</dl>
<h3 id="title"><span class="symbol-name">title</span><small class="property-type">
&nbsp;string</small></h3>
<p>title of message</p>
<dl class="dl-compact">
</dl>
</section>
<h2>Method</h2>
<section>
<h3 id="_format"><span class="symbol-name">_format</span><span class="signature"><span class="signature-params">(sections)</span>&nbsp;&rarr; <span class="signature-returns"> Array of any</span></span></h3>
<p>Creates section array from simple array</p>
<section>
<h4>
Example
</h4>
<div>
<pre class="prettyprint"><code>Input: [{title:&#x27;sectionTitle&#x27;,rows:[{id:&#x27;customId&#x27;, title:&#x27;ListItem2&#x27;, description: &#x27;desc&#x27;},{title:&#x27;ListItem2&#x27;}]}}]
Returns: [{&#x27;title&#x27;:&#x27;sectionTitle&#x27;,&#x27;rows&#x27;:[{&#x27;rowId&#x27;:&#x27;customId&#x27;,&#x27;title&#x27;:&#x27;ListItem1&#x27;,&#x27;description&#x27;:&#x27;desc&#x27;},{&#x27;rowId&#x27;:&#x27;oGSRoD&#x27;,&#x27;title&#x27;:&#x27;ListItem2&#x27;,&#x27;description&#x27;:&#x27;&#x27;}]}]</code></pre>
</div>
</section>
<section>
<h4>Parameter</h4>
<table class="jsdoc-details-table">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Optional</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<p>sections</p>
</td>
<td>
<p>Array of any</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code>Array of any</code> </p>
</dd>
</dl>
</section>
</section>
</div>
</div>
<nav id="jsdoc-toc-nav" role="navigation"></nav>
</div>
</div>
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on January 25, 2022.
</p>
</div>
</footer>
<script src="scripts/jquery.min.js"></script>
<script src="scripts/tree.jquery.js"></script>
<script src="scripts/prettify.js"></script>
<script src="scripts/jsdoc-toc.js"></script>
<script src="scripts/linenumber.js"></script>
<script src="scripts/scrollanchor.js"></script>
</body>
</html>

View File

@@ -4,7 +4,7 @@
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.14.1 &raquo; Class: Location</title>
<title>whatsapp-web.js 1.15.4 &raquo; Class: Location</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" 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">
<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>14.<wbr>1</a>
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>4</a>
</div>
</div>
</nav>
@@ -149,7 +149,7 @@
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on September 1, 2021.
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on January 25, 2022.
</p>
</div>
</footer>

View File

@@ -4,7 +4,7 @@
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.14.1 &raquo; Class: Message</title>
<title>whatsapp-web.js 1.15.4 &raquo; Class: Message</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" 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">
<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>14.<wbr>1</a>
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>4</a>
</div>
</div>
</nav>
@@ -26,7 +26,7 @@
<header class="page-header">
<div class="symbol-detail-labels"><span class="label label-kind">class</span></div>
<h1><small></small><span class="symbol-name">Message</span></h1>
<p class="source-link">Source: <a href="structures_Message.js.html#source-line-13">structures/<wbr>Message.<wbr>js:13</a></p>
<p class="source-link">Source: <a href="structures_Message.js.html#source-line-14">structures/<wbr>Message.<wbr>js:14</a></p>
<div class="symbol-classdesc">
<p>Represents a Message on WhatsApp</p>
</div>
@@ -82,6 +82,9 @@
<dt><a href="Message.html#isForwarded">isForwarded</a></dt>
<dd>
</dd>
<dt><a href="Message.html#isGif">isGif</a></dt>
<dd>
</dd>
<dt><a href="Message.html#isStarred">isStarred</a></dt>
<dd>
</dd>
@@ -94,13 +97,13 @@
<dt><a href="Message.html#location">location</a></dt>
<dd>
</dd>
<dt><a href="Message.html#mediaKey">mediaKey</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
<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>
<dd>
</dd>
@@ -162,13 +165,16 @@
<dt><a href="Message.html#getOrder">getOrder()</a></dt>
<dd>
</dd>
<dt><a href="Message.html#getQuotedMessage">getQuotedMessage()</a></dt>
<dt><a href="Message.html#getPayment">getPayment()</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="Message.html#getQuotedMessage">getQuotedMessage()</a></dt>
<dd>
</dd>
<dt><a href="Message.html#reply">reply(content[, chatId][, options])</a></dt>
<dd>
</dd>
@@ -259,6 +265,11 @@
<p>Indicates if the message was forwarded</p>
<dl class="dl-compact">
</dl>
<h3 id="isGif"><span class="symbol-name">isGif</span><small class="property-type">
&nbsp;boolean</small></h3>
<p>Indicates whether the message is a Gif</p>
<dl class="dl-compact">
</dl>
<h3 id="isStarred"><span class="symbol-name">isStarred</span><small class="property-type">
&nbsp;boolean</small></h3>
<p>Indicates if the message was starred</p>
@@ -459,6 +470,15 @@
</dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="getPayment"><span class="symbol-name">getPayment</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing <a href="Payment.html">Payment</a></span></span></h3>
<p>Gets the payment details associated with a given message</p>
<dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code>Promise containing <a href="Payment.html">Payment</a></code> </p>
</dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="getQuotedMessage"><span class="symbol-name">getQuotedMessage</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing <a href="Message.html">Message</a></span></span></h3>
<p>Returns the quoted message, if any</p>
<dl class="dl-compact">
@@ -552,7 +572,7 @@
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on September 1, 2021.
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on January 25, 2022.
</p>
</div>
</footer>

View File

@@ -4,7 +4,7 @@
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.14.1 &raquo; Class: MessageMedia</title>
<title>whatsapp-web.js 1.15.4 &raquo; Class: MessageMedia</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" 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">
<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>14.<wbr>1</a>
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>4</a>
</div>
</div>
</nav>
@@ -258,7 +258,7 @@
<p>unsafeMime</p>
</td>
<td>
<p>number</p>
<p>boolean</p>
</td>
<td>
<p>Yes</p>
@@ -267,6 +267,19 @@
<p>Defaults to <code>false</code>.</p>
</td>
</tr>
<tr>
<td>
<p>filename</p>
</td>
<td>
<p>string</p>
</td>
<td>
<p>Yes</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>client</p>
@@ -330,7 +343,7 @@
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on September 1, 2021.
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on January 25, 2022.
</p>
</div>
</footer>

View File

@@ -4,7 +4,7 @@
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.14.1 &raquo; Class: Order</title>
<title>whatsapp-web.js 1.15.4 &raquo; Class: Order</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<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>14.<wbr>1</a>
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>4</a>
</div>
</div>
</nav>
@@ -102,7 +102,7 @@
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on September 1, 2021.
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on January 25, 2022.
</p>
</div>
</footer>

View File

@@ -4,7 +4,7 @@
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.14.1 &raquo; Class: PrivateChat</title>
<title>whatsapp-web.js 1.15.4 &raquo; Class: PrivateChat</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" 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">
<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>14.<wbr>1</a>
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>4</a>
</div>
</div>
</nav>
@@ -362,7 +362,7 @@
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="mute"><span class="symbol-name">mute</span><span class="signature"><span class="signature-params">(unmuteDate)</span></span></h3>
<p>Mutes this chat until a specified date</p>
<p>Mutes this chat forever, unless a date is specified</p>
<section>
<h4>Parameter</h4>
<table class="jsdoc-details-table">
@@ -386,7 +386,8 @@
<p>&nbsp;</p>
</td>
<td>
<p>Date at which the Chat will be unmuted</p>
<p>Date at which the Chat will be unmuted, leave as is to mute forever</p>
<p>Value can be null.</p>
</td>
</tr>
</tbody>
@@ -519,7 +520,7 @@
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on September 1, 2021.
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on January 25, 2022.
</p>
</div>
</footer>

View File

@@ -4,7 +4,7 @@
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.14.1 &raquo; Class: PrivateContact</title>
<title>whatsapp-web.js 1.15.4 &raquo; Class: PrivateContact</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" 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">
<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>14.<wbr>1</a>
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>4</a>
</div>
</div>
</nav>
@@ -101,11 +101,17 @@
<dt><a href="PrivateContact.html#getAbout">getAbout()</a></dt>
<dd>
</dd>
<dt><a href="PrivateContact.html#getChat">getChat()</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="PrivateContact.html#getChat">getChat()</a></dt>
<dt><a href="PrivateContact.html#getCountryCode">getCountryCode()</a></dt>
<dd>
</dd>
<dt><a href="PrivateContact.html#getFormattedNumber">getFormattedNumber()</a></dt>
<dd>
</dd>
<dt><a href="PrivateContact.html#getProfilePicUrl">getProfilePicUrl()</a></dt>
@@ -256,6 +262,24 @@
<dd></dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="getCountryCode"><span class="symbol-name">getCountryCode</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing string</span></span></h3>
<p>Returns the contact's countrycode, (1541859685@c.us) =&gt; (1)</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Contact.html#getCountryCode">Contact#getCountryCode</a></dd>
<dt>Returns</dt>
<dd></dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="getFormattedNumber"><span class="symbol-name">getFormattedNumber</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing string</span></span></h3>
<p>Returns the contact's formatted phone number, (12345678901@c.us) =&gt; (+1 (234) 5678-901)</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Contact.html#getFormattedNumber">Contact#getFormattedNumber</a></dd>
<dt>Returns</dt>
<dd></dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<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>
<dl class="dl-compact">
@@ -283,7 +307,7 @@
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on September 1, 2021.
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on January 25, 2022.
</p>
</div>
</footer>

View File

@@ -4,7 +4,7 @@
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.14.1 &raquo; Class: Product</title>
<title>whatsapp-web.js 1.15.4 &raquo; Class: Product</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<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>14.<wbr>1</a>
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>4</a>
</div>
</div>
</nav>
@@ -127,7 +127,7 @@
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on September 1, 2021.
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on January 25, 2022.
</p>
</div>
</footer>

View File

@@ -4,7 +4,7 @@
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.14.1 &raquo; Class: Util</title>
<title>whatsapp-web.js 1.15.4 &raquo; Class: Util</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" 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">
<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>14.<wbr>1</a>
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>4</a>
</div>
</div>
</nav>
@@ -240,7 +240,7 @@
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on September 1, 2021.
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on January 25, 2022.
</p>
</div>
</footer>

View File

@@ -4,7 +4,7 @@
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.14.1 &raquo; Globals</title>
<title>whatsapp-web.js 1.15.4 &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/Noto+Serif:400,400i,700,700i" 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">
<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>14.<wbr>1</a>
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>4</a>
</div>
</div>
</nav>
@@ -849,6 +849,45 @@
<td>
</td>
</tr>
<tr>
<td>
<p>LIST</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>BUTTONS_RESPONSE</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>PAYMENT</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
</tbody>
</table>
</section>
@@ -1608,7 +1647,7 @@
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on September 1, 2021.
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on January 25, 2022.
</p>
</div>
</footer>

View File

@@ -4,7 +4,7 @@
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.14.1 &raquo; Home</title>
<title>whatsapp-web.js 1.15.4 &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/Noto+Serif:400,400i,700,700i" 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">
<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>14.<wbr>1</a>
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>4</a>
</div>
</div>
</nav>
@@ -27,15 +27,22 @@
<div id="jsdoc-main" role="main">
<header class="page-header">
<h1>
whatsapp-web.js 1.14.1
whatsapp-web.js 1.15.4
</h1>
</header>
<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.2126.14-brightgreen.svg" alt="WhatsApp_Web 2.2126.14"> <a href="https://discord.gg/H7DqQs4"><img src="https://img.shields.io/discord/698610475432411196.svg?logo=discord" alt="Discord Chat"></a></p>
<p><a href="https://www.npmjs.com/package/whatsapp-web.js"><img src="https://img.shields.io/npm/v/whatsapp-web.js.svg" alt="npm"></a> <a href="https://depfu.com/github/pedroslopez/whatsapp-web.js?project_id=9765"><img src="https://badges.depfu.com/badges/4a65a0de96ece65fdf39e294e0c8dcba/overview.svg" alt="Depfu"></a> <img src="https://img.shields.io/badge/WhatsApp_Web-2.2202.8-brightgreen.svg" alt="WhatsApp_Web 2.2202.8"> <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>
<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><strong>NOTE:</strong> I can't guarantee you will not be blocked by using this method, although it has worked for me. WhatsApp does not allow bots or unofficial clients on their platform, so this shouldn't be considered totally safe.</p>
<h2>Quick Links</h2>
<ul>
<li><a href="https://wwebjs.dev/guide">Guide / Getting Started</a> <em>(work in progress)</em></li>
<li><a href="https://docs.wwebjs.dev/">Reference documentation</a></li>
<li><a href="https://github.com/pedroslopez/whatsapp-web.js">GitHub</a></li>
<li><a href="https://npmjs.org/package/whatsapp-web.js">npm</a></li>
</ul>
<h2>Installation</h2>
<p>The module is now available on npm! <code>npm i whatsapp-web.js</code></p>
<p>Please note that Node v12+ is required.</p>
@@ -112,7 +119,7 @@ client.initialize();
</tr>
<tr>
<td>Send media (video)</td>
<td><a href="https://guide.wwebjs.dev/features/handling-attachments#caveat-for-sending-videos-and-gifs">(requires google chrome)</a></td>
<td><a href="https://wwebjs.dev/guide/handling-attachments.html#caveat-for-sending-videos-and-gifs">(requires google chrome)</a></td>
</tr>
<tr>
<td>Send stickers</td>
@@ -130,6 +137,14 @@ client.initialize();
<td>Send location</td>
<td></td>
</tr>
<tr>
<td>Send buttons</td>
<td></td>
</tr>
<tr>
<td>Send lists</td>
<td>✅ (business accounts not supported)</td>
</tr>
<tr>
<td>Receive location</td>
<td></td>
@@ -193,13 +208,6 @@ client.initialize();
</tbody>
</table>
<p>Something missing? Make an issue and let us know!</p>
<h2>Links</h2>
<ul>
<li><a href="https://docs.wwebjs.dev/">Reference</a></li>
<li><a href="https://guide.wwebjs.dev/">Guide</a> <em>(work in progress)</em></li>
<li><a href="https://github.com/pedroslopez/whatsapp-web.js">GitHub</a></li>
<li><a href="https://npmjs.org/package/whatsapp-web.js">npm</a></li>
</ul>
<h2>Contributing</h2>
<p>Pull requests are welcome! If you see something you'd like to add, please do. For drastic changes, please open an issue first.</p>
<h2>Donating</h2>
@@ -275,12 +283,17 @@ client.initialize();
<dd>
</dd>
<dt class="symbol-index-name">
<a href="BusinessContact.html#getProfilePicUrl" class="!symbol-index-name">BusinessContact#<wbr>getProfilePicUrl()</a>
<a href="BusinessContact.html#getCountryCode" class="!symbol-index-name">BusinessContact#<wbr>getCountryCode()</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="BusinessContact.html#id" class="!symbol-index-name">BusinessContact#<wbr>id</a>
<a href="BusinessContact.html#getFormattedNumber" class="!symbol-index-name">BusinessContact#<wbr>getFormattedNumber()</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="BusinessContact.html#getProfilePicUrl" class="!symbol-index-name">BusinessContact#<wbr>getProfilePicUrl()</a>
</dt>
<dd>
</dd>
@@ -288,6 +301,11 @@ client.initialize();
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name">
<a href="BusinessContact.html#id" class="!symbol-index-name">BusinessContact#<wbr>id</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="BusinessContact.html#isBlocked" class="!symbol-index-name">BusinessContact#<wbr>isBlocked</a>
</dt>
@@ -362,6 +380,55 @@ client.initialize();
</div>
</div>
</section>
<section>
<div class="symbol-index-content">
<h2 id="Buttons">Buttons</h2>
<div class="symbol-index-section">
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name">
<a href="Buttons.html" class="!symbol-index-name">Buttons(body, buttons, title, footer)</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="Buttons.html#_format" class="!symbol-index-name">Buttons#<wbr>_format(buttons)</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name">
<a href="Buttons.html#body" class="!symbol-index-name">Buttons#<wbr>body</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="Buttons.html#buttons" class="!symbol-index-name">Buttons#<wbr>buttons</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name">
<a href="Buttons.html#footer" class="!symbol-index-name">Buttons#<wbr>footer</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="Buttons.html#title" class="!symbol-index-name">Buttons#<wbr>title</a>
</dt>
<dd>
</dd>
</dl>
</div>
</div>
</div>
</section>
<section>
<div class="symbol-index-content">
<h2 id="Call">Call</h2>
@@ -720,15 +787,15 @@ client.initialize();
</dt>
<dd>
</dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name">
<a href="Client.html#event:message_create" class="!symbol-index-name">Client#<wbr>event:message_create</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name">
<a href="Client.html#event:message_revoke_everyone" class="!symbol-index-name">Client#<wbr>event:message_revoke_everyone</a>
</dt>
@@ -749,6 +816,11 @@ client.initialize();
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="Client.html#getBlockedContacts" class="!symbol-index-name">Client#<wbr>getBlockedContacts()</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="Client.html#getChatById" class="!symbol-index-name">Client#<wbr>getChatById(chatId)</a>
</dt>
@@ -779,6 +851,16 @@ client.initialize();
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="Client.html#getCountryCode" class="!symbol-index-name">Client#<wbr>getCountryCode(number)</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="Client.html#getFormattedNumber" class="!symbol-index-name">Client#<wbr>getFormattedNumber(number)</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="Client.html#getInviteInfo" class="!symbol-index-name">Client#<wbr>getInviteInfo(inviteCode)</a>
</dt>
@@ -809,15 +891,15 @@ client.initialize();
</dt>
<dd>
</dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name">
<a href="Client.html#getWWebVersion" class="!symbol-index-name">Client#<wbr>getWWebVersion()</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name">
<a href="Client.html#info" class="!symbol-index-name">Client#<wbr>info</a>
</dt>
@@ -988,11 +1070,25 @@ client.initialize();
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="Contact.html#getCountryCode" class="!symbol-index-name">Contact#<wbr>getCountryCode()</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="Contact.html#getFormattedNumber" class="!symbol-index-name">Contact#<wbr>getFormattedNumber()</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="Contact.html#getProfilePicUrl" class="!symbol-index-name">Contact#<wbr>getProfilePicUrl()</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name">
<a href="Contact.html#id" class="!symbol-index-name">Contact#<wbr>id</a>
</dt>
@@ -1003,10 +1099,6 @@ client.initialize();
</dt>
<dd>
</dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name">
<a href="Contact.html#isBusiness" class="!symbol-index-name">Contact#<wbr>isBusiness</a>
</dt>
@@ -1032,6 +1124,10 @@ client.initialize();
</dt>
<dd>
</dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name">
<a href="Contact.html#isUser" class="!symbol-index-name">Contact#<wbr>isUser</a>
</dt>
@@ -1042,10 +1138,6 @@ client.initialize();
</dt>
<dd>
</dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name">
<a href="Contact.html#name" class="!symbol-index-name">Contact#<wbr>name</a>
</dt>
@@ -1675,6 +1767,60 @@ client.initialize();
</div>
</div>
</section>
<section>
<div class="symbol-index-content">
<h2 id="List">List</h2>
<div class="symbol-index-section">
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name">
<a href="List.html" class="!symbol-index-name">List(body, buttonText, sections, title, footer)</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="List.html#_format" class="!symbol-index-name">List#<wbr>_format(sections)</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="List.html#buttonText" class="!symbol-index-name">List#<wbr>buttonText</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name">
<a href="List.html#description" class="!symbol-index-name">List#<wbr>description</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="List.html#footer" class="!symbol-index-name">List#<wbr>footer</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="List.html#sections" class="!symbol-index-name">List#<wbr>sections</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name">
<a href="List.html#title" class="!symbol-index-name">List#<wbr>title</a>
</dt>
<dd>
</dd>
</dl>
</div>
</div>
</div>
</section>
<section>
<div class="symbol-index-content">
<h2 id="Location">Location</h2>
@@ -1785,15 +1931,15 @@ client.initialize();
</dt>
<dd>
</dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name">
<a href="Message.html#getChat" class="!symbol-index-name">Message#<wbr>getChat()</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name">
<a href="Message.html#getContact" class="!symbol-index-name">Message#<wbr>getContact()</a>
</dt>
@@ -1814,6 +1960,11 @@ client.initialize();
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="Message.html#getPayment" class="!symbol-index-name">Message#<wbr>getPayment()</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="Message.html#getQuotedMessage" class="!symbol-index-name">Message#<wbr>getQuotedMessage()</a>
</dt>
@@ -1844,6 +1995,11 @@ client.initialize();
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="Message.html#isGif" class="!symbol-index-name">Message#<wbr>isGif</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="Message.html#isStarred" class="!symbol-index-name">Message#<wbr>isStarred</a>
</dt>
@@ -2037,6 +2193,11 @@ client.initialize();
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="global.html#MessageTypes#.BUTTONS_RESPONSE" class="!symbol-index-name">MessageTypes.<wbr>BUTTONS_RESPONSE</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="global.html#MessageTypes#.CONTACT_CARD" class="!symbol-index-name">MessageTypes.<wbr>CONTACT_CARD</a>
</dt>
@@ -2066,6 +2227,11 @@ client.initialize();
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="global.html#MessageTypes#.LIST" class="!symbol-index-name">MessageTypes.<wbr>LIST</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="global.html#MessageTypes#.LOCATION" class="!symbol-index-name">MessageTypes.<wbr>LOCATION</a>
</dt>
@@ -2077,12 +2243,12 @@ client.initialize();
<dd>
</dd>
<dt class="symbol-index-name">
<a href="global.html#MessageTypes#.PRODUCT" class="!symbol-index-name">MessageTypes.<wbr>PRODUCT</a>
<a href="global.html#MessageTypes#.PAYMENT" class="!symbol-index-name">MessageTypes.<wbr>PAYMENT</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="global.html#MessageTypes#.REVOKED" class="!symbol-index-name">MessageTypes.<wbr>REVOKED</a>
<a href="global.html#MessageTypes#.PRODUCT" class="!symbol-index-name">MessageTypes.<wbr>PRODUCT</a>
</dt>
<dd>
</dd>
@@ -2090,6 +2256,11 @@ client.initialize();
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name">
<a href="global.html#MessageTypes#.REVOKED" class="!symbol-index-name">MessageTypes.<wbr>REVOKED</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="global.html#MessageTypes#.STICKER" class="!symbol-index-name">MessageTypes.<wbr>STICKER</a>
</dt>
@@ -2164,6 +2335,65 @@ client.initialize();
</div>
</div>
</section>
<section>
<div class="symbol-index-content">
<h2 id="Payment">Payment</h2>
<div class="symbol-index-section">
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name">
<a href="Payment.html#id" class="!symbol-index-name">Payment#<wbr>id</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="Payment.html#paymentAmount1000" class="!symbol-index-name">Payment#<wbr>paymentAmount1000</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="Payment.html#paymentCurrency" class="!symbol-index-name">Payment#<wbr>paymentCurrency</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name">
<a href="Payment.html#paymentMessageReceiverJid" class="!symbol-index-name">Payment#<wbr>paymentMessageReceiverJid</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="Payment.html#paymentNote" class="!symbol-index-name">Payment#<wbr>paymentNote</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="Payment.html#paymentStatus" class="!symbol-index-name">Payment#<wbr>paymentStatus</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name">
<a href="Payment.html#paymentTransactionTimestamp" class="!symbol-index-name">Payment#<wbr>paymentTransactionTimestamp</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="Payment.html#paymentTxnStatus" class="!symbol-index-name">Payment#<wbr>paymentTxnStatus</a>
</dt>
<dd>
</dd>
</dl>
</div>
</div>
</div>
</section>
<section>
<div class="symbol-index-content">
<h2 id="PrivateChat">PrivateChat</h2>
@@ -2349,11 +2579,25 @@ client.initialize();
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="PrivateContact.html#getCountryCode" class="!symbol-index-name">PrivateContact#<wbr>getCountryCode()</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="PrivateContact.html#getFormattedNumber" class="!symbol-index-name">PrivateContact#<wbr>getFormattedNumber()</a>
</dt>
<dd>
</dd>
<dt class="symbol-index-name">
<a href="PrivateContact.html#getProfilePicUrl" class="!symbol-index-name">PrivateContact#<wbr>getProfilePicUrl()</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name">
<a href="PrivateContact.html#id" class="!symbol-index-name">PrivateContact#<wbr>id</a>
</dt>
@@ -2364,10 +2608,6 @@ client.initialize();
</dt>
<dd>
</dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name">
<a href="PrivateContact.html#isBusiness" class="!symbol-index-name">PrivateContact#<wbr>isBusiness</a>
</dt>
@@ -2393,6 +2633,10 @@ client.initialize();
</dt>
<dd>
</dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name">
<a href="PrivateContact.html#isUser" class="!symbol-index-name">PrivateContact#<wbr>isUser</a>
</dt>
@@ -2403,10 +2647,6 @@ client.initialize();
</dt>
<dd>
</dd>
</dl>
</div>
<div class="symbol-index-column">
<dl class="symbol-index-list">
<dt class="symbol-index-name">
<a href="PrivateContact.html#name" class="!symbol-index-name">PrivateContact#<wbr>name</a>
</dt>
@@ -2701,7 +2941,7 @@ client.initialize();
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on September 1, 2021.
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on January 25, 2022.
</p>
</div>
</footer>

View File

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

View File

@@ -4,7 +4,7 @@
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.14.1 &raquo; Source: structures/Base.js</title>
<title>whatsapp-web.js 1.15.4 &raquo; Source: structures/Base.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" 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">
<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>14.<wbr>1</a>
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>4</a>
</div>
</div>
</nav>
@@ -60,7 +60,7 @@ module.exports &#x3D; Base;</code></pre>
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on September 1, 2021.
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on January 25, 2022.
</p>
</div>
</footer>

View File

@@ -4,7 +4,7 @@
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.14.1 &raquo; Source: structures/BusinessContact.js</title>
<title>whatsapp-web.js 1.15.4 &raquo; Source: structures/BusinessContact.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" 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">
<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>14.<wbr>1</a>
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>4</a>
</div>
</div>
</nav>
@@ -59,7 +59,7 @@ module.exports &#x3D; BusinessContact;</code></pre>
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on September 1, 2021.
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on January 25, 2022.
</p>
</div>
</footer>

View File

@@ -0,0 +1,121 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.15.4 &raquo; Source: structures/Buttons.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
<link href="css/baseline.css" rel="stylesheet">
</head>
<body onload="prettyPrint()">
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>4</a>
</div>
</div>
</nav>
<div id="jsdoc-body-container">
<div id="jsdoc-content">
<div id="jsdoc-content-container">
<div id="jsdoc-banner" role="banner">
</div>
<div id="jsdoc-main" role="main">
<header class="page-header">
<h1>Source: structures/Buttons.js</h1>
</header>
<article>
<pre class="prettyprint linenums"><code>&#x27;use strict&#x27;;
const MessageMedia &#x3D; require(&#x27;./MessageMedia&#x27;);
const Util &#x3D; require(&#x27;../util/Util&#x27;);
/**
* Message type buttons
*/
class Buttons {
/**
* @param {string|MessageMedia} body
* @param {Array&amp;lt;Array&amp;lt;string&gt;&gt;} buttons
* @param {string?} title
* @param {string?} footer
*/
constructor(body, buttons, title, footer) {
/**
* Message body
* @type {string|MessageMedia}
*/
this.body &#x3D; body;
/**
* title of message
* @type {string}
*/
this.title &#x3D; title;
/**
* footer of message
* @type {string}
*/
this.footer &#x3D; footer;
if (body instanceof MessageMedia) {
this.type &#x3D; &#x27;media&#x27;;
this.title &#x3D; &#x27;&#x27;;
}else{
this.type &#x3D; &#x27;chat&#x27;;
}
/**
* buttons of message
* @type {Array&amp;lt;Array&amp;lt;string&gt;&gt;}
*/
this.buttons &#x3D; this._format(buttons);
if(!this.buttons.length){ throw &#x27;[BT01] No buttons&#x27;;}
}
/**
* Creates button array from simple array
* @param {Array&amp;lt;Array&amp;lt;string&gt;&gt;} buttons
* @returns {Array&amp;lt;Array&amp;lt;string&gt;&gt;}
* @example
* Input: [{id:&#x27;customId&#x27;,body:&#x27;button1&#x27;},{body:&#x27;button2&#x27;},{body:&#x27;button3&#x27;},{body:&#x27;button4&#x27;}]
* Returns: [{ buttonId:&#x27;customId&#x27;,buttonText:{&#x27;displayText&#x27;:&#x27;button1&#x27;},type: 1 },{buttonId:&#x27;n3XKsL&#x27;,buttonText:{&#x27;displayText&#x27;:&#x27;button2&#x27;},type:1},{buttonId:&#x27;NDJk0a&#x27;,buttonText:{&#x27;displayText&#x27;:&#x27;button3&#x27;},type:1}]
*/
_format(buttons){
buttons &#x3D; buttons.slice(0,3); // phone users can only see 3 buttons, so lets limit this
return buttons.map((btn) &#x3D;&gt; {
return {&#x27;buttonId&#x27;:btn.id ? String(btn.id) : Util.generateHash(6),&#x27;buttonText&#x27;:{&#x27;displayText&#x27;:btn.body},&#x27;type&#x27;:1};
});
}
}
module.exports &#x3D; Buttons;</code></pre>
</article>
</div>
</div>
<nav id="jsdoc-toc-nav" role="navigation"></nav>
</div>
</div>
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on January 25, 2022.
</p>
</div>
</footer>
<script src="scripts/jquery.min.js"></script>
<script src="scripts/tree.jquery.js"></script>
<script src="scripts/prettify.js"></script>
<script src="scripts/jsdoc-toc.js"></script>
<script src="scripts/linenumber.js"></script>
<script src="scripts/scrollanchor.js"></script>
</body>
</html>

View File

@@ -4,7 +4,7 @@
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.14.1 &raquo; Source: structures/Call.js</title>
<title>whatsapp-web.js 1.15.4 &raquo; Source: structures/Call.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<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>14.<wbr>1</a>
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>4</a>
</div>
</div>
</nav>
@@ -106,7 +106,7 @@ module.exports &#x3D; Call;</code></pre>
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on September 1, 2021.
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on January 25, 2022.
</p>
</div>
</footer>

View File

@@ -4,7 +4,7 @@
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.14.1 &raquo; Source: structures/Chat.js</title>
<title>whatsapp-web.js 1.15.4 &raquo; Source: structures/Chat.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" 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">
<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>14.<wbr>1</a>
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>4</a>
</div>
</div>
</nav>
@@ -178,8 +178,8 @@ class Chat extends Base {
}
/**
* Mutes this chat until a specified date
* @param {Date} unmuteDate Date at which the Chat will be unmuted
* Mutes this chat forever, unless a date is specified
* @param {?Date} unmuteDate Date at which the Chat will be unmuted, leave as is to mute forever
*/
async mute(unmuteDate) {
return this.client.muteChat(this.id._serialized, unmuteDate);
@@ -288,7 +288,7 @@ module.exports &#x3D; Chat;
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on September 1, 2021.
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on January 25, 2022.
</p>
</div>
</footer>

View File

@@ -4,7 +4,7 @@
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.14.1 &raquo; Source: structures/ClientInfo.js</title>
<title>whatsapp-web.js 1.15.4 &raquo; Source: structures/ClientInfo.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" 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">
<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>14.<wbr>1</a>
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>4</a>
</div>
</div>
</nav>
@@ -108,7 +108,7 @@ module.exports &#x3D; ClientInfo;</code></pre>
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on September 1, 2021.
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on January 25, 2022.
</p>
</div>
</footer>

View File

@@ -4,7 +4,7 @@
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.14.1 &raquo; Source: structures/Contact.js</title>
<title>whatsapp-web.js 1.15.4 &raquo; Source: structures/Contact.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" 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">
<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>14.<wbr>1</a>
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>4</a>
</div>
</div>
</nav>
@@ -139,7 +139,7 @@ class Contact extends Base {
* @type {boolean}
*/
this.isBlocked &#x3D; data.isBlocked;
return super._patch(data);
}
@@ -151,6 +151,22 @@ class Contact extends Base {
return await this.client.getProfilePicUrl(this.id._serialized);
}
/**
* Returns the contact&#x27;s formatted phone number, (12345678901@c.us) &#x3D;&gt; (+1 (234) 5678-901)
* @returns {Promise&amp;lt;string&gt;}
*/
async getFormattedNumber() {
return await this.client.getFormattedNumber(this.id._serialized);
}
/**
* Returns the contact&#x27;s countrycode, (1541859685@c.us) &#x3D;&gt; (1)
* @returns {Promise&amp;lt;string&gt;}
*/
async getCountryCode() {
return await this.client.getCountryCode(this.id._serialized);
}
/**
* Returns the Chat that corresponds to this Contact.
* Will return null when getting chat for currently logged in user.
@@ -209,7 +225,8 @@ class Contact extends Base {
}
module.exports &#x3D; Contact;</code></pre>
module.exports &#x3D; Contact;
</code></pre>
</article>
</div>
</div>
@@ -219,7 +236,7 @@ module.exports &#x3D; Contact;</code></pre>
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on September 1, 2021.
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on January 25, 2022.
</p>
</div>
</footer>

View File

@@ -4,7 +4,7 @@
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.14.1 &raquo; Source: structures/GroupChat.js</title>
<title>whatsapp-web.js 1.15.4 &raquo; Source: structures/GroupChat.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" 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">
<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>14.<wbr>1</a>
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>4</a>
</div>
</div>
</nav>
@@ -239,7 +239,7 @@ module.exports &#x3D; GroupChat;</code></pre>
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on September 1, 2021.
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on January 25, 2022.
</p>
</div>
</footer>

View File

@@ -4,7 +4,7 @@
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.14.1 &raquo; Source: structures/GroupNotification.js</title>
<title>whatsapp-web.js 1.15.4 &raquo; Source: structures/GroupNotification.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" 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">
<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>14.<wbr>1</a>
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>4</a>
</div>
</div>
</nav>
@@ -74,7 +74,7 @@ class GroupNotification extends Base {
*
* @type {string}
*/
this.chatId &#x3D; typeof (data.from) &#x3D;&#x3D;&#x3D; &#x27;object&#x27; ? data.from._serialized : data.from;
this.chatId &#x3D; typeof (data.to) &#x3D;&#x3D;&#x3D; &#x27;object&#x27; ? data.to._serialized : data.to;
/**
* ContactId for the user that produced the GroupNotification.
@@ -143,7 +143,7 @@ module.exports &#x3D; GroupNotification;
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on September 1, 2021.
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on January 25, 2022.
</p>
</div>
</footer>

View File

@@ -4,7 +4,7 @@
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.14.1 &raquo; Source: structures/Label.js</title>
<title>whatsapp-web.js 1.15.4 &raquo; Source: structures/Label.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<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>14.<wbr>1</a>
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>4</a>
</div>
</div>
</nav>
@@ -88,7 +88,7 @@ module.exports &#x3D; Label;</code></pre>
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on September 1, 2021.
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on January 25, 2022.
</p>
</div>
</footer>

View File

@@ -0,0 +1,133 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.15.4 &raquo; Source: structures/List.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
<link href="css/baseline.css" rel="stylesheet">
</head>
<body onload="prettyPrint()">
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>4</a>
</div>
</div>
</nav>
<div id="jsdoc-body-container">
<div id="jsdoc-content">
<div id="jsdoc-content-container">
<div id="jsdoc-banner" role="banner">
</div>
<div id="jsdoc-main" role="main">
<header class="page-header">
<h1>Source: structures/List.js</h1>
</header>
<article>
<pre class="prettyprint linenums"><code>&#x27;use strict&#x27;;
const Util &#x3D; require(&#x27;../util/Util&#x27;);
/**
* Message type List
*/
class List {
/**
* @param {string} body
* @param {string} buttonText
* @param {Array&amp;lt;any&gt;} sections
* @param {string?} title
* @param {string?} footer
*/
constructor(body, buttonText, sections, title, footer) {
/**
* Message body
* @type {string}
*/
this.description &#x3D; body;
/**
* List button text
* @type {string}
*/
this.buttonText &#x3D; buttonText;
/**
* title of message
* @type {string}
*/
this.title &#x3D; title;
/**
* footer of message
* @type {string}
*/
this.footer &#x3D; footer;
/**
* sections of message
* @type {Array&amp;lt;any&gt;}
*/
this.sections &#x3D; this._format(sections);
}
/**
* Creates section array from simple array
* @param {Array&amp;lt;any&gt;} sections
* @returns {Array&amp;lt;any&gt;}
* @example
* Input: [{title:&#x27;sectionTitle&#x27;,rows:[{id:&#x27;customId&#x27;, title:&#x27;ListItem2&#x27;, description: &#x27;desc&#x27;},{title:&#x27;ListItem2&#x27;}]}}]
* Returns: [{&#x27;title&#x27;:&#x27;sectionTitle&#x27;,&#x27;rows&#x27;:[{&#x27;rowId&#x27;:&#x27;customId&#x27;,&#x27;title&#x27;:&#x27;ListItem1&#x27;,&#x27;description&#x27;:&#x27;desc&#x27;},{&#x27;rowId&#x27;:&#x27;oGSRoD&#x27;,&#x27;title&#x27;:&#x27;ListItem2&#x27;,&#x27;description&#x27;:&#x27;&#x27;}]}]
*/
_format(sections){
if(!sections.length){throw &#x27;[LT02] List without sections&#x27;;}
if(sections.length &gt; 1 &amp;amp;&amp;amp; sections.filter(s &#x3D;&gt; typeof s.title &#x3D;&#x3D; &#x27;undefined&#x27;).length &gt; 1){throw &#x27;[LT05] You can\&#x27;t have more than one empty title.&#x27;;}
return sections.map( (section) &#x3D;&gt;{
if(!section.rows.length){throw &#x27;[LT03] Section without rows&#x27;;}
return {
title: section.title ? section.title : undefined,
rows: section.rows.map( (row) &#x3D;&gt; {
if(!row.title){throw &#x27;[LT04] Row without title&#x27;;}
return {
rowId: row.id ? row.id : Util.generateHash(6),
title: row.title,
description: row.description ? row.description : &#x27;&#x27;
};
})
};
});
}
}
module.exports &#x3D; List;
</code></pre>
</article>
</div>
</div>
<nav id="jsdoc-toc-nav" role="navigation"></nav>
</div>
</div>
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on January 25, 2022.
</p>
</div>
</footer>
<script src="scripts/jquery.min.js"></script>
<script src="scripts/tree.jquery.js"></script>
<script src="scripts/prettify.js"></script>
<script src="scripts/jsdoc-toc.js"></script>
<script src="scripts/linenumber.js"></script>
<script src="scripts/scrollanchor.js"></script>
</body>
</html>

View File

@@ -4,7 +4,7 @@
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.14.1 &raquo; Source: structures/Location.js</title>
<title>whatsapp-web.js 1.15.4 &raquo; Source: structures/Location.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" 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">
<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>14.<wbr>1</a>
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>4</a>
</div>
</div>
</nav>
@@ -71,7 +71,7 @@ module.exports &#x3D; Location;</code></pre>
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on September 1, 2021.
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on January 25, 2022.
</p>
</div>
</footer>

View File

@@ -4,7 +4,7 @@
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.14.1 &raquo; Source: structures/Message.js</title>
<title>whatsapp-web.js 1.15.4 &raquo; Source: structures/Message.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" 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">
<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>14.<wbr>1</a>
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>4</a>
</div>
</div>
</nav>
@@ -35,6 +35,7 @@ const Base &#x3D; require(&#x27;./Base&#x27;);
const MessageMedia &#x3D; require(&#x27;./MessageMedia&#x27;);
const Location &#x3D; require(&#x27;./Location&#x27;);
const Order &#x3D; require(&#x27;./Order&#x27;);
const Payment &#x3D; require(&#x27;./Payment&#x27;);
const { MessageTypes } &#x3D; require(&#x27;../util/Constants&#x27;);
/**
@@ -209,6 +210,12 @@ class Message extends Base {
*/
this.token &#x3D; data.token ? data.token : undefined;
/**
* Indicates whether the message is a Gif
* @type {boolean}
*/
this.isGif &#x3D; Boolean(data.isGif);
/** Title */
if (data.title) {
this.title &#x3D; data.title;
@@ -236,6 +243,21 @@ class Message extends Base {
*/
this.links &#x3D; data.links;
/** Buttons */
if (data.dynamicReplyButtons) {
this.dynamicReplyButtons &#x3D; data.dynamicReplyButtons;
}
/** Selected Button Id **/
if (data.selectedButtonId) {
this.selectedButtonId &#x3D; data.selectedButtonId;
}
/** Selected List row Id **/
if (data.listResponse &amp;amp;&amp;amp; data.listResponse.singleSelectReply.selectedRowId) {
this.selectedRowId &#x3D; data.listResponse.singleSelectReply.selectedRowId;
}
return super._patch(data);
}
@@ -469,6 +491,21 @@ class Message extends Base {
}
return undefined;
}
/**
* Gets the payment details associated with a given message
* @return {Promise&amp;lt;Payment&gt;}
*/
async getPayment() {
if (this.type &#x3D;&#x3D;&#x3D; MessageTypes.PAYMENT) {
const msg &#x3D; await this.client.pupPage.evaluate(async (msgId) &#x3D;&gt; {
const msg &#x3D; window.Store.Msg.get(msgId);
if(!msg) return null;
return msg.serialize();
}, this.id._serialized);
return new Payment(this.client, msg);
}
return undefined;
}
}
module.exports &#x3D; Message;
@@ -482,7 +519,7 @@ module.exports &#x3D; Message;
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on September 1, 2021.
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on January 25, 2022.
</p>
</div>
</footer>

View File

@@ -4,7 +4,7 @@
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.14.1 &raquo; Source: structures/MessageMedia.js</title>
<title>whatsapp-web.js 1.15.4 &raquo; Source: structures/MessageMedia.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" 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">
<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>14.<wbr>1</a>
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>4</a>
</div>
</div>
</nav>
@@ -81,29 +81,29 @@ class MessageMedia {
* Creates a MessageMedia instance from a URL
* @param {string} url
* @param {Object} [options]
* @param {number} [options.unsafeMime&#x3D;false]
* @param {boolean} [options.unsafeMime&#x3D;false]
* @param {string} [options.filename]
* @param {object} [options.client]
* @param {object} [options.reqOptions]
* @param {number} [options.reqOptions.size&#x3D;0]
* @returns {Promise&amp;lt;MessageMedia&gt;}
*/
static async fromUrl(url, options &#x3D; {}) {
let mimetype;
const pUrl &#x3D; new URL(url);
let mimetype &#x3D; mime.getType(pUrl.pathname);
if (!options.unsafeMime) {
const pUrl &#x3D; new URL(url);
mimetype &#x3D; mime.getType(pUrl.pathname);
if (!mimetype)
throw new Error(&#x27;Unable to determine MIME type&#x27;);
}
if (!mimetype &amp;amp;&amp;amp; !options.unsafeMime)
throw new Error(&#x27;Unable to determine MIME type using URL. Set unsafeMime to true to download it anyway.&#x27;);
async function fetchData (url, options) {
const reqOptions &#x3D; Object.assign({ headers: { accept: &#x27;image/* video/* text/* audio/*&#x27; } }, options);
const response &#x3D; await fetch(url, reqOptions);
const mime &#x3D; response.headers.get(&#x27;Content-Type&#x27;);
let data &#x3D; &#x27;&#x27;;
const contentDisposition &#x3D; response.headers.get(&#x27;Content-Disposition&#x27;);
const name &#x3D; contentDisposition ? contentDisposition.match(/((?&amp;lt;&#x3D;filename&#x3D;&quot;)(.*)(?&#x3D;&quot;))/) : null;
let data &#x3D; &#x27;&#x27;;
if (response.buffer) {
data &#x3D; (await response.buffer()).toString(&#x27;base64&#x27;);
} else {
@@ -114,21 +114,25 @@ class MessageMedia {
data &#x3D; btoa(data);
}
return { data, mime };
return { data, mime, name };
}
const res &#x3D; options.client
? (await options.client.pupPage.evaluate(fetchData, url, options.reqOptions))
: (await fetchData(url, options.reqOptions));
const filename &#x3D; options.filename ||
(res.name ? res.name[0] : (pUrl.pathname.split(&#x27;/&#x27;).pop() || &#x27;file&#x27;));
if (!mimetype)
mimetype &#x3D; res.mime;
return new MessageMedia(mimetype, res.data, null);
return new MessageMedia(mimetype, res.data, filename);
}
}
module.exports &#x3D; MessageMedia;</code></pre>
module.exports &#x3D; MessageMedia;
</code></pre>
</article>
</div>
</div>
@@ -138,7 +142,7 @@ module.exports &#x3D; MessageMedia;</code></pre>
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on September 1, 2021.
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on January 25, 2022.
</p>
</div>
</footer>

View File

@@ -4,7 +4,7 @@
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.14.1 &raquo; Source: structures/Order.js</title>
<title>whatsapp-web.js 1.15.4 &raquo; Source: structures/Order.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<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>14.<wbr>1</a>
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>4</a>
</div>
</div>
</nav>
@@ -90,7 +90,7 @@ module.exports &#x3D; Order;</code></pre>
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on September 1, 2021.
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on January 25, 2022.
</p>
</div>
</footer>

View File

@@ -0,0 +1,133 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.15.4 &raquo; Source: structures/Payment.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
<link href="css/baseline.css" rel="stylesheet">
</head>
<body onload="prettyPrint()">
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
<div id="jsdoc-navbar-container">
<div id="jsdoc-navbar-content">
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>4</a>
</div>
</div>
</nav>
<div id="jsdoc-body-container">
<div id="jsdoc-content">
<div id="jsdoc-content-container">
<div id="jsdoc-banner" role="banner">
</div>
<div id="jsdoc-main" role="main">
<header class="page-header">
<h1>Source: structures/Payment.js</h1>
</header>
<article>
<pre class="prettyprint linenums"><code>const Base &#x3D; require(&#x27;./Base&#x27;);
class Payment extends Base {
constructor(client, data) {
super(client);
if (data) this._patch(data);
}
_patch(data) {
/**
* The payment Id
* @type {object}
*/
this.id &#x3D; data.id;
/**
* The payment currency
* @type {string}
*/
this.paymentCurrency &#x3D; data.paymentCurrency;
/**
* The payment ammount ( R$ 1.00 &#x3D; 1000 )
* @type {number}
*/
this.paymentAmount1000 &#x3D; data.paymentAmount1000;
/**
* The payment receiver
* @type {object}
*/
this.paymentMessageReceiverJid &#x3D; data.paymentMessageReceiverJid;
/**
* The payment transaction timestamp
* @type {number}
*/
this.paymentTransactionTimestamp &#x3D; data.paymentTransactionTimestamp;
/**
* The paymentStatus
*
* Possible Status
* 0:UNKNOWN_STATUS
* 1:PROCESSING
* 2:SENT
* 3:NEED_TO_ACCEPT
* 4:COMPLETE
* 5:COULD_NOT_COMPLETE
* 6:REFUNDED
* 7:EXPIRED
* 8:REJECTED
* 9:CANCELLED
* 10:WAITING_FOR_PAYER
* 11:WAITING
*
* @type {number}
*/
this.paymentStatus &#x3D; data.paymentStatus;
/**
* Integer that represents the payment Text
* @type {number}
*/
this.paymentTxnStatus &#x3D; data.paymentTxnStatus;
/**
* The note sent with the payment
* @type {string}
*/
this.paymentNote &#x3D; !data.paymentNoteMsg ? undefined : data.paymentNoteMsg.body ? data.paymentNoteMsg.body : undefined ;
return super._patch(data);
}
}
module.exports &#x3D; Payment;
</code></pre>
</article>
</div>
</div>
<nav id="jsdoc-toc-nav" role="navigation"></nav>
</div>
</div>
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on January 25, 2022.
</p>
</div>
</footer>
<script src="scripts/jquery.min.js"></script>
<script src="scripts/tree.jquery.js"></script>
<script src="scripts/prettify.js"></script>
<script src="scripts/jsdoc-toc.js"></script>
<script src="scripts/linenumber.js"></script>
<script src="scripts/scrollanchor.js"></script>
</body>
</html>

View File

@@ -4,7 +4,7 @@
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.14.1 &raquo; Source: structures/PrivateChat.js</title>
<title>whatsapp-web.js 1.15.4 &raquo; Source: structures/PrivateChat.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" 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">
<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>14.<wbr>1</a>
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>4</a>
</div>
</div>
</nav>
@@ -51,7 +51,7 @@ module.exports &#x3D; PrivateChat;</code></pre>
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on September 1, 2021.
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on January 25, 2022.
</p>
</div>
</footer>

View File

@@ -4,7 +4,7 @@
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.14.1 &raquo; Source: structures/PrivateContact.js</title>
<title>whatsapp-web.js 1.15.4 &raquo; Source: structures/PrivateContact.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" 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">
<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>14.<wbr>1</a>
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>4</a>
</div>
</div>
</nav>
@@ -51,7 +51,7 @@ module.exports &#x3D; PrivateContact;</code></pre>
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on September 1, 2021.
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on January 25, 2022.
</p>
</div>
</footer>

View File

@@ -4,7 +4,7 @@
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.14.1 &raquo; Source: structures/Product.js</title>
<title>whatsapp-web.js 1.15.4 &raquo; Source: structures/Product.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<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>14.<wbr>1</a>
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>4</a>
</div>
</div>
</nav>
@@ -106,7 +106,7 @@ module.exports &#x3D; Product;</code></pre>
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on September 1, 2021.
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on January 25, 2022.
</p>
</div>
</footer>

View File

@@ -4,7 +4,7 @@
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.14.1 &raquo; Source: structures/ProductMetadata.js</title>
<title>whatsapp-web.js 1.15.4 &raquo; Source: structures/ProductMetadata.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<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>14.<wbr>1</a>
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>4</a>
</div>
</div>
</nav>
@@ -63,7 +63,7 @@ module.exports &#x3D; ProductMetadata;</code></pre>
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on September 1, 2021.
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on January 25, 2022.
</p>
</div>
</footer>

View File

@@ -4,7 +4,7 @@
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.14.1 &raquo; Source: util/Constants.js</title>
<title>whatsapp-web.js 1.15.4 &raquo; Source: util/Constants.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" 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">
<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>14.<wbr>1</a>
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>4</a>
</div>
</div>
</nav>
@@ -42,6 +42,7 @@ exports.DefaultOptions &#x3D; {
qrTimeoutMs: 45000,
qrRefreshIntervalMs: 20000,
authTimeoutMs: 45000,
qrMaxRetries: 0,
takeoverOnConflict: false,
takeoverTimeoutMs: 0,
userAgent: &#x27;Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.109 Safari/537.36&#x27;,
@@ -105,7 +106,10 @@ exports.MessageTypes &#x3D; {
REVOKED: &#x27;revoked&#x27;,
PRODUCT: &#x27;product&#x27;,
UNKNOWN: &#x27;unknown&#x27;,
GROUP_INVITE: &#x27;groups_v4_invite&#x27;
GROUP_INVITE: &#x27;groups_v4_invite&#x27;,
LIST: &#x27;list&#x27;,
BUTTONS_RESPONSE: &#x27;buttons_response&#x27;,
PAYMENT: &#x27;payment&#x27;
};
/**
@@ -179,7 +183,7 @@ exports.MessageAck &#x3D; {
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on September 1, 2021.
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on January 25, 2022.
</p>
</div>
</footer>

View File

@@ -4,7 +4,7 @@
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.14.1 &raquo; Source: util/InterfaceController.js</title>
<title>whatsapp-web.js 1.15.4 &raquo; Source: util/InterfaceController.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
@@ -15,7 +15,7 @@
<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>14.<wbr>1</a>
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>4</a>
</div>
</div>
</nav>
@@ -59,7 +59,7 @@ class InterfaceController {
async openChatDrawer(chatId) {
await this.pupPage.evaluate(async chatId &#x3D;&gt; {
let chat &#x3D; await window.Store.Chat.get(chatId);
await window.Store.Cmd.chatInfoDrawer(chat);
await window.Store.Cmd.openDrawerMid(chat);
}, chatId);
}
@@ -160,7 +160,7 @@ module.exports &#x3D; InterfaceController;
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on September 1, 2021.
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on January 25, 2022.
</p>
</div>
</footer>

View File

@@ -4,7 +4,7 @@
<head>
<meta name="generator" content="JSDoc 3.6.7">
<meta charset="utf-8">
<title>whatsapp-web.js 1.14.1 &raquo; Source: util/Util.js</title>
<title>whatsapp-web.js 1.15.4 &raquo; Source: util/Util.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" 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">
<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>14.<wbr>1</a>
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>15.<wbr>4</a>
</div>
</div>
</nav>
@@ -242,7 +242,7 @@ module.exports &#x3D; Util;
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on September 1, 2021.
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on January 25, 2022.
</p>
</div>
</footer>

40
index.d.ts vendored
View File

@@ -1,7 +1,7 @@
import { EventEmitter } from 'events'
import { RequestInit } from 'node-fetch'
import puppeteer = require('puppeteer')
import puppeteer from 'puppeteer'
declare namespace WAWebJS {
@@ -48,6 +48,9 @@ declare namespace WAWebJS {
/** Logs out the client, closing the current session */
logout(): Promise<void>
/** Get all blocked contacts by host account */
getBlockedContacts(): Promise<Contact[]>
/** Get chat instance by ID */
getChatById(chatId: string): Promise<Chat>
@@ -59,6 +62,12 @@ declare namespace WAWebJS {
/** Get all current contact instances */
getContacts(): Promise<Contact[]>
/** Get the country code of a WhatsApp ID. (154185968@c.us) => (1) */
getCountryCode(number: string): Promise<string>
/** Get the formatted number of a WhatsApp ID. (12345678901@c.us) => (+1 (234) 5678-901) */
getFormattedNumber(number: string): Promise<string>
/** Get all current Labels */
getLabels(): Promise<Label[]>
@@ -91,11 +100,11 @@ declare namespace WAWebJS {
getNumberId(number: string): Promise<ContactId | null>
/**
* Mutes the Chat until a specified date
* Mutes this chat forever, unless a date is specified
* @param chatId ID of the chat that will be muted
* @param unmuteDate Date when the chat will be unmuted
* @param unmuteDate Date when the chat will be unmuted, leave as is to mute forever
*/
muteChat(chatId: string, unmuteDate: Date): Promise<void>
muteChat(chatId: string, unmuteDate?: Date): Promise<void>
/** Force reset of connection state for the client */
resetState(): Promise<void>
@@ -278,13 +287,16 @@ declare namespace WAWebJS {
* @default 45000 */
authTimeoutMs?: number,
/** Puppeteer launch options. View docs here: https://github.com/puppeteer/puppeteer/ */
puppeteer?: puppeteer.LaunchOptions
puppeteer?: puppeteer.LaunchOptions & puppeteer.BrowserLaunchArgumentOptions & puppeteer.BrowserConnectOptions
/** Refresh interval for qr code (how much time to wait before checking if the qr code has changed)
* @default 20000 */
qrRefreshIntervalMs?: number
/** Timeout for qr code selector in puppeteer
* @default 45000 */
qrTimeoutMs?: number,
/** How many times should the qrcode be refreshed before giving up
* @default 0 (disabled) */
qrMaxRetries?: number,
/** Restart client with a new session (i.e. use null 'session' var) if authentication fails
* @default false */
restartOnAuthFail?: boolean
@@ -513,6 +525,8 @@ declare namespace WAWebJS {
broadcast: boolean,
/** Indicates if the message was a status update */
isStatus: boolean,
/** Indicates if the message is a Gif */
isGif: boolean,
/** ID for the Chat that this message was sent to, except if the message was sent by the current user */
from: string,
/** Indicates if the message was sent by the current user */
@@ -678,6 +692,7 @@ declare namespace WAWebJS {
export interface MediaFromURLOptions {
client?: Client
filename?: string
unsafeMime?: boolean
reqOptions?: RequestInit
}
@@ -705,7 +720,7 @@ declare namespace WAWebJS {
static fromUrl: (url: string, options?: MediaFromURLOptions) => Promise<MessageMedia>
}
export type MessageContent = string | MessageMedia | Location | Contact | Contact[]
export type MessageContent = string | MessageMedia | Location | Contact | Contact[] | List | Buttons
/**
* Represents a Contact on WhatsApp
@@ -783,9 +798,16 @@ declare namespace WAWebJS {
* Will return null when getting chat for currently logged in user.
*/
getChat: () => Promise<Chat>,
/** Returns the contact's countrycode, (1541859685@c.us) => (1) */
getCountryCode(): Promise<string>,
/** Returns the contact's formatted phone number, (12345678901@c.us) => (+1 (234) 5678-901) */
getFormattedNumber(): Promise<string>,
/** Blocks this contact from WhatsApp */
block: () => Promise<boolean>,
/** Unlocks this contact from WhatsApp */
unblock: () => Promise<boolean>,
@@ -864,8 +886,8 @@ declare namespace WAWebJS {
delete: () => Promise<boolean>,
/** Loads chat messages, sorted from earliest to latest. */
fetchMessages: (searchOptions: MessageSearchOptions) => Promise<Message[]>,
/** Mutes this chat until a specified date */
mute: (unmuteDate: Date) => Promise<void>,
/** Mutes this chat forever, unless a date is specified */
mute: (unmuteDate?: Date) => Promise<void>,
/** Send a message to this chat */
sendMessage: (content: MessageContent, options?: MessageSendOptions) => Promise<Message>,
/** Set the message as seen */

View File

@@ -1,6 +1,6 @@
{
"name": "whatsapp-web.js",
"version": "1.14.1",
"version": "1.15.4",
"description": "Library for interacting with the WhatsApp Web API ",
"main": "./index.js",
"typings": "./index.d.ts",
@@ -26,26 +26,27 @@
"bugs": {
"url": "https://github.com/pedroslopez/whatsapp-web.js/issues"
},
"homepage": "https://guide.wwebjs.dev/",
"homepage": "https://wwebjs.dev/",
"dependencies": {
"@pedroslopez/moduleraid": "^5.0.2",
"fluent-ffmpeg": "^2.1.2",
"jsqr": "^1.3.1",
"mime": "^2.4.5",
"mime": "^3.0.0",
"node-fetch": "^2.6.5",
"node-webpmux": "^3.1.0",
"puppeteer": "^10.1.0",
"puppeteer": "^13.0.0",
"sharp": "^0.28.3"
},
"devDependencies": {
"@types/node-fetch": "^2.5.11",
"@types/node-fetch": "^2.5.12",
"chai": "^4.3.4",
"dotenv": "^10.0.0",
"eslint": "^7.27.0",
"eslint": "^8.4.1",
"eslint-plugin-mocha": "^9.0.0",
"jsdoc": "^3.6.4",
"jsdoc-baseline": "^0.1.5",
"mocha": "^9.0.2",
"sinon": "^11.1.1"
"sinon": "^12.0.1"
},
"engines": {
"node": ">=12.0.0"

View File

@@ -20,6 +20,7 @@ const { ClientInfo, Message, MessageMedia, Contact, Location, GroupNotification
* @param {object} options.puppeteer - Puppeteer launch options. View docs here: https://github.com/puppeteer/puppeteer/
* @param {number} options.qrRefreshIntervalMs - Refresh interval for qr code (how much time to wait before checking if the qr code has changed)
* @param {number} options.qrTimeoutMs - Timeout for qr code selector in puppeteer
* @param {number} options.qrMaxRetries - How many times should the qrcode be refreshed before giving up
* @param {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
@@ -80,6 +81,11 @@ class Client extends EventEmitter {
this.pupBrowser = browser;
this.pupPage = page;
// remember me
await page.evaluateOnNewDocument(() => {
localStorage.setItem('remember-me', 'true');
});
if (this.options.session) {
await page.evaluateOnNewDocument(
session => {
@@ -100,7 +106,7 @@ class Client extends EventEmitter {
timeout: 0,
});
const KEEP_PHONE_CONNECTED_IMG_SELECTOR = '[data-asset-intro-image-light="true"], [data-asset-intro-image-dark="true"]';
const KEEP_PHONE_CONNECTED_IMG_SELECTOR = '[data-icon="intro-md-beta-logo-dark"], [data-icon="intro-md-beta-logo-light"], [data-asset-intro-image-light="true"], [data-asset-intro-image-dark="true"]';
if (this.options.session) {
// Check if session restore was successfull
@@ -127,6 +133,8 @@ class Client extends EventEmitter {
}
} else {
let qrRetries = 0;
const getQrCode = async () => {
// Check if retry button is present
var QR_RETRY_SELECTOR = 'div[data-ref] > span > button';
@@ -147,6 +155,14 @@ class Client extends EventEmitter {
* @param {string} qr QR Code
*/
this.emit(Events.QR_RECEIVED, qr);
if (this.options.qrMaxRetries > 0) {
qrRetries++;
if (qrRetries > this.options.qrMaxRetries) {
this.emit(Events.DISCONNECTED, 'Max qrcode retries reached');
await this.destroy();
}
}
};
getQrCode();
this._qrRefreshInterval = setInterval(getQrCode, this.options.qrRefreshIntervalMs);
@@ -159,7 +175,7 @@ class Client extends EventEmitter {
}
await page.evaluate(ExposeStore, moduleRaid.toString());
// Get session tokens
const localStorage = JSON.parse(await page.evaluate(() => {
return JSON.stringify(window.localStorage);
@@ -186,6 +202,14 @@ class Client extends EventEmitter {
// Check window.Store Injection
await page.waitForFunction('window.Store != undefined');
const isMD = await page.evaluate(() => {
return window.Store.Features.features.MD_BACKEND;
});
if(isMD) {
throw new Error('Multi-device is not yet supported by whatsapp-web.js. Please check out https://github.com/pedroslopez/whatsapp-web.js/pull/889 to follow the progress.');
}
//Load util functions (serializers, helper functions)
await page.evaluate(LoadUtils);
@@ -617,37 +641,6 @@ class Client extends EventEmitter {
return ContactFactory.create(this, contact);
}
async getMessageById(messageId) {
const msg = await this.pupPage.evaluate(async messageId => {
let msg = window.Store.Msg.get(messageId);
if(msg) return window.WWebJS.getMessageModel(msg);
const params = messageId.split('_');
if(params.length !== 3) throw new Error('Invalid serialized message id specified');
const [fromMe, chatId, id] = params;
const chatWid = window.Store.WidFactory.createWid(chatId);
const fullMsgId = {
fromMe: Boolean(fromMe),
remote: chatWid,
id,
};
const msgKey = new window.Store.MsgKey(fullMsgId);
const chat = await window.Store.Chat.find(msgKey.remote);
const ctx = await chat.getSearchContext(msgKey);
if(ctx.collection && ctx.collection.loadAroundPromise) {
await ctx.collection.loadAroundPromise;
}
msg = window.Store.Msg.get(messageId);
if(msg) return window.WWebJS.getMessageModel(msg);
}, messageId);
if(msg) return new Message(this, msg);
return null;
}
/**
* Returns an object with information about the invite code's group
* @param {string} inviteCode
@@ -788,15 +781,16 @@ class Client extends EventEmitter {
}
/**
* Mutes the Chat until a specified date
* Mutes this chat forever, unless a date is specified
* @param {string} chatId ID of the chat that will be muted
* @param {Date} unmuteDate Date when the chat will be unmuted
* @param {?Date} unmuteDate Date when the chat will be unmuted, leave as is to mute forever
*/
async muteChat(chatId, unmuteDate) {
unmuteDate = unmuteDate ? unmuteDate.getTime() / 1000 : -1;
await this.pupPage.evaluate(async (chatId, timestamp) => {
let chat = await window.Store.Chat.get(chatId);
await chat.mute.mute(timestamp, !0);
}, chatId, unmuteDate.getTime() / 1000);
}, chatId, unmuteDate || -1);
}
/**
@@ -862,10 +856,7 @@ class Client extends EventEmitter {
* @returns {Promise<Object|null>}
*/
async getNumberId(number) {
if(!number.endsWith('@c.us')) {
number += '@c.us';
}
if (!number.endsWith('@c.us')) number += '@c.us';
try {
return await this.pupPage.evaluate(async numberId => {
return window.WWebJS.getNumberId(numberId);
@@ -875,6 +866,33 @@ class Client extends EventEmitter {
}
}
/**
* Get the formatted number of a WhatsApp ID.
* @param {string} number Number or ID
* @returns {Promise<string>}
*/
async getFormattedNumber(number) {
if(!number.endsWith('@s.whatsapp.net')) number = number.replace('c.us', 's.whatsapp.net');
if(!number.includes('@s.whatsapp.net')) number = `${number}@s.whatsapp.net`;
return await this.pupPage.evaluate(async numberId => {
return window.Store.NumberInfo.formattedPhoneNumber(numberId);
}, number);
}
/**
* Get the country code of a WhatsApp ID.
* @param {string} number Number or ID
* @returns {Promise<string>}
*/
async getCountryCode(number) {
number = number.replace(' ', '').replace('+', '').replace('@c.us', '');
return await this.pupPage.evaluate(async numberId => {
return window.Store.NumberInfo.findCC(numberId);
}, number);
}
/**
* Create a new group
* @param {string} name group title
@@ -969,6 +987,19 @@ class Client extends EventEmitter {
return Promise.all(chatIds.map(id => this.getChatById(id)));
}
/**
* Gets all blocked contacts by host account
* @returns {Promise<Array<Contact>>}
*/
async getBlockedContacts() {
const blockedContacts = await this.pupPage.evaluate(() => {
let chatIds = window.Store.Blocklist.models.map(a => a.id._serialized);
return Promise.all(chatIds.map(id => window.WWebJS.getContact(id)));
});
return blockedContacts.map(contact => ContactFactory.create(this.client, contact));
}
}
module.exports = Client;

View File

@@ -59,7 +59,7 @@ class Buttons {
_format(buttons){
buttons = buttons.slice(0,3); // phone users can only see 3 buttons, so lets limit this
return buttons.map((btn) => {
return {'buttonId':btn.id ? btn.id : Util.generateHash(6),'buttonText':{'displayText':btn.body},'type':1};
return {'buttonId':btn.id ? String(btn.id) : Util.generateHash(6),'buttonText':{'displayText':btn.body},'type':1};
});
}

View File

@@ -147,8 +147,8 @@ class Chat extends Base {
}
/**
* Mutes this chat until a specified date
* @param {Date} unmuteDate Date at which the Chat will be unmuted
* Mutes this chat forever, unless a date is specified
* @param {?Date} unmuteDate Date at which the Chat will be unmuted, leave as is to mute forever
*/
async mute(unmuteDate) {
return this.client.muteChat(this.id._serialized, unmuteDate);

View File

@@ -108,7 +108,7 @@ class Contact extends Base {
* @type {boolean}
*/
this.isBlocked = data.isBlocked;
return super._patch(data);
}
@@ -120,6 +120,22 @@ class Contact extends Base {
return await this.client.getProfilePicUrl(this.id._serialized);
}
/**
* Returns the contact's formatted phone number, (12345678901@c.us) => (+1 (234) 5678-901)
* @returns {Promise<string>}
*/
async getFormattedNumber() {
return await this.client.getFormattedNumber(this.id._serialized);
}
/**
* Returns the contact's countrycode, (1541859685@c.us) => (1)
* @returns {Promise<string>}
*/
async getCountryCode() {
return await this.client.getCountryCode(this.id._serialized);
}
/**
* Returns the Chat that corresponds to this Contact.
* Will return null when getting chat for currently logged in user.
@@ -178,4 +194,4 @@ class Contact extends Base {
}
module.exports = Contact;
module.exports = Contact;

View File

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

View File

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

View File

@@ -179,6 +179,12 @@ class Message extends Base {
*/
this.token = data.token ? data.token : undefined;
/**
* Indicates whether the message is a Gif
* @type {boolean}
*/
this.isGif = Boolean(data.isGif);
/** Title */
if (data.title) {
this.title = data.title;

View File

@@ -50,29 +50,29 @@ class MessageMedia {
* Creates a MessageMedia instance from a URL
* @param {string} url
* @param {Object} [options]
* @param {number} [options.unsafeMime=false]
* @param {boolean} [options.unsafeMime=false]
* @param {string} [options.filename]
* @param {object} [options.client]
* @param {object} [options.reqOptions]
* @param {number} [options.reqOptions.size=0]
* @returns {Promise<MessageMedia>}
*/
static async fromUrl(url, options = {}) {
let mimetype;
const pUrl = new URL(url);
let mimetype = mime.getType(pUrl.pathname);
if (!options.unsafeMime) {
const pUrl = new URL(url);
mimetype = mime.getType(pUrl.pathname);
if (!mimetype)
throw new Error('Unable to determine MIME type');
}
if (!mimetype && !options.unsafeMime)
throw new Error('Unable to determine MIME type using URL. Set unsafeMime to true to download it anyway.');
async function fetchData (url, options) {
const reqOptions = Object.assign({ headers: { accept: 'image/* video/* text/* audio/*' } }, options);
const response = await fetch(url, reqOptions);
const mime = response.headers.get('Content-Type');
let data = '';
const contentDisposition = response.headers.get('Content-Disposition');
const name = contentDisposition ? contentDisposition.match(/((?<=filename=")(.*)(?="))/) : null;
let data = '';
if (response.buffer) {
data = (await response.buffer()).toString('base64');
} else {
@@ -83,18 +83,21 @@ class MessageMedia {
data = btoa(data);
}
return { data, mime };
return { data, mime, name };
}
const res = options.client
? (await options.client.pupPage.evaluate(fetchData, url, options.reqOptions))
: (await fetchData(url, options.reqOptions));
const filename = options.filename ||
(res.name ? res.name[0] : (pUrl.pathname.split('/').pop() || 'file'));
if (!mimetype)
mimetype = res.mime;
return new MessageMedia(mimetype, res.data, null);
return new MessageMedia(mimetype, res.data, filename);
}
}
module.exports = MessageMedia;
module.exports = MessageMedia;

View File

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

View File

@@ -11,6 +11,7 @@ exports.DefaultOptions = {
qrTimeoutMs: 45000,
qrRefreshIntervalMs: 20000,
authTimeoutMs: 45000,
qrMaxRetries: 0,
takeoverOnConflict: false,
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',

View File

@@ -5,15 +5,15 @@ exports.ExposeStore = (moduleRaidStr) => {
eval('var moduleRaid = ' + moduleRaidStr);
// eslint-disable-next-line no-undef
window.mR = moduleRaid();
window.Store = window.mR.findModule('Chat')[0].default;
window.Store.AppState = window.mR.findModule('STREAM')[0].default;
window.Store.Conn = window.mR.findModule('Conn')[0].default;
window.Store = Object.assign({}, window.mR.findModule(m => m.default && m.default.Chat)[0].default);
window.Store.AppState = window.mR.findModule('STREAM')[0].Socket;
window.Store.Conn = window.mR.findModule('Conn')[0].Conn;
window.Store.CryptoLib = window.mR.findModule('decryptE2EMedia')[0];
window.Store.Wap = window.mR.findModule('Wap')[0].default;
window.Store.Wap = window.mR.findModule('queryLinkPreview')[0].default;
window.Store.SendSeen = window.mR.findModule('sendSeen')[0];
window.Store.SendClear = window.mR.findModule('sendClear')[0];
window.Store.SendDelete = window.mR.findModule('sendDelete')[0];
window.Store.genId = window.mR.findModule('randomId')[0].default;
window.Store.genId = window.mR.findModule('randomId')[0].randomId;
window.Store.SendMessage = window.mR.findModule('addAndSendMsgToChat')[0];
window.Store.MsgKey = window.mR.findModule((module) => module.default && module.default.fromString)[0].default;
window.Store.Invite = window.mR.findModule('sendJoinGroupViaInvite')[0];
@@ -21,7 +21,8 @@ exports.ExposeStore = (moduleRaidStr) => {
window.Store.MediaPrep = window.mR.findModule('MediaPrep')[0];
window.Store.MediaObject = window.mR.findModule('getOrCreateMediaObject')[0];
window.Store.MediaUpload = window.mR.findModule('uploadMedia')[0];
window.Store.Cmd = window.mR.findModule('Cmd')[0].default;
window.Store.NumberInfo = window.mR.findModule('formattedPhoneNumber')[0];
window.Store.Cmd = window.mR.findModule('Cmd')[0].Cmd;
window.Store.MediaTypes = window.mR.findModule('msgToMediaType')[0];
window.Store.VCard = window.mR.findModule('vcardFromContactModel')[0];
window.Store.UserConstructor = window.mR.findModule((module) => (module.default && module.default.prototype && module.default.prototype.isServer && module.default.prototype.isUser) ? module.default : null)[0].default;
@@ -29,14 +30,13 @@ exports.ExposeStore = (moduleRaidStr) => {
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;
window.Store.Features = window.mR.findModule('FEATURE_CHANGE_EVENT')[0].default;
window.Store.Features = window.mR.findModule('FEATURE_CHANGE_EVENT')[0].GK;
window.Store.QueryOrder = window.mR.findModule('queryOrder')[0];
window.Store.QueryProduct = window.mR.findModule('queryProduct')[0];
window.Store.DownloadManager = window.mR.findModule('DownloadManager')[0].default;
window.Store.Call = window.mR.findModule('CallCollection')[0].default;
window.Store.DownloadManager = window.mR.findModule('downloadManager')[0].downloadManager;
window.Store.Call = window.mR.findModule('CallCollection')[0].CallCollection;
if(!window.Store.Chat._find) {
window.Store.Chat._find = e => {
@@ -329,6 +329,10 @@ exports.LoadUtils = () => {
if(msg.replyButtons) {
msg.replyButtons = JSON.parse(JSON.stringify(msg.replyButtons));
}
if(typeof msg.id.remote === 'object') {
msg.id = Object.assign({}, msg.id, {remote: msg.id.remote._serialized});
}
delete msg.pendingAckUpdate;

View File

@@ -28,7 +28,7 @@ class InterfaceController {
async openChatDrawer(chatId) {
await this.pupPage.evaluate(async chatId => {
let chat = await window.Store.Chat.get(chatId);
await window.Store.Cmd.chatInfoDrawer(chat);
await window.Store.Cmd.openDrawerMid(chat);
}, chatId);
}

View File

@@ -29,6 +29,24 @@ describe('Client', function() {
await client.destroy();
});
it('should disconnect after reaching max qr retries', async function () {
this.timeout(50000);
const qrCallback = sinon.spy();
const disconnectedCallback = sinon.spy();
const client = helper.createClient({options: {qrMaxRetries: 2}});
client.on('qr', qrCallback);
client.on('disconnected', disconnectedCallback);
client.initialize();
await helper.sleep(45000);
expect(qrCallback.calledThrice).to.eql(true);
expect(disconnectedCallback.calledOnceWith('Max qrcode retries reached')).to.eql(true);
});
it('should fail auth if session is invalid', async function() {
this.timeout(40000);
@@ -220,6 +238,17 @@ describe('Client', function() {
expect(msg.body).to.equal('here\'s my media');
expect(msg.to).to.equal(remoteId);
});
it('can send a media message from URL', async function() {
const media = await MessageMedia.fromUrl('https://via.placeholder.com/350x150.png');
const msg = await client.sendMessage(remoteId, media);
expect(msg).to.be.instanceOf(Message);
expect(msg.type).to.equal(MessageTypes.IMAGE);
expect(msg.fromMe).to.equal(true);
expect(msg.hasMedia).to.equal(true);
expect(msg.to).to.equal(remoteId);
});
it('can send a media message as a document', async function() {
const media = new MessageMedia(
@@ -349,18 +378,7 @@ END:VCARD`;
expect(msg.vCards[1]).to.match(/BEGIN:VCARD/);
});
});
describe('Get Messages', function() {
it ('can get a message by it\'s ID', async function() {
const chat = await client.getChatById(remoteId);
const [message] = await chat.fetchMessages({limit: 1});
const messageById = await client.getMessageById(message.id._serialized);
expect(messageById).to.exist;
expect(messageById).to.be.instanceOf(Message);
expect(messageById).to.be.equal(message);
});
});
describe('Get Chats', function () {
it('can get a chat by its ID', async function () {
const chat = await client.getChatById(remoteId);
@@ -395,7 +413,34 @@ END:VCARD`;
expect(contact).to.exist;
expect(contact).to.be.instanceOf(Contact);
});
it('can block a contact', async function () {
const contact = await client.getContactById(remoteId);
await contact.block();
const refreshedContact = await client.getContactById(remoteId);
expect(refreshedContact.isBlocked).to.eql(true);
});
it('can get a list of blocked contacts', async function () {
const blockedContacts = await client.getBlockedContacts();
expect(blockedContacts.length).to.be.greaterThanOrEqual(1);
const contact = blockedContacts.find(c => c.id._serialized === remoteId);
expect(contact).to.exist;
expect(contact).to.be.instanceOf(Contact);
});
it('can unblock a contact', async function () {
const contact = await client.getContactById(remoteId);
await contact.unblock();
const refreshedContact = await client.getContactById(remoteId);
expect(refreshedContact.isBlocked).to.eql(false);
});
});
describe('Numbers and Users', function () {
it('can verify that a user is registered', async function () {
const isRegistered = await client.isRegisteredUser(remoteId);
@@ -422,6 +467,24 @@ END:VCARD`;
const numberId = await client.getNumberId(number);
expect(numberId).to.eql(null);
});
it('can get a number\'s country code', async function () {
const number = '18092201111';
const countryCode = await client.getCountryCode(number);
expect(countryCode).to.eql('1');
});
it('can get a formatted number', async function () {
const number = '18092201111';
const formatted = await client.getFormattedNumber(number);
expect(formatted).to.eql('+1 (809) 220-1111');
});
it('can get a formatted number from a serialized ID', async function () {
const number = '18092201111@c.us';
const formatted = await client.getFormattedNumber(number);
expect(formatted).to.eql('+1 (809) 220-1111');
});
});
});
});
});

4
tools/changelog.sh Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/sh
LAST_TAG=$(git describe --tags --abbrev=0)
git log --pretty="%h - %s" "$LAST_TAG"..HEAD

View File

@@ -1 +1 @@
2.2126.14
2.2202.8