mirror of
https://github.com/cheveguerra/whatsapp-web.js.git
synced 2026-04-18 03:29:14 +00:00
Compare commits
90 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ce0a80383c | ||
|
|
97e488b10a | ||
|
|
ef507fcb95 | ||
|
|
8e011e0233 | ||
|
|
470c7aea04 | ||
|
|
f92f1ec6bf | ||
|
|
702a0ab103 | ||
|
|
d9fb5693d1 | ||
|
|
3cbf1e9c2f | ||
|
|
93a617336a | ||
|
|
1780436b93 | ||
|
|
7acbd3d800 | ||
|
|
67435b2244 | ||
|
|
743ac93f6e | ||
|
|
0a7412cf17 | ||
|
|
d1e357d23b | ||
|
|
3610cef926 | ||
|
|
4e5eeace2f | ||
|
|
6c43a2d2ed | ||
|
|
001c045c08 | ||
|
|
c3ba79464b | ||
|
|
237331b656 | ||
|
|
9d0b58a847 | ||
|
|
842c4f0e06 | ||
|
|
2dddc781c5 | ||
|
|
d8cd2d1d83 | ||
|
|
80d5783f22 | ||
|
|
cb54487197 | ||
|
|
d08b343815 | ||
|
|
ec1a80dfb4 | ||
|
|
56ed020d65 | ||
|
|
25b96378c7 | ||
|
|
5934ec531f | ||
|
|
65542f6025 | ||
|
|
00c603e623 | ||
|
|
bcd18428eb | ||
|
|
995abbf4a6 | ||
|
|
8599a6d918 | ||
|
|
5e9deff8a9 | ||
|
|
539849732c | ||
|
|
4fe7fa93b9 | ||
|
|
2820d3e72a | ||
|
|
cde5719bb6 | ||
|
|
8bdecadba4 | ||
|
|
b41414cfbf | ||
|
|
c61f447a93 | ||
|
|
49aacec4a7 | ||
|
|
d7a3e1a9a3 | ||
|
|
e14b49c5df | ||
|
|
f34902dfdd | ||
|
|
6e76fece91 | ||
|
|
98458f760e | ||
|
|
48b9ae1e81 | ||
|
|
588dc93c17 | ||
|
|
16fe865a9c | ||
|
|
b07b38bbe8 | ||
|
|
d35f101fac | ||
|
|
72441beb37 | ||
|
|
794c9e16fc | ||
|
|
05f57d2f39 | ||
|
|
130da046f5 | ||
|
|
bb40218c66 | ||
|
|
ad3834e575 | ||
|
|
e6ef5929fc | ||
|
|
bb4ad11bfa | ||
|
|
1ebaf56617 | ||
|
|
60ee2ca522 | ||
|
|
132424ea08 | ||
|
|
5c9e76e23f | ||
|
|
37932d9a69 | ||
|
|
3c500a6474 | ||
|
|
1c60c83e80 | ||
|
|
69d7b3e50b | ||
|
|
0b1f06a932 | ||
|
|
1840826e2b | ||
|
|
6ade08e814 | ||
|
|
9891d85b35 | ||
|
|
67784bc797 | ||
|
|
e385563883 | ||
|
|
d5a26add20 | ||
|
|
4bc67b0f99 | ||
|
|
d44fd5d76a | ||
|
|
a293146ed8 | ||
|
|
3c774d6553 | ||
|
|
dd0a4c6cc3 | ||
|
|
ffe803306e | ||
|
|
74cfc69367 | ||
|
|
2607e6df3a | ||
|
|
5fbd8ddf68 | ||
|
|
6f44fc586b |
31
README.md
31
README.md
@@ -1,4 +1,4 @@
|
||||
[](https://www.npmjs.com/package/whatsapp-web.js) [](https://depfu.com/github/pedroslopez/whatsapp-web.js?project_id=9765) 
|
||||
[](https://www.npmjs.com/package/whatsapp-web.js) [](https://depfu.com/github/pedroslopez/whatsapp-web.js?project_id=9765) 
|
||||
|
||||
# whatsapp-web.js
|
||||
A WhatsApp API client that connects through the WhatsApp Web browser app
|
||||
@@ -46,7 +46,7 @@ Take a look at [example.js](https://github.com/pedroslopez/whatsapp-web.js/blob/
|
||||
| Send messages | ✅ |
|
||||
| Receive messages | ✅ |
|
||||
| Send media (images/audio/documents) | ✅ |
|
||||
| Send media (video) | _pending_ |
|
||||
| Send media (video) | ✅ [(requires google chrome)](https://github.com/pedroslopez/whatsapp-web.js/issues/78#issuecomment-592723583) |
|
||||
| Send stickers | _pending_ |
|
||||
| Receive media (images/audio/video/documents) | ✅ |
|
||||
| Send contact cards | _pending_ |
|
||||
@@ -68,9 +68,34 @@ Something missing? Make an issue and let us know!
|
||||
|
||||
## Links
|
||||
|
||||
* [Documentation](https://pedroslopez.me/whatsapp-web.js) _(preview)_
|
||||
* [Reference](https://pedroslopez.me/whatsapp-web.js)
|
||||
* [Guide](https://waguide.pedroslopez.me/) _(work in progress)_
|
||||
* [GitHub](https://github.com/pedroslopez/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.
|
||||
|
||||
## Donating
|
||||
|
||||
You can support the maintainer of this project through the link below
|
||||
|
||||
[](https://www.paypal.me/psla/)
|
||||
|
||||
## Disclaimer
|
||||
|
||||
This project is not affiliated, associated, authorized, endorsed by, or in any way officially connected with WhatsApp or any of its subsidiaries or its affiliates. The official WhatsApp website can be found at https://whatsapp.com. "WhatsApp" as well as related names, marks, emblems and images are registered trademarks of their respective owners.
|
||||
|
||||
## License
|
||||
|
||||
Copyright 2019 Pedro S Lopez
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this project except in compliance with the License.
|
||||
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
BIN
docs/._Contact.html
Normal file
BIN
docs/._Contact.html
Normal file
Binary file not shown.
@@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.0.0 » Class: Base</title>
|
||||
<title>whatsapp-web.js 1.4.1 » 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>0.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>4.<wbr>1</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.3 on February 9, 2020.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on April 11, 2020.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.0.0 » Class: BusinessContact</title>
|
||||
<title>whatsapp-web.js 1.4.1 » 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>0.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>4.<wbr>1</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -227,7 +227,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.3 on February 9, 2020.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on April 11, 2020.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
180
docs/Chat.html
180
docs/Chat.html
@@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.0.0 » Class: Chat</title>
|
||||
<title>whatsapp-web.js 1.4.1 » 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>0.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>4.<wbr>1</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">Chat</span></h1>
|
||||
<p class="source-link">Source: <a href="structures_Chat.js.html#source-line-10">structures/<wbr>Chat.<wbr>js:10</a></p>
|
||||
<p class="source-link">Source: <a href="structures_Chat.js.html#source-line-11">structures/<wbr>Chat.<wbr>js:11</a></p>
|
||||
<div class="symbol-classdesc">
|
||||
<p>Represents a Chat on WhatsApp</p>
|
||||
</div>
|
||||
@@ -39,6 +39,9 @@
|
||||
<div class="summary-content">
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="Chat.html#archived">archived</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Chat.html#id">id</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
@@ -55,13 +58,13 @@
|
||||
<dt><a href="Chat.html#name">name</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Chat.html#timestamp">timestamp</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="Chat.html#timestamp">timestamp</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Chat.html#unreadCount">unreadCount</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
@@ -70,18 +73,49 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="summary-callout">
|
||||
<h2 class="summary-callout-heading">Method</h2>
|
||||
<h2 class="summary-callout-heading">Methods</h2>
|
||||
<div class="summary-content">
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="Chat.html#sendMessage">sendMessage(content, options)</a></dt>
|
||||
<dt><a href="Chat.html#archive">archive()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Chat.html#clearMessages">clearMessages()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Chat.html#clearState">clearState()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Chat.html#delete">delete()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="Chat.html#fetchMessages">fetchMessages(searchOptions)</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Chat.html#sendMessage">sendMessage(content, options)</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Chat.html#sendSeen">sendSeen()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Chat.html#sendStateRecording">sendStateRecording()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="Chat.html#sendStateTyping">sendStateTyping()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Chat.html#unarchive">unarchive()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -96,6 +130,11 @@
|
||||
<section>
|
||||
<h2>Properties</h2>
|
||||
<section>
|
||||
<h3 id="archived"><span class="symbol-name">archived</span><small class="property-type">
|
||||
boolean</small></h3>
|
||||
<p>Indicates if the Chat is archived</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="id"><span class="symbol-name">id</span><small class="property-type">
|
||||
object</small></h3>
|
||||
<p>ID that represents the chat</p>
|
||||
@@ -127,8 +166,104 @@
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
</section>
|
||||
<h2>Method</h2>
|
||||
<h2>Methods</h2>
|
||||
<section>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="archive"><span class="symbol-name">archive</span><span class="signature"><span class="signature-params">()</span></span></h3>
|
||||
<p>Archives this chat</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="clearMessages"><span class="symbol-name">clearMessages</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing Boolean</span></span></h3>
|
||||
<p>Clears all messages from the chat</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p><code>Promise containing Boolean</code> <p>result</p>
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="clearState"><span class="symbol-name">clearState</span><span class="signature"><span class="signature-params">()</span></span></h3>
|
||||
<p>Stops typing or recording in chat immediately.</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="delete"><span class="symbol-name">delete</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing Boolean</span></span></h3>
|
||||
<p>Deletes the chat</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p><code>Promise containing Boolean</code> <p>result</p>
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="fetchMessages"><span class="symbol-name">fetchMessages</span><span class="signature"><span class="signature-params">(searchOptions)</span> → <span class="signature-returns"> Promise containing Array of <a href="Message.html">Message</a></span></span></h3>
|
||||
<p>Loads chat messages, sorted from earliest to latest.</p>
|
||||
<section>
|
||||
<h4>Parameters</h4>
|
||||
<table class="jsdoc-details-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Optional</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>searchOptions</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Object</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Options for searching messages. Right now only limit is supported.</p>
|
||||
<p>Values in <code>searchOptions</code> have the following properties:</p>
|
||||
<table class="jsdoc-details-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Optional</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>limit</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Number</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Yes</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>The amount of messages to return. Note that the actual number of returned messages may be smaller if there aren't enough messages in the conversation. Set this to Infinity to load all messages.</p>
|
||||
<p>Defaults to <code>50</code>.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<dl class="dl-compact">
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p><code>Promise containing Array of <a href="Message.html">Message</a></code> </p>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="sendMessage"><span class="symbol-name">sendMessage</span><span class="signature"><span class="signature-params">(content, options)</span> → <span class="signature-returns"> Promise containing <a href="Message.html">Message</a></span></span></h3>
|
||||
<p>Send a message to this chat</p>
|
||||
@@ -180,6 +315,31 @@
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="sendSeen"><span class="symbol-name">sendSeen</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing Boolean</span></span></h3>
|
||||
<p>Set the message as seen</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p><code>Promise containing Boolean</code> <p>result</p>
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="sendStateRecording"><span class="symbol-name">sendStateRecording</span><span class="signature"><span class="signature-params">()</span></span></h3>
|
||||
<p>Simulate recording audio in chat. This will last for 25 seconds.</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="sendStateTyping"><span class="symbol-name">sendStateTyping</span><span class="signature"><span class="signature-params">()</span></span></h3>
|
||||
<p>Simulate typing in chat. This will last for 25 seconds.</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="unarchive"><span class="symbol-name">unarchive</span><span class="signature"><span class="signature-params">()</span></span></h3>
|
||||
<p>un-archives this chat</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
</section>
|
||||
</section>
|
||||
</div>
|
||||
@@ -190,7 +350,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.3 on February 9, 2020.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on April 11, 2020.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
509
docs/Client.html
509
docs/Client.html
@@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.0.0 » Class: Client</title>
|
||||
<title>whatsapp-web.js 1.4.1 » 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>0.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>4.<wbr>1</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-32">Client.<wbr>js:32</a></p>
|
||||
<p class="source-link">Source: <a href="Client.js.html#source-line-35">Client.<wbr>js:35</a></p>
|
||||
<div class="symbol-classdesc">
|
||||
<p>Starting point for interacting with the WhatsApp Web API</p>
|
||||
</div>
|
||||
@@ -42,38 +42,62 @@
|
||||
<dt><a href="Client.html#acceptInvite">acceptInvite(inviteCode)</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Client.html#archiveChat">archiveChat()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Client.html#createGroup">createGroup(name, participants)</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Client.html#destroy">destroy()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Client.html#getChatById">getChatById(chatId)</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Client.html#getChats">getChats()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="Client.html#getChats">getChats()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Client.html#getContactById">getContactById(contactId)</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Client.html#getContacts">getContacts()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Client.html#getState">getState()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Client.html#getWWebVersion">getWWebVersion()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Client.html#initialize">initialize()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Client.html#isRegisteredUser">isRegisteredUser()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="Client.html#initialize">initialize()</a></dt>
|
||||
<dt><a href="Client.html#resetState">resetState()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Client.html#sendMessage">sendMessage(chatId, content, options)</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Client.html#sendSeen">sendSeen(chatId)</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Client.html#setStatus">setStatus(status)</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Client.html#unarchiveChat">unarchiveChat()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
@@ -89,26 +113,47 @@
|
||||
<dt><a href="Client.html#event:authenticated">authenticated</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Client.html#event:change_battery">change_battery</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Client.html#event:change_state">change_state</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Client.html#event:disconnected">disconnected</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Client.html#event:group_join">group_join</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="Client.html#event:group_leave">group_leave</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Client.html#event:group_update">group_update</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Client.html#event:media_uploaded">media_uploaded</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Client.html#event:message">message</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Client.html#event:message_ack">message_ack</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Client.html#event:message_create">message_create</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Client.html#event:message_revoke_everyone">message_revoke_everyone</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="Client.html#event:message_revoke_everyone">message_revoke_everyone</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Client.html#event:message_revoke_me">message_revoke_me</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
@@ -134,10 +179,17 @@
|
||||
<dd><a href="Client.html#event:auth_failure">Client#event:auth_failure</a></dd>
|
||||
<dd><a href="Client.html#event:ready">Client#event:ready</a></dd>
|
||||
<dd><a href="Client.html#event:message">Client#event:message</a></dd>
|
||||
<dd><a href="Client.html#event:message_ack">Client#event:message_ack</a></dd>
|
||||
<dd><a href="Client.html#event:message_create">Client#event:message_create</a></dd>
|
||||
<dd><a href="Client.html#event:message_revoke_me">Client#event:message_revoke_me</a></dd>
|
||||
<dd><a href="Client.html#event:message_revoke_everyone">Client#event:message_revoke_everyone</a></dd>
|
||||
<dd><a href="Client.html#event:media_uploaded">Client#event:media_uploaded</a></dd>
|
||||
<dd><a href="Client.html#event:group_join">Client#event:group_join</a></dd>
|
||||
<dd><a href="Client.html#event:group_leave">Client#event:group_leave</a></dd>
|
||||
<dd><a href="Client.html#event:group_update">Client#event:group_update</a></dd>
|
||||
<dd><a href="Client.html#event:disconnected">Client#event:disconnected</a></dd>
|
||||
<dd><a href="Client.html#event:change_state">Client#event:change_state</a></dd>
|
||||
<dd><a href="Client.html#event:change_battery">Client#event:change_battery</a></dd>
|
||||
</dl>
|
||||
</section>
|
||||
<section>
|
||||
@@ -178,6 +230,76 @@
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="archiveChat"><span class="symbol-name">archiveChat</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> boolean</span></span></h3>
|
||||
<p>Enables and returns the archive state of the Chat</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p><code>boolean</code> </p>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="createGroup"><span class="symbol-name">createGroup</span><span class="signature"><span class="signature-params">(name, participants)</span> → <span class="signature-returns"> (Object, string, or Object with string properties)</span></span></h3>
|
||||
<p>Create a new group</p>
|
||||
<section>
|
||||
<h4>Parameters</h4>
|
||||
<table class="jsdoc-details-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Optional</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>name</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>string</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p>group title</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>participants</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Array of (<a href="Contact.html">Contact</a> or string)</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p>an array of Contacts or contact IDs to add to the group</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<dl class="dl-compact">
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p><code>Object</code> <p>createRes</p>
|
||||
</p>
|
||||
</dd>
|
||||
<dd>
|
||||
<p><code>string</code> <p>createRes.gid - ID for the group that was just created</p>
|
||||
</p>
|
||||
</dd>
|
||||
<dd>
|
||||
<p><code>Object with string properties</code> <p>createRes.missingParticipants - participants that were not added to the group. Keys represent the ID for participant that was not added and its value is a status code that represents the reason why participant could not be added. This is usually 403 if the user's privacy settings don't allow you to add them to groups.</p>
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="destroy"><span class="symbol-name">destroy</span><span class="signature"><span class="signature-params">()</span></span></h3>
|
||||
<p>Closes the client</p>
|
||||
<dl class="dl-compact">
|
||||
@@ -275,11 +397,44 @@
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="getState"><span class="symbol-name">getState</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> <a href="global.html#WAState">WAState</a></span></span></h3>
|
||||
<p>Gets the current connection state for the client</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p><code><a href="global.html#WAState">WAState</a></code> </p>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="getWWebVersion"><span class="symbol-name">getWWebVersion</span><span class="signature"><span class="signature-params">()</span></span></h3>
|
||||
<p>Returns the version of WhatsApp Web currently being run</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p>Promise<string>
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="initialize"><span class="symbol-name">initialize</span><span class="signature"><span class="signature-params">()</span></span></h3>
|
||||
<p>Sets up events and requirements, kicks off authentication request</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="isRegisteredUser"><span class="symbol-name">isRegisteredUser</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing Boolean</span></span></h3>
|
||||
<p>Check if a given ID is registered in whatsapp</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p><code>Promise containing Boolean</code> </p>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="resetState"><span class="symbol-name">resetState</span><span class="signature"><span class="signature-params">()</span></span></h3>
|
||||
<p>Force reset of connection state for the client</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="sendMessage"><span class="symbol-name">sendMessage</span><span class="signature"><span class="signature-params">(chatId, content, options)</span> → <span class="signature-returns"> Promise containing <a href="Message.html">Message</a></span></span></h3>
|
||||
<p>Send a message to a specific chatId</p>
|
||||
<section>
|
||||
@@ -344,6 +499,44 @@
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="sendSeen"><span class="symbol-name">sendSeen</span><span class="signature"><span class="signature-params">(chatId)</span> → <span class="signature-returns"> Promise containing boolean</span></span></h3>
|
||||
<p>Mark as seen for the Chat</p>
|
||||
<section>
|
||||
<h4>Parameter</h4>
|
||||
<table class="jsdoc-details-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Optional</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>chatId</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>string</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<dl class="dl-compact">
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p><code>Promise containing boolean</code> <p>result</p>
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="setStatus"><span class="symbol-name">setStatus</span><span class="signature"><span class="signature-params">(status)</span></span></h3>
|
||||
<p>Sets the current user's status message</p>
|
||||
<section>
|
||||
@@ -377,6 +570,15 @@
|
||||
</section>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="unarchiveChat"><span class="symbol-name">unarchiveChat</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> boolean</span></span></h3>
|
||||
<p>Changes and returns the archive state of the Chat</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p><code>boolean</code> </p>
|
||||
</dd>
|
||||
</dl>
|
||||
</section>
|
||||
<h2>Events</h2>
|
||||
<section>
|
||||
@@ -445,6 +647,112 @@
|
||||
</section>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="event:change_battery"><span class="symbol-name">change_battery</span></h3>
|
||||
<p>Emitted when the battery percentage for the attached device changes</p>
|
||||
<section>
|
||||
<h4>Parameters</h4>
|
||||
<table class="jsdoc-details-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Optional</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>batteryInfo</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>object</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Values in <code>batteryInfo</code> have the following properties:</p>
|
||||
<table class="jsdoc-details-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Optional</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>battery</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>number</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p>The current battery percentage</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>plugged</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>boolean</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Indicates if the phone is plugged in (true) or not (false)</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="event:change_state"><span class="symbol-name">change_state</span></h3>
|
||||
<p>Emitted when the connection state changes</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>state</p>
|
||||
</td>
|
||||
<td>
|
||||
<p><a href="global.html#WAState">WAState</a></p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p>the new connection state</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="event:disconnected"><span class="symbol-name">disconnected</span></h3>
|
||||
<p>Emitted when the client has been disconnected</p>
|
||||
<section>
|
||||
@@ -478,6 +786,138 @@
|
||||
</section>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="event:group_join"><span class="symbol-name">group_join</span></h3>
|
||||
<p>Emitted when a user joins the chat via invite link or is added by an admin.</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>notification</p>
|
||||
</td>
|
||||
<td>
|
||||
<p><a href="GroupNotification.html">GroupNotification</a></p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p>GroupNotification with more information about the action</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="event:group_leave"><span class="symbol-name">group_leave</span></h3>
|
||||
<p>Emitted when a user leaves the chat or is removed by an admin.</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>notification</p>
|
||||
</td>
|
||||
<td>
|
||||
<p><a href="GroupNotification.html">GroupNotification</a></p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p>GroupNotification with more information about the action</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="event:group_update"><span class="symbol-name">group_update</span></h3>
|
||||
<p>Emitted when group settings are updated, such as subject, description or picture.</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>notification</p>
|
||||
</td>
|
||||
<td>
|
||||
<p><a href="GroupNotification.html">GroupNotification</a></p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p>GroupNotification with more information about the action</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="event:media_uploaded"><span class="symbol-name">media_uploaded</span></h3>
|
||||
<p>Emitted when media has been uploaded for a message sent by the client.</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>message</p>
|
||||
</td>
|
||||
<td>
|
||||
<p><a href="Message.html">Message</a></p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p>The message with media that was uploaded</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="event:message"><span class="symbol-name">message</span></h3>
|
||||
<p>Emitted when a new message is received.</p>
|
||||
<section>
|
||||
@@ -511,6 +951,53 @@
|
||||
</section>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="event:message_ack"><span class="symbol-name">message_ack</span></h3>
|
||||
<p>Emitted when an ack event occurrs on message type.</p>
|
||||
<section>
|
||||
<h4>Parameters</h4>
|
||||
<table class="jsdoc-details-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Optional</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>message</p>
|
||||
</td>
|
||||
<td>
|
||||
<p><a href="Message.html">Message</a></p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p>The message that was affected</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>ack</p>
|
||||
</td>
|
||||
<td>
|
||||
<p><a href="global.html#MessageAck">MessageAck</a></p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p>The new ACK value</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="event:message_create"><span class="symbol-name">message_create</span></h3>
|
||||
<p>Emitted when a new message is created, which may include the current user's own messages.</p>
|
||||
<section>
|
||||
@@ -673,7 +1160,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.3 on February 9, 2020.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on April 11, 2020.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.0.0 » Source: Client.js</title>
|
||||
<title>whatsapp-web.js 1.4.1 » 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>0.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>4.<wbr>1</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
const EventEmitter = require('events');
|
||||
const puppeteer = require('puppeteer');
|
||||
const moduleRaid = require('moduleraid/moduleraid');
|
||||
const moduleRaid = require('@pedroslopez/moduleraid/moduleraid');
|
||||
const jsQR = require('jsqr');
|
||||
|
||||
const Util = require('./util/Util');
|
||||
@@ -41,11 +41,7 @@ const { WhatsWebURL, UserAgent, DefaultOptions, Events, WAState } = require
|
||||
const { ExposeStore, LoadUtils } = require('./util/Injected');
|
||||
const ChatFactory = require('./factories/ChatFactory');
|
||||
const ContactFactory = require('./factories/ContactFactory');
|
||||
const ClientInfo = require('./structures/ClientInfo');
|
||||
const Message = require('./structures/Message');
|
||||
const MessageMedia = require('./structures/MessageMedia');
|
||||
const Location = require('./structures/Location');
|
||||
|
||||
const { ClientInfo, Message, MessageMedia, Contact, Location, GroupNotification } = require('./structures');
|
||||
/**
|
||||
* Starting point for interacting with the WhatsApp Web API
|
||||
* @extends {EventEmitter}
|
||||
@@ -54,10 +50,17 @@ const Location = require('./structures/Location');
|
||||
* @fires Client#auth_failure
|
||||
* @fires Client#ready
|
||||
* @fires Client#message
|
||||
* @fires Client#message_ack
|
||||
* @fires Client#message_create
|
||||
* @fires Client#message_revoke_me
|
||||
* @fires Client#message_revoke_everyone
|
||||
* @fires Client#media_uploaded
|
||||
* @fires Client#group_join
|
||||
* @fires Client#group_leave
|
||||
* @fires Client#group_update
|
||||
* @fires Client#disconnected
|
||||
* @fires Client#change_state
|
||||
* @fires Client#change_battery
|
||||
*/
|
||||
class Client extends EventEmitter {
|
||||
constructor(options = {}) {
|
||||
@@ -74,9 +77,12 @@ class Client extends EventEmitter {
|
||||
*/
|
||||
async initialize() {
|
||||
const browser = await puppeteer.launch(this.options.puppeteer);
|
||||
const page = await browser.newPage();
|
||||
const page = (await browser.pages())[0];
|
||||
page.setUserAgent(UserAgent);
|
||||
|
||||
this.pupBrowser = browser;
|
||||
this.pupPage = page;
|
||||
|
||||
if (this.options.session) {
|
||||
await page.evaluateOnNewDocument(
|
||||
session => {
|
||||
@@ -95,7 +101,7 @@ class Client extends EventEmitter {
|
||||
if (this.options.session) {
|
||||
// Check if session restore was successfull
|
||||
try {
|
||||
await page.waitForSelector(KEEP_PHONE_CONNECTED_IMG_SELECTOR, { timeout: 15000 });
|
||||
await page.waitForSelector(KEEP_PHONE_CONNECTED_IMG_SELECTOR, { timeout: this.options.authTimeoutMs });
|
||||
} catch (err) {
|
||||
if (err.name === 'TimeoutError') {
|
||||
/**
|
||||
@@ -105,7 +111,11 @@ class Client extends EventEmitter {
|
||||
*/
|
||||
this.emit(Events.AUTHENTICATION_FAILURE, 'Unable to log in. Are the session details valid?');
|
||||
browser.close();
|
||||
|
||||
if (this.options.restartOnAuthFail) {
|
||||
// session restore failed so try again but without session to force new authentication
|
||||
this.options.session = null;
|
||||
this.initialize();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -113,21 +123,34 @@ class Client extends EventEmitter {
|
||||
}
|
||||
|
||||
} else {
|
||||
// Wait for QR Code
|
||||
const QR_CANVAS_SELECTOR = 'canvas';
|
||||
await page.waitForSelector(QR_CANVAS_SELECTOR);
|
||||
const qrImgData = await page.$eval(QR_CANVAS_SELECTOR, canvas => [].slice.call(canvas.getContext('2d').getImageData(0,0,264,264).data));
|
||||
const qr = jsQR(qrImgData, 264, 264).data;
|
||||
|
||||
/**
|
||||
* Emitted when the QR code is received
|
||||
* @event Client#qr
|
||||
* @param {string} qr QR Code
|
||||
*/
|
||||
this.emit(Events.QR_RECEIVED, qr);
|
||||
const getQrCode = async () => {
|
||||
// Check if retry button is present
|
||||
var QR_RETRY_SELECTOR = 'div[data-ref] > span > div';
|
||||
var qrRetry = await page.$(QR_RETRY_SELECTOR);
|
||||
if (qrRetry) {
|
||||
await qrRetry.click();
|
||||
}
|
||||
|
||||
// Wait for QR Code
|
||||
|
||||
const QR_CANVAS_SELECTOR = 'canvas';
|
||||
await page.waitForSelector(QR_CANVAS_SELECTOR, { timeout: this.options.qrTimeoutMs });
|
||||
const qrImgData = await page.$eval(QR_CANVAS_SELECTOR, canvas => [].slice.call(canvas.getContext('2d').getImageData(0, 0, 264, 264).data));
|
||||
const qr = jsQR(qrImgData, 264, 264).data;
|
||||
/**
|
||||
* Emitted when the QR code is received
|
||||
* @event Client#qr
|
||||
* @param {string} qr QR Code
|
||||
*/
|
||||
this.emit(Events.QR_RECEIVED, qr);
|
||||
};
|
||||
getQrCode();
|
||||
let retryInterval = setInterval(getQrCode, this.options.qrRefreshIntervalMs);
|
||||
|
||||
// Wait for code scan
|
||||
await page.waitForSelector(KEEP_PHONE_CONNECTED_IMG_SELECTOR, { timeout: 0 });
|
||||
clearInterval(retryInterval);
|
||||
|
||||
}
|
||||
|
||||
await page.evaluate(ExposeStore, moduleRaid.toString());
|
||||
@@ -166,6 +189,33 @@ class Client extends EventEmitter {
|
||||
await page.exposeFunction('onAddMessageEvent', msg => {
|
||||
if (!msg.isNewMsg) return;
|
||||
|
||||
if (msg.type === 'gp2') {
|
||||
const notification = new GroupNotification(this, msg);
|
||||
if (msg.subtype === 'add' || msg.subtype === 'invite') {
|
||||
/**
|
||||
* Emitted when a user joins the chat via invite link or is added by an admin.
|
||||
* @event Client#group_join
|
||||
* @param {GroupNotification} notification GroupNotification with more information about the action
|
||||
*/
|
||||
this.emit(Events.GROUP_JOIN, notification);
|
||||
} else if (msg.subtype === 'remove' || msg.subtype === 'leave') {
|
||||
/**
|
||||
* Emitted when a user leaves the chat or is removed by an admin.
|
||||
* @event Client#group_leave
|
||||
* @param {GroupNotification} notification GroupNotification with more information about the action
|
||||
*/
|
||||
this.emit(Events.GROUP_LEAVE, notification);
|
||||
} else {
|
||||
/**
|
||||
* Emitted when group settings are updated, such as subject, description or picture.
|
||||
* @event Client#group_update
|
||||
* @param {GroupNotification} notification GroupNotification with more information about the action
|
||||
*/
|
||||
this.emit(Events.GROUP_UPDATE, notification);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
const message = new Message(this, msg);
|
||||
|
||||
/**
|
||||
@@ -192,7 +242,7 @@ class Client extends EventEmitter {
|
||||
if (msg.type === 'revoked') {
|
||||
const message = new Message(this, msg);
|
||||
let revoked_msg;
|
||||
if(last_message &amp;&amp; msg.id.id === last_message.id.id) {
|
||||
if (last_message &amp;&amp; msg.id.id === last_message.id.id) {
|
||||
revoked_msg = new Message(this, last_message);
|
||||
}
|
||||
|
||||
@@ -205,11 +255,11 @@ class Client extends EventEmitter {
|
||||
*/
|
||||
this.emit(Events.MESSAGE_REVOKED_EVERYONE, message, revoked_msg);
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
await page.exposeFunction('onChangeMessageEvent', (msg) => {
|
||||
|
||||
|
||||
if (msg.type !== 'revoked') {
|
||||
last_message = msg;
|
||||
}
|
||||
@@ -231,8 +281,42 @@ class Client extends EventEmitter {
|
||||
|
||||
});
|
||||
|
||||
await page.exposeFunction('onAppStateChangedEvent', (AppState, state) => {
|
||||
const ACCEPTED_STATES = [WAState.CONNECTED, WAState.OPENING, WAState.PAIRING];
|
||||
await page.exposeFunction('onMessageAckEvent', (msg, ack) => {
|
||||
|
||||
const message = new Message(this, msg);
|
||||
|
||||
/**
|
||||
* Emitted when an ack event occurrs on message type.
|
||||
* @event Client#message_ack
|
||||
* @param {Message} message The message that was affected
|
||||
* @param {MessageAck} ack The new ACK value
|
||||
*/
|
||||
this.emit(Events.MESSAGE_ACK, message, ack);
|
||||
|
||||
});
|
||||
|
||||
await page.exposeFunction('onMessageMediaUploadedEvent', (msg) => {
|
||||
|
||||
const message = new Message(this, msg);
|
||||
|
||||
/**
|
||||
* Emitted when media has been uploaded for a message sent by the client.
|
||||
* @event Client#media_uploaded
|
||||
* @param {Message} message The message with media that was uploaded
|
||||
*/
|
||||
this.emit(Events.MEDIA_UPLOADED, message);
|
||||
});
|
||||
|
||||
await page.exposeFunction('onAppStateChangedEvent', (state) => {
|
||||
|
||||
/**
|
||||
* Emitted when the connection state changes
|
||||
* @event Client#change_state
|
||||
* @param {WAState} state the new connection state
|
||||
*/
|
||||
this.emit(Events.STATE_CHANGED, state);
|
||||
|
||||
const ACCEPTED_STATES = [WAState.CONNECTED, WAState.OPENING, WAState.PAIRING, WAState.TIMEOUT];
|
||||
if (!ACCEPTED_STATES.includes(state)) {
|
||||
/**
|
||||
* Emitted when the client has been disconnected
|
||||
@@ -244,16 +328,30 @@ class Client extends EventEmitter {
|
||||
}
|
||||
});
|
||||
|
||||
await page.evaluate(() => {
|
||||
window.Store.Msg.on('add', window.onAddMessageEvent);
|
||||
window.Store.Msg.on('change', window.onChangeMessageEvent);
|
||||
window.Store.Msg.on('change:type', window.onChangeMessageTypeEvent);
|
||||
window.Store.Msg.on('remove', window.onRemoveMessageEvent);
|
||||
window.Store.AppState.on('change:state', window.onAppStateChangedEvent);
|
||||
await page.exposeFunction('onBatteryStateChangedEvent', (state) => {
|
||||
|
||||
const { battery, plugged } = state;
|
||||
|
||||
/**
|
||||
* Emitted when the battery percentage for the attached device changes
|
||||
* @event Client#change_battery
|
||||
* @param {object} batteryInfo
|
||||
* @param {number} batteryInfo.battery - The current battery percentage
|
||||
* @param {boolean} batteryInfo.plugged - Indicates if the phone is plugged in (true) or not (false)
|
||||
*/
|
||||
this.emit(Events.BATTERY_CHANGED, { battery, plugged });
|
||||
});
|
||||
|
||||
this.pupBrowser = browser;
|
||||
this.pupPage = page;
|
||||
await page.evaluate(() => {
|
||||
window.Store.Msg.on('add', (msg) => { if(msg.isNewMsg) window.onAddMessageEvent(msg); });
|
||||
window.Store.Msg.on('change', (msg) => { window.onChangeMessageEvent(msg); });
|
||||
window.Store.Msg.on('change:type', (msg) => { window.onChangeMessageTypeEvent(msg); });
|
||||
window.Store.Msg.on('change:ack', (msg, ack) => { window.onMessageAckEvent(msg, ack); });
|
||||
window.Store.Msg.on('change:isUnsentMedia', (msg, unsent) => { if(msg.id.fromMe &amp;&amp; !unsent) window.onMessageMediaUploadedEvent(msg); });
|
||||
window.Store.Msg.on('remove', (msg) => { if(msg.isNewMsg) window.onRemoveMessageEvent(msg); });
|
||||
window.Store.AppState.on('change:state', (_AppState, state) => { window.onAppStateChangedEvent(state); });
|
||||
window.Store.Conn.on('change:battery', (state) => { window.onBatteryStateChangedEvent(state); });
|
||||
});
|
||||
|
||||
/**
|
||||
* Emitted when the client has initialized and is ready to receive messages.
|
||||
@@ -269,6 +367,30 @@ class Client extends EventEmitter {
|
||||
await this.pupBrowser.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the version of WhatsApp Web currently being run
|
||||
* @returns Promise&lt;string>
|
||||
*/
|
||||
async getWWebVersion() {
|
||||
return await this.pupPage.evaluate(() => {
|
||||
return window.Debug.VERSION;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark as seen for the Chat
|
||||
* @param {string} chatId
|
||||
* @returns {Promise&lt;boolean>} result
|
||||
*
|
||||
*/
|
||||
async sendSeen(chatId) {
|
||||
const result = await this.pupPage.evaluate(async (chatId) => {
|
||||
return window.WWebJS.sendSeen(chatId);
|
||||
|
||||
}, chatId);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a message to a specific chatId
|
||||
* @param {string} chatId
|
||||
@@ -276,28 +398,55 @@ class Client extends EventEmitter {
|
||||
* @param {object} options
|
||||
* @returns {Promise&lt;Message>} Message that was just sent
|
||||
*/
|
||||
async sendMessage(chatId, content, options={}) {
|
||||
async sendMessage(chatId, content, options = {}) {
|
||||
let internalOptions = {
|
||||
caption: options.caption,
|
||||
quotedMessageId: options.quotedMessageId,
|
||||
mentionedJidList: Array.isArray(options.mentions) ? options.mentions.map(contact => contact.id._serialized) : []
|
||||
mentionedJidList: Array.isArray(options.mentions) ? options.mentions.map(contact => contact.id._serialized) : []
|
||||
};
|
||||
|
||||
const sendSeen = typeof options.sendSeen === 'undefined' ? true : options.sendSeen;
|
||||
|
||||
if(content instanceof MessageMedia) {
|
||||
if (content instanceof MessageMedia) {
|
||||
internalOptions.attachment = content;
|
||||
content = '';
|
||||
} else if(options.media instanceof MessageMedia) {
|
||||
internalOptions.media = options.media;
|
||||
} else if (options.media instanceof MessageMedia) {
|
||||
internalOptions.attachment = options.media;
|
||||
internalOptions.caption = content;
|
||||
} else if(content instanceof Location) {
|
||||
} else if (content instanceof Location) {
|
||||
internalOptions.location = content;
|
||||
content = '';
|
||||
}
|
||||
|
||||
const newMessage = await this.pupPage.evaluate(async (chatId, message, options) => {
|
||||
const msg = await window.WWebJS.sendMessage(window.Store.Chat.get(chatId), message, options);
|
||||
const newMessage = await this.pupPage.evaluate(async (chatId, message, options, sendSeen) => {
|
||||
let chat = window.Store.Chat.get(chatId);
|
||||
let msg;
|
||||
if (!chat) { // The chat is not available in the previously chatted list
|
||||
|
||||
let newChatId = await window.WWebJS.getNumberId(chatId);
|
||||
if (newChatId) {
|
||||
//get the topmost chat object and assign the new chatId to it .
|
||||
//This is just a workaround.May cause problem if there are no chats at all. Need to dig in and emulate how whatsapp web does
|
||||
let chat = window.Store.Chat.models[0];
|
||||
if (!chat)
|
||||
throw 'Chat List empty! Need at least one open conversation with any of your contact';
|
||||
|
||||
let originalChatObjId = chat.id;
|
||||
chat.id = newChatId;
|
||||
|
||||
msg = await window.WWebJS.sendMessage(chat, message, options);
|
||||
chat.id = originalChatObjId; //replace the chat with its original id
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(sendSeen) {
|
||||
window.WWebJS.sendSeen(chatId);
|
||||
}
|
||||
|
||||
msg = await window.WWebJS.sendMessage(chat, message, options, sendSeen);
|
||||
}
|
||||
return msg.serialize();
|
||||
}, chatId, content, internalOptions);
|
||||
}, chatId, content, internalOptions, sendSeen);
|
||||
|
||||
return new Message(this, newMessage);
|
||||
}
|
||||
@@ -374,6 +523,97 @@ class Client extends EventEmitter {
|
||||
}, status);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current connection state for the client
|
||||
* @returns {WAState}
|
||||
*/
|
||||
async getState() {
|
||||
return await this.pupPage.evaluate(() => {
|
||||
return window.Store.AppState.state;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables and returns the archive state of the Chat
|
||||
* @returns {boolean}
|
||||
*/
|
||||
async archiveChat(chatId) {
|
||||
return await this.pupPage.evaluate(async chatId => {
|
||||
let chat = await window.Store.Chat.get(chatId);
|
||||
await window.Store.Cmd.archiveChat(chat, true);
|
||||
return chat.archive;
|
||||
}, chatId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes and returns the archive state of the Chat
|
||||
* @returns {boolean}
|
||||
*/
|
||||
async unarchiveChat(chatId) {
|
||||
return await this.pupPage.evaluate(async chatId => {
|
||||
let chat = await window.Store.Chat.get(chatId);
|
||||
await window.Store.Cmd.archiveChat(chat, false);
|
||||
return chat.archive;
|
||||
}, chatId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Force reset of connection state for the client
|
||||
*/
|
||||
async resetState(){
|
||||
await this.pupPage.evaluate(() => {
|
||||
window.Store.AppState.phoneWatchdog.shiftTimer.forceRunNow();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given ID is registered in whatsapp
|
||||
* @returns {Promise&lt;Boolean>}
|
||||
*/
|
||||
async isRegisteredUser(id) {
|
||||
return await this.pupPage.evaluate(async (id) => {
|
||||
let result = await window.Store.Wap.queryExist(id);
|
||||
return result.jid !== undefined;
|
||||
}, id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new group
|
||||
* @param {string} name group title
|
||||
* @param {Array&lt;Contact|string>} participants an array of Contacts or contact IDs to add to the group
|
||||
* @returns {Object} createRes
|
||||
* @returns {string} createRes.gid - ID for the group that was just created
|
||||
* @returns {Object.&lt;string,string>} createRes.missingParticipants - participants that were not added to the group. Keys represent the ID for participant that was not added and its value is a status code that represents the reason why participant could not be added. This is usually 403 if the user's privacy settings don't allow you to add them to groups.
|
||||
*/
|
||||
async createGroup(name, participants) {
|
||||
if(!Array.isArray(participants) || participants.length == 0) {
|
||||
throw 'You need to add at least one other participant to the group';
|
||||
}
|
||||
|
||||
if(participants.every(c => c instanceof Contact)) {
|
||||
participants = participants.map(c => c.id._serialized);
|
||||
}
|
||||
|
||||
const createRes = await this.pupPage.evaluate(async (name, participantIds) => {
|
||||
const res = await window.Store.Wap.createGroup(name, participantIds);
|
||||
console.log(res);
|
||||
if(!res.status === 200) {
|
||||
throw 'An error occurred while creating the group!';
|
||||
}
|
||||
|
||||
return res;
|
||||
}, name, participants);
|
||||
|
||||
const missingParticipants = createRes.participants.reduce(((missing, c) => {
|
||||
const id = Object.keys(c)[0];
|
||||
const statusCode = c[id].code;
|
||||
if(statusCode != 200) return Object.assign(missing, {[id]: statusCode});
|
||||
return missing;
|
||||
}), {});
|
||||
|
||||
return { gid: createRes.gid, missingParticipants};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = Client;
|
||||
@@ -387,7 +627,7 @@ module.exports = 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.3 on February 9, 2020.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on April 11, 2020.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.0.0 » Class: ClientInfo</title>
|
||||
<title>whatsapp-web.js 1.4.1 » 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>0.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>4.<wbr>1</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -187,7 +187,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.3 on February 9, 2020.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on April 11, 2020.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.0.0 » Class: Contact</title>
|
||||
<title>whatsapp-web.js 1.4.1 » 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>0.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>4.<wbr>1</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -196,7 +196,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.3 on February 9, 2020.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on April 11, 2020.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.0.0 » Class: GroupChat</title>
|
||||
<title>whatsapp-web.js 1.4.1 » 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>0.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>4.<wbr>1</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -39,6 +39,9 @@
|
||||
<div class="summary-content">
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="GroupChat.html#archived">archived</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="GroupChat.html#createdAt">createdAt</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
@@ -48,13 +51,13 @@
|
||||
<dt><a href="GroupChat.html#id">id</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="GroupChat.html#isGroup">isGroup</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="GroupChat.html#isGroup">isGroup</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="GroupChat.html#isReadOnly">isReadOnly</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
@@ -64,13 +67,13 @@
|
||||
<dt><a href="GroupChat.html#owner">owner</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="GroupChat.html#participants">participants</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="GroupChat.html#participants">participants</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="GroupChat.html#timestamp">timestamp</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
@@ -95,13 +98,28 @@
|
||||
<dt><a href="GroupChat.html#addParticipants">addParticipants(participantIds)</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="GroupChat.html#demoteParticipants">demoteParticipants(participantIds)</a></dt>
|
||||
<dt><a href="GroupChat.html#archive">archive()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="GroupChat.html#clearMessages">clearMessages()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="GroupChat.html#clearState">clearState()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="GroupChat.html#delete">delete()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="GroupChat.html#demoteParticipants">demoteParticipants(participantIds)</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="GroupChat.html#fetchMessages">fetchMessages(searchOptions)</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="GroupChat.html#getInviteCode">getInviteCode()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
@@ -114,14 +132,23 @@
|
||||
<dt><a href="GroupChat.html#removeParticipants">removeParticipants(participantIds)</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="GroupChat.html#revokeInvite">revokeInvite()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="GroupChat.html#revokeInvite">revokeInvite()</a></dt>
|
||||
<dt><a href="GroupChat.html#sendMessage">sendMessage(content, options)</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="GroupChat.html#sendMessage">sendMessage(content, options)</a></dt>
|
||||
<dt><a href="GroupChat.html#sendSeen">sendSeen()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="GroupChat.html#sendStateRecording">sendStateRecording()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="GroupChat.html#sendStateTyping">sendStateTyping()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="GroupChat.html#setDescription">setDescription(description)</a></dt>
|
||||
@@ -130,6 +157,9 @@
|
||||
<dt><a href="GroupChat.html#setSubject">setSubject(subject)</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="GroupChat.html#unarchive">unarchive()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
@@ -145,6 +175,13 @@
|
||||
<section>
|
||||
<h2>Properties</h2>
|
||||
<section>
|
||||
<h3 id="archived"><span class="symbol-name">archived</span><small class="property-type">
|
||||
unknown</small></h3>
|
||||
<p>Indicates if the Chat is archived</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Chat.html#archived">Chat#archived</a></dd>
|
||||
</dl>
|
||||
<h3 id="createdAt"><span class="symbol-name">createdAt</span><small class="property-type">
|
||||
date</small></h3>
|
||||
<p>Gets the date at which the group was created</p>
|
||||
@@ -314,6 +351,42 @@
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="archive"><span class="symbol-name">archive</span><span class="signature"><span class="signature-params">()</span></span></h3>
|
||||
<p>Archives this chat</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Chat.html#archive">Chat#archive</a></dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="clearMessages"><span class="symbol-name">clearMessages</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing Boolean</span></span></h3>
|
||||
<p>Clears all messages from the chat</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Chat.html#clearMessages">Chat#clearMessages</a></dd>
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p>result</p>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="clearState"><span class="symbol-name">clearState</span><span class="signature"><span class="signature-params">()</span></span></h3>
|
||||
<p>Stops typing or recording in chat immediately.</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Chat.html#clearState">Chat#clearState</a></dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="delete"><span class="symbol-name">delete</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing Boolean</span></span></h3>
|
||||
<p>Deletes the chat</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Chat.html#delete">Chat#delete</a></dd>
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p>result</p>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="demoteParticipants"><span class="symbol-name">demoteParticipants</span><span class="signature"><span class="signature-params">(participantIds)</span></span></h3>
|
||||
<p>Demotes participants by IDs to regular users</p>
|
||||
<section>
|
||||
@@ -347,6 +420,72 @@
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="fetchMessages"><span class="symbol-name">fetchMessages</span><span class="signature"><span class="signature-params">(searchOptions)</span> → <span class="signature-returns"> Promise containing Array of <a href="Message.html">Message</a></span></span></h3>
|
||||
<p>Loads chat messages, sorted from earliest to latest.</p>
|
||||
<section>
|
||||
<h4>Parameters</h4>
|
||||
<table class="jsdoc-details-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Optional</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>searchOptions</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Options for searching messages. Right now only limit is supported.</p>
|
||||
<p>Values in <code>searchOptions</code> have the following properties:</p>
|
||||
<table class="jsdoc-details-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Optional</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>limit</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Yes</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>The amount of messages to return. Note that the actual number of returned messages may be smaller if there aren't enough messages in the conversation. Set this to Infinity to load all messages.</p>
|
||||
<p>Defaults to <code>50</code>.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Chat.html#fetchMessages">Chat#fetchMessages</a></dd>
|
||||
<dt>Returns</dt>
|
||||
<dd></dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="getInviteCode"><span class="symbol-name">getInviteCode</span><span class="signature"><span class="signature-params">()</span></span></h3>
|
||||
<p>Gets the invite code for a specific group</p>
|
||||
<dl class="dl-compact">
|
||||
@@ -480,6 +619,31 @@
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="sendSeen"><span class="symbol-name">sendSeen</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing Boolean</span></span></h3>
|
||||
<p>Set the message as seen</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Chat.html#sendSeen">Chat#sendSeen</a></dd>
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p>result</p>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="sendStateRecording"><span class="symbol-name">sendStateRecording</span><span class="signature"><span class="signature-params">()</span></span></h3>
|
||||
<p>Simulate recording audio in chat. This will last for 25 seconds.</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Chat.html#sendStateRecording">Chat#sendStateRecording</a></dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="sendStateTyping"><span class="symbol-name">sendStateTyping</span><span class="signature"><span class="signature-params">()</span></span></h3>
|
||||
<p>Simulate typing in chat. This will last for 25 seconds.</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Chat.html#sendStateTyping">Chat#sendStateTyping</a></dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="setDescription"><span class="symbol-name">setDescription</span><span class="signature"><span class="signature-params">(description)</span></span></h3>
|
||||
<p>Updates the group description</p>
|
||||
<section>
|
||||
@@ -545,6 +709,13 @@
|
||||
</section>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="unarchive"><span class="symbol-name">unarchive</span><span class="signature"><span class="signature-params">()</span></span></h3>
|
||||
<p>un-archives this chat</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Chat.html#unarchive">Chat#unarchive</a></dd>
|
||||
</dl>
|
||||
</section>
|
||||
</section>
|
||||
</div>
|
||||
@@ -555,7 +726,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.3 on February 9, 2020.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on April 11, 2020.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
248
docs/GroupNotification.html
Normal file
248
docs/GroupNotification.html
Normal file
@@ -0,0 +1,248 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.4.1 » 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">
|
||||
<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>4.<wbr>1</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">GroupNotification</span></h1>
|
||||
<p class="source-link">Source: <a href="structures_GroupNotification.js.html#source-line-10">structures/<wbr>GroupNotification.<wbr>js:10</a></p>
|
||||
<div class="symbol-classdesc">
|
||||
<p>Represents a GroupNotification on WhatsApp</p>
|
||||
</div>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
</header>
|
||||
<section id="summary">
|
||||
<div class="summary-callout">
|
||||
<h2 class="summary-callout-heading">Properties</h2>
|
||||
<div class="summary-content">
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="GroupNotification.html#author">author</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="GroupNotification.html#body">body</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="GroupNotification.html#chatId">chatId</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="GroupNotification.html#id">id</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="GroupNotification.html#recipientIds">recipientIds</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="GroupNotification.html#timestamp">timestamp</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="GroupNotification.html#type">type</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="summary-callout">
|
||||
<h2 class="summary-callout-heading">Methods</h2>
|
||||
<div class="summary-content">
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="GroupNotification.html#getChat">getChat()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="GroupNotification.html#getContact">getContact()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="GroupNotification.html#getRecipients">getRecipients()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="GroupNotification.html#reply">reply(content, options)</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section>
|
||||
<h2 id="GroupNotification">new <span class="symbol-name">GroupNotification</span><span class="signature"><span class="signature-params">()</span></span></h2>
|
||||
<dl class="dl-compact">
|
||||
<dt>Extends</dt>
|
||||
<dd><a href="Base.html">Base</a></dd>
|
||||
</dl>
|
||||
</section>
|
||||
<section>
|
||||
<h2>Properties</h2>
|
||||
<section>
|
||||
<h3 id="author"><span class="symbol-name">author</span><small class="property-type">
|
||||
string</small></h3>
|
||||
<p>ContactId for the user that produced the GroupNotification.</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="body"><span class="symbol-name">body</span><small class="property-type">
|
||||
string</small></h3>
|
||||
<p>Extra content</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="chatId"><span class="symbol-name">chatId</span><small class="property-type">
|
||||
string</small></h3>
|
||||
<p>ID for the Chat that this groupNotification was sent for.</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="id"><span class="symbol-name">id</span><small class="property-type">
|
||||
object</small></h3>
|
||||
<p>ID that represents the groupNotification</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="recipientIds"><span class="symbol-name">recipientIds</span><small class="property-type">
|
||||
Array of string</small></h3>
|
||||
<p>Contact IDs for the users that were affected by this GroupNotification.</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="timestamp"><span class="symbol-name">timestamp</span><small class="property-type">
|
||||
number</small></h3>
|
||||
<p>Unix timestamp for when the groupNotification was created</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="type"><span class="symbol-name">type</span><small class="property-type">
|
||||
<a href="global.html#GroupNotificationTypes">GroupNotificationTypes</a></small></h3>
|
||||
<p>GroupNotification type</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
</section>
|
||||
<h2>Methods</h2>
|
||||
<section>
|
||||
<h3 id="getChat"><span class="symbol-name">getChat</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing <a href="Chat.html">Chat</a></span></span></h3>
|
||||
<p>Returns the Chat this groupNotification was sent in</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p><code>Promise containing <a href="Chat.html">Chat</a></code> </p>
|
||||
</dd>
|
||||
</dl>
|
||||
<h3 id="getContact"><span class="symbol-name">getContact</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing <a href="Contact.html">Contact</a></span></span></h3>
|
||||
<p>Returns the Contact this GroupNotification was produced by</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p><code>Promise containing <a href="Contact.html">Contact</a></code> </p>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="getRecipients"><span class="symbol-name">getRecipients</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing Array of <a href="Contact.html">Contact</a></span></span></h3>
|
||||
<p>Returns the Contacts affected by this GroupNotification.</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="reply"><span class="symbol-name">reply</span><span class="signature"><span class="signature-params">(content, options)</span> → <span class="signature-returns"> Promise containing <a href="Message.html">Message</a></span></span></h3>
|
||||
<p>Sends a message to the same chat this GroupNotification was produced in.</p>
|
||||
<section>
|
||||
<h4>Parameters</h4>
|
||||
<table class="jsdoc-details-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Optional</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>content</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>(string, <a href="MessageMedia.html">MessageMedia</a>, or <a href="Location.html">Location</a>)</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>options</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>object</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<dl class="dl-compact">
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p><code>Promise containing <a href="Message.html">Message</a></code> </p>
|
||||
</dd>
|
||||
</dl>
|
||||
</section>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
<nav id="jsdoc-toc-nav" role="navigation"></nav>
|
||||
</div>
|
||||
</div>
|
||||
<footer id="jsdoc-footer" class="jsdoc-footer">
|
||||
<div id="jsdoc-footer-container">
|
||||
<p>
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on April 11, 2020.
|
||||
</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>
|
||||
@@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.0.0 » Class: Location</title>
|
||||
<title>whatsapp-web.js 1.4.1 » 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>0.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>4.<wbr>1</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.3 on February 9, 2020.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on April 11, 2020.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.0.0 » Class: Message</title>
|
||||
<title>whatsapp-web.js 1.4.1 » 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>0.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>4.<wbr>1</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -39,6 +39,9 @@
|
||||
<div class="summary-content">
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="Message.html#ack">ack</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Message.html#author">author</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
@@ -73,6 +76,9 @@
|
||||
<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">
|
||||
@@ -98,6 +104,9 @@
|
||||
<div class="summary-content">
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="Message.html#delete">delete(everyone)</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Message.html#downloadMedia">downloadMedia()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
@@ -114,13 +123,13 @@
|
||||
<dt><a href="Message.html#getMentions">getMentions()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Message.html#getQuotedMessage">getQuotedMessage()</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>
|
||||
@@ -139,6 +148,11 @@
|
||||
<section>
|
||||
<h2>Properties</h2>
|
||||
<section>
|
||||
<h3 id="ack"><span class="symbol-name">ack</span><small class="property-type">
|
||||
<a href="global.html#MessageAck">MessageAck</a></small></h3>
|
||||
<p>ACK status for the message</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="author"><span class="symbol-name">author</span><small class="property-type">
|
||||
string</small></h3>
|
||||
<p>If the message was sent to a group, this field will contain the user that sent the message.</p>
|
||||
@@ -189,6 +203,11 @@
|
||||
<p>Location information contained in the message, if the message is type "location"</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="mediaKey"><span class="symbol-name">mediaKey</span><small class="property-type">
|
||||
string</small></h3>
|
||||
<p>MediaKey that represents the sticker 'ID'</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="mentionedIds"><span class="symbol-name">mentionedIds</span><small class="property-type">
|
||||
Array of string</small></h3>
|
||||
<p>Indicates the mentions in the message body.</p>
|
||||
@@ -214,6 +233,41 @@
|
||||
</section>
|
||||
<h2>Methods</h2>
|
||||
<section>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="delete"><span class="symbol-name">delete</span><span class="signature"><span class="signature-params">(everyone)</span></span></h3>
|
||||
<p>Deletes a message from the chat</p>
|
||||
<section>
|
||||
<h4>Parameter</h4>
|
||||
<table class="jsdoc-details-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Optional</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>everyone</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>boolean</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p>If true and the message is sent by the current user, will delete it for everyone in the chat.</p>
|
||||
<p>Value can be null.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="downloadMedia"><span class="symbol-name">downloadMedia</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing <a href="MessageMedia.html">MessageMedia</a></span></span></h3>
|
||||
<p>Downloads and returns the attatched message media</p>
|
||||
@@ -333,7 +387,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.3 on February 9, 2020.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on April 11, 2020.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.0.0 » Class: MessageMedia</title>
|
||||
<title>whatsapp-web.js 1.4.1 » 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>0.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>4.<wbr>1</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -152,7 +152,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.3 on February 9, 2020.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on April 11, 2020.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.0.0 » Class: PrivateChat</title>
|
||||
<title>whatsapp-web.js 1.4.1 » 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>0.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>4.<wbr>1</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -39,6 +39,9 @@
|
||||
<div class="summary-content">
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="PrivateChat.html#archived">archived</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="PrivateChat.html#id">id</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
@@ -55,13 +58,13 @@
|
||||
<dt><a href="PrivateChat.html#name">name</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="PrivateChat.html#timestamp">timestamp</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="PrivateChat.html#timestamp">timestamp</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="PrivateChat.html#unreadCount">unreadCount</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
@@ -70,18 +73,49 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="summary-callout">
|
||||
<h2 class="summary-callout-heading">Method</h2>
|
||||
<h2 class="summary-callout-heading">Methods</h2>
|
||||
<div class="summary-content">
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="PrivateChat.html#sendMessage">sendMessage(content, options)</a></dt>
|
||||
<dt><a href="PrivateChat.html#archive">archive()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="PrivateChat.html#clearMessages">clearMessages()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="PrivateChat.html#clearState">clearState()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="PrivateChat.html#delete">delete()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="PrivateChat.html#fetchMessages">fetchMessages(searchOptions)</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="PrivateChat.html#sendMessage">sendMessage(content, options)</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="PrivateChat.html#sendSeen">sendSeen()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="PrivateChat.html#sendStateRecording">sendStateRecording()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="PrivateChat.html#sendStateTyping">sendStateTyping()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="PrivateChat.html#unarchive">unarchive()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -96,6 +130,13 @@
|
||||
<section>
|
||||
<h2>Properties</h2>
|
||||
<section>
|
||||
<h3 id="archived"><span class="symbol-name">archived</span><small class="property-type">
|
||||
unknown</small></h3>
|
||||
<p>Indicates if the Chat is archived</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Chat.html#archived">Chat#archived</a></dd>
|
||||
</dl>
|
||||
<h3 id="id"><span class="symbol-name">id</span><small class="property-type">
|
||||
unknown</small></h3>
|
||||
<p>ID that represents the chat</p>
|
||||
@@ -139,8 +180,110 @@
|
||||
<dd><a href="Chat.html#unreadCount">Chat#unreadCount</a></dd>
|
||||
</dl>
|
||||
</section>
|
||||
<h2>Method</h2>
|
||||
<h2>Methods</h2>
|
||||
<section>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="archive"><span class="symbol-name">archive</span><span class="signature"><span class="signature-params">()</span></span></h3>
|
||||
<p>Archives this chat</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Chat.html#archive">Chat#archive</a></dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="clearMessages"><span class="symbol-name">clearMessages</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing Boolean</span></span></h3>
|
||||
<p>Clears all messages from the chat</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Chat.html#clearMessages">Chat#clearMessages</a></dd>
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p>result</p>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="clearState"><span class="symbol-name">clearState</span><span class="signature"><span class="signature-params">()</span></span></h3>
|
||||
<p>Stops typing or recording in chat immediately.</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Chat.html#clearState">Chat#clearState</a></dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="delete"><span class="symbol-name">delete</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing Boolean</span></span></h3>
|
||||
<p>Deletes the chat</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Chat.html#delete">Chat#delete</a></dd>
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p>result</p>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="fetchMessages"><span class="symbol-name">fetchMessages</span><span class="signature"><span class="signature-params">(searchOptions)</span> → <span class="signature-returns"> Promise containing Array of <a href="Message.html">Message</a></span></span></h3>
|
||||
<p>Loads chat messages, sorted from earliest to latest.</p>
|
||||
<section>
|
||||
<h4>Parameters</h4>
|
||||
<table class="jsdoc-details-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Optional</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>searchOptions</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Options for searching messages. Right now only limit is supported.</p>
|
||||
<p>Values in <code>searchOptions</code> have the following properties:</p>
|
||||
<table class="jsdoc-details-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Optional</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>limit</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Yes</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>The amount of messages to return. Note that the actual number of returned messages may be smaller if there aren't enough messages in the conversation. Set this to Infinity to load all messages.</p>
|
||||
<p>Defaults to <code>50</code>.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Chat.html#fetchMessages">Chat#fetchMessages</a></dd>
|
||||
<dt>Returns</dt>
|
||||
<dd></dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="sendMessage"><span class="symbol-name">sendMessage</span><span class="signature"><span class="signature-params">(content, options)</span> → <span class="signature-returns"> Promise containing <a href="Message.html">Message</a></span></span></h3>
|
||||
<p>Send a message to this chat</p>
|
||||
@@ -193,6 +336,38 @@
|
||||
<p>Message that was just sent</p>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="sendSeen"><span class="symbol-name">sendSeen</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing Boolean</span></span></h3>
|
||||
<p>Set the message as seen</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Chat.html#sendSeen">Chat#sendSeen</a></dd>
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p>result</p>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="sendStateRecording"><span class="symbol-name">sendStateRecording</span><span class="signature"><span class="signature-params">()</span></span></h3>
|
||||
<p>Simulate recording audio in chat. This will last for 25 seconds.</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Chat.html#sendStateRecording">Chat#sendStateRecording</a></dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="sendStateTyping"><span class="symbol-name">sendStateTyping</span><span class="signature"><span class="signature-params">()</span></span></h3>
|
||||
<p>Simulate typing in chat. This will last for 25 seconds.</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Chat.html#sendStateTyping">Chat#sendStateTyping</a></dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="unarchive"><span class="symbol-name">unarchive</span><span class="signature"><span class="signature-params">()</span></span></h3>
|
||||
<p>un-archives this chat</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Chat.html#unarchive">Chat#unarchive</a></dd>
|
||||
</dl>
|
||||
</section>
|
||||
</section>
|
||||
</div>
|
||||
@@ -203,7 +378,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.3 on February 9, 2020.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on April 11, 2020.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.0.0 » Class: PrivateContact</title>
|
||||
<title>whatsapp-web.js 1.4.1 » 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>0.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>4.<wbr>1</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -220,7 +220,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.3 on February 9, 2020.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on April 11, 2020.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.0.0 » Class: Util</title>
|
||||
<title>whatsapp-web.js 1.4.1 » 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>0.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>4.<wbr>1</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.3 on February 9, 2020.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on April 11, 2020.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
340
docs/global.html
340
docs/global.html
@@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.0.0 » Globals</title>
|
||||
<title>whatsapp-web.js 1.4.1 » 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>0.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>4.<wbr>1</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -36,10 +36,16 @@
|
||||
<dt><a href="global.html#Events">Events</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="global.html#GroupNotificationTypes">GroupNotificationTypes</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="global.html#MessageAck">MessageAck</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="global.html#MessageTypes">MessageTypes</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
@@ -228,6 +234,71 @@
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>MESSAGE_ACK</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>MEDIA_UPLOADED</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>GROUP_JOIN</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>GROUP_LEAVE</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>GROUP_UPDATE</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>QR_RECEIVED</p>
|
||||
@@ -254,6 +325,269 @@
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>STATE_CHANGED</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>BATTERY_CHANGED</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-readonly">read-only</span></div>
|
||||
<h3 id="GroupNotificationTypes"><span class="symbol-name">GroupNotificationTypes</span><small class="property-type">
|
||||
string</small></h3>
|
||||
<p>Group notification types</p>
|
||||
<section>
|
||||
<h4>Properties</h4>
|
||||
<table class="jsdoc-details-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Optional</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>ADD</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>INVITE</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>REMOVE</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>LEAVE</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>SUBJECT</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>DESCRIPTION</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>PICTURE</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>ANNOUNCE</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>RESTRICT</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-readonly">read-only</span></div>
|
||||
<h3 id="MessageAck"><span class="symbol-name">MessageAck</span><small class="property-type">
|
||||
number</small></h3>
|
||||
<p>Message ACK</p>
|
||||
<section>
|
||||
<h4>Properties</h4>
|
||||
<table class="jsdoc-details-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Optional</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>ACK_ERROR</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>ACK_PENDING</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>ACK_SERVER</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>ACK_DEVICE</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>ACK_READ</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>ACK_PLAYED</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
@@ -683,7 +1017,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.3 on February 9, 2020.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on April 11, 2020.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
545
docs/index.html
545
docs/index.html
@@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.0.0 » Home</title>
|
||||
<title>whatsapp-web.js 1.4.1 » 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>0.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>4.<wbr>1</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -27,11 +27,11 @@
|
||||
<div id="jsdoc-main" role="main">
|
||||
<header class="page-header">
|
||||
<h1>
|
||||
whatsapp-web.js 1.0.0
|
||||
whatsapp-web.js 1.4.1
|
||||
</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-0.4.612-brightgreen.svg" alt="WhatsApp_Web 0.4.612"></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.2013.7-brightgreen.svg" alt="WhatsApp_Web 2.2013.7"></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>
|
||||
@@ -84,7 +84,7 @@ client.initialize();
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Send media (video)</td>
|
||||
<td><em>pending</em></td>
|
||||
<td>✅ <a href="https://github.com/pedroslopez/whatsapp-web.js/issues/78#issuecomment-592723583">(requires google chrome)</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Send stickers</td>
|
||||
@@ -155,11 +155,27 @@ client.initialize();
|
||||
<p>Something missing? Make an issue and let us know!</p>
|
||||
<h2>Links</h2>
|
||||
<ul>
|
||||
<li><a href="https://pedroslopez.me/whatsapp-web.js">Documentation</a> <em>(preview)</em></li>
|
||||
<li><a href="https://pedroslopez.me/whatsapp-web.js">Reference</a></li>
|
||||
<li><a href="https://waguide.pedroslopez.me/">Guide</a> <em>(work in progress)</em></li>
|
||||
<li><a href="https://github.com/pedroslopez/whatsapp-web.js">GitHub</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>
|
||||
<p>You can support the maintainer of this project through the link below</p>
|
||||
<p><a href="https://www.paypal.me/psla/"><img src="https://cdn.rawgit.com/twolfson/paypal-github-button/1.0.0/dist/button.svg" alt="Support via PayPal"></a></p>
|
||||
<h2>Disclaimer</h2>
|
||||
<p>This project is not affiliated, associated, authorized, endorsed by, or in any way officially connected with WhatsApp or any of its subsidiaries or its affiliates. The official WhatsApp website can be found at https://whatsapp.com. "WhatsApp" as well as related names, marks, emblems and images are registered trademarks of their respective owners.</p>
|
||||
<h2>License</h2>
|
||||
<p>Copyright 2019 Pedro S Lopez</p>
|
||||
<p>Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this project except in compliance with the License.
|
||||
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.</p>
|
||||
<p>Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.</p>
|
||||
</article>
|
||||
<div class="symbol-index">
|
||||
<section>
|
||||
@@ -291,6 +307,40 @@ client.initialize();
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="Chat.html#archive" class="!symbol-index-name">Chat#<wbr>archive()</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="Chat.html#archived" class="!symbol-index-name">Chat#<wbr>archived</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="Chat.html#clearMessages" class="!symbol-index-name">Chat#<wbr>clearMessages()</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="Chat.html#clearState" class="!symbol-index-name">Chat#<wbr>clearState()</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="Chat.html#delete" class="!symbol-index-name">Chat#<wbr>delete()</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="symbol-index-column">
|
||||
<dl class="symbol-index-list">
|
||||
<dt class="symbol-index-name">
|
||||
<a href="Chat.html#fetchMessages" class="!symbol-index-name">Chat#<wbr>fetchMessages(searchOptions)</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="Chat.html#id" class="!symbol-index-name">Chat#<wbr>id</a>
|
||||
</dt>
|
||||
@@ -301,10 +351,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="Chat.html#isReadOnly" class="!symbol-index-name">Chat#<wbr>isReadOnly</a>
|
||||
</dt>
|
||||
@@ -324,11 +370,31 @@ client.initialize();
|
||||
</div>
|
||||
<div class="symbol-index-column">
|
||||
<dl class="symbol-index-list">
|
||||
<dt class="symbol-index-name">
|
||||
<a href="Chat.html#sendSeen" class="!symbol-index-name">Chat#<wbr>sendSeen()</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="Chat.html#sendStateRecording" class="!symbol-index-name">Chat#<wbr>sendStateRecording()</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="Chat.html#sendStateTyping" class="!symbol-index-name">Chat#<wbr>sendStateTyping()</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="Chat.html#timestamp" class="!symbol-index-name">Chat#<wbr>timestamp</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="Chat.html#unarchive" class="!symbol-index-name">Chat#<wbr>unarchive()</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="Chat.html#unreadCount" class="!symbol-index-name">Chat#<wbr>unreadCount</a>
|
||||
</dt>
|
||||
@@ -389,6 +455,16 @@ client.initialize();
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="Client.html#archiveChat" class="!symbol-index-name">Client#<wbr>archiveChat()</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="Client.html#createGroup" class="!symbol-index-name">Client#<wbr>createGroup(name, participants)</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="Client.html#destroy" class="!symbol-index-name">Client#<wbr>destroy()</a>
|
||||
</dt>
|
||||
@@ -404,20 +480,55 @@ client.initialize();
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="Client.html#event:change_battery" class="!symbol-index-name">Client#<wbr>event:change_battery</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="Client.html#event:change_state" class="!symbol-index-name">Client#<wbr>event:change_state</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="Client.html#event:disconnected" class="!symbol-index-name">Client#<wbr>event:disconnected</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="Client.html#event:group_join" class="!symbol-index-name">Client#<wbr>event:group_join</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="Client.html#event:group_leave" class="!symbol-index-name">Client#<wbr>event:group_leave</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:group_update" class="!symbol-index-name">Client#<wbr>event:group_update</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="Client.html#event:media_uploaded" class="!symbol-index-name">Client#<wbr>event:media_uploaded</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="Client.html#event:message" class="!symbol-index-name">Client#<wbr>event:message</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_ack" class="!symbol-index-name">Client#<wbr>event:message_ack</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="Client.html#event:message_create" class="!symbol-index-name">Client#<wbr>event:message_create</a>
|
||||
</dt>
|
||||
@@ -453,35 +564,65 @@ 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#getContactById" class="!symbol-index-name">Client#<wbr>getContactById(contactId)</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#getContacts" class="!symbol-index-name">Client#<wbr>getContacts()</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="Client.html#getState" class="!symbol-index-name">Client#<wbr>getState()</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="Client.html#getWWebVersion" class="!symbol-index-name">Client#<wbr>getWWebVersion()</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="Client.html#initialize" class="!symbol-index-name">Client#<wbr>initialize()</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="Client.html#isRegisteredUser" class="!symbol-index-name">Client#<wbr>isRegisteredUser()</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="Client.html#resetState" class="!symbol-index-name">Client#<wbr>resetState()</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="Client.html#sendMessage" class="!symbol-index-name">Client#<wbr>sendMessage(chatId, content, options)</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="Client.html#sendSeen" class="!symbol-index-name">Client#<wbr>sendSeen(chatId)</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="Client.html#setStatus" class="!symbol-index-name">Client#<wbr>setStatus(status)</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="Client.html#unarchiveChat" class="!symbol-index-name">Client#<wbr>unarchiveChat()</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
@@ -636,15 +777,45 @@ client.initialize();
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="global.html#Events#.BATTERY_CHANGED" class="!symbol-index-name">Events.<wbr>BATTERY_CHANGED</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="global.html#Events#.DISCONNECTED" class="!symbol-index-name">Events.<wbr>DISCONNECTED</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="global.html#Events#.GROUP_JOIN" class="!symbol-index-name">Events.<wbr>GROUP_JOIN</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="global.html#Events#.GROUP_LEAVE" class="!symbol-index-name">Events.<wbr>GROUP_LEAVE</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="symbol-index-column">
|
||||
<dl class="symbol-index-list">
|
||||
<dt class="symbol-index-name">
|
||||
<a href="global.html#Events#.GROUP_UPDATE" class="!symbol-index-name">Events.<wbr>GROUP_UPDATE</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="global.html#Events#.MEDIA_UPLOADED" class="!symbol-index-name">Events.<wbr>MEDIA_UPLOADED</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="global.html#Events#.MESSAGE_ACK" class="!symbol-index-name">Events.<wbr>MESSAGE_ACK</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="global.html#Events#.MESSAGE_CREATE" class="!symbol-index-name">Events.<wbr>MESSAGE_CREATE</a>
|
||||
</dt>
|
||||
@@ -679,6 +850,11 @@ client.initialize();
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="global.html#Events#.STATE_CHANGED" class="!symbol-index-name">Events.<wbr>STATE_CHANGED</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
@@ -710,30 +886,60 @@ client.initialize();
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="GroupChat.html#archive" class="!symbol-index-name">GroupChat#<wbr>archive()</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="GroupChat.html#archived" class="!symbol-index-name">GroupChat#<wbr>archived</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="GroupChat.html#clearMessages" class="!symbol-index-name">GroupChat#<wbr>clearMessages()</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="GroupChat.html#clearState" class="!symbol-index-name">GroupChat#<wbr>clearState()</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="GroupChat.html#createdAt" class="!symbol-index-name">GroupChat#<wbr>createdAt</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="GroupChat.html#delete" class="!symbol-index-name">GroupChat#<wbr>delete()</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="GroupChat.html#demoteParticipants" class="!symbol-index-name">GroupChat#<wbr>demoteParticipants(participantIds)</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="symbol-index-column">
|
||||
<dl class="symbol-index-list">
|
||||
<dt class="symbol-index-name">
|
||||
<a href="GroupChat.html#description" class="!symbol-index-name">GroupChat#<wbr>description</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="GroupChat.html#fetchMessages" class="!symbol-index-name">GroupChat#<wbr>fetchMessages(searchOptions)</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="GroupChat.html#getInviteCode" class="!symbol-index-name">GroupChat#<wbr>getInviteCode()</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="symbol-index-column">
|
||||
<dl class="symbol-index-list">
|
||||
<dt class="symbol-index-name">
|
||||
<a href="GroupChat.html#id" class="!symbol-index-name">GroupChat#<wbr>id</a>
|
||||
</dt>
|
||||
@@ -793,6 +999,21 @@ client.initialize();
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="GroupChat.html#sendSeen" class="!symbol-index-name">GroupChat#<wbr>sendSeen()</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="GroupChat.html#sendStateRecording" class="!symbol-index-name">GroupChat#<wbr>sendStateRecording()</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="GroupChat.html#sendStateTyping" class="!symbol-index-name">GroupChat#<wbr>sendStateTyping()</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="GroupChat.html#setDescription" class="!symbol-index-name">GroupChat#<wbr>setDescription(description)</a>
|
||||
</dt>
|
||||
@@ -808,6 +1029,11 @@ client.initialize();
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="GroupChat.html#unarchive" class="!symbol-index-name">GroupChat#<wbr>unarchive()</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="GroupChat.html#unreadCount" class="!symbol-index-name">GroupChat#<wbr>unreadCount</a>
|
||||
</dt>
|
||||
@@ -818,6 +1044,149 @@ client.initialize();
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section>
|
||||
<div class="symbol-index-content">
|
||||
<h2 id="GroupNotification">GroupNotification</h2>
|
||||
<div class="symbol-index-section">
|
||||
<div class="symbol-index-column">
|
||||
<dl class="symbol-index-list">
|
||||
<dt class="symbol-index-name">
|
||||
<a href="GroupNotification.html" class="!symbol-index-name">GroupNotification()</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="GroupNotification.html#author" class="!symbol-index-name">GroupNotification#<wbr>author</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="GroupNotification.html#body" class="!symbol-index-name">GroupNotification#<wbr>body</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="GroupNotification.html#chatId" class="!symbol-index-name">GroupNotification#<wbr>chatId</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="symbol-index-column">
|
||||
<dl class="symbol-index-list">
|
||||
<dt class="symbol-index-name">
|
||||
<a href="GroupNotification.html#getChat" class="!symbol-index-name">GroupNotification#<wbr>getChat()</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="GroupNotification.html#getContact" class="!symbol-index-name">GroupNotification#<wbr>getContact()</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="GroupNotification.html#getRecipients" class="!symbol-index-name">GroupNotification#<wbr>getRecipients()</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="GroupNotification.html#id" class="!symbol-index-name">GroupNotification#<wbr>id</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="symbol-index-column">
|
||||
<dl class="symbol-index-list">
|
||||
<dt class="symbol-index-name">
|
||||
<a href="GroupNotification.html#recipientIds" class="!symbol-index-name">GroupNotification#<wbr>recipientIds</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="GroupNotification.html#reply" class="!symbol-index-name">GroupNotification#<wbr>reply(content, options)</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="GroupNotification.html#timestamp" class="!symbol-index-name">GroupNotification#<wbr>timestamp</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="GroupNotification.html#type" class="!symbol-index-name">GroupNotification#<wbr>type</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section>
|
||||
<div class="symbol-index-content">
|
||||
<h2 id="GroupNotificationTypes">GroupNotificationTypes</h2>
|
||||
<div class="symbol-index-section">
|
||||
<div class="symbol-index-column">
|
||||
<dl class="symbol-index-list">
|
||||
<dt class="symbol-index-name">
|
||||
<a href="global.html#GroupNotificationTypes#.ADD" class="!symbol-index-name">GroupNotificationTypes.<wbr>ADD</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="global.html#GroupNotificationTypes#.ANNOUNCE" class="!symbol-index-name">GroupNotificationTypes.<wbr>ANNOUNCE</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="global.html#GroupNotificationTypes#.DESCRIPTION" class="!symbol-index-name">GroupNotificationTypes.<wbr>DESCRIPTION</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="symbol-index-column">
|
||||
<dl class="symbol-index-list">
|
||||
<dt class="symbol-index-name">
|
||||
<a href="global.html#GroupNotificationTypes#.INVITE" class="!symbol-index-name">GroupNotificationTypes.<wbr>INVITE</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="global.html#GroupNotificationTypes#.LEAVE" class="!symbol-index-name">GroupNotificationTypes.<wbr>LEAVE</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="global.html#GroupNotificationTypes#.PICTURE" class="!symbol-index-name">GroupNotificationTypes.<wbr>PICTURE</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="symbol-index-column">
|
||||
<dl class="symbol-index-list">
|
||||
<dt class="symbol-index-name">
|
||||
<a href="global.html#GroupNotificationTypes#.REMOVE" class="!symbol-index-name">GroupNotificationTypes.<wbr>REMOVE</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="global.html#GroupNotificationTypes#.RESTRICT" class="!symbol-index-name">GroupNotificationTypes.<wbr>RESTRICT</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="global.html#GroupNotificationTypes#.SUBJECT" class="!symbol-index-name">GroupNotificationTypes.<wbr>SUBJECT</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section>
|
||||
<div class="symbol-index-content">
|
||||
<h2 id="Location">Location</h2>
|
||||
@@ -868,6 +1237,11 @@ client.initialize();
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="Message.html#ack" class="!symbol-index-name">Message#<wbr>ack</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="Message.html#author" class="!symbol-index-name">Message#<wbr>author</a>
|
||||
</dt>
|
||||
@@ -883,6 +1257,11 @@ client.initialize();
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="Message.html#delete" class="!symbol-index-name">Message#<wbr>delete(everyone)</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="Message.html#downloadMedia" class="!symbol-index-name">Message#<wbr>downloadMedia()</a>
|
||||
</dt>
|
||||
@@ -893,15 +1272,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#fromMe" class="!symbol-index-name">Message#<wbr>fromMe</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#getChat" class="!symbol-index-name">Message#<wbr>getChat()</a>
|
||||
</dt>
|
||||
@@ -951,6 +1330,11 @@ client.initialize();
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="Message.html#mediaKey" class="!symbol-index-name">Message#<wbr>mediaKey</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="Message.html#mentionedIds" class="!symbol-index-name">Message#<wbr>mentionedIds</a>
|
||||
</dt>
|
||||
@@ -981,6 +1365,55 @@ client.initialize();
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section>
|
||||
<div class="symbol-index-content">
|
||||
<h2 id="MessageAck">MessageAck</h2>
|
||||
<div class="symbol-index-section">
|
||||
<div class="symbol-index-column">
|
||||
<dl class="symbol-index-list">
|
||||
<dt class="symbol-index-name">
|
||||
<a href="global.html#MessageAck#.ACK_DEVICE" class="!symbol-index-name">MessageAck.<wbr>ACK_DEVICE</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="global.html#MessageAck#.ACK_ERROR" class="!symbol-index-name">MessageAck.<wbr>ACK_ERROR</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="symbol-index-column">
|
||||
<dl class="symbol-index-list">
|
||||
<dt class="symbol-index-name">
|
||||
<a href="global.html#MessageAck#.ACK_PENDING" class="!symbol-index-name">MessageAck.<wbr>ACK_PENDING</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="global.html#MessageAck#.ACK_PLAYED" class="!symbol-index-name">MessageAck.<wbr>ACK_PLAYED</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="symbol-index-column">
|
||||
<dl class="symbol-index-list">
|
||||
<dt class="symbol-index-name">
|
||||
<a href="global.html#MessageAck#.ACK_READ" class="!symbol-index-name">MessageAck.<wbr>ACK_READ</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="global.html#MessageAck#.ACK_SERVER" class="!symbol-index-name">MessageAck.<wbr>ACK_SERVER</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section>
|
||||
<div class="symbol-index-content">
|
||||
<h2 id="MessageMedia">MessageMedia</h2>
|
||||
@@ -1110,6 +1543,40 @@ client.initialize();
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="PrivateChat.html#archive" class="!symbol-index-name">PrivateChat#<wbr>archive()</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="PrivateChat.html#archived" class="!symbol-index-name">PrivateChat#<wbr>archived</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="PrivateChat.html#clearMessages" class="!symbol-index-name">PrivateChat#<wbr>clearMessages()</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="PrivateChat.html#clearState" class="!symbol-index-name">PrivateChat#<wbr>clearState()</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="PrivateChat.html#delete" class="!symbol-index-name">PrivateChat#<wbr>delete()</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="symbol-index-column">
|
||||
<dl class="symbol-index-list">
|
||||
<dt class="symbol-index-name">
|
||||
<a href="PrivateChat.html#fetchMessages" class="!symbol-index-name">PrivateChat#<wbr>fetchMessages(searchOptions)</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="PrivateChat.html#id" class="!symbol-index-name">PrivateChat#<wbr>id</a>
|
||||
</dt>
|
||||
@@ -1120,10 +1587,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="PrivateChat.html#isReadOnly" class="!symbol-index-name">PrivateChat#<wbr>isReadOnly</a>
|
||||
</dt>
|
||||
@@ -1143,11 +1606,31 @@ client.initialize();
|
||||
</div>
|
||||
<div class="symbol-index-column">
|
||||
<dl class="symbol-index-list">
|
||||
<dt class="symbol-index-name">
|
||||
<a href="PrivateChat.html#sendSeen" class="!symbol-index-name">PrivateChat#<wbr>sendSeen()</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="PrivateChat.html#sendStateRecording" class="!symbol-index-name">PrivateChat#<wbr>sendStateRecording()</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="PrivateChat.html#sendStateTyping" class="!symbol-index-name">PrivateChat#<wbr>sendStateTyping()</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="PrivateChat.html#timestamp" class="!symbol-index-name">PrivateChat#<wbr>timestamp</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="PrivateChat.html#unarchive" class="!symbol-index-name">PrivateChat#<wbr>unarchive()</a>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt class="symbol-index-name">
|
||||
<a href="PrivateChat.html#unreadCount" class="!symbol-index-name">PrivateChat#<wbr>unreadCount</a>
|
||||
</dt>
|
||||
@@ -1393,7 +1876,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.3 on February 9, 2020.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on April 11, 2020.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
treeNode.tree({
|
||||
autoEscape: false,
|
||||
closedIcon: '⇢',
|
||||
data: [{"label":"<a href=\"global.html\">Globals</a>","id":"global","children":[]},{"label":"<a href=\"Base.html\">Base</a>","id":"Base","children":[]},{"label":"<a href=\"BusinessContact.html\">BusinessContact</a>","id":"BusinessContact","children":[]},{"label":"<a href=\"Chat.html\">Chat</a>","id":"Chat","children":[]},{"label":"<a href=\"Client.html\">Client</a>","id":"Client","children":[]},{"label":"<a href=\"ClientInfo.html\">ClientInfo</a>","id":"ClientInfo","children":[]},{"label":"<a href=\"Contact.html\">Contact</a>","id":"Contact","children":[]},{"label":"<a href=\"GroupChat.html\">GroupChat</a>","id":"GroupChat","children":[]},{"label":"<a href=\"Location.html\">Location</a>","id":"Location","children":[]},{"label":"<a href=\"Message.html\">Message</a>","id":"Message","children":[]},{"label":"<a href=\"MessageMedia.html\">MessageMedia</a>","id":"MessageMedia","children":[]},{"label":"<a href=\"PrivateChat.html\">PrivateChat</a>","id":"PrivateChat","children":[]},{"label":"<a href=\"PrivateContact.html\">PrivateContact</a>","id":"PrivateContact","children":[]},{"label":"<a href=\"Util.html\">Util</a>","id":"Util","children":[]}],
|
||||
data: [{"label":"<a href=\"global.html\">Globals</a>","id":"global","children":[]},{"label":"<a href=\"Base.html\">Base</a>","id":"Base","children":[]},{"label":"<a href=\"BusinessContact.html\">BusinessContact</a>","id":"BusinessContact","children":[]},{"label":"<a href=\"Chat.html\">Chat</a>","id":"Chat","children":[]},{"label":"<a href=\"Client.html\">Client</a>","id":"Client","children":[]},{"label":"<a href=\"ClientInfo.html\">ClientInfo</a>","id":"ClientInfo","children":[]},{"label":"<a href=\"Contact.html\">Contact</a>","id":"Contact","children":[]},{"label":"<a href=\"GroupChat.html\">GroupChat</a>","id":"GroupChat","children":[]},{"label":"<a href=\"GroupNotification.html\">GroupNotification</a>","id":"GroupNotification","children":[]},{"label":"<a href=\"Location.html\">Location</a>","id":"Location","children":[]},{"label":"<a href=\"Message.html\">Message</a>","id":"Message","children":[]},{"label":"<a href=\"MessageMedia.html\">MessageMedia</a>","id":"MessageMedia","children":[]},{"label":"<a href=\"PrivateChat.html\">PrivateChat</a>","id":"PrivateChat","children":[]},{"label":"<a href=\"PrivateContact.html\">PrivateContact</a>","id":"PrivateContact","children":[]},{"label":"<a href=\"Util.html\">Util</a>","id":"Util","children":[]}],
|
||||
openedIcon: ' ⇣',
|
||||
saveState: false,
|
||||
useContextMenu: false
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.0.0 » Source: structures/Base.js</title>
|
||||
<title>whatsapp-web.js 1.4.1 » 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>0.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>4.<wbr>1</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -60,7 +60,7 @@ module.exports = 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.3 on February 9, 2020.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on April 11, 2020.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.0.0 » Source: structures/BusinessContact.js</title>
|
||||
<title>whatsapp-web.js 1.4.1 » 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>0.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>4.<wbr>1</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -59,7 +59,7 @@ module.exports = 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.3 on February 9, 2020.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on April 11, 2020.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.0.0 » Source: structures/Chat.js</title>
|
||||
<title>whatsapp-web.js 1.4.1 » 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>0.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>4.<wbr>1</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -32,6 +32,7 @@
|
||||
<pre class="prettyprint linenums"><code>'use strict';
|
||||
|
||||
const Base = require('./Base');
|
||||
const Message = require('./Message');
|
||||
|
||||
/**
|
||||
* Represents a Chat on WhatsApp
|
||||
@@ -41,7 +42,7 @@ class Chat extends Base {
|
||||
constructor(client, data) {
|
||||
super(client);
|
||||
|
||||
if(data) this._patch(data);
|
||||
if (data) this._patch(data);
|
||||
}
|
||||
|
||||
_patch(data) {
|
||||
@@ -81,6 +82,12 @@ class Chat extends Base {
|
||||
*/
|
||||
this.timestamp = data.t;
|
||||
|
||||
/**
|
||||
* Indicates if the Chat is archived
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.archived = data.archive;
|
||||
|
||||
return super._patch(data);
|
||||
}
|
||||
|
||||
@@ -93,9 +100,112 @@ class Chat extends Base {
|
||||
async sendMessage(content, options) {
|
||||
return this.client.sendMessage(this.id._serialized, content, options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the message as seen
|
||||
* @returns {Promise&lt;Boolean>} result
|
||||
*/
|
||||
async sendSeen() {
|
||||
return this.client.sendSeen(this.id._serialized);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears all messages from the chat
|
||||
* @returns {Promise&lt;Boolean>} result
|
||||
*/
|
||||
async clearMessages() {
|
||||
return this.client.pupPage.evaluate(chatId => {
|
||||
return window.WWebJS.sendClearChat(chatId);
|
||||
}, this.id._serialized);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the chat
|
||||
* @returns {Promise&lt;Boolean>} result
|
||||
*/
|
||||
async delete() {
|
||||
return this.client.pupPage.evaluate(chatId => {
|
||||
return window.WWebJS.sendDeleteChat(chatId);
|
||||
}, this.id._serialized);
|
||||
}
|
||||
|
||||
/**
|
||||
* Archives this chat
|
||||
*/
|
||||
async archive() {
|
||||
return this.client.archiveChat(this.id._serialized);
|
||||
}
|
||||
|
||||
/**
|
||||
* un-archives this chat
|
||||
*/
|
||||
async unarchive() {
|
||||
return this.client.unarchiveChat(this.id._serialized);
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads chat messages, sorted from earliest to latest.
|
||||
* @param {Object} searchOptions Options for searching messages. Right now only limit is supported.
|
||||
* @param {Number} [searchOptions.limit=50] The amount of messages to return. Note that the actual number of returned messages may be smaller if there aren't enough messages in the conversation. Set this to Infinity to load all messages.
|
||||
* @returns {Promise&lt;Array&lt;Message>>}
|
||||
*/
|
||||
async fetchMessages(searchOptions) {
|
||||
if(!searchOptions || !searchOptions.limit) {
|
||||
searchOptions = {limit: 50};
|
||||
}
|
||||
let messages = await this.client.pupPage.evaluate(async (chatId, limit) => {
|
||||
const msgFilter = m => !m.isNotification; // dont include notification messages
|
||||
|
||||
const chat = window.Store.Chat.get(chatId);
|
||||
let msgs = chat.msgs.models.filter(msgFilter);
|
||||
|
||||
while(msgs.length &lt; limit) {
|
||||
const loadedMessages = await chat.loadEarlierMsgs();
|
||||
if(!loadedMessages) break;
|
||||
msgs = [...loadedMessages.filter(msgFilter), ...msgs];
|
||||
}
|
||||
|
||||
msgs.sort((a, b) => (a.t > b.t) ? 1 : -1);
|
||||
return msgs.splice(msgs.length - limit).map(m => m.serialize());
|
||||
|
||||
}, this.id._serialized, searchOptions.limit);
|
||||
|
||||
return messages.map(m => new Message(this.client, m));
|
||||
}
|
||||
|
||||
/**
|
||||
* Simulate typing in chat. This will last for 25 seconds.
|
||||
*/
|
||||
async sendStateTyping() {
|
||||
return this.client.pupPage.evaluate(chatId => {
|
||||
window.WWebJS.sendChatstate('typing', chatId);
|
||||
return true;
|
||||
}, this.id._serialized);
|
||||
}
|
||||
|
||||
/**
|
||||
* Simulate recording audio in chat. This will last for 25 seconds.
|
||||
*/
|
||||
async sendStateRecording() {
|
||||
return this.client.pupPage.evaluate(chatId => {
|
||||
window.WWebJS.sendChatstate('recording', chatId);
|
||||
return true;
|
||||
}, this.id._serialized);
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops typing or recording in chat immediately.
|
||||
*/
|
||||
async clearState() {
|
||||
return this.client.pupPage.evaluate(chatId => {
|
||||
window.WWebJS.sendChatstate('stop', chatId);
|
||||
return true;
|
||||
}, this.id._serialized);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Chat;</code></pre>
|
||||
module.exports = Chat;
|
||||
</code></pre>
|
||||
</article>
|
||||
</div>
|
||||
</div>
|
||||
@@ -105,7 +215,7 @@ module.exports = Chat;</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.3 on February 9, 2020.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on April 11, 2020.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.0.0 » Source: structures/ClientInfo.js</title>
|
||||
<title>whatsapp-web.js 1.4.1 » 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>0.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>4.<wbr>1</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -89,7 +89,7 @@ module.exports = 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.3 on February 9, 2020.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on April 11, 2020.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.0.0 » Source: structures/Contact.js</title>
|
||||
<title>whatsapp-web.js 1.4.1 » 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>0.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>4.<wbr>1</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -153,7 +153,7 @@ module.exports = 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.3 on February 9, 2020.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on April 11, 2020.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.0.0 » Source: structures/GroupChat.js</title>
|
||||
<title>whatsapp-web.js 1.4.1 » 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>0.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>4.<wbr>1</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -209,7 +209,7 @@ module.exports = 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.3 on February 9, 2020.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on April 11, 2020.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
158
docs/structures_GroupNotification.js.html
Normal file
158
docs/structures_GroupNotification.js.html
Normal file
@@ -0,0 +1,158 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.4.1 » 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">
|
||||
<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>4.<wbr>1</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/GroupNotification.js</h1>
|
||||
</header>
|
||||
<article>
|
||||
<pre class="prettyprint linenums"><code>'use strict';
|
||||
|
||||
const Base = require('./Base');
|
||||
|
||||
/**
|
||||
* Represents a GroupNotification on WhatsApp
|
||||
* @extends {Base}
|
||||
*/
|
||||
class GroupNotification extends Base {
|
||||
constructor(client, data) {
|
||||
super(client);
|
||||
|
||||
if(data) this._patch(data);
|
||||
}
|
||||
|
||||
_patch(data) {
|
||||
/**
|
||||
* ID that represents the groupNotification
|
||||
* @type {object}
|
||||
*/
|
||||
this.id = data.id;
|
||||
|
||||
/**
|
||||
* Extra content
|
||||
* @type {string}
|
||||
*/
|
||||
this.body = data.body || '';
|
||||
|
||||
/**
|
||||
* GroupNotification type
|
||||
* @type {GroupNotificationTypes}
|
||||
*/
|
||||
this.type = data.subtype;
|
||||
|
||||
/**
|
||||
* Unix timestamp for when the groupNotification was created
|
||||
* @type {number}
|
||||
*/
|
||||
this.timestamp = data.t;
|
||||
|
||||
/**
|
||||
* ID for the Chat that this groupNotification was sent for.
|
||||
*
|
||||
* @type {string}
|
||||
*/
|
||||
this.chatId = typeof (data.from) === 'object' ? data.from._serialized : data.from;
|
||||
|
||||
/**
|
||||
* ContactId for the user that produced the GroupNotification.
|
||||
* @type {string}
|
||||
*/
|
||||
this.author = typeof (data.author) === 'object' ? data.author._serialized : data.author;
|
||||
|
||||
/**
|
||||
* Contact IDs for the users that were affected by this GroupNotification.
|
||||
* @type {Array&lt;string>}
|
||||
*/
|
||||
this.recipientIds = [];
|
||||
|
||||
if (data.recipients) {
|
||||
this.recipientIds = data.recipients;
|
||||
}
|
||||
|
||||
return super._patch(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Chat this groupNotification was sent in
|
||||
* @returns {Promise&lt;Chat>}
|
||||
*/
|
||||
getChat() {
|
||||
return this.client.getChatById(this.chatId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Contact this GroupNotification was produced by
|
||||
* @returns {Promise&lt;Contact>}
|
||||
*/
|
||||
getContact() {
|
||||
return this.client.getContactById(this.author);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Contacts affected by this GroupNotification.
|
||||
* @returns {Promise&lt;Array&lt;Contact>>}
|
||||
*/
|
||||
async getRecipients() {
|
||||
return await Promise.all(this.recipientIds.map(async m => await this.client.getContactById(m)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a message to the same chat this GroupNotification was produced in.
|
||||
*
|
||||
* @param {string|MessageMedia|Location} content
|
||||
* @param {object} options
|
||||
* @returns {Promise&lt;Message>}
|
||||
*/
|
||||
async reply(content, options={}) {
|
||||
return this.client.sendMessage(this.chatId, content, options);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = GroupNotification;
|
||||
</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.3 on April 11, 2020.
|
||||
</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>
|
||||
@@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.0.0 » Source: structures/Location.js</title>
|
||||
<title>whatsapp-web.js 1.4.1 » 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>0.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>4.<wbr>1</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -71,7 +71,7 @@ module.exports = 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.3 on February 9, 2020.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on April 11, 2020.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.0.0 » Source: structures/Message.js</title>
|
||||
<title>whatsapp-web.js 1.4.1 » 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>0.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>4.<wbr>1</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -48,12 +48,25 @@ class Message extends Base {
|
||||
}
|
||||
|
||||
_patch(data) {
|
||||
/**
|
||||
* MediaKey that represents the sticker 'ID'
|
||||
* @type {string}
|
||||
*/
|
||||
this.mediaKey = data.mediaKey;
|
||||
|
||||
|
||||
/**
|
||||
* ID that represents the message
|
||||
* @type {object}
|
||||
*/
|
||||
this.id = data.id;
|
||||
|
||||
/**
|
||||
* ACK status for the message
|
||||
* @type {MessageAck}
|
||||
*/
|
||||
this.ack = data.ack;
|
||||
|
||||
/**
|
||||
* Indicates if the message has media available for download
|
||||
* @type {boolean}
|
||||
@@ -217,8 +230,19 @@ class Message extends Base {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const {data, mimetype, filename} = await this.client.pupPage.evaluate(async (msgId) => {
|
||||
const result = await this.client.pupPage.evaluate(async (msgId) => {
|
||||
const msg = window.Store.Msg.get(msgId);
|
||||
|
||||
if(msg.mediaData.mediaStage != 'RESOLVED') {
|
||||
// try to resolve media
|
||||
await msg.downloadMedia(true, 1);
|
||||
}
|
||||
|
||||
if(msg.mediaData.mediaStage.includes('ERROR')) {
|
||||
// media could not be downloaded
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const buffer = await window.WWebJS.downloadBuffer(msg.clientUrl);
|
||||
const decrypted = await window.Store.CryptoLib.decryptE2EMedia(msg.type, buffer, msg.mediaKey, msg.mimetype);
|
||||
const data = await window.WWebJS.readBlobAsync(decrypted._blob);
|
||||
@@ -231,7 +255,24 @@ class Message extends Base {
|
||||
|
||||
}, this.id._serialized);
|
||||
|
||||
return new MessageMedia(mimetype, data, filename);
|
||||
if(!result) return undefined;
|
||||
return new MessageMedia(result.mimetype, result.data, result.filename);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a message from the chat
|
||||
* @param {?boolean} everyone If true and the message is sent by the current user, will delete it for everyone in the chat.
|
||||
*/
|
||||
async delete(everyone) {
|
||||
await this.client.pupPage.evaluate((msgId, everyone) => {
|
||||
let msg = window.Store.Msg.get(msgId);
|
||||
|
||||
if(everyone &amp;&amp; msg.id.fromMe &amp;&amp; msg.canRevoke()) {
|
||||
return window.Store.Cmd.sendRevokeMsgs(msg.chat, [msg], true);
|
||||
}
|
||||
|
||||
return window.Store.Cmd.sendDeleteMsgs(msg.chat, [msg], true);
|
||||
}, this.id._serialized, everyone);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,7 +287,7 @@ module.exports = 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.3 on February 9, 2020.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on April 11, 2020.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.0.0 » Source: structures/MessageMedia.js</title>
|
||||
<title>whatsapp-web.js 1.4.1 » 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>0.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>4.<wbr>1</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -69,7 +69,7 @@ module.exports = 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.3 on February 9, 2020.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on April 11, 2020.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.0.0 » Source: structures/PrivateChat.js</title>
|
||||
<title>whatsapp-web.js 1.4.1 » 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>0.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>4.<wbr>1</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -51,7 +51,7 @@ module.exports = 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.3 on February 9, 2020.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on April 11, 2020.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.0.0 » Source: structures/PrivateContact.js</title>
|
||||
<title>whatsapp-web.js 1.4.1 » 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>0.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>4.<wbr>1</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -51,7 +51,7 @@ module.exports = 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.3 on February 9, 2020.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on April 11, 2020.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.0.0 » Source: util/Constants.js</title>
|
||||
<title>whatsapp-web.js 1.4.1 » 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>0.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>4.<wbr>1</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -39,7 +39,10 @@ exports.DefaultOptions = {
|
||||
puppeteer: {
|
||||
headless: true
|
||||
},
|
||||
session: false
|
||||
session: false,
|
||||
qrTimeoutMs: 45000,
|
||||
qrRefreshIntervalMs: 20000,
|
||||
authTimeoutMs: 45000,
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -66,8 +69,15 @@ exports.Events = {
|
||||
MESSAGE_CREATE: 'message_create',
|
||||
MESSAGE_REVOKED_EVERYONE: 'message_revoke_everyone',
|
||||
MESSAGE_REVOKED_ME: 'message_revoke_me',
|
||||
MESSAGE_ACK: 'message_ack',
|
||||
MEDIA_UPLOADED: 'media_uploaded',
|
||||
GROUP_JOIN: 'group_join',
|
||||
GROUP_LEAVE: 'group_leave',
|
||||
GROUP_UPDATE: 'group_update',
|
||||
QR_RECEIVED: 'qr',
|
||||
DISCONNECTED: 'disconnected'
|
||||
DISCONNECTED: 'disconnected',
|
||||
STATE_CHANGED: 'change_state',
|
||||
BATTERY_CHANGED: 'change_battery'
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -90,6 +100,23 @@ exports.MessageTypes = {
|
||||
UNKNOWN: 'unknown'
|
||||
};
|
||||
|
||||
/**
|
||||
* Group notification types
|
||||
* @readonly
|
||||
* @enum {string}
|
||||
*/
|
||||
exports.GroupNotificationTypes = {
|
||||
ADD: 'add',
|
||||
INVITE: 'invite',
|
||||
REMOVE: 'remove',
|
||||
LEAVE: 'leave',
|
||||
SUBJECT: 'subject',
|
||||
DESCRIPTION: 'description',
|
||||
PICTURE: 'picture',
|
||||
ANNOUNCE: 'announce',
|
||||
RESTRICT: 'restrict',
|
||||
};
|
||||
|
||||
/**
|
||||
* Chat types
|
||||
* @readonly
|
||||
@@ -119,7 +146,22 @@ exports.WAState = {
|
||||
UNLAUNCHED: 'UNLAUNCHED',
|
||||
UNPAIRED: 'UNPAIRED',
|
||||
UNPAIRED_IDLE: 'UNPAIRED_IDLE'
|
||||
};</code></pre>
|
||||
};
|
||||
|
||||
/**
|
||||
* Message ACK
|
||||
* @readonly
|
||||
* @enum {number}
|
||||
*/
|
||||
exports.MessageAck = {
|
||||
ACK_ERROR: -1,
|
||||
ACK_PENDING: 0,
|
||||
ACK_SERVER: 1,
|
||||
ACK_DEVICE: 2,
|
||||
ACK_READ: 3,
|
||||
ACK_PLAYED: 4,
|
||||
};
|
||||
</code></pre>
|
||||
</article>
|
||||
</div>
|
||||
</div>
|
||||
@@ -129,7 +171,7 @@ exports.WAState = {
|
||||
<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.3 on February 9, 2020.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on April 11, 2020.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.0.0 » Source: util/Util.js</title>
|
||||
<title>whatsapp-web.js 1.4.1 » 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>0.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>4.<wbr>1</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -73,7 +73,7 @@ module.exports = Util;</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.3 on February 9, 2020.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on April 11, 2020.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
127
example.js
127
example.js
@@ -1,6 +1,13 @@
|
||||
const { Client } = require('./index');
|
||||
const fs = require('fs');
|
||||
const { Client, Location } = require('./index');
|
||||
|
||||
const client = new Client({puppeteer: {headless: false}});
|
||||
const SESSION_FILE_PATH = './session.json';
|
||||
let sessionCfg;
|
||||
if (fs.existsSync(SESSION_FILE_PATH)) {
|
||||
sessionCfg = require(SESSION_FILE_PATH);
|
||||
}
|
||||
|
||||
const client = new Client({ puppeteer: { headless: false }, session: sessionCfg });
|
||||
// You can use an existing session and avoid scanning a QR code by adding a "session" object to the client options.
|
||||
// This object must include WABrowserId, WASecretBundle, WAToken1 and WAToken2.
|
||||
|
||||
@@ -13,6 +20,12 @@ client.on('qr', (qr) => {
|
||||
|
||||
client.on('authenticated', (session) => {
|
||||
console.log('AUTHENTICATED', session);
|
||||
sessionCfg=session;
|
||||
fs.writeFile(SESSION_FILE_PATH, JSON.stringify(session), function (err) {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
client.on('auth_failure', msg => {
|
||||
@@ -35,10 +48,20 @@ client.on('message', async msg => {
|
||||
// Send a new message to the same chat
|
||||
client.sendMessage(msg.from, 'pong');
|
||||
|
||||
} else if (msg.body.startsWith('!sendto ')) {
|
||||
// Direct send a new message to specific id
|
||||
let number = msg.body.split(' ')[1];
|
||||
let messageIndex = msg.body.indexOf(number) + number.length;
|
||||
let message = msg.body.slice(messageIndex, msg.body.length);
|
||||
number = number.includes('@c.us') ? number : `${number}@c.us`;
|
||||
let chat = await msg.getChat();
|
||||
chat.sendSeen();
|
||||
client.sendMessage(number, message);
|
||||
|
||||
} else if (msg.body.startsWith('!subject ')) {
|
||||
// Change the group subject
|
||||
let chat = await msg.getChat();
|
||||
if(chat.isGroup) {
|
||||
if (chat.isGroup) {
|
||||
let newSubject = msg.body.slice(9);
|
||||
chat.setSubject(newSubject);
|
||||
} else {
|
||||
@@ -50,7 +73,7 @@ client.on('message', async msg => {
|
||||
} else if (msg.body.startsWith('!desc ')) {
|
||||
// Change the group description
|
||||
let chat = await msg.getChat();
|
||||
if(chat.isGroup) {
|
||||
if (chat.isGroup) {
|
||||
let newDescription = msg.body.slice(6);
|
||||
chat.setDescription(newDescription);
|
||||
} else {
|
||||
@@ -59,22 +82,22 @@ client.on('message', async msg => {
|
||||
} else if (msg.body == '!leave') {
|
||||
// Leave the group
|
||||
let chat = await msg.getChat();
|
||||
if(chat.isGroup) {
|
||||
if (chat.isGroup) {
|
||||
chat.leave();
|
||||
} else {
|
||||
msg.reply('This command can only be used in a group!');
|
||||
}
|
||||
} else if(msg.body.startsWith('!join ')) {
|
||||
} else if (msg.body.startsWith('!join ')) {
|
||||
const inviteCode = msg.body.split(' ')[1];
|
||||
try {
|
||||
await client.acceptInvite(inviteCode);
|
||||
msg.reply('Joined the group!');
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
msg.reply('That invite code seems to be invalid.');
|
||||
}
|
||||
} else if(msg.body == '!groupinfo') {
|
||||
}
|
||||
} else if (msg.body == '!groupinfo') {
|
||||
let chat = await msg.getChat();
|
||||
if(chat.isGroup) {
|
||||
if (chat.isGroup) {
|
||||
msg.reply(`
|
||||
*Group Details*
|
||||
Name: ${chat.name}
|
||||
@@ -86,10 +109,10 @@ client.on('message', async msg => {
|
||||
} else {
|
||||
msg.reply('This command can only be used in a group!');
|
||||
}
|
||||
} else if(msg.body == '!chats') {
|
||||
} else if (msg.body == '!chats') {
|
||||
const chats = await client.getChats();
|
||||
client.sendMessage(msg.from, `The bot has ${chats.length} chats open.`);
|
||||
} else if(msg.body == '!info') {
|
||||
} else if (msg.body == '!info') {
|
||||
let info = client.info;
|
||||
client.sendMessage(msg.from, `
|
||||
*Connection info*
|
||||
@@ -98,7 +121,7 @@ client.on('message', async msg => {
|
||||
Platform: ${info.platform}
|
||||
WhatsApp version: ${info.phone.wa_version}
|
||||
`);
|
||||
} else if(msg.body == '!mediainfo' && msg.hasMedia) {
|
||||
} else if (msg.body == '!mediainfo' && msg.hasMedia) {
|
||||
const attachmentData = await msg.downloadMedia();
|
||||
msg.reply(`
|
||||
*Media info*
|
||||
@@ -106,7 +129,7 @@ client.on('message', async msg => {
|
||||
Filename: ${attachmentData.filename}
|
||||
Data (length): ${attachmentData.data.length}
|
||||
`);
|
||||
} else if(msg.body == '!quoteinfo' && msg.hasQuotedMsg) {
|
||||
} else if (msg.body == '!quoteinfo' && msg.hasQuotedMsg) {
|
||||
const quotedMsg = await msg.getQuotedMessage();
|
||||
|
||||
quotedMsg.reply(`
|
||||
@@ -116,18 +139,17 @@ client.on('message', async msg => {
|
||||
Timestamp: ${quotedMsg.timestamp}
|
||||
Has Media? ${quotedMsg.hasMedia}
|
||||
`);
|
||||
} else if(msg.body == '!resendmedia' && msg.hasQuotedMsg) {
|
||||
} else if (msg.body == '!resendmedia' && msg.hasQuotedMsg) {
|
||||
const quotedMsg = await msg.getQuotedMessage();
|
||||
if(quotedMsg.hasMedia) {
|
||||
if (quotedMsg.hasMedia) {
|
||||
const attachmentData = await quotedMsg.downloadMedia();
|
||||
client.sendMessage(msg.from, attachmentData, {caption: 'Here\'s your requested media.'});
|
||||
client.sendMessage(msg.from, attachmentData, { caption: 'Here\'s your requested media.' });
|
||||
}
|
||||
|
||||
} else if(msg.body == '!location') {
|
||||
} else if (msg.body == '!location') {
|
||||
msg.reply(new Location(37.422, -122.084, 'Googleplex\nGoogle Headquarters'));
|
||||
} else if(msg.location) {
|
||||
} else if (msg.location) {
|
||||
msg.reply(msg.location);
|
||||
} else if(msg.body.startsWith('!status ')) {
|
||||
} else if (msg.body.startsWith('!status ')) {
|
||||
const newStatus = msg.body.split(' ')[1];
|
||||
await client.setStatus(newStatus);
|
||||
msg.reply(`Status was updated to *${newStatus}*`);
|
||||
@@ -137,12 +159,34 @@ client.on('message', async msg => {
|
||||
chat.sendMessage(`Hi @${contact.number}!`, {
|
||||
mentions: [contact]
|
||||
});
|
||||
} else if (msg.body == '!delete' && msg.hasQuotedMsg) {
|
||||
const quotedMsg = await msg.getQuotedMessage();
|
||||
if (quotedMsg.fromMe) {
|
||||
quotedMsg.delete(true);
|
||||
} else {
|
||||
msg.reply('I can only delete my own messages');
|
||||
}
|
||||
} else if (msg.body === '!archive') {
|
||||
const chat = await msg.getChat();
|
||||
chat.archive();
|
||||
} else if (msg.body === '!typing') {
|
||||
const chat = await msg.getChat();
|
||||
// simulates typing in the chat
|
||||
chat.sendStateTyping();
|
||||
} else if (msg.body === '!recording') {
|
||||
const chat = await msg.getChat();
|
||||
// simulates recording audio in the chat
|
||||
chat.sendStateRecording();
|
||||
} else if (msg.body === '!clearstate') {
|
||||
const chat = await msg.getChat();
|
||||
// stops typing or recording in the chat
|
||||
chat.clearState();
|
||||
}
|
||||
});
|
||||
|
||||
client.on('message_create', (msg) => {
|
||||
// Fired on all message creations, including your own
|
||||
if(msg.fromMe) {
|
||||
if (msg.fromMe) {
|
||||
// do stuff here
|
||||
}
|
||||
});
|
||||
@@ -160,6 +204,45 @@ client.on('message_revoke_me', async (msg) => {
|
||||
console.log(msg.body); // message before it was deleted.
|
||||
});
|
||||
|
||||
client.on('message_ack', (msg, ack) => {
|
||||
/*
|
||||
== ACK VALUES ==
|
||||
ACK_ERROR: -1
|
||||
ACK_PENDING: 0
|
||||
ACK_SERVER: 1
|
||||
ACK_DEVICE: 2
|
||||
ACK_READ: 3
|
||||
ACK_PLAYED: 4
|
||||
*/
|
||||
|
||||
if(ack == 3) {
|
||||
// The message was read
|
||||
}
|
||||
});
|
||||
|
||||
client.on('group_join', (notification) => {
|
||||
// User has joined or been added to the group.
|
||||
console.log('join', notification);
|
||||
notification.reply('User joined.');
|
||||
});
|
||||
|
||||
client.on('group_leave', (notification) => {
|
||||
// User has left or been kicked from the group.
|
||||
console.log('leave', notification);
|
||||
notification.reply('User left.');
|
||||
});
|
||||
|
||||
client.on('group_update', (notification) => {
|
||||
// Group picture, subject or description has been updated.
|
||||
console.log('update', notification);
|
||||
});
|
||||
|
||||
client.on('change_battery', (batteryInfo) => {
|
||||
// Battery percentage for attached device has changed
|
||||
const { battery, plugged } = batteryInfo;
|
||||
console.log(`Battery: ${battery}% - Charging? ${plugged}`);
|
||||
});
|
||||
|
||||
client.on('disconnected', (reason) => {
|
||||
console.log('Client was logged out', reason);
|
||||
});
|
||||
|
||||
91
package-lock.json
generated
91
package-lock.json
generated
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "whatsapp-web.js",
|
||||
"version": "0.3.2-post",
|
||||
"version": "1.4.0-post",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
@@ -25,11 +25,16 @@
|
||||
}
|
||||
},
|
||||
"@babel/parser": {
|
||||
"version": "7.8.4",
|
||||
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.8.4.tgz",
|
||||
"integrity": "sha512-0fKu/QqildpXmPVaRBoXOlyBb3MC+J0A66x97qEfLOMkn3u6nfY5esWogQwi/K0BjASYy4DbnsEWnpNL6qT5Mw==",
|
||||
"version": "7.9.4",
|
||||
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.9.4.tgz",
|
||||
"integrity": "sha512-bC49otXX6N0/VYhgOMh4gnP26E9xnDZK3TmbNpxYzzz9BQLBosQwfyOe9/cXUU3txYhTzLCbcqd5c8y/OmCjHA==",
|
||||
"dev": true
|
||||
},
|
||||
"@pedroslopez/moduleraid": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@pedroslopez/moduleraid/-/moduleraid-4.1.0.tgz",
|
||||
"integrity": "sha512-+2OYf1IDLhZlOY3QEwGfZJKfM/uPB3lw9zedl3eqEMtod73r1R7TUnmlh8S7hM8uLUcrWXMnJ9TrMbxXeV1pZg=="
|
||||
},
|
||||
"@types/mime-types": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/mime-types/-/mime-types-2.1.0.tgz",
|
||||
@@ -42,9 +47,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"acorn": {
|
||||
"version": "7.1.0",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.0.tgz",
|
||||
"integrity": "sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ==",
|
||||
"version": "7.1.1",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.1.tgz",
|
||||
"integrity": "sha512-add7dgA5ppRPxCFJoAGfMDi7PIBXq1RtGo7BhbLaxwrXPOmw8gq48Y9ozT01hUKy9byMjlR20EJhu5zlkErEkg==",
|
||||
"dev": true
|
||||
},
|
||||
"acorn-jsx": {
|
||||
@@ -315,9 +320,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"entities": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz",
|
||||
"integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==",
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/entities/-/entities-2.0.0.tgz",
|
||||
"integrity": "sha512-D9f7V0JSRwIxlRI2mjMqufDrRDnx8p+eEOz7aUM9SuvF8gsBzra0/6tbjl1m8eQHrZlYj6PxqE00hZ1SAIKPLw==",
|
||||
"dev": true
|
||||
},
|
||||
"escape-string-regexp": {
|
||||
@@ -782,25 +787,25 @@
|
||||
}
|
||||
},
|
||||
"jsdoc": {
|
||||
"version": "3.6.3",
|
||||
"resolved": "https://registry.npmjs.org/jsdoc/-/jsdoc-3.6.3.tgz",
|
||||
"integrity": "sha512-Yf1ZKA3r9nvtMWHO1kEuMZTlHOF8uoQ0vyo5eH7SQy5YeIiHM+B0DgKnn+X6y6KDYZcF7G2SPkKF+JORCXWE/A==",
|
||||
"version": "3.6.4",
|
||||
"resolved": "https://registry.npmjs.org/jsdoc/-/jsdoc-3.6.4.tgz",
|
||||
"integrity": "sha512-3G9d37VHv7MFdheviDCjUfQoIjdv4TC5zTTf5G9VODLtOnVS6La1eoYBDlbWfsRT3/Xo+j2MIqki2EV12BZfwA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/parser": "^7.4.4",
|
||||
"bluebird": "^3.5.4",
|
||||
"@babel/parser": "^7.9.4",
|
||||
"bluebird": "^3.7.2",
|
||||
"catharsis": "^0.8.11",
|
||||
"escape-string-regexp": "^2.0.0",
|
||||
"js2xmlparser": "^4.0.0",
|
||||
"js2xmlparser": "^4.0.1",
|
||||
"klaw": "^3.0.0",
|
||||
"markdown-it": "^8.4.2",
|
||||
"markdown-it-anchor": "^5.0.2",
|
||||
"marked": "^0.7.0",
|
||||
"mkdirp": "^0.5.1",
|
||||
"markdown-it": "^10.0.0",
|
||||
"markdown-it-anchor": "^5.2.7",
|
||||
"marked": "^0.8.2",
|
||||
"mkdirp": "^1.0.4",
|
||||
"requizzle": "^0.2.3",
|
||||
"strip-json-comments": "^3.0.1",
|
||||
"strip-json-comments": "^3.1.0",
|
||||
"taffydb": "2.6.2",
|
||||
"underscore": "~1.9.1"
|
||||
"underscore": "~1.10.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"escape-string-regexp": {
|
||||
@@ -808,6 +813,18 @@
|
||||
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz",
|
||||
"integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==",
|
||||
"dev": true
|
||||
},
|
||||
"mkdirp": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
|
||||
"integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==",
|
||||
"dev": true
|
||||
},
|
||||
"strip-json-comments": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.0.tgz",
|
||||
"integrity": "sha512-e6/d0eBu7gHtdCqFt0xJr642LdToM5/cN4Qb9DbHjVx1CP5RyeM+zH7pbecEmDv/lBqb0QH+6Uqq75rxFPkM0w==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -918,28 +935,28 @@
|
||||
}
|
||||
},
|
||||
"markdown-it": {
|
||||
"version": "8.4.2",
|
||||
"resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-8.4.2.tgz",
|
||||
"integrity": "sha512-GcRz3AWTqSUphY3vsUqQSFMbgR38a4Lh3GWlHRh/7MRwz8mcu9n2IO7HOh+bXHrR9kOPDl5RNCaEsrneb+xhHQ==",
|
||||
"version": "10.0.0",
|
||||
"resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-10.0.0.tgz",
|
||||
"integrity": "sha512-YWOP1j7UbDNz+TumYP1kpwnP0aEa711cJjrAQrzd0UXlbJfc5aAq0F/PZHjiioqDC1NKgvIMX+o+9Bk7yuM2dg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"argparse": "^1.0.7",
|
||||
"entities": "~1.1.1",
|
||||
"entities": "~2.0.0",
|
||||
"linkify-it": "^2.0.0",
|
||||
"mdurl": "^1.0.1",
|
||||
"uc.micro": "^1.0.5"
|
||||
}
|
||||
},
|
||||
"markdown-it-anchor": {
|
||||
"version": "5.2.5",
|
||||
"resolved": "https://registry.npmjs.org/markdown-it-anchor/-/markdown-it-anchor-5.2.5.tgz",
|
||||
"integrity": "sha512-xLIjLQmtym3QpoY9llBgApknl7pxAcN3WDRc2d3rwpl+/YvDZHPmKscGs+L6E05xf2KrCXPBvosWt7MZukwSpQ==",
|
||||
"version": "5.2.7",
|
||||
"resolved": "https://registry.npmjs.org/markdown-it-anchor/-/markdown-it-anchor-5.2.7.tgz",
|
||||
"integrity": "sha512-REFmIaSS6szaD1bye80DMbp7ePwsPNvLTR5HunsUcZ0SG0rWJQ+Pz24R4UlTKtjKBPhxo0v0tOBDYjZQQknW8Q==",
|
||||
"dev": true
|
||||
},
|
||||
"marked": {
|
||||
"version": "0.7.0",
|
||||
"resolved": "https://registry.npmjs.org/marked/-/marked-0.7.0.tgz",
|
||||
"integrity": "sha512-c+yYdCZJQrsRjTPhUx7VKkApw9bwDkNbHUKo1ovgcfDjb2kc8rLuRbIFyXL5WOEUwzSSKo3IXpph2K6DqB/KZg==",
|
||||
"version": "0.8.2",
|
||||
"resolved": "https://registry.npmjs.org/marked/-/marked-0.8.2.tgz",
|
||||
"integrity": "sha512-EGwzEeCcLniFX51DhTpmTom+dSA/MG/OBUDjnWtHbEnjAH180VzUeAw+oE4+Zv+CoYBWyRlYOTR0N8SO9R1PVw==",
|
||||
"dev": true
|
||||
},
|
||||
"mdurl": {
|
||||
@@ -1016,10 +1033,6 @@
|
||||
"minimist": "0.0.8"
|
||||
}
|
||||
},
|
||||
"moduleraid": {
|
||||
"version": "git+https://github.com/pixeldesu/moduleRaid.git#113b90ec709f5d4601db8d5e96b1155aa772ae97",
|
||||
"from": "git+https://github.com/pixeldesu/moduleRaid.git"
|
||||
},
|
||||
"ms": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||
@@ -1525,9 +1538,9 @@
|
||||
}
|
||||
},
|
||||
"underscore": {
|
||||
"version": "1.9.2",
|
||||
"resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.2.tgz",
|
||||
"integrity": "sha512-D39qtimx0c1fI3ya1Lnhk3E9nONswSKhnffBI0gME9C99fYOkNi04xs8K6pePLhvl1frbDemkaBQ5ikWllR2HQ==",
|
||||
"version": "1.10.2",
|
||||
"resolved": "https://registry.npmjs.org/underscore/-/underscore-1.10.2.tgz",
|
||||
"integrity": "sha512-N4P+Q/BuyuEKFJ43B9gYuOj4TQUHXX+j2FqguVOpjkssLUUrnJofCcBccJSCoeturDoZU6GorDTHSvUDlSQbTg==",
|
||||
"dev": true
|
||||
},
|
||||
"uri-js": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "whatsapp-web.js",
|
||||
"version": "1.0.0",
|
||||
"version": "1.4.1",
|
||||
"description": "Library for interacting with the WhatsApp Web API ",
|
||||
"main": "./index.js",
|
||||
"scripts": {
|
||||
@@ -26,13 +26,13 @@
|
||||
},
|
||||
"homepage": "https://github.com/pedroslopez/whatsapp-web.js#readme",
|
||||
"dependencies": {
|
||||
"@pedroslopez/moduleraid": "^4.1.0",
|
||||
"jsqr": "^1.2.0",
|
||||
"moduleraid": "git+https://github.com/pixeldesu/moduleRaid.git",
|
||||
"puppeteer": "^2.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^6.8.0",
|
||||
"jsdoc": "^3.6.3",
|
||||
"jsdoc": "^3.6.4",
|
||||
"jsdoc-baseline": "^0.1.5"
|
||||
}
|
||||
}
|
||||
|
||||
326
src/Client.js
326
src/Client.js
@@ -2,7 +2,7 @@
|
||||
|
||||
const EventEmitter = require('events');
|
||||
const puppeteer = require('puppeteer');
|
||||
const moduleRaid = require('moduleraid/moduleraid');
|
||||
const moduleRaid = require('@pedroslopez/moduleraid/moduleraid');
|
||||
const jsQR = require('jsqr');
|
||||
|
||||
const Util = require('./util/Util');
|
||||
@@ -10,11 +10,7 @@ const { WhatsWebURL, UserAgent, DefaultOptions, Events, WAState } = require('./u
|
||||
const { ExposeStore, LoadUtils } = require('./util/Injected');
|
||||
const ChatFactory = require('./factories/ChatFactory');
|
||||
const ContactFactory = require('./factories/ContactFactory');
|
||||
const ClientInfo = require('./structures/ClientInfo');
|
||||
const Message = require('./structures/Message');
|
||||
const MessageMedia = require('./structures/MessageMedia');
|
||||
const Location = require('./structures/Location');
|
||||
|
||||
const { ClientInfo, Message, MessageMedia, Contact, Location, GroupNotification } = require('./structures');
|
||||
/**
|
||||
* Starting point for interacting with the WhatsApp Web API
|
||||
* @extends {EventEmitter}
|
||||
@@ -23,10 +19,17 @@ const Location = require('./structures/Location');
|
||||
* @fires Client#auth_failure
|
||||
* @fires Client#ready
|
||||
* @fires Client#message
|
||||
* @fires Client#message_ack
|
||||
* @fires Client#message_create
|
||||
* @fires Client#message_revoke_me
|
||||
* @fires Client#message_revoke_everyone
|
||||
* @fires Client#media_uploaded
|
||||
* @fires Client#group_join
|
||||
* @fires Client#group_leave
|
||||
* @fires Client#group_update
|
||||
* @fires Client#disconnected
|
||||
* @fires Client#change_state
|
||||
* @fires Client#change_battery
|
||||
*/
|
||||
class Client extends EventEmitter {
|
||||
constructor(options = {}) {
|
||||
@@ -43,9 +46,12 @@ class Client extends EventEmitter {
|
||||
*/
|
||||
async initialize() {
|
||||
const browser = await puppeteer.launch(this.options.puppeteer);
|
||||
const page = await browser.newPage();
|
||||
const page = (await browser.pages())[0];
|
||||
page.setUserAgent(UserAgent);
|
||||
|
||||
this.pupBrowser = browser;
|
||||
this.pupPage = page;
|
||||
|
||||
if (this.options.session) {
|
||||
await page.evaluateOnNewDocument(
|
||||
session => {
|
||||
@@ -64,7 +70,7 @@ class Client extends EventEmitter {
|
||||
if (this.options.session) {
|
||||
// Check if session restore was successfull
|
||||
try {
|
||||
await page.waitForSelector(KEEP_PHONE_CONNECTED_IMG_SELECTOR, { timeout: 15000 });
|
||||
await page.waitForSelector(KEEP_PHONE_CONNECTED_IMG_SELECTOR, { timeout: this.options.authTimeoutMs });
|
||||
} catch (err) {
|
||||
if (err.name === 'TimeoutError') {
|
||||
/**
|
||||
@@ -74,7 +80,11 @@ class Client extends EventEmitter {
|
||||
*/
|
||||
this.emit(Events.AUTHENTICATION_FAILURE, 'Unable to log in. Are the session details valid?');
|
||||
browser.close();
|
||||
|
||||
if (this.options.restartOnAuthFail) {
|
||||
// session restore failed so try again but without session to force new authentication
|
||||
this.options.session = null;
|
||||
this.initialize();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -82,21 +92,34 @@ class Client extends EventEmitter {
|
||||
}
|
||||
|
||||
} else {
|
||||
// Wait for QR Code
|
||||
const QR_CANVAS_SELECTOR = 'canvas';
|
||||
await page.waitForSelector(QR_CANVAS_SELECTOR);
|
||||
const qrImgData = await page.$eval(QR_CANVAS_SELECTOR, canvas => [].slice.call(canvas.getContext('2d').getImageData(0,0,264,264).data));
|
||||
const qr = jsQR(qrImgData, 264, 264).data;
|
||||
|
||||
/**
|
||||
* Emitted when the QR code is received
|
||||
* @event Client#qr
|
||||
* @param {string} qr QR Code
|
||||
*/
|
||||
this.emit(Events.QR_RECEIVED, qr);
|
||||
const getQrCode = async () => {
|
||||
// Check if retry button is present
|
||||
var QR_RETRY_SELECTOR = 'div[data-ref] > span > div';
|
||||
var qrRetry = await page.$(QR_RETRY_SELECTOR);
|
||||
if (qrRetry) {
|
||||
await qrRetry.click();
|
||||
}
|
||||
|
||||
// Wait for QR Code
|
||||
|
||||
const QR_CANVAS_SELECTOR = 'canvas';
|
||||
await page.waitForSelector(QR_CANVAS_SELECTOR, { timeout: this.options.qrTimeoutMs });
|
||||
const qrImgData = await page.$eval(QR_CANVAS_SELECTOR, canvas => [].slice.call(canvas.getContext('2d').getImageData(0, 0, 264, 264).data));
|
||||
const qr = jsQR(qrImgData, 264, 264).data;
|
||||
/**
|
||||
* Emitted when the QR code is received
|
||||
* @event Client#qr
|
||||
* @param {string} qr QR Code
|
||||
*/
|
||||
this.emit(Events.QR_RECEIVED, qr);
|
||||
};
|
||||
getQrCode();
|
||||
let retryInterval = setInterval(getQrCode, this.options.qrRefreshIntervalMs);
|
||||
|
||||
// Wait for code scan
|
||||
await page.waitForSelector(KEEP_PHONE_CONNECTED_IMG_SELECTOR, { timeout: 0 });
|
||||
clearInterval(retryInterval);
|
||||
|
||||
}
|
||||
|
||||
await page.evaluate(ExposeStore, moduleRaid.toString());
|
||||
@@ -135,6 +158,33 @@ class Client extends EventEmitter {
|
||||
await page.exposeFunction('onAddMessageEvent', msg => {
|
||||
if (!msg.isNewMsg) return;
|
||||
|
||||
if (msg.type === 'gp2') {
|
||||
const notification = new GroupNotification(this, msg);
|
||||
if (msg.subtype === 'add' || msg.subtype === 'invite') {
|
||||
/**
|
||||
* Emitted when a user joins the chat via invite link or is added by an admin.
|
||||
* @event Client#group_join
|
||||
* @param {GroupNotification} notification GroupNotification with more information about the action
|
||||
*/
|
||||
this.emit(Events.GROUP_JOIN, notification);
|
||||
} else if (msg.subtype === 'remove' || msg.subtype === 'leave') {
|
||||
/**
|
||||
* Emitted when a user leaves the chat or is removed by an admin.
|
||||
* @event Client#group_leave
|
||||
* @param {GroupNotification} notification GroupNotification with more information about the action
|
||||
*/
|
||||
this.emit(Events.GROUP_LEAVE, notification);
|
||||
} else {
|
||||
/**
|
||||
* Emitted when group settings are updated, such as subject, description or picture.
|
||||
* @event Client#group_update
|
||||
* @param {GroupNotification} notification GroupNotification with more information about the action
|
||||
*/
|
||||
this.emit(Events.GROUP_UPDATE, notification);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
const message = new Message(this, msg);
|
||||
|
||||
/**
|
||||
@@ -161,7 +211,7 @@ class Client extends EventEmitter {
|
||||
if (msg.type === 'revoked') {
|
||||
const message = new Message(this, msg);
|
||||
let revoked_msg;
|
||||
if(last_message && msg.id.id === last_message.id.id) {
|
||||
if (last_message && msg.id.id === last_message.id.id) {
|
||||
revoked_msg = new Message(this, last_message);
|
||||
}
|
||||
|
||||
@@ -174,11 +224,11 @@ class Client extends EventEmitter {
|
||||
*/
|
||||
this.emit(Events.MESSAGE_REVOKED_EVERYONE, message, revoked_msg);
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
await page.exposeFunction('onChangeMessageEvent', (msg) => {
|
||||
|
||||
|
||||
if (msg.type !== 'revoked') {
|
||||
last_message = msg;
|
||||
}
|
||||
@@ -200,8 +250,42 @@ class Client extends EventEmitter {
|
||||
|
||||
});
|
||||
|
||||
await page.exposeFunction('onAppStateChangedEvent', (AppState, state) => {
|
||||
const ACCEPTED_STATES = [WAState.CONNECTED, WAState.OPENING, WAState.PAIRING];
|
||||
await page.exposeFunction('onMessageAckEvent', (msg, ack) => {
|
||||
|
||||
const message = new Message(this, msg);
|
||||
|
||||
/**
|
||||
* Emitted when an ack event occurrs on message type.
|
||||
* @event Client#message_ack
|
||||
* @param {Message} message The message that was affected
|
||||
* @param {MessageAck} ack The new ACK value
|
||||
*/
|
||||
this.emit(Events.MESSAGE_ACK, message, ack);
|
||||
|
||||
});
|
||||
|
||||
await page.exposeFunction('onMessageMediaUploadedEvent', (msg) => {
|
||||
|
||||
const message = new Message(this, msg);
|
||||
|
||||
/**
|
||||
* Emitted when media has been uploaded for a message sent by the client.
|
||||
* @event Client#media_uploaded
|
||||
* @param {Message} message The message with media that was uploaded
|
||||
*/
|
||||
this.emit(Events.MEDIA_UPLOADED, message);
|
||||
});
|
||||
|
||||
await page.exposeFunction('onAppStateChangedEvent', (state) => {
|
||||
|
||||
/**
|
||||
* Emitted when the connection state changes
|
||||
* @event Client#change_state
|
||||
* @param {WAState} state the new connection state
|
||||
*/
|
||||
this.emit(Events.STATE_CHANGED, state);
|
||||
|
||||
const ACCEPTED_STATES = [WAState.CONNECTED, WAState.OPENING, WAState.PAIRING, WAState.TIMEOUT];
|
||||
if (!ACCEPTED_STATES.includes(state)) {
|
||||
/**
|
||||
* Emitted when the client has been disconnected
|
||||
@@ -213,16 +297,30 @@ class Client extends EventEmitter {
|
||||
}
|
||||
});
|
||||
|
||||
await page.evaluate(() => {
|
||||
window.Store.Msg.on('add', window.onAddMessageEvent);
|
||||
window.Store.Msg.on('change', window.onChangeMessageEvent);
|
||||
window.Store.Msg.on('change:type', window.onChangeMessageTypeEvent);
|
||||
window.Store.Msg.on('remove', window.onRemoveMessageEvent);
|
||||
window.Store.AppState.on('change:state', window.onAppStateChangedEvent);
|
||||
await page.exposeFunction('onBatteryStateChangedEvent', (state) => {
|
||||
|
||||
const { battery, plugged } = state;
|
||||
|
||||
/**
|
||||
* Emitted when the battery percentage for the attached device changes
|
||||
* @event Client#change_battery
|
||||
* @param {object} batteryInfo
|
||||
* @param {number} batteryInfo.battery - The current battery percentage
|
||||
* @param {boolean} batteryInfo.plugged - Indicates if the phone is plugged in (true) or not (false)
|
||||
*/
|
||||
this.emit(Events.BATTERY_CHANGED, { battery, plugged });
|
||||
});
|
||||
|
||||
this.pupBrowser = browser;
|
||||
this.pupPage = page;
|
||||
await page.evaluate(() => {
|
||||
window.Store.Msg.on('add', (msg) => { if(msg.isNewMsg) window.onAddMessageEvent(msg); });
|
||||
window.Store.Msg.on('change', (msg) => { window.onChangeMessageEvent(msg); });
|
||||
window.Store.Msg.on('change:type', (msg) => { window.onChangeMessageTypeEvent(msg); });
|
||||
window.Store.Msg.on('change:ack', (msg, ack) => { window.onMessageAckEvent(msg, ack); });
|
||||
window.Store.Msg.on('change:isUnsentMedia', (msg, unsent) => { if(msg.id.fromMe && !unsent) window.onMessageMediaUploadedEvent(msg); });
|
||||
window.Store.Msg.on('remove', (msg) => { if(msg.isNewMsg) window.onRemoveMessageEvent(msg); });
|
||||
window.Store.AppState.on('change:state', (_AppState, state) => { window.onAppStateChangedEvent(state); });
|
||||
window.Store.Conn.on('change:battery', (state) => { window.onBatteryStateChangedEvent(state); });
|
||||
});
|
||||
|
||||
/**
|
||||
* Emitted when the client has initialized and is ready to receive messages.
|
||||
@@ -238,6 +336,30 @@ class Client extends EventEmitter {
|
||||
await this.pupBrowser.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the version of WhatsApp Web currently being run
|
||||
* @returns Promise<string>
|
||||
*/
|
||||
async getWWebVersion() {
|
||||
return await this.pupPage.evaluate(() => {
|
||||
return window.Debug.VERSION;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark as seen for the Chat
|
||||
* @param {string} chatId
|
||||
* @returns {Promise<boolean>} result
|
||||
*
|
||||
*/
|
||||
async sendSeen(chatId) {
|
||||
const result = await this.pupPage.evaluate(async (chatId) => {
|
||||
return window.WWebJS.sendSeen(chatId);
|
||||
|
||||
}, chatId);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a message to a specific chatId
|
||||
* @param {string} chatId
|
||||
@@ -245,28 +367,55 @@ class Client extends EventEmitter {
|
||||
* @param {object} options
|
||||
* @returns {Promise<Message>} Message that was just sent
|
||||
*/
|
||||
async sendMessage(chatId, content, options={}) {
|
||||
async sendMessage(chatId, content, options = {}) {
|
||||
let internalOptions = {
|
||||
caption: options.caption,
|
||||
quotedMessageId: options.quotedMessageId,
|
||||
mentionedJidList: Array.isArray(options.mentions) ? options.mentions.map(contact => contact.id._serialized) : []
|
||||
mentionedJidList: Array.isArray(options.mentions) ? options.mentions.map(contact => contact.id._serialized) : []
|
||||
};
|
||||
|
||||
const sendSeen = typeof options.sendSeen === 'undefined' ? true : options.sendSeen;
|
||||
|
||||
if(content instanceof MessageMedia) {
|
||||
if (content instanceof MessageMedia) {
|
||||
internalOptions.attachment = content;
|
||||
content = '';
|
||||
} else if(options.media instanceof MessageMedia) {
|
||||
internalOptions.media = options.media;
|
||||
} else if (options.media instanceof MessageMedia) {
|
||||
internalOptions.attachment = options.media;
|
||||
internalOptions.caption = content;
|
||||
} else if(content instanceof Location) {
|
||||
} else if (content instanceof Location) {
|
||||
internalOptions.location = content;
|
||||
content = '';
|
||||
}
|
||||
|
||||
const newMessage = await this.pupPage.evaluate(async (chatId, message, options) => {
|
||||
const msg = await window.WWebJS.sendMessage(window.Store.Chat.get(chatId), message, options);
|
||||
const newMessage = await this.pupPage.evaluate(async (chatId, message, options, sendSeen) => {
|
||||
let chat = window.Store.Chat.get(chatId);
|
||||
let msg;
|
||||
if (!chat) { // The chat is not available in the previously chatted list
|
||||
|
||||
let newChatId = await window.WWebJS.getNumberId(chatId);
|
||||
if (newChatId) {
|
||||
//get the topmost chat object and assign the new chatId to it .
|
||||
//This is just a workaround.May cause problem if there are no chats at all. Need to dig in and emulate how whatsapp web does
|
||||
let chat = window.Store.Chat.models[0];
|
||||
if (!chat)
|
||||
throw 'Chat List empty! Need at least one open conversation with any of your contact';
|
||||
|
||||
let originalChatObjId = chat.id;
|
||||
chat.id = newChatId;
|
||||
|
||||
msg = await window.WWebJS.sendMessage(chat, message, options);
|
||||
chat.id = originalChatObjId; //replace the chat with its original id
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(sendSeen) {
|
||||
window.WWebJS.sendSeen(chatId);
|
||||
}
|
||||
|
||||
msg = await window.WWebJS.sendMessage(chat, message, options, sendSeen);
|
||||
}
|
||||
return msg.serialize();
|
||||
}, chatId, content, internalOptions);
|
||||
}, chatId, content, internalOptions, sendSeen);
|
||||
|
||||
return new Message(this, newMessage);
|
||||
}
|
||||
@@ -343,6 +492,97 @@ class Client extends EventEmitter {
|
||||
}, status);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current connection state for the client
|
||||
* @returns {WAState}
|
||||
*/
|
||||
async getState() {
|
||||
return await this.pupPage.evaluate(() => {
|
||||
return window.Store.AppState.state;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables and returns the archive state of the Chat
|
||||
* @returns {boolean}
|
||||
*/
|
||||
async archiveChat(chatId) {
|
||||
return await this.pupPage.evaluate(async chatId => {
|
||||
let chat = await window.Store.Chat.get(chatId);
|
||||
await window.Store.Cmd.archiveChat(chat, true);
|
||||
return chat.archive;
|
||||
}, chatId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes and returns the archive state of the Chat
|
||||
* @returns {boolean}
|
||||
*/
|
||||
async unarchiveChat(chatId) {
|
||||
return await this.pupPage.evaluate(async chatId => {
|
||||
let chat = await window.Store.Chat.get(chatId);
|
||||
await window.Store.Cmd.archiveChat(chat, false);
|
||||
return chat.archive;
|
||||
}, chatId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Force reset of connection state for the client
|
||||
*/
|
||||
async resetState(){
|
||||
await this.pupPage.evaluate(() => {
|
||||
window.Store.AppState.phoneWatchdog.shiftTimer.forceRunNow();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given ID is registered in whatsapp
|
||||
* @returns {Promise<Boolean>}
|
||||
*/
|
||||
async isRegisteredUser(id) {
|
||||
return await this.pupPage.evaluate(async (id) => {
|
||||
let result = await window.Store.Wap.queryExist(id);
|
||||
return result.jid !== undefined;
|
||||
}, id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new group
|
||||
* @param {string} name group title
|
||||
* @param {Array<Contact|string>} participants an array of Contacts or contact IDs to add to the group
|
||||
* @returns {Object} createRes
|
||||
* @returns {string} createRes.gid - ID for the group that was just created
|
||||
* @returns {Object.<string,string>} createRes.missingParticipants - participants that were not added to the group. Keys represent the ID for participant that was not added and its value is a status code that represents the reason why participant could not be added. This is usually 403 if the user's privacy settings don't allow you to add them to groups.
|
||||
*/
|
||||
async createGroup(name, participants) {
|
||||
if(!Array.isArray(participants) || participants.length == 0) {
|
||||
throw 'You need to add at least one other participant to the group';
|
||||
}
|
||||
|
||||
if(participants.every(c => c instanceof Contact)) {
|
||||
participants = participants.map(c => c.id._serialized);
|
||||
}
|
||||
|
||||
const createRes = await this.pupPage.evaluate(async (name, participantIds) => {
|
||||
const res = await window.Store.Wap.createGroup(name, participantIds);
|
||||
console.log(res);
|
||||
if(!res.status === 200) {
|
||||
throw 'An error occurred while creating the group!';
|
||||
}
|
||||
|
||||
return res;
|
||||
}, name, participants);
|
||||
|
||||
const missingParticipants = createRes.participants.reduce(((missing, c) => {
|
||||
const id = Object.keys(c)[0];
|
||||
const statusCode = c[id].code;
|
||||
if(statusCode != 200) return Object.assign(missing, {[id]: statusCode});
|
||||
return missing;
|
||||
}), {});
|
||||
|
||||
return { gid: createRes.gid, missingParticipants};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = Client;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
const Base = require('./Base');
|
||||
const Message = require('./Message');
|
||||
|
||||
/**
|
||||
* Represents a Chat on WhatsApp
|
||||
@@ -10,7 +11,7 @@ class Chat extends Base {
|
||||
constructor(client, data) {
|
||||
super(client);
|
||||
|
||||
if(data) this._patch(data);
|
||||
if (data) this._patch(data);
|
||||
}
|
||||
|
||||
_patch(data) {
|
||||
@@ -50,6 +51,12 @@ class Chat extends Base {
|
||||
*/
|
||||
this.timestamp = data.t;
|
||||
|
||||
/**
|
||||
* Indicates if the Chat is archived
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.archived = data.archive;
|
||||
|
||||
return super._patch(data);
|
||||
}
|
||||
|
||||
@@ -62,6 +69,108 @@ class Chat extends Base {
|
||||
async sendMessage(content, options) {
|
||||
return this.client.sendMessage(this.id._serialized, content, options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the message as seen
|
||||
* @returns {Promise<Boolean>} result
|
||||
*/
|
||||
async sendSeen() {
|
||||
return this.client.sendSeen(this.id._serialized);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears all messages from the chat
|
||||
* @returns {Promise<Boolean>} result
|
||||
*/
|
||||
async clearMessages() {
|
||||
return this.client.pupPage.evaluate(chatId => {
|
||||
return window.WWebJS.sendClearChat(chatId);
|
||||
}, this.id._serialized);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the chat
|
||||
* @returns {Promise<Boolean>} result
|
||||
*/
|
||||
async delete() {
|
||||
return this.client.pupPage.evaluate(chatId => {
|
||||
return window.WWebJS.sendDeleteChat(chatId);
|
||||
}, this.id._serialized);
|
||||
}
|
||||
|
||||
/**
|
||||
* Archives this chat
|
||||
*/
|
||||
async archive() {
|
||||
return this.client.archiveChat(this.id._serialized);
|
||||
}
|
||||
|
||||
/**
|
||||
* un-archives this chat
|
||||
*/
|
||||
async unarchive() {
|
||||
return this.client.unarchiveChat(this.id._serialized);
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads chat messages, sorted from earliest to latest.
|
||||
* @param {Object} searchOptions Options for searching messages. Right now only limit is supported.
|
||||
* @param {Number} [searchOptions.limit=50] The amount of messages to return. Note that the actual number of returned messages may be smaller if there aren't enough messages in the conversation. Set this to Infinity to load all messages.
|
||||
* @returns {Promise<Array<Message>>}
|
||||
*/
|
||||
async fetchMessages(searchOptions) {
|
||||
if(!searchOptions || !searchOptions.limit) {
|
||||
searchOptions = {limit: 50};
|
||||
}
|
||||
let messages = await this.client.pupPage.evaluate(async (chatId, limit) => {
|
||||
const msgFilter = m => !m.isNotification; // dont include notification messages
|
||||
|
||||
const chat = window.Store.Chat.get(chatId);
|
||||
let msgs = chat.msgs.models.filter(msgFilter);
|
||||
|
||||
while(msgs.length < limit) {
|
||||
const loadedMessages = await chat.loadEarlierMsgs();
|
||||
if(!loadedMessages) break;
|
||||
msgs = [...loadedMessages.filter(msgFilter), ...msgs];
|
||||
}
|
||||
|
||||
msgs.sort((a, b) => (a.t > b.t) ? 1 : -1);
|
||||
return msgs.splice(msgs.length - limit).map(m => m.serialize());
|
||||
|
||||
}, this.id._serialized, searchOptions.limit);
|
||||
|
||||
return messages.map(m => new Message(this.client, m));
|
||||
}
|
||||
|
||||
/**
|
||||
* Simulate typing in chat. This will last for 25 seconds.
|
||||
*/
|
||||
async sendStateTyping() {
|
||||
return this.client.pupPage.evaluate(chatId => {
|
||||
window.WWebJS.sendChatstate('typing', chatId);
|
||||
return true;
|
||||
}, this.id._serialized);
|
||||
}
|
||||
|
||||
/**
|
||||
* Simulate recording audio in chat. This will last for 25 seconds.
|
||||
*/
|
||||
async sendStateRecording() {
|
||||
return this.client.pupPage.evaluate(chatId => {
|
||||
window.WWebJS.sendChatstate('recording', chatId);
|
||||
return true;
|
||||
}, this.id._serialized);
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops typing or recording in chat immediately.
|
||||
*/
|
||||
async clearState() {
|
||||
return this.client.pupPage.evaluate(chatId => {
|
||||
window.WWebJS.sendChatstate('stop', chatId);
|
||||
return true;
|
||||
}, this.id._serialized);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Chat;
|
||||
module.exports = Chat;
|
||||
|
||||
104
src/structures/GroupNotification.js
Normal file
104
src/structures/GroupNotification.js
Normal file
@@ -0,0 +1,104 @@
|
||||
'use strict';
|
||||
|
||||
const Base = require('./Base');
|
||||
|
||||
/**
|
||||
* Represents a GroupNotification on WhatsApp
|
||||
* @extends {Base}
|
||||
*/
|
||||
class GroupNotification extends Base {
|
||||
constructor(client, data) {
|
||||
super(client);
|
||||
|
||||
if(data) this._patch(data);
|
||||
}
|
||||
|
||||
_patch(data) {
|
||||
/**
|
||||
* ID that represents the groupNotification
|
||||
* @type {object}
|
||||
*/
|
||||
this.id = data.id;
|
||||
|
||||
/**
|
||||
* Extra content
|
||||
* @type {string}
|
||||
*/
|
||||
this.body = data.body || '';
|
||||
|
||||
/**
|
||||
* GroupNotification type
|
||||
* @type {GroupNotificationTypes}
|
||||
*/
|
||||
this.type = data.subtype;
|
||||
|
||||
/**
|
||||
* Unix timestamp for when the groupNotification was created
|
||||
* @type {number}
|
||||
*/
|
||||
this.timestamp = data.t;
|
||||
|
||||
/**
|
||||
* ID for the Chat that this groupNotification was sent for.
|
||||
*
|
||||
* @type {string}
|
||||
*/
|
||||
this.chatId = typeof (data.from) === 'object' ? data.from._serialized : data.from;
|
||||
|
||||
/**
|
||||
* ContactId for the user that produced the GroupNotification.
|
||||
* @type {string}
|
||||
*/
|
||||
this.author = typeof (data.author) === 'object' ? data.author._serialized : data.author;
|
||||
|
||||
/**
|
||||
* Contact IDs for the users that were affected by this GroupNotification.
|
||||
* @type {Array<string>}
|
||||
*/
|
||||
this.recipientIds = [];
|
||||
|
||||
if (data.recipients) {
|
||||
this.recipientIds = data.recipients;
|
||||
}
|
||||
|
||||
return super._patch(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Chat this groupNotification was sent in
|
||||
* @returns {Promise<Chat>}
|
||||
*/
|
||||
getChat() {
|
||||
return this.client.getChatById(this.chatId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Contact this GroupNotification was produced by
|
||||
* @returns {Promise<Contact>}
|
||||
*/
|
||||
getContact() {
|
||||
return this.client.getContactById(this.author);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Contacts affected by this GroupNotification.
|
||||
* @returns {Promise<Array<Contact>>}
|
||||
*/
|
||||
async getRecipients() {
|
||||
return await Promise.all(this.recipientIds.map(async m => await this.client.getContactById(m)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a message to the same chat this GroupNotification was produced in.
|
||||
*
|
||||
* @param {string|MessageMedia|Location} content
|
||||
* @param {object} options
|
||||
* @returns {Promise<Message>}
|
||||
*/
|
||||
async reply(content, options={}) {
|
||||
return this.client.sendMessage(this.chatId, content, options);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = GroupNotification;
|
||||
@@ -17,12 +17,25 @@ class Message extends Base {
|
||||
}
|
||||
|
||||
_patch(data) {
|
||||
/**
|
||||
* MediaKey that represents the sticker 'ID'
|
||||
* @type {string}
|
||||
*/
|
||||
this.mediaKey = data.mediaKey;
|
||||
|
||||
|
||||
/**
|
||||
* ID that represents the message
|
||||
* @type {object}
|
||||
*/
|
||||
this.id = data.id;
|
||||
|
||||
/**
|
||||
* ACK status for the message
|
||||
* @type {MessageAck}
|
||||
*/
|
||||
this.ack = data.ack;
|
||||
|
||||
/**
|
||||
* Indicates if the message has media available for download
|
||||
* @type {boolean}
|
||||
@@ -186,8 +199,19 @@ class Message extends Base {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const {data, mimetype, filename} = await this.client.pupPage.evaluate(async (msgId) => {
|
||||
const result = await this.client.pupPage.evaluate(async (msgId) => {
|
||||
const msg = window.Store.Msg.get(msgId);
|
||||
|
||||
if(msg.mediaData.mediaStage != 'RESOLVED') {
|
||||
// try to resolve media
|
||||
await msg.downloadMedia(true, 1);
|
||||
}
|
||||
|
||||
if(msg.mediaData.mediaStage.includes('ERROR')) {
|
||||
// media could not be downloaded
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const buffer = await window.WWebJS.downloadBuffer(msg.clientUrl);
|
||||
const decrypted = await window.Store.CryptoLib.decryptE2EMedia(msg.type, buffer, msg.mediaKey, msg.mimetype);
|
||||
const data = await window.WWebJS.readBlobAsync(decrypted._blob);
|
||||
@@ -200,7 +224,24 @@ class Message extends Base {
|
||||
|
||||
}, this.id._serialized);
|
||||
|
||||
return new MessageMedia(mimetype, data, filename);
|
||||
if(!result) return undefined;
|
||||
return new MessageMedia(result.mimetype, result.data, result.filename);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a message from the chat
|
||||
* @param {?boolean} everyone If true and the message is sent by the current user, will delete it for everyone in the chat.
|
||||
*/
|
||||
async delete(everyone) {
|
||||
await this.client.pupPage.evaluate((msgId, everyone) => {
|
||||
let msg = window.Store.Msg.get(msgId);
|
||||
|
||||
if(everyone && msg.id.fromMe && msg.canRevoke()) {
|
||||
return window.Store.Cmd.sendRevokeMsgs(msg.chat, [msg], true);
|
||||
}
|
||||
|
||||
return window.Store.Cmd.sendDeleteMsgs(msg.chat, [msg], true);
|
||||
}, this.id._serialized, everyone);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
14
src/structures/index.js
Normal file
14
src/structures/index.js
Normal file
@@ -0,0 +1,14 @@
|
||||
module.exports = {
|
||||
Base: require('./Base'),
|
||||
BusinessContact: require('./BusinessContact'),
|
||||
Chat: require('./Chat'),
|
||||
ClientInfo: require('./ClientInfo'),
|
||||
Contact: require('./Contact'),
|
||||
GroupChat: require('./GroupChat'),
|
||||
Location: require('./Location'),
|
||||
Message: require('./Message'),
|
||||
MessageMedia: require('./MessageMedia'),
|
||||
PrivateChat: require('./PrivateChat'),
|
||||
PrivateContact: require('./PrivateContact'),
|
||||
GroupNotification: require('./GroupNotification')
|
||||
};
|
||||
@@ -8,7 +8,10 @@ exports.DefaultOptions = {
|
||||
puppeteer: {
|
||||
headless: true
|
||||
},
|
||||
session: false
|
||||
session: false,
|
||||
qrTimeoutMs: 45000,
|
||||
qrRefreshIntervalMs: 20000,
|
||||
authTimeoutMs: 45000,
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -35,8 +38,15 @@ exports.Events = {
|
||||
MESSAGE_CREATE: 'message_create',
|
||||
MESSAGE_REVOKED_EVERYONE: 'message_revoke_everyone',
|
||||
MESSAGE_REVOKED_ME: 'message_revoke_me',
|
||||
MESSAGE_ACK: 'message_ack',
|
||||
MEDIA_UPLOADED: 'media_uploaded',
|
||||
GROUP_JOIN: 'group_join',
|
||||
GROUP_LEAVE: 'group_leave',
|
||||
GROUP_UPDATE: 'group_update',
|
||||
QR_RECEIVED: 'qr',
|
||||
DISCONNECTED: 'disconnected'
|
||||
DISCONNECTED: 'disconnected',
|
||||
STATE_CHANGED: 'change_state',
|
||||
BATTERY_CHANGED: 'change_battery'
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -59,6 +69,23 @@ exports.MessageTypes = {
|
||||
UNKNOWN: 'unknown'
|
||||
};
|
||||
|
||||
/**
|
||||
* Group notification types
|
||||
* @readonly
|
||||
* @enum {string}
|
||||
*/
|
||||
exports.GroupNotificationTypes = {
|
||||
ADD: 'add',
|
||||
INVITE: 'invite',
|
||||
REMOVE: 'remove',
|
||||
LEAVE: 'leave',
|
||||
SUBJECT: 'subject',
|
||||
DESCRIPTION: 'description',
|
||||
PICTURE: 'picture',
|
||||
ANNOUNCE: 'announce',
|
||||
RESTRICT: 'restrict',
|
||||
};
|
||||
|
||||
/**
|
||||
* Chat types
|
||||
* @readonly
|
||||
@@ -88,4 +115,18 @@ exports.WAState = {
|
||||
UNLAUNCHED: 'UNLAUNCHED',
|
||||
UNPAIRED: 'UNPAIRED',
|
||||
UNPAIRED_IDLE: 'UNPAIRED_IDLE'
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Message ACK
|
||||
* @readonly
|
||||
* @enum {number}
|
||||
*/
|
||||
exports.MessageAck = {
|
||||
ACK_ERROR: -1,
|
||||
ACK_PENDING: 0,
|
||||
ACK_SERVER: 1,
|
||||
ACK_DEVICE: 2,
|
||||
ACK_READ: 3,
|
||||
ACK_PLAYED: 4,
|
||||
};
|
||||
|
||||
@@ -10,6 +10,9 @@ exports.ExposeStore = (moduleRaidStr) => {
|
||||
window.Store.Conn = window.mR.findModule('Conn')[0].default;
|
||||
window.Store.CryptoLib = window.mR.findModule('decryptE2EMedia')[0];
|
||||
window.Store.Wap = window.mR.findModule('Wap')[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((module) => module.default && typeof module.default === 'function' && module.default.toString().match(/crypto/))[0].default;
|
||||
window.Store.SendMessage = window.mR.findModule('addAndSendMsgToChat')[0];
|
||||
window.Store.MsgKey = window.mR.findModule((module) => module.default && module.default.fromString)[0].default;
|
||||
@@ -18,13 +21,31 @@ 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.MediaTypes = window.mR.findModule('msgToMediaType')[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;
|
||||
|
||||
};
|
||||
|
||||
exports.LoadUtils = () => {
|
||||
window.WWebJS = {};
|
||||
window.WWebJS.getNumberId = async (id) => {
|
||||
|
||||
window.WWebJS.sendMessage = async (chat, content, options={}) => {
|
||||
let result = await window.Store.Wap.queryExist(id);
|
||||
if (result.jid === undefined)
|
||||
throw 'The number provided is not a registered whatsapp user';
|
||||
return result.jid;
|
||||
};
|
||||
window.WWebJS.sendSeen = async (chatId) => {
|
||||
let chat = window.Store.Chat.get(chatId);
|
||||
if (chat !== undefined) {
|
||||
await window.Store.SendSeen.sendSeen(chat, false);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
};
|
||||
window.WWebJS.sendMessage = async (chat, content, options = {}) => {
|
||||
let attOptions = {};
|
||||
if (options.attachment) {
|
||||
attOptions = await window.WWebJS.processMediaData(options.attachment);
|
||||
@@ -34,25 +55,27 @@ exports.LoadUtils = () => {
|
||||
let quotedMsgOptions = {};
|
||||
if (options.quotedMessageId) {
|
||||
let quotedMessage = window.Store.Msg.get(options.quotedMessageId);
|
||||
if(quotedMessage.canReply()) {
|
||||
if (quotedMessage.canReply()) {
|
||||
quotedMsgOptions = quotedMessage.msgContextInfo(chat);
|
||||
}
|
||||
delete options.quotedMessageId;
|
||||
}
|
||||
|
||||
options.mentionedJidList = options.mentionedJidList.map(cId=> window.Store.Contact.get(cId).id);
|
||||
if (options.mentionedJidList) {
|
||||
options.mentionedJidList = options.mentionedJidList.map(cId => window.Store.Contact.get(cId).id);
|
||||
}
|
||||
|
||||
let locationOptions = {};
|
||||
if (options.location) {
|
||||
locationOptions = {
|
||||
type: 'location',
|
||||
loc: options.location.description,
|
||||
lat: options.location.latitude,
|
||||
loc: options.location.description,
|
||||
lat: options.location.latitude,
|
||||
lng: options.location.longitude
|
||||
};
|
||||
delete options.location;
|
||||
}
|
||||
|
||||
|
||||
const newMsgId = new window.Store.MsgKey({
|
||||
from: window.Store.Conn.me,
|
||||
to: chat.id,
|
||||
@@ -92,7 +115,15 @@ exports.LoadUtils = () => {
|
||||
isGif: mediaData.isGif
|
||||
});
|
||||
|
||||
const uploadedMedia = await window.Store.MediaUpload.uploadMedia(mediaData.mimetype, mediaObject, mediaType);
|
||||
if (!(mediaData.mediaBlob instanceof window.Store.OpaqueData.default)) {
|
||||
mediaData.mediaBlob = await window.Store.OpaqueData.default.createFromData(mediaData.mediaBlob, mediaData.mediaBlob.type);
|
||||
}
|
||||
|
||||
mediaData.renderableUrl = mediaData.mediaBlob.url();
|
||||
mediaObject.consolidate(mediaData.toJSON());
|
||||
mediaData.mediaBlob.autorelease();
|
||||
|
||||
const uploadedMedia = await window.Store.MediaUpload.uploadMedia({ mimetype: mediaData.mimetype, mediaObject, mediaType });
|
||||
if (!uploadedMedia) {
|
||||
throw new Error('upload failed: media entry was not created');
|
||||
}
|
||||
@@ -151,7 +182,7 @@ exports.LoadUtils = () => {
|
||||
|
||||
return res;
|
||||
};
|
||||
|
||||
|
||||
window.WWebJS.getContact = contactId => {
|
||||
const contact = window.Store.Contact.get(contactId);
|
||||
return window.WWebJS.getContactModel(contact);
|
||||
@@ -162,16 +193,16 @@ exports.LoadUtils = () => {
|
||||
return contacts.map(contact => window.WWebJS.getContactModel(contact));
|
||||
};
|
||||
|
||||
window.WWebJS.mediaInfoToFile = ({data, mimetype, filename}) => {
|
||||
window.WWebJS.mediaInfoToFile = ({ data, mimetype, filename }) => {
|
||||
const binaryData = atob(data);
|
||||
|
||||
|
||||
const buffer = new ArrayBuffer(binaryData.length);
|
||||
const view = new Uint8Array(buffer);
|
||||
for(let i=0; i < binaryData.length; i++) {
|
||||
for (let i = 0; i < binaryData.length; i++) {
|
||||
view[i] = binaryData.charCodeAt(i);
|
||||
}
|
||||
|
||||
const blob = new Blob([buffer], {type: mimetype});
|
||||
const blob = new Blob([buffer], { type: mimetype });
|
||||
return new File([blob], filename, {
|
||||
type: mimetype,
|
||||
lastModified: Date.now()
|
||||
@@ -179,7 +210,7 @@ exports.LoadUtils = () => {
|
||||
};
|
||||
|
||||
window.WWebJS.downloadBuffer = (url) => {
|
||||
return new Promise(function(resolve, reject) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', url);
|
||||
xhr.responseType = 'arraybuffer';
|
||||
@@ -206,16 +237,53 @@ exports.LoadUtils = () => {
|
||||
window.WWebJS.readBlobAsync = (blob) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
let reader = new FileReader();
|
||||
|
||||
|
||||
reader.onload = () => {
|
||||
resolve(reader.result);
|
||||
};
|
||||
|
||||
|
||||
reader.onerror = reject;
|
||||
|
||||
|
||||
reader.readAsDataURL(blob);
|
||||
});
|
||||
};
|
||||
|
||||
window.WWebJS.sendClearChat = async (chatId) => {
|
||||
let chat = window.Store.Chat.get(chatId);
|
||||
if (chat !== undefined) {
|
||||
await window.Store.SendClear.sendClear(chat, false);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
window.WWebJS.sendDeleteChat = async (chatId) => {
|
||||
let chat = window.Store.Chat.get(chatId);
|
||||
if (chat !== undefined) {
|
||||
await window.Store.SendDelete.sendDelete(chat);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
window.WWebJS.sendChatstate = async (state, chatId) => {
|
||||
switch(state) {
|
||||
case 'typing':
|
||||
await window.Store.Wap.sendChatstateComposing(chatId);
|
||||
break;
|
||||
case 'recording':
|
||||
await window.Store.Wap.sendChatstateRecording(chatId);
|
||||
break;
|
||||
case 'stop':
|
||||
await window.Store.Wap.sendChatstatePaused(chatId);
|
||||
break;
|
||||
default:
|
||||
throw 'Invalid chatstate';
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
exports.MarkAllRead = () => {
|
||||
@@ -233,4 +301,4 @@ exports.MarkAllRead = () => {
|
||||
window.Store.Wap.sendConversationSeen(chat.id, chat.getLastMsgKeyForAction(), chat.unreadCount - chat.pendingSeenCount);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user