42 Commits
v1.0 ... pr8New

Author SHA1 Message Date
Mohammed Ashab Uddin
2aae4fe6e9 small fixes 2020-07-28 10:46:02 +04:00
Mohammed Ashab Uddin
e71e9f372b fixed entity map problems 2020-07-28 10:44:40 +04:00
Mohammed Ashab Uddin
595941341d staged 2020-07-27 10:15:48 +04:00
Baber-Jan
ff7eb53eef Single change 2020-07-26 20:10:58 +04:00
Baber-Jan
eeb04e1615 Did the required changes 2020-07-26 19:12:51 +04:00
Baber-Jan
d53380616e Did the required change 2020-07-25 22:13:01 +04:00
Mohammed Ashab Uddin
416deb477c fixed bug in command.js 2020-07-25 21:19:59 +04:00
Mohammed Ashab Uddin
d4be542a91 fixed bug in command.js 2020-07-25 21:17:11 +04:00
Mohammed Ashab Uddin
90a14a9e1b added default value to the object parameter 2020-07-25 10:46:30 +04:00
Mohammed Ashab Uddin
0b0569b783 deleted all the logic.onWg() 2020-07-25 10:15:33 +04:00
Baber-Jan
c58bc1ce91 I Think the product functions are done. 2020-07-24 19:11:38 +04:00
Mohammed Ashab Uddin
6288eefa99 Merge remote-tracking branch 'origin' 2020-07-24 16:00:34 +04:00
Mohammed Ashab Uddin
11063d120d fixed gettng input from the message 2020-07-24 15:59:23 +04:00
Mohammed Ashab Uddin
507e62e049 added input functionalities on command 2020-07-24 14:58:32 +04:00
Akilan Selvacoumar
2a1ade4f25 Merge pull request #5 from HWTechClub/dependabot/npm_and_yarn/website-generator/lodash-4.17.19
Bump lodash from 4.17.15 to 4.17.19 in /website-generator
2020-07-24 11:45:37 +04:00
Baber-Jan
4ca9d1418c moved some code to logic.j 2020-07-23 20:23:15 +04:00
Baber-Jan
2f653468e6 Added all the product methods, now have to figure out how to use id in call back function 2020-07-23 20:02:16 +04:00
dependabot[bot]
60367476d8 Bump lodash from 4.17.15 to 4.17.19 in /website-generator
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.19)

Signed-off-by: dependabot[bot] <support@github.com>
2020-07-22 10:10:57 +00:00
Mohammed Ashab Uddin
ca46a66283 getAllData() is added 2020-07-22 11:01:47 +04:00
Mohammed Ashab Uddin
7b0779d552 added and used entity methods 2020-07-22 10:51:29 +04:00
Mohammed Ashab Uddin
596f56b708 StructuredData uses entity to store data 2020-07-22 10:43:52 +04:00
Mohammed Ashab Uddin
1535d4cec0 added entity 2020-07-22 10:43:05 +04:00
Mohammed Ashab Uddin
29db39c642 Added mocha and chai for testing 2020-07-22 10:42:51 +04:00
Mohammed Ashab Uddin
9c7f90a102 fixed bugs 2020-07-22 08:30:01 +04:00
ashab272000
401aa1a17d Update commands.md 2020-07-22 08:25:18 +04:00
ashab272000
07f3c114e0 Update README.md 2020-07-22 08:20:03 +04:00
ashab272000
4924eaef2c Update commands.md 2020-07-22 07:58:48 +04:00
ashab272000
1513186a45 Merge pull request #7 from HWTechClub/npmBot
Npm bot
2020-07-21 14:56:58 +04:00
Mohammed Ashab Uddin
d737615385 added some commands 2020-07-21 14:56:05 +04:00
Mohammed Ashab Uddin
aee182a02f added tasks to be completed 2020-07-21 14:18:04 +04:00
Mohammed Ashab Uddin
97e7e4ae85 added commands.md 2020-07-21 14:10:42 +04:00
Mohammed Ashab Uddin
d7adb17b37 slight changes 2020-07-21 13:58:19 +04:00
Mohammed Ashab Uddin
0efda2dc11 added data model and user model 2020-07-21 13:58:04 +04:00
Mohammed Ashab Uddin
95dc1ae218 changed location for command.js 2020-07-21 13:57:26 +04:00
Mohammed Ashab Uddin
fc966644ef added basic functions 2020-07-21 13:56:06 +04:00
ashab272000
23ceb9fe14 Merge pull request #4 from HWTechClub/npmBot
Integrated the whatsapp bot from npm.
2020-07-20 15:18:19 +04:00
Mohammed Ashab Uddin
cbe03c5954 foundation is set 2020-07-20 15:14:36 +04:00
Mohammed Ashab Uddin
64a4b81f1d Integrated whatsapp-web from npm 2020-07-19 09:56:55 +04:00
Akilan Selvacoumar
cba2828f38 Update package.json 2020-07-15 14:35:22 +05:30
Akilan Selvacoumar
a7caff32fc Delete session.json 2020-07-13 12:59:32 +04:00
akilan
c93d3a358d new changes 2020-07-13 12:57:35 +04:00
akilan
82d55a625f new changes 2020-07-13 12:47:04 +04:00
89 changed files with 1978 additions and 13997 deletions

View File

@@ -35,8 +35,10 @@ build/Release
# Dependency directories # Dependency directories
node_modules/ node_modules/
jspm_packages/ jspm_packages/
whatsapp-web.js/node_modules/
website-generator/node_modules/
# TypeScript v1 declaration files # Typescript v1 declaration files
typings/ typings/
# Optional npm cache directory # Optional npm cache directory
@@ -59,3 +61,6 @@ typings/
# next.js build output # next.js build output
.next .next
#session whatsappwebjs json file
whatsapp-web.js/session.json

View File

@@ -9,21 +9,45 @@ In this project we will illustrate how to build a static web page using commands
## Installation ## Installation
Requirements : Node js and Npm Requirements : Node js and Npm
### To start web generator ### Install web generator
First, go to the folder named **website-generator**.
Then install all the node modules.
``` ```
cd website-generation cd website-generation
npm install
``` ```
Installation : https://github.com/Tech-club/Challenge-1/tree/master/website-generator#installation
### Install whatsapp bot
### To start whatsapp bot First, go to the folder named **whatsapp-web.js**.
Then install all the node modules.
``` ```
cd whatsapp-web.js cd whatsapp-web.js
npm install npm install
```
### Start the website generator
Make sure you are in **website-generator** directory. Then type the following command :
```
npm start npm start
``` ```
For more information on deploying the server in IPFS, please click the following link:
https://github.com/Tech-club/Challenge-1/tree/master/website-generator#installation
### Start whatsapp bot
Make sure you are in **whatsapp-web.js** directory. Then type the following command :
```
npm start
```
### Start generating websites with whatsapp
You need to start both website-generator and whatsapp-bot.
### Contributors ### Contributors
1. Akilan Selvacoumar : as251@hw.ac.uk 1. Akilan Selvacoumar : as251@hw.ac.uk

View File

@@ -1132,9 +1132,9 @@
"integrity": "sha1-ZMTwJfF/1Tv7RXY/rrFvAVp0dVA=" "integrity": "sha1-ZMTwJfF/1Tv7RXY/rrFvAVp0dVA="
}, },
"lodash": { "lodash": {
"version": "4.17.15", "version": "4.17.19",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz",
"integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==" "integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ=="
}, },
"lodash.debounce": { "lodash.debounce": {
"version": "4.0.8", "version": "4.0.8",

View File

@@ -1,8 +0,0 @@
root = true
[*]
indent_style = space
indent_size = 4
charset = utf-8
trim_trailing_whitespace = false
insert_final_newline = false

View File

@@ -1,34 +0,0 @@
{
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"node": true
},
"extends": "eslint:recommended",
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parserOptions": {
"ecmaVersion": 2018
},
"rules": {
"indent": [
"error",
4
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"single"
],
"semi": [
"error",
"always"
]
}
}

View File

@@ -1,20 +0,0 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 30
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Issues with these labels will never be considered stale
exemptLabels:
- pinned
- security
- enhancement
- bug
- WhatsApp Change
# Label to use when marking an issue as stale
staleLabel: stale
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false

View File

@@ -1,24 +0,0 @@
name: Lint
on:
push:
pull_request:
jobs:
eslint:
name: eslint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: install node v12
uses: actions/setup-node@v1
with:
node-version: 12
- name: npm install
run: npm install
- name: eslint
uses: icrawl/action-eslint@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
job-name: eslint

View File

@@ -1,26 +0,0 @@
{
"tags": {
"allowUnknownTags": true,
"dictionaries": ["jsdoc"]
},
"source": {
"include": ["src", "package.json", "README.md"],
"includePattern": ".js$",
"excludePattern": "(node_modules/|docs)"
},
"plugins": [
"plugins/markdown"
],
"templates": {
"cleverLinks": false,
"monospaceLinks": true,
"useLongnameInNav": false,
"showInheritedInNav": true
},
"opts": {
"destination": "./docs/",
"encoding": "utf8",
"recurse": true,
"template": "./node_modules/jsdoc-baseline"
}
}

View File

@@ -1,201 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2019 Pedro S Lopez
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file 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.

View File

@@ -1,76 +0,0 @@
[![npm](https://img.shields.io/npm/v/whatsapp-web.js.svg)](https://www.npmjs.com/package/whatsapp-web.js) [![Depfu](https://badges.depfu.com/badges/4a65a0de96ece65fdf39e294e0c8dcba/overview.svg)](https://depfu.com/github/pedroslopez/whatsapp-web.js?project_id=9765) ![WhatsApp_Web 0.4.1296](https://img.shields.io/badge/WhatsApp_Web-0.4.1296-brightgreen.svg)
# whatsapp-web.js
A WhatsApp API client that connects through the WhatsApp Web browser app
It uses Puppeteer to run a real instance of Whatsapp Web to avoid getting blocked.
**NOTE:** I can't guarantee you will not be blocked by using this method, although it has worked for me. WhatsApp does not allow bots or unofficial clients on their platform, so this shouldn't be considered totally safe.
## Installation
The module is now available on npm! `npm i whatsapp-web.js`
Please note that Node v8+ is required due to Puppeteer.
## Example usage
```js
const { Client } = require('whatsapp-web.js');
const client = new Client();
client.on('qr', (qr) => {
// Generate and scan this code with your phone
console.log('QR RECEIVED', qr);
});
client.on('ready', () => {
console.log('Client is ready!');
});
client.on('message', msg => {
if (msg.body == '!ping') {
msg.reply('pong');
}
});
client.initialize();
```
Take a look at [example.js](https://github.com/pedroslopez/whatsapp-web.js/blob/master/example.js) for another example with more use cases.
## Supported features
| Feature | Status |
| ------------- | ------------- |
| Send messages | ✅ |
| Receive messages | ✅ |
| Send media (images/audio/documents) | ✅ |
| Send media (video) | ✅ (requires google chrome) |
| Send stickers | _pending_ |
| Receive media (images/audio/video/documents) | ✅ |
| Send contact cards | _pending_ |
| Send location | ✅ |
| Receive location | ✅ |
| Message replies | ✅ |
| Join groups by invite | ✅ |
| Get invite for group | ✅ |
| Modify group info (subject, description) | ✅ |
| Add group participants | ✅ |
| Kick group participants | ✅ |
| Promote/demote group participants | ✅ |
| Mention users | ✅ |
| Get contact info | ✅ |
| Get profile pictures | ✅ |
| Set user status message | ✅ |
Something missing? Make an issue and let us know!
## Links
* [Documentation](https://pedroslopez.me/whatsapp-web.js) _(preview)_
* [GitHub](https://github.com/pedroslopez/whatsapp-web.js)
## Contributing
Pull requests are welcome! If you see something you'd like to add, please do. For drastic changes, please open an issue first.

Binary file not shown.

Binary file not shown.

View File

@@ -1,65 +0,0 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.3">
<meta charset="utf-8">
<title>whatsapp-web.js 1.2.1-post &raquo; Class: Base</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
<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>2.<wbr>1-post</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">Base</span></h1>
<p class="source-link">Source: <a href="structures_Base.js.html#source-line-7">structures/<wbr>Base.<wbr>js:7</a></p>
<div class="symbol-classdesc">
<p>Represents a WhatsApp data structure</p>
</div>
<dl class="dl-compact">
</dl>
</header>
<section id="summary">
</section>
<section>
<h2 id="Base">new&nbsp;<span class="symbol-name">Base</span><span class="signature"><span class="signature-params">()</span></span></h2>
<dl class="dl-compact">
</dl>
</section>
<section>
</section>
</div>
</div>
<nav id="jsdoc-toc-nav" role="navigation"></nav>
</div>
</div>
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on March 13, 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>

View File

@@ -1,242 +0,0 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.3">
<meta charset="utf-8">
<title>whatsapp-web.js 1.2.1-post &raquo; Class: BusinessContact</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
<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>2.<wbr>1-post</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">BusinessContact</span></h1>
<p class="source-link">Source: <a href="structures_BusinessContact.js.html#source-line-9">structures/<wbr>BusinessContact.<wbr>js:9</a></p>
<div class="symbol-classdesc">
<p>Represents a Business Contact 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="BusinessContact.html#businessProfile">businessProfile</a></dt>
<dd>
</dd>
<dt><a href="BusinessContact.html#id">id</a></dt>
<dd>
</dd>
<dt><a href="BusinessContact.html#isBusiness">isBusiness</a></dt>
<dd>
</dd>
<dt><a href="BusinessContact.html#isEnterprise">isEnterprise</a></dt>
<dd>
</dd>
<dt><a href="BusinessContact.html#isGroup">isGroup</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="BusinessContact.html#isMe">isMe</a></dt>
<dd>
</dd>
<dt><a href="BusinessContact.html#isMyContact">isMyContact</a></dt>
<dd>
</dd>
<dt><a href="BusinessContact.html#isUser">isUser</a></dt>
<dd>
</dd>
<dt><a href="BusinessContact.html#isWAContact">isWAContact</a></dt>
<dd>
</dd>
<dt><a href="BusinessContact.html#name">name</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="BusinessContact.html#number">number</a></dt>
<dd>
</dd>
<dt><a href="BusinessContact.html#pushname">pushname</a></dt>
<dd>
</dd>
<dt><a href="BusinessContact.html#shortName">shortName</a></dt>
<dd>
</dd>
</dl>
</div>
</div>
</div>
<div class="summary-callout">
<h2 class="summary-callout-heading">Method</h2>
<div class="summary-content">
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="BusinessContact.html#getProfilePicUrl">getProfilePicUrl()</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
</div>
<div class="summary-column">
</div>
</div>
</div>
</section>
<section>
<h2 id="BusinessContact">new&nbsp;<span class="symbol-name">BusinessContact</span><span class="signature"><span class="signature-params">()</span></span></h2>
<dl class="dl-compact">
<dt>Extends</dt>
<dd><a href="Contact.html">Contact</a></dd>
</dl>
</section>
<section>
<h2>Properties</h2>
<section>
<h3 id="businessProfile"><span class="symbol-name">businessProfile</span></h3>
<p>The contact's business profile</p>
<dl class="dl-compact">
</dl>
<h3 id="id"><span class="symbol-name">id</span><small class="property-type">
&nbsp;unknown</small></h3>
<p>ID that represents the contact</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Contact.html#id">Contact#id</a></dd>
</dl>
<h3 id="isBusiness"><span class="symbol-name">isBusiness</span><small class="property-type">
&nbsp;unknown</small></h3>
<p>Indicates if the contact is a business contact</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Contact.html#isBusiness">Contact#isBusiness</a></dd>
</dl>
<h3 id="isEnterprise"><span class="symbol-name">isEnterprise</span><small class="property-type">
&nbsp;unknown</small></h3>
<p>Indicates if the contact is an enterprise contact</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Contact.html#isEnterprise">Contact#isEnterprise</a></dd>
</dl>
<h3 id="isGroup"><span class="symbol-name">isGroup</span><small class="property-type">
&nbsp;unknown</small></h3>
<p>Indicates if the contact is a group contact</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Contact.html#isGroup">Contact#isGroup</a></dd>
</dl>
<h3 id="isMe"><span class="symbol-name">isMe</span><small class="property-type">
&nbsp;unknown</small></h3>
<p>Indicates if the contact is the current user's contact</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Contact.html#isMe">Contact#isMe</a></dd>
</dl>
<h3 id="isMyContact"><span class="symbol-name">isMyContact</span><small class="property-type">
&nbsp;unknown</small></h3>
<p>Indicates if the number is saved in the current phone's contacts</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Contact.html#isMyContact">Contact#isMyContact</a></dd>
</dl>
<h3 id="isUser"><span class="symbol-name">isUser</span><small class="property-type">
&nbsp;unknown</small></h3>
<p>Indicates if the contact is a user contact</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Contact.html#isUser">Contact#isUser</a></dd>
</dl>
<h3 id="isWAContact"><span class="symbol-name">isWAContact</span><small class="property-type">
&nbsp;unknown</small></h3>
<p>Indicates if the number is registered on WhatsApp</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Contact.html#isWAContact">Contact#isWAContact</a></dd>
</dl>
<h3 id="name"><span class="symbol-name">name</span><small class="property-type">
&nbsp;unknown</small></h3>
<p>The contact's name, as saved by the current user</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Contact.html#name">Contact#name</a></dd>
</dl>
<h3 id="number"><span class="symbol-name">number</span><small class="property-type">
&nbsp;unknown</small></h3>
<p>Contact's phone number</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Contact.html#number">Contact#number</a></dd>
</dl>
<h3 id="pushname"><span class="symbol-name">pushname</span><small class="property-type">
&nbsp;unknown</small></h3>
<p>The name that the contact has configured to be shown publically</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Contact.html#pushname">Contact#pushname</a></dd>
</dl>
<h3 id="shortName"><span class="symbol-name">shortName</span><small class="property-type">
&nbsp;unknown</small></h3>
<p>A shortened version of name</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Contact.html#shortName">Contact#shortName</a></dd>
</dl>
</section>
<h2>Method</h2>
<section>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="getProfilePicUrl"><span class="symbol-name">getProfilePicUrl</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing string</span></span></h3>
<p>Returns the contact's profile picture URL, if privacy settings allow it</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Contact.html#getProfilePicUrl">Contact#getProfilePicUrl</a></dd>
<dt>Returns</dt>
<dd></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 March 13, 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>

View File

@@ -1,365 +0,0 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.3">
<meta charset="utf-8">
<title>whatsapp-web.js 1.2.1-post &raquo; Class: Chat</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
<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>2.<wbr>1-post</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">Chat</span></h1>
<p class="source-link">Source: <a href="structures_Chat.js.html#source-line-11">structures/<wbr>Chat.<wbr>js:11</a></p>
<div class="symbol-classdesc">
<p>Represents a Chat 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="Chat.html#archived">archived</a></dt>
<dd>
</dd>
<dt><a href="Chat.html#id">id</a></dt>
<dd>
</dd>
<dt><a href="Chat.html#isGroup">isGroup</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="Chat.html#isReadOnly">isReadOnly</a></dt>
<dd>
</dd>
<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#unreadCount">unreadCount</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="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>
</section>
<section>
<h2 id="Chat">new&nbsp;<span class="symbol-name">Chat</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="archived"><span class="symbol-name">archived</span><small class="property-type">
&nbsp;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">
&nbsp;object</small></h3>
<p>ID that represents the chat</p>
<dl class="dl-compact">
</dl>
<h3 id="isGroup"><span class="symbol-name">isGroup</span><small class="property-type">
&nbsp;boolean</small></h3>
<p>Indicates if the Chat is a Group Chat</p>
<dl class="dl-compact">
</dl>
<h3 id="isReadOnly"><span class="symbol-name">isReadOnly</span><small class="property-type">
&nbsp;boolean</small></h3>
<p>Indicates if the Chat is readonly</p>
<dl class="dl-compact">
</dl>
<h3 id="name"><span class="symbol-name">name</span><small class="property-type">
&nbsp;string</small></h3>
<p>Title of the chat</p>
<dl class="dl-compact">
</dl>
<h3 id="timestamp"><span class="symbol-name">timestamp</span><small class="property-type">
&nbsp;number</small></h3>
<p>Unix timestamp for when the chat was created</p>
<dl class="dl-compact">
</dl>
<h3 id="unreadCount"><span class="symbol-name">unreadCount</span><small class="property-type">
&nbsp;number</small></h3>
<p>Amount of messages unread</p>
<dl class="dl-compact">
</dl>
</section>
<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>&nbsp;&rarr; <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>&nbsp;&rarr; <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>&nbsp;&rarr; <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>&nbsp;</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>&nbsp;&rarr; <span class="signature-returns"> Promise containing <a href="Message.html">Message</a></span></span></h3>
<p>Send a message to this chat</p>
<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>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>options</p>
</td>
<td>
<p>object</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code>Promise containing <a href="Message.html">Message</a></code> <p>Message that was just sent</p>
</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>&nbsp;&rarr; <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>
</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 March 13, 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>

View File

@@ -1,972 +0,0 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.3">
<meta charset="utf-8">
<title>whatsapp-web.js 1.2.1-post &raquo; Class: Client</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
<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>2.<wbr>1-post</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">Client</span></h1>
<p class="source-link">Source: <a href="Client.js.html#source-line-33">Client.<wbr>js:33</a></p>
<div class="symbol-classdesc">
<p>Starting point for interacting with the WhatsApp Web API</p>
</div>
<dl class="dl-compact">
</dl>
</header>
<section id="summary">
<div class="summary-callout">
<h2 class="summary-callout-heading">Methods</h2>
<div class="summary-content">
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="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#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#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#initialize">initialize()</a></dt>
<dd>
</dd>
<dt><a href="Client.html#resetState">resetState()</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
<dl class="dl-summary-callout">
<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>
</div>
<div class="summary-callout">
<h2 class="summary-callout-heading">Events</h2>
<div class="summary-content">
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="Client.html#event:auth_failure">auth_failure</a></dt>
<dd>
</dd>
<dt><a href="Client.html#event:authenticated">authenticated</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: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>
</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>
<dt><a href="Client.html#event:qr">qr</a></dt>
<dd>
</dd>
<dt><a href="Client.html#event:ready">ready</a></dt>
<dd>
</dd>
</dl>
</div>
</div>
</div>
</section>
<section>
<h2 id="Client">new&nbsp;<span class="symbol-name">Client</span><span class="signature"><span class="signature-params">()</span></span></h2>
<dl class="dl-compact">
<dt>Extends</dt>
<dd>EventEmitter</dd>
<dt>Fires</dt>
<dd><a href="Client.html#event:qr">Client#event:qr</a></dd>
<dd><a href="Client.html#event:authenticated">Client#event:authenticated</a></dd>
<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: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>
</dl>
</section>
<section>
<h2>Methods</h2>
<section>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="acceptInvite"><span class="symbol-name">acceptInvite</span><span class="signature"><span class="signature-params">(inviteCode)</span></span></h3>
<p>Accepts an invitation to join a group</p>
<section>
<h4>Parameter</h4>
<table class="jsdoc-details-table">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Optional</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<p>inviteCode</p>
</td>
<td>
<p>string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Invitation code</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="archiveChat"><span class="symbol-name">archiveChat</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> boolean</span></span></h3>
<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="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">
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="getChatById"><span class="symbol-name">getChatById</span><span class="signature"><span class="signature-params">(chatId)</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing <a href="Chat.html">Chat</a></span></span></h3>
<p>Get chat instance by ID</p>
<section>
<h4>Parameter</h4>
<table class="jsdoc-details-table">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Optional</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<p>chatId</p>
</td>
<td>
<p>string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code>Promise containing <a href="Chat.html">Chat</a></code> </p>
</dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="getChats"><span class="symbol-name">getChats</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing Array of <a href="Chat.html">Chat</a></span></span></h3>
<p>Get all current chat instances</p>
<dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code>Promise containing Array of <a href="Chat.html">Chat</a></code> </p>
</dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="getContactById"><span class="symbol-name">getContactById</span><span class="signature"><span class="signature-params">(contactId)</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing <a href="Contact.html">Contact</a></span></span></h3>
<p>Get contact instance by ID</p>
<section>
<h4>Parameter</h4>
<table class="jsdoc-details-table">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Optional</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<p>contactId</p>
</td>
<td>
<p>string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code>Promise containing <a href="Contact.html">Contact</a></code> </p>
</dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="getContacts"><span class="symbol-name">getContacts</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing Array of <a href="Contact.html">Contact</a></span></span></h3>
<p>Get all current contact instances</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="getState"><span class="symbol-name">getState</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <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="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="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>&nbsp;&rarr; <span class="signature-returns"> Promise containing <a href="Message.html">Message</a></span></span></h3>
<p>Send a message to a specific chatId</p>
<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>chatId</p>
</td>
<td>
<p>string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
<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>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>options</p>
</td>
<td>
<p>object</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code>Promise containing <a href="Message.html">Message</a></code> <p>Message that was just sent</p>
</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">(chatId)</span>&nbsp;&rarr; <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>&nbsp;</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>
<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>status</p>
</td>
<td>
<p>string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>New status message</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="unarchiveChat"><span class="symbol-name">unarchiveChat</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <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>
<h3 id="event:auth_failure"><span class="symbol-name">auth_failure</span></h3>
<p>Emitted when there has been an error while trying to restore an existing session</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>string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
</dl>
<h3 id="event:authenticated"><span class="symbol-name">authenticated</span></h3>
<p>Emitted when authentication is successful</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>session</p>
</td>
<td>
<p>object</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Object containing session information. Can be used to restore the session.</p>
</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>&nbsp;</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>
<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>reason</p>
</td>
<td>
<p><a href="global.html#WAState">WAState</a></p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>state that caused the disconnect</p>
</td>
</tr>
</tbody>
</table>
</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>&nbsp;</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>&nbsp;</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>&nbsp;</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:message"><span class="symbol-name">message</span></h3>
<p>Emitted when a new message is received.</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>&nbsp;</p>
</td>
<td>
<p>The message that was received</p>
</td>
</tr>
</tbody>
</table>
</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>&nbsp;</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>&nbsp;</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>
<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>&nbsp;</p>
</td>
<td>
<p>The message that was created</p>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
</dl>
<h3 id="event:message_revoke_everyone"><span class="symbol-name">message_revoke_everyone</span></h3>
<p>Emitted when a message is deleted for everyone in the chat.</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>&nbsp;</p>
</td>
<td>
<p>The message that was revoked, in its current state. It will not contain the original message's data.</p>
</td>
</tr>
<tr>
<td>
<p>revoked_msg</p>
</td>
<td>
<p><a href="Message.html">Message</a></p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>The message that was revoked, before it was revoked. It will contain the message's original data.
Note that due to the way this data is captured, it may be possible that this param will be undefined.</p>
<p>Value can be null.</p>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
</dl>
<h3 id="event:message_revoke_me"><span class="symbol-name">message_revoke_me</span></h3>
<p>Emitted when a message is deleted by the current user.</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>&nbsp;</p>
</td>
<td>
<p>The message that was revoked</p>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
</dl>
<h3 id="event:qr"><span class="symbol-name">qr</span></h3>
<p>Emitted when the QR code is received</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>qr</p>
</td>
<td>
<p>string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>QR Code</p>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
</dl>
<h3 id="event:ready"><span class="symbol-name">ready</span></h3>
<p>Emitted when the client has initialized and is ready to receive messages.</p>
<dl class="dl-compact">
</dl>
</section>
</section>
</div>
</div>
<nav id="jsdoc-toc-nav" role="navigation"></nav>
</div>
</div>
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on March 13, 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>

View File

@@ -1,548 +0,0 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.3">
<meta charset="utf-8">
<title>whatsapp-web.js 1.2.1-post &raquo; Source: Client.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
<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>2.<wbr>1-post</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: Client.js</h1>
</header>
<article>
<pre class="prettyprint linenums"><code>&#x27;use strict&#x27;;
const EventEmitter &#x3D; require(&#x27;events&#x27;);
const puppeteer &#x3D; require(&#x27;puppeteer&#x27;);
const moduleRaid &#x3D; require(&#x27;moduleraid/moduleraid&#x27;);
const jsQR &#x3D; require(&#x27;jsqr&#x27;);
const Util &#x3D; require(&#x27;./util/Util&#x27;);
const { WhatsWebURL, UserAgent, DefaultOptions, Events, WAState } &#x3D; require(&#x27;./util/Constants&#x27;);
const { ExposeStore, LoadUtils } &#x3D; require(&#x27;./util/Injected&#x27;);
const ChatFactory &#x3D; require(&#x27;./factories/ChatFactory&#x27;);
const ContactFactory &#x3D; require(&#x27;./factories/ContactFactory&#x27;);
const { ClientInfo, Message, MessageMedia, Location, GroupNotification } &#x3D; require(&#x27;./structures&#x27;);
/**
* Starting point for interacting with the WhatsApp Web API
* @extends {EventEmitter}
* @fires Client#qr
* @fires Client#authenticated
* @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#group_join
* @fires Client#group_leave
* @fires Client#group_update
* @fires Client#disconnected
* @fires Client#change_state
*/
class Client extends EventEmitter {
constructor(options &#x3D; {}) {
super();
this.options &#x3D; Util.mergeDefault(DefaultOptions, options);
this.pupBrowser &#x3D; null;
this.pupPage &#x3D; null;
}
/**
* Sets up events and requirements, kicks off authentication request
*/
async initialize() {
const browser &#x3D; await puppeteer.launch(this.options.puppeteer);
const page &#x3D; (await browser.pages())[0];
page.setUserAgent(UserAgent);
if (this.options.session) {
await page.evaluateOnNewDocument(
session &#x3D;&gt; {
localStorage.clear();
localStorage.setItem(&#x27;WABrowserId&#x27;, session.WABrowserId);
localStorage.setItem(&#x27;WASecretBundle&#x27;, session.WASecretBundle);
localStorage.setItem(&#x27;WAToken1&#x27;, session.WAToken1);
localStorage.setItem(&#x27;WAToken2&#x27;, session.WAToken2);
}, this.options.session);
}
await page.goto(WhatsWebURL);
const KEEP_PHONE_CONNECTED_IMG_SELECTOR &#x3D; &#x27;[data-asset-intro-image&#x3D;&quot;true&quot;]&#x27;;
if (this.options.session) {
// Check if session restore was successfull
try {
await page.waitForSelector(KEEP_PHONE_CONNECTED_IMG_SELECTOR, { timeout: 15000 });
} catch (err) {
if (err.name &#x3D;&#x3D;&#x3D; &#x27;TimeoutError&#x27;) {
/**
* Emitted when there has been an error while trying to restore an existing session
* @event Client#auth_failure
* @param {string} message
*/
this.emit(Events.AUTHENTICATION_FAILURE, &#x27;Unable to log in. Are the session details valid?&#x27;);
browser.close();
return;
}
throw err;
}
} else {
const getQrCode &#x3D; async () &#x3D;&gt; {
// Check if retry button is present
var QR_RETRY_SELECTOR &#x3D; &#x27;div[data-ref] &gt; span &gt; div&#x27;;
var qrRetry &#x3D; await page.$(QR_RETRY_SELECTOR);
if (qrRetry) {
await qrRetry.click();
}
// Wait for QR Code
const QR_CANVAS_SELECTOR &#x3D; &#x27;canvas&#x27;;
await page.waitForSelector(QR_CANVAS_SELECTOR);
const qrImgData &#x3D; await page.$eval(QR_CANVAS_SELECTOR, canvas &#x3D;&gt; [].slice.call(canvas.getContext(&#x27;2d&#x27;).getImageData(0, 0, 264, 264).data));
const qr &#x3D; jsQR(qrImgData, 264, 264).data;
/**
* Emitted when the QR code is received
* @event Client#qr
* @param {string} qr QR Code
*/
this.emit(Events.QR_RECEIVED, qr);
};
getQrCode();
let retryInterval &#x3D; setInterval(getQrCode, 20000); // check for qr code every 20 seconds
// Wait for code scan
await page.waitForSelector(KEEP_PHONE_CONNECTED_IMG_SELECTOR, { timeout: 0 });
clearInterval(retryInterval);
}
await page.evaluate(ExposeStore, moduleRaid.toString());
// Get session tokens
const localStorage &#x3D; JSON.parse(await page.evaluate(() &#x3D;&gt; {
return JSON.stringify(window.localStorage);
}));
const session &#x3D; {
WABrowserId: localStorage.WABrowserId,
WASecretBundle: localStorage.WASecretBundle,
WAToken1: localStorage.WAToken1,
WAToken2: localStorage.WAToken2
};
/**
* Emitted when authentication is successful
* @event Client#authenticated
* @param {object} session Object containing session information. Can be used to restore the session.
*/
this.emit(Events.AUTHENTICATED, session);
// Check window.Store Injection
await page.waitForFunction(&#x27;window.Store !&#x3D; undefined&#x27;);
//Load util functions (serializers, helper functions)
await page.evaluate(LoadUtils);
// Expose client info
this.info &#x3D; new ClientInfo(this, await page.evaluate(() &#x3D;&gt; {
return window.Store.Conn.serialize();
}));
// Register events
await page.exposeFunction(&#x27;onAddMessageEvent&#x27;, msg &#x3D;&gt; {
if (!msg.isNewMsg) return;
if (msg.type &#x3D;&#x3D;&#x3D; &#x27;gp2&#x27;) {
const notification &#x3D; new GroupNotification(this, msg);
if (msg.subtype &#x3D;&#x3D;&#x3D; &#x27;add&#x27; || msg.subtype &#x3D;&#x3D;&#x3D; &#x27;invite&#x27;) {
/**
* 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 &#x3D;&#x3D;&#x3D; &#x27;remove&#x27; || msg.subtype &#x3D;&#x3D;&#x3D; &#x27;leave&#x27;) {
/**
* 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 &#x3D; new Message(this, msg);
/**
* Emitted when a new message is created, which may include the current user&#x27;s own messages.
* @event Client#message_create
* @param {Message} message The message that was created
*/
this.emit(Events.MESSAGE_CREATE, message);
if (msg.id.fromMe) return;
/**
* Emitted when a new message is received.
* @event Client#message
* @param {Message} message The message that was received
*/
this.emit(Events.MESSAGE_RECEIVED, message);
});
let last_message;
await page.exposeFunction(&#x27;onChangeMessageTypeEvent&#x27;, (msg) &#x3D;&gt; {
if (msg.type &#x3D;&#x3D;&#x3D; &#x27;revoked&#x27;) {
const message &#x3D; new Message(this, msg);
let revoked_msg;
if (last_message &amp;amp;&amp;amp; msg.id.id &#x3D;&#x3D;&#x3D; last_message.id.id) {
revoked_msg &#x3D; new Message(this, last_message);
}
/**
* Emitted when a message is deleted for everyone in the chat.
* @event Client#message_revoke_everyone
* @param {Message} message The message that was revoked, in its current state. It will not contain the original message&#x27;s data.
* @param {?Message} revoked_msg The message that was revoked, before it was revoked. It will contain the message&#x27;s original data.
* Note that due to the way this data is captured, it may be possible that this param will be undefined.
*/
this.emit(Events.MESSAGE_REVOKED_EVERYONE, message, revoked_msg);
}
});
await page.exposeFunction(&#x27;onChangeMessageEvent&#x27;, (msg) &#x3D;&gt; {
if (msg.type !&#x3D;&#x3D; &#x27;revoked&#x27;) {
last_message &#x3D; msg;
}
});
await page.exposeFunction(&#x27;onRemoveMessageEvent&#x27;, (msg) &#x3D;&gt; {
if (!msg.isNewMsg) return;
const message &#x3D; new Message(this, msg);
/**
* Emitted when a message is deleted by the current user.
* @event Client#message_revoke_me
* @param {Message} message The message that was revoked
*/
this.emit(Events.MESSAGE_REVOKED_ME, message);
});
await page.exposeFunction(&#x27;onMessageAckEvent&#x27;, (msg, ack) &#x3D;&gt; {
const message &#x3D; 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(&#x27;onAppStateChangedEvent&#x27;, (_AppState, state) &#x3D;&gt; {
/**
* 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 &#x3D; [WAState.CONNECTED, WAState.OPENING, WAState.PAIRING, WAState.TIMEOUT];
if (!ACCEPTED_STATES.includes(state)) {
/**
* Emitted when the client has been disconnected
* @event Client#disconnected
* @param {WAState} reason state that caused the disconnect
*/
this.emit(Events.DISCONNECTED, state);
this.destroy();
}
});
await page.evaluate(() &#x3D;&gt; {
window.Store.Msg.on(&#x27;add&#x27;, (msg) &#x3D;&gt; { if(msg.isNewMsg) window.onAddMessageEvent(msg);});
window.Store.Msg.on(&#x27;change&#x27;, window.onChangeMessageEvent);
window.Store.Msg.on(&#x27;change:type&#x27;, window.onChangeMessageTypeEvent);
window.Store.Msg.on(&#x27;change:ack&#x27;, window.onMessageAckEvent);
window.Store.Msg.on(&#x27;remove&#x27;, window.onRemoveMessageEvent);
window.Store.AppState.on(&#x27;change:state&#x27;, window.onAppStateChangedEvent);
});
this.pupBrowser &#x3D; browser;
this.pupPage &#x3D; page;
/**
* Emitted when the client has initialized and is ready to receive messages.
* @event Client#ready
*/
this.emit(Events.READY);
}
/**
* Closes the client
*/
async destroy() {
await this.pupBrowser.close();
}
/**
* Mark as seen for the Chat
* @param {string} chatId
* @returns {Promise&amp;lt;boolean&gt;} result
*
*/
async sendSeen(chatId) {
const result &#x3D; await this.pupPage.evaluate(async (chatId) &#x3D;&gt; {
return window.WWebJS.sendSeen(chatId);
}, chatId);
return result;
}
/**
* Send a message to a specific chatId
* @param {string} chatId
* @param {string|MessageMedia|Location} content
* @param {object} options
* @returns {Promise&amp;lt;Message&gt;} Message that was just sent
*/
async sendMessage(chatId, content, options &#x3D; {}) {
let internalOptions &#x3D; {
caption: options.caption,
quotedMessageId: options.quotedMessageId,
mentionedJidList: Array.isArray(options.mentions) ? options.mentions.map(contact &#x3D;&gt; contact.id._serialized) : []
};
const sendSeen &#x3D; typeof options.sendSeen &#x3D;&#x3D;&#x3D; &#x27;undefined&#x27; ? true : options.sendSeen;
if (content instanceof MessageMedia) {
internalOptions.attachment &#x3D; content;
content &#x3D; &#x27;&#x27;;
} else if (options.media instanceof MessageMedia) {
internalOptions.attachment &#x3D; options.media;
internalOptions.caption &#x3D; content;
} else if (content instanceof Location) {
internalOptions.location &#x3D; content;
content &#x3D; &#x27;&#x27;;
}
const newMessage &#x3D; await this.pupPage.evaluate(async (chatId, message, options, sendSeen) &#x3D;&gt; {
let chat &#x3D; window.Store.Chat.get(chatId);
let msg;
if (!chat) { // The chat is not available in the previously chatted list
let newChatId &#x3D; 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 &#x3D; window.Store.Chat.models[0];
if (!chat)
throw &#x27;Chat List empty! Need at least one open conversation with any of your contact&#x27;;
let originalChatObjId &#x3D; chat.id;
chat.id &#x3D; newChatId;
msg &#x3D; await window.WWebJS.sendMessage(chat, message, options);
chat.id &#x3D; originalChatObjId; //replace the chat with its original id
}
}
else {
if(sendSeen) {
window.WWebJS.sendSeen(chatId);
}
msg &#x3D; await window.WWebJS.sendMessage(chat, message, options, sendSeen);
}
return msg.serialize();
}, chatId, content, internalOptions, sendSeen);
return new Message(this, newMessage);
}
/**
* Get all current chat instances
* @returns {Promise&amp;lt;Array&amp;lt;Chat&gt;&gt;}
*/
async getChats() {
let chats &#x3D; await this.pupPage.evaluate(() &#x3D;&gt; {
return window.WWebJS.getChats();
});
return chats.map(chat &#x3D;&gt; ChatFactory.create(this, chat));
}
/**
* Get chat instance by ID
* @param {string} chatId
* @returns {Promise&amp;lt;Chat&gt;}
*/
async getChatById(chatId) {
let chat &#x3D; await this.pupPage.evaluate(chatId &#x3D;&gt; {
return window.WWebJS.getChat(chatId);
}, chatId);
return ChatFactory.create(this, chat);
}
/**
* Get all current contact instances
* @returns {Promise&amp;lt;Array&amp;lt;Contact&gt;&gt;}
*/
async getContacts() {
let contacts &#x3D; await this.pupPage.evaluate(() &#x3D;&gt; {
return window.WWebJS.getContacts();
});
return contacts.map(contact &#x3D;&gt; ContactFactory.create(this, contact));
}
/**
* Get contact instance by ID
* @param {string} contactId
* @returns {Promise&amp;lt;Contact&gt;}
*/
async getContactById(contactId) {
let contact &#x3D; await this.pupPage.evaluate(contactId &#x3D;&gt; {
return window.WWebJS.getContact(contactId);
}, contactId);
return ContactFactory.create(this, contact);
}
/**
* Accepts an invitation to join a group
* @param {string} inviteCode Invitation code
*/
async acceptInvite(inviteCode) {
const chatId &#x3D; await this.pupPage.evaluate(async inviteCode &#x3D;&gt; {
return await window.Store.Invite.sendJoinGroupViaInvite(inviteCode);
}, inviteCode);
return chatId._serialized;
}
/**
* Sets the current user&#x27;s status message
* @param {string} status New status message
*/
async setStatus(status) {
await this.pupPage.evaluate(async status &#x3D;&gt; {
return await window.Store.Wap.sendSetStatus(status);
}, status);
}
/**
* Gets the current connection state for the client
* @returns {WAState}
*/
async getState() {
return await this.pupPage.evaluate(() &#x3D;&gt; {
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 &#x3D;&gt; {
let chat &#x3D; 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 &#x3D;&gt; {
let chat &#x3D; 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(() &#x3D;&gt; {
window.Store.AppState.phoneWatchdog.shiftTimer.forceRunNow();
});
}
}
module.exports &#x3D; Client;
</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 March 13, 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>

View File

@@ -1,202 +0,0 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.3">
<meta charset="utf-8">
<title>whatsapp-web.js 1.2.1-post &raquo; Class: ClientInfo</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
<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>2.<wbr>1-post</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">ClientInfo</span></h1>
<p class="source-link">Source: <a href="structures_ClientInfo.js.html#source-line-10">structures/<wbr>ClientInfo.<wbr>js:10</a></p>
<div class="symbol-classdesc">
<p>Current connection information</p>
</div>
<dl class="dl-compact">
</dl>
</header>
<section id="summary">
<div class="summary-callout">
<h2 class="summary-callout-heading">Properties</h2>
<div class="summary-content">
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="ClientInfo.html#me">me</a></dt>
<dd>
</dd>
<dt><a href="ClientInfo.html#phone">phone</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="ClientInfo.html#platform">platform</a></dt>
<dd>
</dd>
<dt><a href="ClientInfo.html#pushname">pushname</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
</div>
</div>
</div>
</section>
<section>
<h2 id="ClientInfo">new&nbsp;<span class="symbol-name">ClientInfo</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="me"><span class="symbol-name">me</span><small class="property-type">
&nbsp;object</small></h3>
<p>Current user ID</p>
<dl class="dl-compact">
</dl>
<h3 id="phone"><span class="symbol-name">phone</span><small class="property-type">
&nbsp;object</small></h3>
<p>Information about the phone this client is connected to</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>wa_version</p>
</td>
<td>
<p>string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>WhatsApp Version running on the phone</p>
</td>
</tr>
<tr>
<td>
<p>os_version</p>
</td>
<td>
<p>string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>OS Version running on the phone (iOS or Android version)</p>
</td>
</tr>
<tr>
<td>
<p>device_manufacturer</p>
</td>
<td>
<p>string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Device manufacturer</p>
</td>
</tr>
<tr>
<td>
<p>device_model</p>
</td>
<td>
<p>string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Device model</p>
</td>
</tr>
<tr>
<td>
<p>os_build_number</p>
</td>
<td>
<p>string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>OS build number</p>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
</dl>
<h3 id="platform"><span class="symbol-name">platform</span><small class="property-type">
&nbsp;string</small></h3>
<p>Platform the phone is running on</p>
<dl class="dl-compact">
</dl>
<h3 id="pushname"><span class="symbol-name">pushname</span><small class="property-type">
&nbsp;string</small></h3>
<p>Name configured to be shown in push notifications</p>
<dl class="dl-compact">
</dl>
</section>
</section>
</div>
</div>
<nav id="jsdoc-toc-nav" role="navigation"></nav>
</div>
</div>
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on March 13, 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>

View File

@@ -1,211 +0,0 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.3">
<meta charset="utf-8">
<title>whatsapp-web.js 1.2.1-post &raquo; Class: Contact</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
<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>2.<wbr>1-post</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">Contact</span></h1>
<p class="source-link">Source: <a href="structures_Contact.js.html#source-line-10">structures/<wbr>Contact.<wbr>js:10</a></p>
<div class="symbol-classdesc">
<p>Represents a Contact 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="Contact.html#id">id</a></dt>
<dd>
</dd>
<dt><a href="Contact.html#isBusiness">isBusiness</a></dt>
<dd>
</dd>
<dt><a href="Contact.html#isEnterprise">isEnterprise</a></dt>
<dd>
</dd>
<dt><a href="Contact.html#isGroup">isGroup</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="Contact.html#isMe">isMe</a></dt>
<dd>
</dd>
<dt><a href="Contact.html#isMyContact">isMyContact</a></dt>
<dd>
</dd>
<dt><a href="Contact.html#isUser">isUser</a></dt>
<dd>
</dd>
<dt><a href="Contact.html#isWAContact">isWAContact</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="Contact.html#name">name</a></dt>
<dd>
</dd>
<dt><a href="Contact.html#number">number</a></dt>
<dd>
</dd>
<dt><a href="Contact.html#pushname">pushname</a></dt>
<dd>
</dd>
<dt><a href="Contact.html#shortName">shortName</a></dt>
<dd>
</dd>
</dl>
</div>
</div>
</div>
<div class="summary-callout">
<h2 class="summary-callout-heading">Method</h2>
<div class="summary-content">
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="Contact.html#getProfilePicUrl">getProfilePicUrl()</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
</div>
<div class="summary-column">
</div>
</div>
</div>
</section>
<section>
<h2 id="Contact">new&nbsp;<span class="symbol-name">Contact</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="id"><span class="symbol-name">id</span><small class="property-type">
&nbsp;object</small></h3>
<p>ID that represents the contact</p>
<dl class="dl-compact">
</dl>
<h3 id="isBusiness"><span class="symbol-name">isBusiness</span><small class="property-type">
&nbsp;boolean</small></h3>
<p>Indicates if the contact is a business contact</p>
<dl class="dl-compact">
</dl>
<h3 id="isEnterprise"><span class="symbol-name">isEnterprise</span><small class="property-type">
&nbsp;boolean</small></h3>
<p>Indicates if the contact is an enterprise contact</p>
<dl class="dl-compact">
</dl>
<h3 id="isGroup"><span class="symbol-name">isGroup</span><small class="property-type">
&nbsp;boolean</small></h3>
<p>Indicates if the contact is a group contact</p>
<dl class="dl-compact">
</dl>
<h3 id="isMe"><span class="symbol-name">isMe</span><small class="property-type">
&nbsp;boolean</small></h3>
<p>Indicates if the contact is the current user's contact</p>
<dl class="dl-compact">
</dl>
<h3 id="isMyContact"><span class="symbol-name">isMyContact</span><small class="property-type">
&nbsp;boolean</small></h3>
<p>Indicates if the number is saved in the current phone's contacts</p>
<dl class="dl-compact">
</dl>
<h3 id="isUser"><span class="symbol-name">isUser</span><small class="property-type">
&nbsp;boolean</small></h3>
<p>Indicates if the contact is a user contact</p>
<dl class="dl-compact">
</dl>
<h3 id="isWAContact"><span class="symbol-name">isWAContact</span><small class="property-type">
&nbsp;boolean</small></h3>
<p>Indicates if the number is registered on WhatsApp</p>
<dl class="dl-compact">
</dl>
<h3 id="name"><span class="symbol-name">name</span><small class="property-type">
&nbsp;nullable string</small></h3>
<p>The contact's name, as saved by the current user</p>
<dl class="dl-compact">
</dl>
<h3 id="number"><span class="symbol-name">number</span><small class="property-type">
&nbsp;string</small></h3>
<p>Contact's phone number</p>
<dl class="dl-compact">
</dl>
<h3 id="pushname"><span class="symbol-name">pushname</span><small class="property-type">
&nbsp;string</small></h3>
<p>The name that the contact has configured to be shown publically</p>
<dl class="dl-compact">
</dl>
<h3 id="shortName"><span class="symbol-name">shortName</span><small class="property-type">
&nbsp;nullable string</small></h3>
<p>A shortened version of name</p>
<dl class="dl-compact">
</dl>
</section>
<h2>Method</h2>
<section>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="getProfilePicUrl"><span class="symbol-name">getProfilePicUrl</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing string</span></span></h3>
<p>Returns the contact's profile picture URL, if privacy settings allow it</p>
<dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code>Promise containing string</code> </p>
</dd>
</dl>
</section>
</section>
</div>
</div>
<nav id="jsdoc-toc-nav" role="navigation"></nav>
</div>
</div>
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on March 13, 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>

View File

@@ -1,741 +0,0 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.3">
<meta charset="utf-8">
<title>whatsapp-web.js 1.2.1-post &raquo; Class: GroupChat</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
<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>2.<wbr>1-post</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">GroupChat</span></h1>
<p class="source-link">Source: <a href="structures_GroupChat.js.html#source-line-9">structures/<wbr>GroupChat.<wbr>js:9</a></p>
<div class="symbol-classdesc">
<p>Represents a Group Chat 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="GroupChat.html#archived">archived</a></dt>
<dd>
</dd>
<dt><a href="GroupChat.html#createdAt">createdAt</a></dt>
<dd>
</dd>
<dt><a href="GroupChat.html#description">description</a></dt>
<dd>
</dd>
<dt><a href="GroupChat.html#id">id</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>
<dt><a href="GroupChat.html#name">name</a></dt>
<dd>
</dd>
<dt><a href="GroupChat.html#owner">owner</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>
<dt><a href="GroupChat.html#unreadCount">unreadCount</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="GroupChat.html#.getInviteInfo">getInviteInfo(inviteCode)</a></dt>
<dd>
</dd>
<dt><a href="GroupChat.html#.join">join(inviteCode)</a></dt>
<dd>
</dd>
<dt><a href="GroupChat.html#addParticipants">addParticipants(participantIds)</a></dt>
<dd>
</dd>
<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>
<dt><a href="GroupChat.html#leave">leave()</a></dt>
<dd>
</dd>
<dt><a href="GroupChat.html#promoteParticipants">promoteParticipants(participantIds)</a></dt>
<dd>
</dd>
<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#sendMessage">sendMessage(content, options)</a></dt>
<dd>
</dd>
<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>
<dd>
</dd>
<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>
</div>
</section>
<section>
<h2 id="GroupChat">new&nbsp;<span class="symbol-name">GroupChat</span><span class="signature"><span class="signature-params">()</span></span></h2>
<dl class="dl-compact">
<dt>Extends</dt>
<dd><a href="Chat.html">Chat</a></dd>
</dl>
</section>
<section>
<h2>Properties</h2>
<section>
<h3 id="archived"><span class="symbol-name">archived</span><small class="property-type">
&nbsp;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">
&nbsp;date</small></h3>
<p>Gets the date at which the group was created</p>
<dl class="dl-compact">
</dl>
<h3 id="description"><span class="symbol-name">description</span><small class="property-type">
&nbsp;string</small></h3>
<p>Gets the group description</p>
<dl class="dl-compact">
</dl>
<h3 id="id"><span class="symbol-name">id</span><small class="property-type">
&nbsp;unknown</small></h3>
<p>ID that represents the chat</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Chat.html#id">Chat#id</a></dd>
</dl>
<h3 id="isGroup"><span class="symbol-name">isGroup</span><small class="property-type">
&nbsp;unknown</small></h3>
<p>Indicates if the Chat is a Group Chat</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Chat.html#isGroup">Chat#isGroup</a></dd>
</dl>
<h3 id="isReadOnly"><span class="symbol-name">isReadOnly</span><small class="property-type">
&nbsp;unknown</small></h3>
<p>Indicates if the Chat is readonly</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Chat.html#isReadOnly">Chat#isReadOnly</a></dd>
</dl>
<h3 id="name"><span class="symbol-name">name</span><small class="property-type">
&nbsp;unknown</small></h3>
<p>Title of the chat</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Chat.html#name">Chat#name</a></dd>
</dl>
<h3 id="owner"><span class="symbol-name">owner</span></h3>
<p>Gets the group owner</p>
<dl class="dl-compact">
</dl>
<h3 id="participants"><span class="symbol-name">participants</span><small class="property-type">
&nbsp;array</small></h3>
<p>Gets the group participants</p>
<dl class="dl-compact">
</dl>
<h3 id="timestamp"><span class="symbol-name">timestamp</span><small class="property-type">
&nbsp;unknown</small></h3>
<p>Unix timestamp for when the chat was created</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Chat.html#timestamp">Chat#timestamp</a></dd>
</dl>
<h3 id="unreadCount"><span class="symbol-name">unreadCount</span><small class="property-type">
&nbsp;unknown</small></h3>
<p>Amount of messages unread</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Chat.html#unreadCount">Chat#unreadCount</a></dd>
</dl>
</section>
<h2>Methods</h2>
<section>
<div class="symbol-detail-labels"><span class="label label-async">async</span>&nbsp;<span class="label label-static">static</span></div>
<h3 id=".getInviteInfo"><span class="symbol-name">getInviteInfo</span><span class="signature"><span class="signature-params">(inviteCode)</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing object</span></span></h3>
<p>Returns an object with information about the invite code's group</p>
<section>
<h4>Parameter</h4>
<table class="jsdoc-details-table">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Optional</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<p>inviteCode</p>
</td>
<td>
<p>string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code>Promise containing object</code> <p>Invite information</p>
</p>
</dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span>&nbsp;<span class="label label-static">static</span></div>
<h3 id=".join"><span class="symbol-name">join</span><span class="signature"><span class="signature-params">(inviteCode)</span></span></h3>
<p>Joins a group with an invite code</p>
<section>
<h4>Parameter</h4>
<table class="jsdoc-details-table">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Optional</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<p>inviteCode</p>
</td>
<td>
<p>string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="addParticipants"><span class="symbol-name">addParticipants</span><span class="signature"><span class="signature-params">(participantIds)</span></span></h3>
<p>Adds a list of participants by ID to the group</p>
<section>
<h4>Parameter</h4>
<table class="jsdoc-details-table">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Optional</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<p>participantIds</p>
</td>
<td>
<p>Array of string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<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>&nbsp;&rarr; <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>&nbsp;&rarr; <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>
<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>participantIds</p>
</td>
<td>
<p>Array of string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="fetchMessages"><span class="symbol-name">fetchMessages</span><span class="signature"><span class="signature-params">(searchOptions)</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing Array of <a href="Message.html">Message</a></span></span></h3>
<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>&nbsp;</p>
</td>
<td>
<p>&nbsp;</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>&nbsp;</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">
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="leave"><span class="symbol-name">leave</span><span class="signature"><span class="signature-params">()</span></span></h3>
<p>Makes the bot leave the group</p>
<dl class="dl-compact">
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="promoteParticipants"><span class="symbol-name">promoteParticipants</span><span class="signature"><span class="signature-params">(participantIds)</span></span></h3>
<p>Promotes participants by IDs to admins</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>participantIds</p>
</td>
<td>
<p>Array of string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="removeParticipants"><span class="symbol-name">removeParticipants</span><span class="signature"><span class="signature-params">(participantIds)</span></span></h3>
<p>Removes a list of participants by ID to the group</p>
<section>
<h4>Parameter</h4>
<table class="jsdoc-details-table">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Optional</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<p>participantIds</p>
</td>
<td>
<p>Array of string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="revokeInvite"><span class="symbol-name">revokeInvite</span><span class="signature"><span class="signature-params">()</span></span></h3>
<p>Invalidates the current group invite code and generates a new one</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">(content, options)</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing <a href="Message.html">Message</a></span></span></h3>
<p>Send a message to this chat</p>
<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>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>options</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Chat.html#sendMessage">Chat#sendMessage</a></dd>
<dt>Returns</dt>
<dd>
<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>&nbsp;&rarr; <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>
<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>description</p>
</td>
<td>
<p>string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="setSubject"><span class="symbol-name">setSubject</span><span class="signature"><span class="signature-params">(subject)</span></span></h3>
<p>Updates the group subject</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>subject</p>
</td>
<td>
<p>string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<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>
</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 March 13, 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>

View File

@@ -1,248 +0,0 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.3">
<meta charset="utf-8">
<title>whatsapp-web.js 1.2.1-post &raquo; Class: GroupNotification</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
<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>2.<wbr>1-post</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&nbsp;<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">
&nbsp;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">
&nbsp;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">
&nbsp;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">
&nbsp;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">
&nbsp;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">
&nbsp;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">
&nbsp;<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>&nbsp;&rarr; <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>&nbsp;&rarr; <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>&nbsp;&rarr; <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>&nbsp;&rarr; <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>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>options</p>
</td>
<td>
<p>object</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code>Promise containing <a href="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 March 13, 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>

View File

@@ -1,164 +0,0 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.3">
<meta charset="utf-8">
<title>whatsapp-web.js 1.2.1-post &raquo; Class: Location</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
<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>2.<wbr>1-post</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">Location</span></h1>
<p class="source-link">Source: <a href="structures_Location.js.html#source-line-12">structures/<wbr>Location.<wbr>js:12</a></p>
<div class="symbol-classdesc">
<p>Location information</p>
</div>
<dl class="dl-compact">
</dl>
</header>
<section id="summary">
<div class="summary-callout">
<h2 class="summary-callout-heading">Properties</h2>
<div class="summary-content">
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="Location.html#description">description</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="Location.html#latitude">latitude</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="Location.html#longitude">longitude</a></dt>
<dd>
</dd>
</dl>
</div>
</div>
</div>
</section>
<section>
<h2 id="Location">new&nbsp;<span class="symbol-name">Location</span><span class="signature"><span class="signature-params">(latitude, longitude, description)</span></span></h2>
<section>
<h3>Parameters</h3>
<table class="jsdoc-details-table">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Optional</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<p>latitude</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>longitude</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>description</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Value can be null.</p>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
</dl>
</section>
<section>
<h2>Properties</h2>
<section>
<h3 id="description"><span class="symbol-name">description</span><small class="property-type">
&nbsp;nullable string</small></h3>
<p>Name for the location</p>
<dl class="dl-compact">
</dl>
<h3 id="latitude"><span class="symbol-name">latitude</span><small class="property-type">
&nbsp;number</small></h3>
<p>Location latitude</p>
<dl class="dl-compact">
</dl>
<h3 id="longitude"><span class="symbol-name">longitude</span><small class="property-type">
&nbsp;number</small></h3>
<p>Location longitude</p>
<dl class="dl-compact">
</dl>
</section>
</section>
</div>
</div>
<nav id="jsdoc-toc-nav" role="navigation"></nav>
</div>
</div>
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on March 13, 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>

View File

@@ -1,386 +0,0 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.3">
<meta charset="utf-8">
<title>whatsapp-web.js 1.2.1-post &raquo; Class: Message</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
<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>2.<wbr>1-post</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">Message</span></h1>
<p class="source-link">Source: <a href="structures_Message.js.html#source-line-13">structures/<wbr>Message.<wbr>js:13</a></p>
<div class="symbol-classdesc">
<p>Represents a Message 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="Message.html#author">author</a></dt>
<dd>
</dd>
<dt><a href="Message.html#body">body</a></dt>
<dd>
</dd>
<dt><a href="Message.html#broadcast">broadcast</a></dt>
<dd>
</dd>
<dt><a href="Message.html#from">from</a></dt>
<dd>
</dd>
<dt><a href="Message.html#fromMe">fromMe</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="Message.html#hasMedia">hasMedia</a></dt>
<dd>
</dd>
<dt><a href="Message.html#hasQuotedMsg">hasQuotedMsg</a></dt>
<dd>
</dd>
<dt><a href="Message.html#id">id</a></dt>
<dd>
</dd>
<dt><a href="Message.html#isForwarded">isForwarded</a></dt>
<dd>
</dd>
<dt><a href="Message.html#location">location</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="Message.html#mentionedIds">mentionedIds</a></dt>
<dd>
</dd>
<dt><a href="Message.html#timestamp">timestamp</a></dt>
<dd>
</dd>
<dt><a href="Message.html#to">to</a></dt>
<dd>
</dd>
<dt><a href="Message.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="Message.html#delete">delete(everyone)</a></dt>
<dd>
</dd>
<dt><a href="Message.html#downloadMedia">downloadMedia()</a></dt>
<dd>
</dd>
<dt><a href="Message.html#getChat">getChat()</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="Message.html#getContact">getContact()</a></dt>
<dd>
</dd>
<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#reply">reply(content, chatId, options)</a></dt>
<dd>
</dd>
</dl>
</div>
</div>
</div>
</section>
<section>
<h2 id="Message">new&nbsp;<span class="symbol-name">Message</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">
&nbsp;string</small></h3>
<p>If the message was sent to a group, this field will contain the user that sent the message.</p>
<dl class="dl-compact">
</dl>
<h3 id="body"><span class="symbol-name">body</span><small class="property-type">
&nbsp;string</small></h3>
<p>Message content</p>
<dl class="dl-compact">
</dl>
<h3 id="broadcast"><span class="symbol-name">broadcast</span><small class="property-type">
&nbsp;boolean</small></h3>
<p>Indicates if the message was a broadcast</p>
<dl class="dl-compact">
</dl>
<h3 id="from"><span class="symbol-name">from</span><small class="property-type">
&nbsp;string</small></h3>
<p>ID for the Chat that this message was sent to, except if the message was sent by the current user.</p>
<dl class="dl-compact">
</dl>
<h3 id="fromMe"><span class="symbol-name">fromMe</span><small class="property-type">
&nbsp;boolean</small></h3>
<p>Indicates if the message was sent by the current user</p>
<dl class="dl-compact">
</dl>
<h3 id="hasMedia"><span class="symbol-name">hasMedia</span><small class="property-type">
&nbsp;boolean</small></h3>
<p>Indicates if the message has media available for download</p>
<dl class="dl-compact">
</dl>
<h3 id="hasQuotedMsg"><span class="symbol-name">hasQuotedMsg</span><small class="property-type">
&nbsp;boolean</small></h3>
<p>Indicates if the message was sent as a reply to another message.</p>
<dl class="dl-compact">
</dl>
<h3 id="id"><span class="symbol-name">id</span><small class="property-type">
&nbsp;object</small></h3>
<p>ID that represents the message</p>
<dl class="dl-compact">
</dl>
<h3 id="isForwarded"><span class="symbol-name">isForwarded</span><small class="property-type">
&nbsp;boolean</small></h3>
<p>Indicates if the message was forwarded</p>
<dl class="dl-compact">
</dl>
<h3 id="location"><span class="symbol-name">location</span><small class="property-type">
&nbsp;<a href="Location.html">Location</a></small></h3>
<p>Location information contained in the message, if the message is type &quot;location&quot;</p>
<dl class="dl-compact">
</dl>
<h3 id="mentionedIds"><span class="symbol-name">mentionedIds</span><small class="property-type">
&nbsp;Array of string</small></h3>
<p>Indicates the mentions in the message body.</p>
<dl class="dl-compact">
</dl>
<h3 id="timestamp"><span class="symbol-name">timestamp</span><small class="property-type">
&nbsp;number</small></h3>
<p>Unix timestamp for when the message was created</p>
<dl class="dl-compact">
</dl>
<h3 id="to"><span class="symbol-name">to</span><small class="property-type">
&nbsp;string</small></h3>
<p>ID for who this message is for.</p>
<p>If the message is sent by the current user, it will be the Chat to which the message is being sent.
If the message is sent by another user, it will be the ID for the current user.</p>
<dl class="dl-compact">
</dl>
<h3 id="type"><span class="symbol-name">type</span><small class="property-type">
&nbsp;<a href="global.html#MessageTypes">MessageTypes</a></small></h3>
<p>Message type</p>
<dl class="dl-compact">
</dl>
</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>&nbsp;</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>&nbsp;&rarr; <span class="signature-returns"> Promise containing <a href="MessageMedia.html">MessageMedia</a></span></span></h3>
<p>Downloads and returns the attatched message media</p>
<dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code>Promise containing <a href="MessageMedia.html">MessageMedia</a></code> </p>
</dd>
</dl>
<h3 id="getChat"><span class="symbol-name">getChat</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing <a href="Chat.html">Chat</a></span></span></h3>
<p>Returns the Chat this message 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>&nbsp;&rarr; <span class="signature-returns"> Promise containing <a href="Contact.html">Contact</a></span></span></h3>
<p>Returns the Contact this message was sent from</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="getMentions"><span class="symbol-name">getMentions</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing Array of <a href="Contact.html">Contact</a></span></span></h3>
<p>Returns the Contacts mentioned in this message</p>
<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="getQuotedMessage"><span class="symbol-name">getQuotedMessage</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing <a href="Message.html">Message</a></span></span></h3>
<p>Returns the quoted message, if any</p>
<dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code>Promise containing <a href="Message.html">Message</a></code> </p>
</dd>
</dl>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="reply"><span class="symbol-name">reply</span><span class="signature"><span class="signature-params">(content, chatId, options)</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing <a href="Message.html">Message</a></span></span></h3>
<p>Sends a message as a reply to this message. If chatId is specified, it will be sent
through the specified Chat. If not, it will send the message
in the same Chat as the original message was sent.</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>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>chatId</p>
</td>
<td>
<p>string</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Value can be null.</p>
</td>
</tr>
<tr>
<td>
<p>options</p>
</td>
<td>
<p>object</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code>Promise containing <a href="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 March 13, 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>

View File

@@ -1,167 +0,0 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.3">
<meta charset="utf-8">
<title>whatsapp-web.js 1.2.1-post &raquo; Class: MessageMedia</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
<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>2.<wbr>1-post</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">MessageMedia</span></h1>
<p class="source-link">Source: <a href="structures_MessageMedia.js.html#source-line-10">structures/<wbr>MessageMedia.<wbr>js:10</a></p>
<div class="symbol-classdesc">
<p>Media attached to a message</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="MessageMedia.html#data">data</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="MessageMedia.html#filename">filename</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="MessageMedia.html#mimetype">mimetype</a></dt>
<dd>
</dd>
</dl>
</div>
</div>
</div>
</section>
<section>
<h2 id="MessageMedia">new&nbsp;<span class="symbol-name">MessageMedia</span><span class="signature"><span class="signature-params">(mimetype, data, filename)</span></span></h2>
<section>
<h3>Parameters</h3>
<table class="jsdoc-details-table">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Optional</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<p>mimetype</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>MIME type of the attachment</p>
</td>
</tr>
<tr>
<td>
<p>data</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Base64-encoded data of the file</p>
</td>
</tr>
<tr>
<td>
<p>filename</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>Document file name</p>
<p>Value can be null.</p>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
</dl>
</section>
<section>
<h2>Properties</h2>
<section>
<h3 id="data"><span class="symbol-name">data</span><small class="property-type">
&nbsp;string</small></h3>
<p>Base64 encoded data that represents the file</p>
<dl class="dl-compact">
</dl>
<h3 id="filename"><span class="symbol-name">filename</span><small class="property-type">
&nbsp;nullable string</small></h3>
<p>Name of the file (for documents)</p>
<dl class="dl-compact">
</dl>
<h3 id="mimetype"><span class="symbol-name">mimetype</span><small class="property-type">
&nbsp;string</small></h3>
<p>MIME type of the attachment</p>
<dl class="dl-compact">
</dl>
</section>
</section>
</div>
</div>
<nav id="jsdoc-toc-nav" role="navigation"></nav>
</div>
</div>
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on March 13, 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>

View File

@@ -1,393 +0,0 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.3">
<meta charset="utf-8">
<title>whatsapp-web.js 1.2.1-post &raquo; Class: PrivateChat</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
<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>2.<wbr>1-post</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">PrivateChat</span></h1>
<p class="source-link">Source: <a href="structures_PrivateChat.js.html#source-line-9">structures/<wbr>PrivateChat.<wbr>js:9</a></p>
<div class="symbol-classdesc">
<p>Represents a Private Chat 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="PrivateChat.html#archived">archived</a></dt>
<dd>
</dd>
<dt><a href="PrivateChat.html#id">id</a></dt>
<dd>
</dd>
<dt><a href="PrivateChat.html#isGroup">isGroup</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="PrivateChat.html#isReadOnly">isReadOnly</a></dt>
<dd>
</dd>
<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#unreadCount">unreadCount</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="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>
</section>
<section>
<h2 id="PrivateChat">new&nbsp;<span class="symbol-name">PrivateChat</span><span class="signature"><span class="signature-params">()</span></span></h2>
<dl class="dl-compact">
<dt>Extends</dt>
<dd><a href="Chat.html">Chat</a></dd>
</dl>
</section>
<section>
<h2>Properties</h2>
<section>
<h3 id="archived"><span class="symbol-name">archived</span><small class="property-type">
&nbsp;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">
&nbsp;unknown</small></h3>
<p>ID that represents the chat</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Chat.html#id">Chat#id</a></dd>
</dl>
<h3 id="isGroup"><span class="symbol-name">isGroup</span><small class="property-type">
&nbsp;unknown</small></h3>
<p>Indicates if the Chat is a Group Chat</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Chat.html#isGroup">Chat#isGroup</a></dd>
</dl>
<h3 id="isReadOnly"><span class="symbol-name">isReadOnly</span><small class="property-type">
&nbsp;unknown</small></h3>
<p>Indicates if the Chat is readonly</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Chat.html#isReadOnly">Chat#isReadOnly</a></dd>
</dl>
<h3 id="name"><span class="symbol-name">name</span><small class="property-type">
&nbsp;unknown</small></h3>
<p>Title of the chat</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Chat.html#name">Chat#name</a></dd>
</dl>
<h3 id="timestamp"><span class="symbol-name">timestamp</span><small class="property-type">
&nbsp;unknown</small></h3>
<p>Unix timestamp for when the chat was created</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Chat.html#timestamp">Chat#timestamp</a></dd>
</dl>
<h3 id="unreadCount"><span class="symbol-name">unreadCount</span><small class="property-type">
&nbsp;unknown</small></h3>
<p>Amount of messages unread</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Chat.html#unreadCount">Chat#unreadCount</a></dd>
</dl>
</section>
<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>&nbsp;&rarr; <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>&nbsp;&rarr; <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>&nbsp;&rarr; <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>&nbsp;</p>
</td>
<td>
<p>&nbsp;</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>&nbsp;</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>&nbsp;&rarr; <span class="signature-returns"> Promise containing <a href="Message.html">Message</a></span></span></h3>
<p>Send a message to this chat</p>
<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>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>options</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
<p>&nbsp;</p>
</td>
<td>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Chat.html#sendMessage">Chat#sendMessage</a></dd>
<dt>Returns</dt>
<dd>
<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>&nbsp;&rarr; <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>
</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 March 13, 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>

View File

@@ -1,235 +0,0 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.3">
<meta charset="utf-8">
<title>whatsapp-web.js 1.2.1-post &raquo; Class: PrivateContact</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
<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>2.<wbr>1-post</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">PrivateContact</span></h1>
<p class="source-link">Source: <a href="structures_PrivateContact.js.html#source-line-9">structures/<wbr>PrivateContact.<wbr>js:9</a></p>
<div class="symbol-classdesc">
<p>Represents a Private Contact 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="PrivateContact.html#id">id</a></dt>
<dd>
</dd>
<dt><a href="PrivateContact.html#isBusiness">isBusiness</a></dt>
<dd>
</dd>
<dt><a href="PrivateContact.html#isEnterprise">isEnterprise</a></dt>
<dd>
</dd>
<dt><a href="PrivateContact.html#isGroup">isGroup</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="PrivateContact.html#isMe">isMe</a></dt>
<dd>
</dd>
<dt><a href="PrivateContact.html#isMyContact">isMyContact</a></dt>
<dd>
</dd>
<dt><a href="PrivateContact.html#isUser">isUser</a></dt>
<dd>
</dd>
<dt><a href="PrivateContact.html#isWAContact">isWAContact</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="PrivateContact.html#name">name</a></dt>
<dd>
</dd>
<dt><a href="PrivateContact.html#number">number</a></dt>
<dd>
</dd>
<dt><a href="PrivateContact.html#pushname">pushname</a></dt>
<dd>
</dd>
<dt><a href="PrivateContact.html#shortName">shortName</a></dt>
<dd>
</dd>
</dl>
</div>
</div>
</div>
<div class="summary-callout">
<h2 class="summary-callout-heading">Method</h2>
<div class="summary-content">
<div class="summary-column">
<dl class="dl-summary-callout">
<dt><a href="PrivateContact.html#getProfilePicUrl">getProfilePicUrl()</a></dt>
<dd>
</dd>
</dl>
</div>
<div class="summary-column">
</div>
<div class="summary-column">
</div>
</div>
</div>
</section>
<section>
<h2 id="PrivateContact">new&nbsp;<span class="symbol-name">PrivateContact</span><span class="signature"><span class="signature-params">()</span></span></h2>
<dl class="dl-compact">
<dt>Extends</dt>
<dd><a href="Contact.html">Contact</a></dd>
</dl>
</section>
<section>
<h2>Properties</h2>
<section>
<h3 id="id"><span class="symbol-name">id</span><small class="property-type">
&nbsp;unknown</small></h3>
<p>ID that represents the contact</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Contact.html#id">Contact#id</a></dd>
</dl>
<h3 id="isBusiness"><span class="symbol-name">isBusiness</span><small class="property-type">
&nbsp;unknown</small></h3>
<p>Indicates if the contact is a business contact</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Contact.html#isBusiness">Contact#isBusiness</a></dd>
</dl>
<h3 id="isEnterprise"><span class="symbol-name">isEnterprise</span><small class="property-type">
&nbsp;unknown</small></h3>
<p>Indicates if the contact is an enterprise contact</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Contact.html#isEnterprise">Contact#isEnterprise</a></dd>
</dl>
<h3 id="isGroup"><span class="symbol-name">isGroup</span><small class="property-type">
&nbsp;unknown</small></h3>
<p>Indicates if the contact is a group contact</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Contact.html#isGroup">Contact#isGroup</a></dd>
</dl>
<h3 id="isMe"><span class="symbol-name">isMe</span><small class="property-type">
&nbsp;unknown</small></h3>
<p>Indicates if the contact is the current user's contact</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Contact.html#isMe">Contact#isMe</a></dd>
</dl>
<h3 id="isMyContact"><span class="symbol-name">isMyContact</span><small class="property-type">
&nbsp;unknown</small></h3>
<p>Indicates if the number is saved in the current phone's contacts</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Contact.html#isMyContact">Contact#isMyContact</a></dd>
</dl>
<h3 id="isUser"><span class="symbol-name">isUser</span><small class="property-type">
&nbsp;unknown</small></h3>
<p>Indicates if the contact is a user contact</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Contact.html#isUser">Contact#isUser</a></dd>
</dl>
<h3 id="isWAContact"><span class="symbol-name">isWAContact</span><small class="property-type">
&nbsp;unknown</small></h3>
<p>Indicates if the number is registered on WhatsApp</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Contact.html#isWAContact">Contact#isWAContact</a></dd>
</dl>
<h3 id="name"><span class="symbol-name">name</span><small class="property-type">
&nbsp;unknown</small></h3>
<p>The contact's name, as saved by the current user</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Contact.html#name">Contact#name</a></dd>
</dl>
<h3 id="number"><span class="symbol-name">number</span><small class="property-type">
&nbsp;unknown</small></h3>
<p>Contact's phone number</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Contact.html#number">Contact#number</a></dd>
</dl>
<h3 id="pushname"><span class="symbol-name">pushname</span><small class="property-type">
&nbsp;unknown</small></h3>
<p>The name that the contact has configured to be shown publically</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Contact.html#pushname">Contact#pushname</a></dd>
</dl>
<h3 id="shortName"><span class="symbol-name">shortName</span><small class="property-type">
&nbsp;unknown</small></h3>
<p>A shortened version of name</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Contact.html#shortName">Contact#shortName</a></dd>
</dl>
</section>
<h2>Method</h2>
<section>
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
<h3 id="getProfilePicUrl"><span class="symbol-name">getProfilePicUrl</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Promise containing string</span></span></h3>
<p>Returns the contact's profile picture URL, if privacy settings allow it</p>
<dl class="dl-compact">
<dt>Inherited from</dt>
<dd><a href="Contact.html#getProfilePicUrl">Contact#getProfilePicUrl</a></dd>
<dt>Returns</dt>
<dd></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 March 13, 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>

View File

@@ -1,65 +0,0 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.3">
<meta charset="utf-8">
<title>whatsapp-web.js 1.2.1-post &raquo; Class: Util</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
<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>2.<wbr>1-post</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">Util</span></h1>
<p class="source-link">Source: <a href="util_Util.js.html#source-line-10">util/<wbr>Util.<wbr>js:10</a></p>
<div class="symbol-classdesc">
<p>Utility methods</p>
</div>
<dl class="dl-compact">
</dl>
</header>
<section id="summary">
</section>
<section>
<h2 id="Util">new&nbsp;<span class="symbol-name">Util</span><span class="signature"><span class="signature-params">()</span></span></h2>
<dl class="dl-compact">
</dl>
</section>
<section>
</section>
</div>
</div>
<nav id="jsdoc-toc-nav" role="navigation"></nav>
</div>
</div>
<footer id="jsdoc-footer" class="jsdoc-footer">
<div id="jsdoc-footer-container">
<p>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on March 13, 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>

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -1,17 +0,0 @@
(function($) {
// TODO: make the node ID configurable
var treeNode = $('#jsdoc-toc-nav');
// initialize the tree
treeNode.tree({
autoEscape: false,
closedIcon: '&#x21e2;',
data: [{"label":"<a href=\"global.html\">Globals</a>","id":"global","children":[]},{"label":"<a href=\"Base.html\">Base</a>","id":"Base","children":[]},{"label":"<a href=\"BusinessContact.html\">BusinessContact</a>","id":"BusinessContact","children":[]},{"label":"<a href=\"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: ' &#x21e3;',
saveState: false,
useContextMenu: false
});
// add event handlers
// TODO
})(jQuery);

View File

@@ -1 +0,0 @@
PR.registerLangHandler(PR.createSimpleLexer([[PR.PR_PLAIN,/^[ \t\r\n\f]+/,null," \t\r\n\f"]],[[PR.PR_STRING,/^\"(?:[^\n\r\f\\\"]|\\(?:\r\n?|\n|\f)|\\[\s\S])*\"/,null],[PR.PR_STRING,/^\'(?:[^\n\r\f\\\']|\\(?:\r\n?|\n|\f)|\\[\s\S])*\'/,null],["lang-css-str",/^url\(([^\)\"\']+)\)/i],[PR.PR_KEYWORD,/^(?:url|rgb|\!important|@import|@page|@media|@charset|inherit)(?=[^\-\w]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|(?:\\[0-9a-f]+ ?))(?:[_a-z0-9\-]|\\(?:\\[0-9a-f]+ ?))*)\s*:/i],[PR.PR_COMMENT,/^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//],[PR.PR_COMMENT,/^(?:<!--|-->)/],[PR.PR_LITERAL,/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],[PR.PR_LITERAL,/^#(?:[0-9a-f]{3}){1,2}\b/i],[PR.PR_PLAIN,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i],[PR.PR_PUNCTUATION,/^[^\s\w\'\"]+/]]),["css"]),PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_KEYWORD,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i]]),["css-kw"]),PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_STRING,/^[^\)\"\']+/]]),["css-str"]);

View File

@@ -1 +0,0 @@
!function(){var n,e=0,t=document.getElementsByClassName("prettyprint");t&&t[0]&&(n=(n=(t=t[0].getElementsByTagName("code")[0]).innerHTML.split("\n")).map(function(n){return'<span id="source-line-'+ ++e+'" class="line"></span>'+n}),t.innerHTML=n.join("\n"))}();

File diff suppressed because one or more lines are too long

View File

@@ -1 +0,0 @@
!function(){function o(n){var o,t,e=document.getElementById(n.replace(/^#/,""));e&&(t=e.getBoundingClientRect(),o=t.top+window.pageYOffset,setTimeout(function(){window.scrollTo(0,o-50)},5))}window.addEventListener("load",function(){var n=window.location.hash;n&&"#"!==n&&o(n),window.addEventListener("hashchange",function(){o(window.location.hash)})})}();

File diff suppressed because one or more lines are too long

View File

@@ -1,75 +0,0 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.3">
<meta charset="utf-8">
<title>whatsapp-web.js 1.2.1-post &raquo; Source: structures/Base.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
<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>2.<wbr>1-post</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/Base.js</h1>
</header>
<article>
<pre class="prettyprint linenums"><code>&#x27;use strict&#x27;;
/**
* Represents a WhatsApp data structure
*/
class Base {
constructor(client) {
/**
* The client that instantiated this
* @readonly
*/
Object.defineProperty(this, &#x27;client&#x27;, { value: client });
}
_clone() {
return Object.assign(Object.create(this), this);
}
_patch(data) { return data; }
}
module.exports &#x3D; Base;</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 March 13, 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>

View File

@@ -1,74 +0,0 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.3">
<meta charset="utf-8">
<title>whatsapp-web.js 1.2.1-post &raquo; Source: structures/BusinessContact.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
<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>2.<wbr>1-post</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/BusinessContact.js</h1>
</header>
<article>
<pre class="prettyprint linenums"><code>&#x27;use strict&#x27;;
const Contact &#x3D; require(&#x27;./Contact&#x27;);
/**
* Represents a Business Contact on WhatsApp
* @extends {Contact}
*/
class BusinessContact extends Contact {
_patch(data) {
/**
* The contact&#x27;s business profile
*/
this.businessProfile &#x3D; data.businessProfile;
return super._patch(data);
}
}
module.exports &#x3D; BusinessContact;</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 March 13, 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>

View File

@@ -1,230 +0,0 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.3">
<meta charset="utf-8">
<title>whatsapp-web.js 1.2.1-post &raquo; Source: structures/Chat.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
<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>2.<wbr>1-post</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/Chat.js</h1>
</header>
<article>
<pre class="prettyprint linenums"><code>&#x27;use strict&#x27;;
const Base &#x3D; require(&#x27;./Base&#x27;);
const Message &#x3D; require(&#x27;./Message&#x27;);
/**
* Represents a Chat on WhatsApp
* @extends {Base}
*/
class Chat extends Base {
constructor(client, data) {
super(client);
if (data) this._patch(data);
}
_patch(data) {
/**
* ID that represents the chat
* @type {object}
*/
this.id &#x3D; data.id;
/**
* Title of the chat
* @type {string}
*/
this.name &#x3D; data.formattedTitle;
/**
* Indicates if the Chat is a Group Chat
* @type {boolean}
*/
this.isGroup &#x3D; data.isGroup;
/**
* Indicates if the Chat is readonly
* @type {boolean}
*/
this.isReadOnly &#x3D; data.isReadOnly;
/**
* Amount of messages unread
* @type {number}
*/
this.unreadCount &#x3D; data.unreadCount;
/**
* Unix timestamp for when the chat was created
* @type {number}
*/
this.timestamp &#x3D; data.t;
/**
* Indicates if the Chat is archived
* @type {boolean}
*/
this.archived &#x3D; data.archive;
return super._patch(data);
}
/**
* Send a message to this chat
* @param {string|MessageMedia|Location} content
* @param {object} options
* @returns {Promise&amp;lt;Message&gt;} Message that was just sent
*/
async sendMessage(content, options) {
return this.client.sendMessage(this.id._serialized, content, options);
}
/**
* Set the message as seen
* @returns {Promise&amp;lt;Boolean&gt;} result
*/
async sendSeen() {
return this.client.sendSeen(this.id._serialized);
}
/**
* Clears all messages from the chat
* @returns {Promise&amp;lt;Boolean&gt;} result
*/
async clearMessages() {
return this.client.pupPage.evaluate(chatId &#x3D;&gt; {
return window.WWebJS.sendClearChat(chatId);
}, this.id._serialized);
}
/**
* Deletes the chat
* @returns {Promise&amp;lt;Boolean&gt;} result
*/
async delete() {
return this.client.pupPage.evaluate(chatId &#x3D;&gt; {
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&#x3D;50] The amount of messages to return. Note that the actual number of returned messages may be smaller if there aren&#x27;t enough messages in the conversation. Set this to Infinity to load all messages.
* @returns {Promise&amp;lt;Array&amp;lt;Message&gt;&gt;}
*/
async fetchMessages(searchOptions) {
if(!searchOptions || !searchOptions.limit) {
searchOptions &#x3D; {limit: 50};
}
let messages &#x3D; await this.client.pupPage.evaluate(async (chatId, limit) &#x3D;&gt; {
const msgFilter &#x3D; m &#x3D;&gt; !m.isNotification; // dont include notification messages
const chat &#x3D; window.Store.Chat.get(chatId);
let msgs &#x3D; chat.msgs.models.filter(msgFilter);
while(msgs.length &amp;lt; limit) {
const loadedMessages &#x3D; await chat.loadEarlierMsgs();
if(!loadedMessages) break;
msgs &#x3D; [...loadedMessages.filter(msgFilter), ...msgs];
}
msgs.sort((a, b) &#x3D;&gt; (a.t &gt; b.t) ? 1 : -1);
return msgs.splice(msgs.length - limit).map(m &#x3D;&gt; m.serialize());
}, this.id._serialized, searchOptions.limit);
return messages.map(m &#x3D;&gt; new Message(this.client, m));
}
/**
* Simulate typing in chat. This will last for 25 seconds.
*/
async sendStateTyping() {
return this.client.pupPage.evaluate(chatId &#x3D;&gt; {
window.WWebJS.sendChatstate(&#x27;typing&#x27;, 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 &#x3D;&gt; {
window.WWebJS.sendChatstate(&#x27;recording&#x27;, chatId);
return true;
}, this.id._serialized);
}
/**
* Stops typing or recording in chat immediately.
*/
async clearState() {
return this.client.pupPage.evaluate(chatId &#x3D;&gt; {
window.WWebJS.sendChatstate(&#x27;stop&#x27;, chatId);
return true;
}, this.id._serialized);
}
}
module.exports &#x3D; Chat;
</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 March 13, 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>

View File

@@ -1,104 +0,0 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.3">
<meta charset="utf-8">
<title>whatsapp-web.js 1.2.1-post &raquo; Source: structures/ClientInfo.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
<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>2.<wbr>1-post</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/ClientInfo.js</h1>
</header>
<article>
<pre class="prettyprint linenums"><code>&#x27;use strict&#x27;;
const Base &#x3D; require(&#x27;./Base&#x27;);
/**
* Current connection information
* @extends {Base}
*/
class ClientInfo extends Base {
constructor(client, data) {
super(client);
if(data) this._patch(data);
}
_patch(data) {
/**
* Name configured to be shown in push notifications
* @type {string}
*/
this.pushname &#x3D; data.pushname;
/**
* Current user ID
* @type {object}
*/
this.me &#x3D; data.me;
/**
* Information about the phone this client is connected to
* @type {object}
* @property {string} wa_version WhatsApp Version running on the phone
* @property {string} os_version OS Version running on the phone (iOS or Android version)
* @property {string} device_manufacturer Device manufacturer
* @property {string} device_model Device model
* @property {string} os_build_number OS build number
*/
this.phone &#x3D; data.phone;
/**
* Platform the phone is running on
* @type {string}
*/
this.platform &#x3D; data.platform;
return super._patch(data);
}
}
module.exports &#x3D; ClientInfo;</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 March 13, 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>

View File

@@ -1,168 +0,0 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.3">
<meta charset="utf-8">
<title>whatsapp-web.js 1.2.1-post &raquo; Source: structures/Contact.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
<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>2.<wbr>1-post</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/Contact.js</h1>
</header>
<article>
<pre class="prettyprint linenums"><code>&#x27;use strict&#x27;;
const Base &#x3D; require(&#x27;./Base&#x27;);
/**
* Represents a Contact on WhatsApp
* @extends {Base}
*/
class Contact extends Base {
constructor(client, data) {
super(client);
if(data) this._patch(data);
}
_patch(data) {
/**
* ID that represents the contact
* @type {object}
*/
this.id &#x3D; data.id;
/**
* Contact&#x27;s phone number
* @type {string}
*/
this.number &#x3D; data.userid;
/**
* Indicates if the contact is a business contact
* @type {boolean}
*/
this.isBusiness &#x3D; data.isBusiness;
/**
* Indicates if the contact is an enterprise contact
* @type {boolean}
*/
this.isEnterprise &#x3D; data.isEnterprise;
this.labels &#x3D; data.labels;
/**
* The contact&#x27;s name, as saved by the current user
* @type {?string}
*/
this.name &#x3D; data.name;
/**
* The name that the contact has configured to be shown publically
* @type {string}
*/
this.pushname &#x3D; data.pushname;
this.sectionHeader &#x3D; data.sectionHeader;
/**
* A shortened version of name
* @type {?string}
*/
this.shortName &#x3D; data.shortName;
this.statusMute &#x3D; data.statusMute;
this.type &#x3D; data.type;
this.verifiedLevel &#x3D; data.verifiedLevel;
this.verifiedName &#x3D; data.verifiedName;
/**
* Indicates if the contact is the current user&#x27;s contact
* @type {boolean}
*/
this.isMe &#x3D; data.isMe;
/**
* Indicates if the contact is a user contact
* @type {boolean}
*/
this.isUser &#x3D; data.isUser;
/**
* Indicates if the contact is a group contact
* @type {boolean}
*/
this.isGroup &#x3D; data.isGroup;
/**
* Indicates if the number is registered on WhatsApp
* @type {boolean}
*/
this.isWAContact &#x3D; data.isWAContact;
/**
* Indicates if the number is saved in the current phone&#x27;s contacts
* @type {boolean}
*/
this.isMyContact &#x3D; data.isMyContact;
return super._patch(data);
}
/**
* Returns the contact&#x27;s profile picture URL, if privacy settings allow it
* @returns {Promise&amp;lt;string&gt;}
*/
async getProfilePicUrl() {
const profilePic &#x3D; await this.client.pupPage.evaluate((contactId) &#x3D;&gt; {
return window.Store.Wap.profilePicFind(contactId);
}, this.id._serialized);
return profilePic ? profilePic.eurl : undefined;
}
}
module.exports &#x3D; Contact;</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 March 13, 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>

View File

@@ -1,224 +0,0 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.3">
<meta charset="utf-8">
<title>whatsapp-web.js 1.2.1-post &raquo; Source: structures/GroupChat.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
<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>2.<wbr>1-post</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/GroupChat.js</h1>
</header>
<article>
<pre class="prettyprint linenums"><code>&#x27;use strict&#x27;;
const Chat &#x3D; require(&#x27;./Chat&#x27;);
/**
* Represents a Group Chat on WhatsApp
* @extends {Chat}
*/
class GroupChat extends Chat {
_patch(data) {
this.groupMetadata &#x3D; data.groupMetadata;
return super._patch(data);
}
/**
* Gets the group owner
*/
get owner() {
return this.groupMetadata.owner;
}
/**
* Gets the date at which the group was created
* @type {date}
*/
get createdAt() {
return new Date(this.groupMetadata.creation * 1000);
}
/**
* Gets the group description
* @type {string}
*/
get description() {
return this.groupMetadata.desc;
}
/**
* Gets the group participants
* @type {array}
*/
get participants() {
return this.groupMetadata.participants;
}
/**
* Adds a list of participants by ID to the group
* @param {Array&amp;lt;string&gt;} participantIds
*/
async addParticipants(participantIds) {
return await this.client.pupPage.evaluate((chatId, participantIds) &#x3D;&gt; {
return window.Store.Wap.addParticipants(chatId, participantIds);
}, this.id._serialized, participantIds);
}
/**
* Removes a list of participants by ID to the group
* @param {Array&amp;lt;string&gt;} participantIds
*/
async removeParticipants(participantIds) {
return await this.client.pupPage.evaluate((chatId, participantIds) &#x3D;&gt; {
return window.Store.Wap.removeParticipants(chatId, participantIds);
}, this.id._serialized, participantIds);
}
/**
* Promotes participants by IDs to admins
* @param {Array&amp;lt;string&gt;} participantIds
*/
async promoteParticipants(participantIds) {
return await this.client.pupPage.evaluate((chatId, participantIds) &#x3D;&gt; {
return window.Store.Wap.promoteParticipants(chatId, participantIds);
}, this.id._serialized, participantIds);
}
/**
* Demotes participants by IDs to regular users
* @param {Array&amp;lt;string&gt;} participantIds
*/
async demoteParticipants(participantIds) {
return await this.client.pupPage.evaluate((chatId, participantIds) &#x3D;&gt; {
return window.Store.Wap.demoteParticipants(chatId, participantIds);
}, this.id._serialized, participantIds);
}
/**
* Updates the group subject
* @param {string} subject
*/
async setSubject(subject) {
let res &#x3D; await this.client.pupPage.evaluate((chatId, subject) &#x3D;&gt; {
return window.Store.Wap.changeSubject(chatId, subject);
}, this.id._serialized, subject);
if(res.status &#x3D;&#x3D; 200) {
this.name &#x3D; subject;
}
}
/**
* Updates the group description
* @param {string} description
*/
async setDescription(description) {
let res &#x3D; await this.client.pupPage.evaluate((chatId, description) &#x3D;&gt; {
let descId &#x3D; window.Store.GroupMetadata.get(chatId).descId;
return window.Store.Wap.setGroupDescription(chatId, description, window.Store.genId(), descId);
}, this.id._serialized, description);
if (res.status &#x3D;&#x3D; 200) {
this.groupMetadata.desc &#x3D; description;
}
}
/**
* Gets the invite code for a specific group
*/
async getInviteCode() {
let res &#x3D; await this.client.pupPage.evaluate(chatId &#x3D;&gt; {
return window.Store.Wap.groupInviteCode(chatId);
}, this.id._serialized);
if (res.status &#x3D;&#x3D; 200) {
return res.code;
}
throw new Error(&#x27;Not authorized&#x27;);
}
/**
* Invalidates the current group invite code and generates a new one
*/
async revokeInvite() {
return await this.client.pupPage.evaluate(chatId &#x3D;&gt; {
return window.Store.Wap.revokeGroupInvite(chatId);
}, this.id._serialized);
}
/**
* Returns an object with information about the invite code&#x27;s group
* @param {string} inviteCode
* @returns {Promise&amp;lt;object&gt;} Invite information
*/
static async getInviteInfo(inviteCode) {
return await this.client.pupPage.evaluate(inviteCode &#x3D;&gt; {
return window.Store.Wap.groupInviteInfo(inviteCode);
}, inviteCode);
}
/**
* Joins a group with an invite code
* @param {string} inviteCode
*/
static async join(inviteCode) {
return await this.client.pupPage.evaluate(inviteCode &#x3D;&gt; {
return window.Store.Wap.acceptGroupInvite(inviteCode);
}, inviteCode);
}
/**
* Makes the bot leave the group
*/
async leave() {
return await this.client.pupPage.evaluate(chatId &#x3D;&gt; {
return window.Store.Wap.leaveGroup(chatId);
}, this.id._serialized);
}
}
module.exports &#x3D; GroupChat;</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 March 13, 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>

View File

@@ -1,158 +0,0 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.3">
<meta charset="utf-8">
<title>whatsapp-web.js 1.2.1-post &raquo; Source: structures/GroupNotification.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
<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>2.<wbr>1-post</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>&#x27;use strict&#x27;;
const Base &#x3D; require(&#x27;./Base&#x27;);
/**
* 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 &#x3D; data.id;
/**
* Extra content
* @type {string}
*/
this.body &#x3D; data.body || &#x27;&#x27;;
/**
* GroupNotification type
* @type {GroupNotificationTypes}
*/
this.type &#x3D; data.subtype;
/**
* Unix timestamp for when the groupNotification was created
* @type {number}
*/
this.timestamp &#x3D; data.t;
/**
* ID for the Chat that this groupNotification was sent for.
*
* @type {string}
*/
this.chatId &#x3D; typeof (data.to) &#x3D;&#x3D;&#x3D; &#x27;object&#x27; ? data.to._serialized : data.to;
/**
* ContactId for the user that produced the GroupNotification.
* @type {string}
*/
this.author &#x3D; typeof (data.author) &#x3D;&#x3D;&#x3D; &#x27;object&#x27; ? data.author._serialized : data.author;
/**
* Contact IDs for the users that were affected by this GroupNotification.
* @type {Array&amp;lt;string&gt;}
*/
this.recipientIds &#x3D; [];
if (data.recipients) {
this.recipientIds &#x3D; data.recipients;
}
return super._patch(data);
}
/**
* Returns the Chat this groupNotification was sent in
* @returns {Promise&amp;lt;Chat&gt;}
*/
getChat() {
return this.client.getChatById(this.chatId);
}
/**
* Returns the Contact this GroupNotification was produced by
* @returns {Promise&amp;lt;Contact&gt;}
*/
getContact() {
return this.client.getContactById(this.author);
}
/**
* Returns the Contacts affected by this GroupNotification.
* @returns {Promise&amp;lt;Array&amp;lt;Contact&gt;&gt;}
*/
async getRecipients() {
return await Promise.all(this.recipientIds.map(async m &#x3D;&gt; 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&amp;lt;Message&gt;}
*/
async reply(content, options&#x3D;{}) {
return this.client.sendMessage(this.chatId, content, options);
}
}
module.exports &#x3D; 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 March 13, 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>

View File

@@ -1,86 +0,0 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.3">
<meta charset="utf-8">
<title>whatsapp-web.js 1.2.1-post &raquo; Source: structures/Location.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
<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>2.<wbr>1-post</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/Location.js</h1>
</header>
<article>
<pre class="prettyprint linenums"><code>&#x27;use strict&#x27;;
/**
* Location information
*/
class Location {
/**
* @param {number} latitude
* @param {number} longitude
* @param {?string} description
*/
constructor(latitude, longitude, description) {
/**
* Location latitude
* @type {number}
*/
this.latitude &#x3D; latitude;
/**
* Location longitude
* @type {number}
*/
this.longitude &#x3D; longitude;
/**
* Name for the location
* @type {?string}
*/
this.description &#x3D; description;
}
}
module.exports &#x3D; Location;</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 March 13, 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>

View File

@@ -1,277 +0,0 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.3">
<meta charset="utf-8">
<title>whatsapp-web.js 1.2.1-post &raquo; Source: structures/Message.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
<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>2.<wbr>1-post</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/Message.js</h1>
</header>
<article>
<pre class="prettyprint linenums"><code>&#x27;use strict&#x27;;
const Base &#x3D; require(&#x27;./Base&#x27;);
const MessageMedia &#x3D; require(&#x27;./MessageMedia&#x27;);
const Location &#x3D; require(&#x27;./Location&#x27;);
const { MessageTypes } &#x3D; require(&#x27;../util/Constants&#x27;);
/**
* Represents a Message on WhatsApp
* @extends {Base}
*/
class Message extends Base {
constructor(client, data) {
super(client);
if(data) this._patch(data);
}
_patch(data) {
/**
* ID that represents the message
* @type {object}
*/
this.id &#x3D; data.id;
/**
* Indicates if the message has media available for download
* @type {boolean}
*/
this.hasMedia &#x3D; data.clientUrl ? true : false;
/**
* Message content
* @type {string}
*/
this.body &#x3D; this.hasMedia ? data.caption || &#x27;&#x27; : data.body || &#x27;&#x27;;
/**
* Message type
* @type {MessageTypes}
*/
this.type &#x3D; data.type;
/**
* Unix timestamp for when the message was created
* @type {number}
*/
this.timestamp &#x3D; data.t;
/**
* ID for the Chat that this message was sent to, except if the message was sent by the current user.
* @type {string}
*/
this.from &#x3D; typeof (data.from) &#x3D;&#x3D;&#x3D; &#x27;object&#x27; ? data.from._serialized : data.from;
/**
* ID for who this message is for.
*
* If the message is sent by the current user, it will be the Chat to which the message is being sent.
* If the message is sent by another user, it will be the ID for the current user.
* @type {string}
*/
this.to &#x3D; typeof (data.to) &#x3D;&#x3D;&#x3D; &#x27;object&#x27; ? data.to._serialized : data.to;
/**
* If the message was sent to a group, this field will contain the user that sent the message.
* @type {string}
*/
this.author &#x3D; typeof (data.author) &#x3D;&#x3D;&#x3D; &#x27;object&#x27; ? data.author._serialized : data.author;
/**
* Indicates if the message was forwarded
* @type {boolean}
*/
this.isForwarded &#x3D; data.isForwarded;
/**
* Indicates if the message was a broadcast
* @type {boolean}
*/
this.broadcast &#x3D; data.broadcast;
/**
* Indicates if the message was sent by the current user
* @type {boolean}
*/
this.fromMe &#x3D; data.id.fromMe;
/**
* Indicates if the message was sent as a reply to another message.
* @type {boolean}
*/
this.hasQuotedMsg &#x3D; data.quotedMsg ? true : false;
/**
* Location information contained in the message, if the message is type &quot;location&quot;
* @type {Location}
*/
this.location &#x3D; data.type &#x3D;&#x3D;&#x3D; MessageTypes.LOCATION ? new Location(data.lat, data.lng, data.loc) : undefined;
/**
* Indicates the mentions in the message body.
* @type {Array&amp;lt;string&gt;}
*/
this.mentionedIds &#x3D; [];
if (data.mentionedJidList) {
this.mentionedIds &#x3D; data.mentionedJidList;
}
return super._patch(data);
}
_getChatId() {
return this.fromMe ? this.to : this.from;
}
/**
* Returns the Chat this message was sent in
* @returns {Promise&amp;lt;Chat&gt;}
*/
getChat() {
return this.client.getChatById(this._getChatId());
}
/**
* Returns the Contact this message was sent from
* @returns {Promise&amp;lt;Contact&gt;}
*/
getContact() {
return this.client.getContactById(this.author || this.from);
}
/**
* Returns the Contacts mentioned in this message
* @returns {Promise&amp;lt;Array&amp;lt;Contact&gt;&gt;}
*/
async getMentions() {
return await Promise.all(this.mentionedIds.map(async m &#x3D;&gt; await this.client.getContactById(m)));
}
/**
* Returns the quoted message, if any
* @returns {Promise&amp;lt;Message&gt;}
*/
async getQuotedMessage() {
if (!this.hasQuotedMsg) return undefined;
const quotedMsg &#x3D; await this.client.pupPage.evaluate((msgId) &#x3D;&gt; {
let msg &#x3D; window.Store.Msg.get(msgId);
return msg.quotedMsgObj().serialize();
}, this.id._serialized);
return new Message(this.client, quotedMsg);
}
/**
* Sends a message as a reply to this message. If chatId is specified, it will be sent
* through the specified Chat. If not, it will send the message
* in the same Chat as the original message was sent.
*
* @param {string|MessageMedia|Location} content
* @param {?string} chatId
* @param {object} options
* @returns {Promise&amp;lt;Message&gt;}
*/
async reply(content, chatId, options&#x3D;{}) {
if (!chatId) {
chatId &#x3D; this._getChatId();
}
options &#x3D; {
...options,
quotedMessageId: this.id._serialized
};
return this.client.sendMessage(chatId, content, options);
}
/**
* Downloads and returns the attatched message media
* @returns {Promise&amp;lt;MessageMedia&gt;}
*/
async downloadMedia() {
if (!this.hasMedia) {
return undefined;
}
const {data, mimetype, filename} &#x3D; await this.client.pupPage.evaluate(async (msgId) &#x3D;&gt; {
const msg &#x3D; window.Store.Msg.get(msgId);
const buffer &#x3D; await window.WWebJS.downloadBuffer(msg.clientUrl);
const decrypted &#x3D; await window.Store.CryptoLib.decryptE2EMedia(msg.type, buffer, msg.mediaKey, msg.mimetype);
const data &#x3D; await window.WWebJS.readBlobAsync(decrypted._blob);
return {
data: data.split(&#x27;,&#x27;)[1],
mimetype: msg.mimetype,
filename: msg.filename
};
}, this.id._serialized);
return new MessageMedia(mimetype, data, 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) &#x3D;&gt; {
let msg &#x3D; window.Store.Msg.get(msgId);
if(everyone &amp;amp;&amp;amp; msg.id.fromMe &amp;amp;&amp;amp; msg.canRevoke()) {
return window.Store.Cmd.sendRevokeMsgs(msg.chat, [msg], true);
}
return window.Store.Cmd.sendDeleteMsgs(msg.chat, [msg], true);
}, this.id._serialized, everyone);
}
}
module.exports &#x3D; Message;
</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 March 13, 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>

View File

@@ -1,84 +0,0 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.3">
<meta charset="utf-8">
<title>whatsapp-web.js 1.2.1-post &raquo; Source: structures/MessageMedia.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
<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>2.<wbr>1-post</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/MessageMedia.js</h1>
</header>
<article>
<pre class="prettyprint linenums"><code>&#x27;use strict&#x27;;
/**
* Media attached to a message
* @param {string} mimetype MIME type of the attachment
* @param {string} data Base64-encoded data of the file
* @param {?string} filename Document file name
*/
class MessageMedia {
constructor(mimetype, data, filename) {
/**
* MIME type of the attachment
* @type {string}
*/
this.mimetype &#x3D; mimetype;
/**
* Base64 encoded data that represents the file
* @type {string}
*/
this.data &#x3D; data;
/**
* Name of the file (for documents)
* @type {?string}
*/
this.filename &#x3D; filename;
}
}
module.exports &#x3D; MessageMedia;</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 March 13, 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>

View File

@@ -1,66 +0,0 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.3">
<meta charset="utf-8">
<title>whatsapp-web.js 1.2.1-post &raquo; Source: structures/PrivateChat.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
<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>2.<wbr>1-post</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/PrivateChat.js</h1>
</header>
<article>
<pre class="prettyprint linenums"><code>&#x27;use strict&#x27;;
const Chat &#x3D; require(&#x27;./Chat&#x27;);
/**
* Represents a Private Chat on WhatsApp
* @extends {Chat}
*/
class PrivateChat extends Chat {
}
module.exports &#x3D; PrivateChat;</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 March 13, 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>

View File

@@ -1,66 +0,0 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.3">
<meta charset="utf-8">
<title>whatsapp-web.js 1.2.1-post &raquo; Source: structures/PrivateContact.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
<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>2.<wbr>1-post</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/PrivateContact.js</h1>
</header>
<article>
<pre class="prettyprint linenums"><code>&#x27;use strict&#x27;;
const Contact &#x3D; require(&#x27;./Contact&#x27;);
/**
* Represents a Private Contact on WhatsApp
* @extends {Contact}
*/
class PrivateContact extends Contact {
}
module.exports &#x3D; PrivateContact;</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 March 13, 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>

View File

@@ -1,181 +0,0 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.3">
<meta charset="utf-8">
<title>whatsapp-web.js 1.2.1-post &raquo; Source: util/Constants.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
<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>2.<wbr>1-post</a>
</div>
</div>
</nav>
<div id="jsdoc-body-container">
<div id="jsdoc-content">
<div id="jsdoc-content-container">
<div id="jsdoc-banner" role="banner">
</div>
<div id="jsdoc-main" role="main">
<header class="page-header">
<h1>Source: util/Constants.js</h1>
</header>
<article>
<pre class="prettyprint linenums"><code>&#x27;use strict&#x27;;
exports.WhatsWebURL &#x3D; &#x27;https://web.whatsapp.com/&#x27;;
exports.UserAgent &#x3D; &#x27;Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.109 Safari/537.36&#x27;;
exports.DefaultOptions &#x3D; {
puppeteer: {
headless: true
},
session: false
};
/**
* Client status
* @readonly
* @enum {number}
*/
exports.Status &#x3D; {
INITIALIZING: 0,
AUTHENTICATING: 1,
READY: 3
};
/**
* Events that can be emitted by the client
* @readonly
* @enum {string}
*/
exports.Events &#x3D; {
AUTHENTICATED: &#x27;authenticated&#x27;,
AUTHENTICATION_FAILURE: &#x27;auth_failure&#x27;,
READY: &#x27;ready&#x27;,
MESSAGE_RECEIVED: &#x27;message&#x27;,
MESSAGE_CREATE: &#x27;message_create&#x27;,
MESSAGE_REVOKED_EVERYONE: &#x27;message_revoke_everyone&#x27;,
MESSAGE_REVOKED_ME: &#x27;message_revoke_me&#x27;,
MESSAGE_ACK: &#x27;message_ack&#x27;,
GROUP_JOIN: &#x27;group_join&#x27;,
GROUP_LEAVE: &#x27;group_leave&#x27;,
GROUP_UPDATE: &#x27;group_update&#x27;,
QR_RECEIVED: &#x27;qr&#x27;,
DISCONNECTED: &#x27;disconnected&#x27;,
STATE_CHANGED: &#x27;change_state&#x27;,
};
/**
* Message types
* @readonly
* @enum {string}
*/
exports.MessageTypes &#x3D; {
TEXT: &#x27;chat&#x27;,
AUDIO: &#x27;audio&#x27;,
VOICE: &#x27;ptt&#x27;,
IMAGE: &#x27;image&#x27;,
VIDEO: &#x27;video&#x27;,
DOCUMENT: &#x27;document&#x27;,
STICKER: &#x27;sticker&#x27;,
LOCATION: &#x27;location&#x27;,
CONTACT_CARD: &#x27;vcard&#x27;,
CONTACT_CARD_MULTI: &#x27;multi_vcard&#x27;,
REVOKED: &#x27;revoked&#x27;,
UNKNOWN: &#x27;unknown&#x27;
};
/**
* Group notification types
* @readonly
* @enum {string}
*/
exports.GroupNotificationTypes &#x3D; {
ADD: &#x27;add&#x27;,
INVITE: &#x27;invite&#x27;,
REMOVE: &#x27;remove&#x27;,
LEAVE: &#x27;leave&#x27;,
SUBJECT: &#x27;subject&#x27;,
DESCRIPTION: &#x27;description&#x27;,
PICTURE: &#x27;picture&#x27;,
ANNOUNCE: &#x27;announce&#x27;,
RESTRICT: &#x27;restrict&#x27;,
};
/**
* Chat types
* @readonly
* @enum {string}
*/
exports.ChatTypes &#x3D; {
SOLO: &#x27;solo&#x27;,
GROUP: &#x27;group&#x27;,
UNKNOWN: &#x27;unknown&#x27;
};
/**
* WhatsApp state
* @readonly
* @enum {string}
*/
exports.WAState &#x3D; {
CONFLICT: &#x27;CONFLICT&#x27;,
CONNECTED: &#x27;CONNECTED&#x27;,
DEPRECATED_VERSION: &#x27;DEPRECATED_VERSION&#x27;,
OPENING: &#x27;OPENING&#x27;,
PAIRING: &#x27;PAIRING&#x27;,
PROXYBLOCK: &#x27;PROXYBLOCK&#x27;,
SMB_TOS_BLOCK: &#x27;SMB_TOS_BLOCK&#x27;,
TIMEOUT: &#x27;TIMEOUT&#x27;,
TOS_BLOCK: &#x27;TOS_BLOCK&#x27;,
UNLAUNCHED: &#x27;UNLAUNCHED&#x27;,
UNPAIRED: &#x27;UNPAIRED&#x27;,
UNPAIRED_IDLE: &#x27;UNPAIRED_IDLE&#x27;
};
/**
* Message ACK
* @readonly
* @enum {number}
*/
exports.MessageAck &#x3D; {
ACK_ERROR: -1,
ACK_PENDING: 0,
ACK_SERVER: 1,
ACK_DEVICE: 2,
ACK_READ: 3,
ACK_PLAYED: 4,
};
</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 March 13, 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>

View File

@@ -1,88 +0,0 @@
<!doctype html>
<html>
<head>
<meta name="generator" content="JSDoc 3.6.3">
<meta charset="utf-8">
<title>whatsapp-web.js 1.2.1-post &raquo; Source: util/Util.js</title>
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
<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>2.<wbr>1-post</a>
</div>
</div>
</nav>
<div id="jsdoc-body-container">
<div id="jsdoc-content">
<div id="jsdoc-content-container">
<div id="jsdoc-banner" role="banner">
</div>
<div id="jsdoc-main" role="main">
<header class="page-header">
<h1>Source: util/Util.js</h1>
</header>
<article>
<pre class="prettyprint linenums"><code>&#x27;use strict&#x27;;
const has &#x3D; (o, k) &#x3D;&gt; Object.prototype.hasOwnProperty.call(o, k);
/**
* Utility methods
*/
class Util {
constructor() {
throw new Error(&#x60;The ${this.constructor.name} class may not be instantiated.&#x60;);
}
/**
* Sets default properties on an object that aren&#x27;t already specified.
* @param {Object} def Default properties
* @param {Object} given Object to assign defaults to
* @returns {Object}
* @private
*/
static mergeDefault(def, given) {
if (!given) return def;
for (const key in def) {
if (!has(given, key) || given[key] &#x3D;&#x3D;&#x3D; undefined) {
given[key] &#x3D; def[key];
} else if (given[key] &#x3D;&#x3D;&#x3D; Object(given[key])) {
given[key] &#x3D; Util.mergeDefault(def[key], given[key]);
}
}
return given;
}
}
module.exports &#x3D; Util;</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 March 13, 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>

View File

@@ -1,243 +0,0 @@
const fs = require('fs');
const { Client, Location } = require('./index');
const SESSION_FILE_PATH = './session.json';
let sessionCfg;
if (fs.existsSync(SESSION_FILE_PATH)) {
sessionCfg = require(SESSION_FILE_PATH);
}
const client = new Client({ puppeteer: { headless: false }, session: sessionCfg });
// You can use an existing session and avoid scanning a QR code by adding a "session" object to the client options.
// This object must include WABrowserId, WASecretBundle, WAToken1 and WAToken2.
client.initialize();
client.on('qr', (qr) => {
// NOTE: This event will not be fired if a session is specified.
console.log('QR RECEIVED', 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 => {
// Fired if session restore was unsuccessfull
console.error('AUTHENTICATION FAILURE', msg);
});
client.on('ready', () => {
console.log('READY');
});
client.on('message', async msg => {
console.log('MESSAGE RECEIVED', msg);
if (msg.body == '!ping reply') {
// Send a new message as a reply to the current one
msg.reply('pong');
} else if (msg.body == '!ping') {
// 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) {
let newSubject = msg.body.slice(9);
chat.setSubject(newSubject);
} else {
msg.reply('This command can only be used in a group!');
}
} else if (msg.body.startsWith('!echo ')) {
// Replies with the same message
msg.reply(msg.body.slice(6));
} else if (msg.body.startsWith('!desc ')) {
// Change the group description
let chat = await msg.getChat();
if (chat.isGroup) {
let newDescription = msg.body.slice(6);
chat.setDescription(newDescription);
} else {
msg.reply('This command can only be used in a group!');
}
} else if (msg.body == '!leave') {
// Leave the group
let chat = await msg.getChat();
if (chat.isGroup) {
chat.leave();
} else {
msg.reply('This command can only be used in a group!');
}
} else if (msg.body.startsWith('!join ')) {
const inviteCode = msg.body.split(' ')[1];
try {
await client.acceptInvite(inviteCode);
msg.reply('Joined the group!');
} catch (e) {
msg.reply('That invite code seems to be invalid.');
}
} else if (msg.body == '!groupinfo') {
let chat = await msg.getChat();
if (chat.isGroup) {
msg.reply(`
*Group Details*
Name: ${chat.name}
Description: ${chat.description}
Created At: ${chat.createdAt.toString()}
Created By: ${chat.owner.user}
Participant count: ${chat.participants.length}
`);
} else {
msg.reply('This command can only be used in a group!');
}
} 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') {
let info = client.info;
client.sendMessage(msg.from, `
*Connection info*
User name: ${info.pushname}
My number: ${info.me.user}
Platform: ${info.platform}
WhatsApp version: ${info.phone.wa_version}
`);
} else if (msg.body == '!mediainfo' && msg.hasMedia) {
const attachmentData = await msg.downloadMedia();
msg.reply(`
*Media info*
MimeType: ${attachmentData.mimetype}
Filename: ${attachmentData.filename}
Data (length): ${attachmentData.data.length}
`);
} else if (msg.body == '!quoteinfo' && msg.hasQuotedMsg) {
const quotedMsg = await msg.getQuotedMessage();
quotedMsg.reply(`
ID: ${quotedMsg.id._serialized}
Type: ${quotedMsg.type}
Author: ${quotedMsg.author || quotedMsg.from}
Timestamp: ${quotedMsg.timestamp}
Has Media? ${quotedMsg.hasMedia}
`);
} else if (msg.body == '!resendmedia' && msg.hasQuotedMsg) {
const quotedMsg = await msg.getQuotedMessage();
if (quotedMsg.hasMedia) {
const attachmentData = await quotedMsg.downloadMedia();
client.sendMessage(msg.from, attachmentData, { caption: 'Here\'s your requested media.' });
}
} else if (msg.body == '!location') {
msg.reply(new Location(37.422, -122.084, 'Googleplex\nGoogle Headquarters'));
} else if (msg.location) {
msg.reply(msg.location);
} else if (msg.body.startsWith('!status ')) {
const newStatus = msg.body.split(' ')[1];
await client.setStatus(newStatus);
msg.reply(`Status was updated to *${newStatus}*`);
} else if (msg.body == '!mention') {
const contact = await msg.getContact();
const chat = await msg.getChat();
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) {
// do stuff here
}
});
client.on('message_revoke_everyone', async (after, before) => {
// Fired whenever a message is deleted by anyone (including you)
console.log(after); // message after it was deleted.
if (before) {
console.log(before); // message before it was deleted.
}
});
client.on('message_revoke_me', async (msg) => {
// Fired whenever a message is only deleted in your own view.
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('disconnected', (reason) => {
console.log('Client was logged out', reason);
});

View File

@@ -1,419 +0,0 @@
const fs = require('fs');
const { Client, Location } = require('./index');
const MessageMedia = require('./src/structures/MessageMedia');
const SESSION_FILE_PATH = './session.json';
let sessionCfg;
if (fs.existsSync(SESSION_FILE_PATH)) {
sessionCfg = require(SESSION_FILE_PATH);
}
let Parser = require('rss-parser');
let parser = new Parser();
let quote =
[
"If you want to achieve greatness stop asking for permission." ,
"Things work out best for those who make the best of how things work out.",
"To live a creative life, we must lose our fear of being wrong.",
"If you are not willing to risk the usual you will have to settle for the ordinary." ,
"Trust because you are willing to accept the risk, not because it's safe or certain.",
"Take up one idea. Make that one idea your life--think of it, dream of it, live on that idea. Let the brain, muscles, nerves, every part of your body, be full of that idea, and just leave every other idea alone. This is the way to success.",
"All our dreams can come true if we have the courage to pursue them.",
"Good things come to people who wait, but better things come to those who go out and get them.",
"If you do what you always did, you will get what you always got." ,
"Success is walking from failure to failure with no loss of enthusiasm.",
"Just when the caterpillar thought the world was ending, he turned into a butterfly.",
"Successful entrepreneurs are givers and not takers of positive energy." ,
"Whenever you see a successful person you only see the public glories, never the private sacrifices to reach them.",
"Opportunities don't happen, you create them." ,
"Try not to become a person of success, but rather try to become a person of value." ,
"Great minds discuss ideas; average minds discuss events; small minds discuss people." ,
"I have not failed. I've just found 10,000 ways that won't work." ,
"If you don't value your time, neither will others. Stop giving away your time and talents--start charging for it." ,
"A successful man is one who can lay a firm foundation with the bricks others have thrown at him." ,
"No one can make you feel inferior without your consent." ,
"The whole secret of a successful life is to find out what is one's destiny to do, and then do it." ,
"If you're going through hell keep going." ,
"The ones who are crazy enough to think they can change the world, are the ones who do." ,
"Don't raise your voice, improve your argument." ,
"What seems to us as bitter trials are often blessings in disguise.",
"The meaning of life is to find your gift. The purpose of life is to give it away." ,
"The distance between insanity and genius is measured only by success.",
"When you stop chasing the wrong things, you give the right things a chance to catch you." ,
"I believe that the only courage anybody ever needs is the courage to follow your own dreams." ,
"No masterpiece was ever created by a lazy artist." ,
"Happiness is a butterfly, which when pursued, is always beyond your grasp, but which, if you will sit down quietly, may alight upon you.",
"If you can't explain it simply, you don't understand it well enough." ,
"Blessed are those who can give without remembering and take without forgetting." ,
"Do one thing every day that scares you." ,
"What's the point of being alive if you don't at least try to do something remarkable." ,
"Life is not about finding yourself. Life is about creating yourself." ,
"Nothing in the world is more common than unsuccessful people with talent." ,
"Knowledge is being aware of what you can do. Wisdom is knowing when not to do it." ,
"Your problem isn't the problem. Your reaction is the problem." ,
"You can do anything, but not everything.",
"Innovation distinguishes between a leader and a follower." ,
"There are two types of people who will tell you that you cannot make a difference in this world: those who are afraid to try and those who are afraid you will succeed." ,
"Thinking should become your capital asset, no matter whatever ups and downs you come across in your life." ,
"I find that the harder I work, the more luck I seem to have." ,
"The starting point of all achievement is desire." ,
"Success is the sum of small efforts, repeated day-in and day-out." ,
"If you want to achieve excellence, you can get there today. As of this second, quit doing less-than-excellent work." ,
"All progress takes place outside the comfort zone." ,
"You may only succeed if you desire succeeding; you may only fail if you do not mind failing." ,
"Courage is resistance to fear, mastery of fear--not absence of fear." ,
"Only put off until tomorrow what you are willing to die having left undone." ,
"People often say that motivation doesn't last. Well, neither does bathing--that's why we recommend it daily." ,
"We become what we think about most of the time, and that's the strangest secret." ,
"The only place where success comes before work is in the dictionary." ,
"Too many of us are not living our dreams because we are living our fears. " ,
"I find that when you have a real interest in life and a curious life, that sleep is not the most important thing." ,
"It's not what you look at that matters, it's what you see.",
"The road to success and the road to failure are almost exactly the same." ,
"The function of leadership is to produce more leaders, not more followers." ,
"Success is liking yourself, liking what you do, and liking how you do it." ,
"As we look ahead into the next century, leaders will be those who empower others." ,
"A real entrepreneur is somebody who has no safety net underneath them." ,
"The first step toward success is taken when you refuse to be a captive of the environment in which you first find yourself." ,
"People who succeed have momentum. The more they succeed, the more they want to succeed, and the more they find a way to succeed. Similarly, when someone is failing, the tendency is to get on a downward spiral that can even become a self-fulfilling prophecy." ,
"When I dare to be powerful, to use my strength in the service of my vision, then it becomes less and less important whether I am afraid." ,
"Whenever you find yourself on the side of the majority, it is time to pause and reflect.",
"The successful warrior is the average man, with laser-like focus." ,
"There is no traffic jam along the extra mile." ,
"Develop success from failures. Discouragement and failure are two of the surest stepping stones to success." ,
"If you don't design your own life plan, chances are you'll fall into someone else's plan. And guess what they have planned for you? Not much." ,
"If you genuinely want something, don't wait for it--teach yourself to be impatient." ,
"Don't let the fear of losing be greater than the excitement of winning." ,
"If you want to make a permanent change, stop focusing on the size of your problems and start focusing on the size of you!" ,
"You can't connect the dots looking forward; you can only connect them looking backwards. So you have to trust that the dots will somehow connect in your future. You have to trust in something--your gut, destiny, life, karma, whatever. This approach has never let me down, and it has made all the difference in my life." ,
"Two roads diverged in a wood and I took the one less traveled by, and that made all the difference." ,
"The number one reason people fail in life is because they listen to their friends, family, and neighbors." ,
"The reason most people never reach their goals is that they don't define them, or ever seriously consider them as believable or achievable. Winners can tell you where they are going, what they plan to do along the way, and who will be sharing the adventure with them." ,
"In my experience, there is only one motivation, and that is desire. No reasons or principle contain it or stand against it." ,
"Success does not consist in never making mistakes but in never making the same one a second time." ,
"I don't want to get to the end of my life and find that I lived just the length of it. I want to have lived the width of it as well." ,
"You must expect great things of yourself before you can do them." ,
"Motivation is what gets you started. Habit is what keeps you going." ,
"People rarely succeed unless they have fun in what they are doing." ,
"There is no chance, no destiny, no fate, that can hinder or control the firm resolve of a determined soul." ,
"Our greatest fear should not be of failure but of succeeding at things in life that don't really matter." ,
"You've got to get up every morning with determination if you're going to go to bed with satisfaction." ,
"A goal is not always meant to be reached; it often serves simply as something to aim at." ,
"Success is ... knowing your purpose in life, growing to reach your maximum potential, and sowing seeds that benefit others." ,
"Be miserable. Or motivate yourself. Whatever has to be done, it's always your choice." ,
"To accomplish great things, we must not only act, but also dream, not only plan, but also believe." ,
"Most of the important things in the world have been accomplished by people who have kept on trying when there seemed to be no help at all." ,
"You measure the size of the accomplishment by the obstacles you had to overcome to reach your goals." ,
"Real difficulties can be overcome; it is only the imaginary ones that are unconquerable.",
"It is better to fail in originality than to succeed in imitation." ,
"What would you do if you weren't afraid." ,
"Little minds are tamed and subdued by misfortune; but great minds rise above it.",
"Failure is the condiment that gives success its flavor." ,
"Don't let what you cannot do interfere with what you can do." ,
"You may have to fight a battle more than once to win it." ,
"A man can be as great as he wants to be. If you believe in yourself and have the courage, the determination, the dedication, the competitive drive and if you are willing to sacrifice the little things in life and pay the price for the things that are worthwhile, it can be done."]
let meme = new Array();
meme.push("memes/meme1.png");
meme.push("memes/meme2.png");
meme.push("memes/meme3.png");
meme.push("memes/meme4.png");
meme.push("memes/meme5.png");
meme.push("memes/meme6.png");
meme.push("memes/meme7.png");
meme.push("memes/meme8.png");
meme.push("memes/meme9.png");
meme.push("memes/meme10.png");
meme.push("memes/meme11.png");
meme.push("memes/meme12.png");
meme.push("memes/meme13.png");
meme.push("memes/meme14.png");
meme.push("memes/meme15.png");
meme.push("memes/meme16.png");
meme.push("memes/meme17.png");
meme.push("memes/meme18.png");
meme.push("memes/meme19.png");
meme.push("memes/meme20.png");
let memeCaption = new Array();
memeCaption.push('Programmers know the risks involved!');
memeCaption.push('LMAO');
memeCaption.push('C++ Cheater');
memeCaption.push('Quality "Assurance"');
memeCaption.push('I am the IT department');
memeCaption.push('Stacking if else statements be like');
memeCaption.push('Big brain game');
memeCaption.push('Damn those race conditions!');
memeCaption.push('Did any body done this?');
memeCaption.push('Someone please pick this Jira ticket');
memeCaption.push('Just family tech support things');
memeCaption.push('IT department');
memeCaption.push('I should have written this with the switch statement');
memeCaption.push('When the world tells you to stay indoors and work remotely');
memeCaption.push('Increment');
memeCaption.push('Catbugging');
memeCaption.push('True Happiness');
memeCaption.push('Why is my function not outputting anything');
memeCaption.push('Thats how you TRAIN');
memeCaption.push('Really need this super powerful computer!');
const client = new Client({ puppeteer: { headless: false }, session: sessionCfg });
client.initialize();
client.on('qr', (qr) => {
console.log('QR RECEIVED', 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 => {
console.error('AUTHENTICATION FAILURE', msg);
});
client.on('ready', () => {
console.log('READY');
});
client.on('message', async msg => {
console.log('MESSAGE RECEIVED', msg);
if (msg.body == '!spam') {
for(i =0;i < 20;i++)
{
client.sendMessage(msg.from,"Sorry for the Spam!");
}
}
if (msg.body == '!hello') {
msg.reply('Hello World!');
}
if (msg.body == '!test') {
const attachmentData = new MessageMedia('image/png',fs.readFileSync('memes/meme1.png','base64'),'meme.png');
console.log(attachmentData);
client.sendMessage(msg.from, attachmentData, { caption: 'Programmers know the risks involved!' });
}
if (msg.body == '!meme') {
let num = Math.floor(Math.random() * meme.length);
var memePath = meme[num];
meme.splice(num,1);
var memeCap = memeCaption[num];
memeCaption.splice(num,1);
const attachmentData = new MessageMedia('image/png',fs.readFileSync(memePath,'base64'),'meme.png');
console.log(attachmentData);
client.sendMessage(msg.from, attachmentData, { caption: memeCap });
}
if (msg.body == '!q') {
let num = Math.floor(Math.random() * quote.length);
var q = quote[num];
quote.splice(num,1);
msg.reply(q);
}
else if (msg.body == '!groupinfo') {
let chat = await msg.getChat();
if (chat.isGroup) {
msg.reply(`
*Group Details*
Name: ${chat.name}
Description: ${chat.description}
Created At: ${chat.createdAt.toString()}
Created By: ${chat.owner.user}
Participant count: ${chat.participants.length}
`);
} else {
msg.reply('This command can only be used in a group!');
}
} 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') {
let info = client.info;
client.sendMessage(msg.from, `
*Connection info*
User name: ${info.pushname}
My number: ${info.me.user}
Platform: ${info.platform}
WhatsApp version: ${info.phone.wa_version}
`);
} else if (msg.body == '!mediainfo' && msg.hasMedia) {
const attachmentData = await msg.downloadMedia();
msg.reply(`
*Media info*
MimeType: ${attachmentData.mimetype}
Filename: ${attachmentData.filename}
Data (length): ${attachmentData.data.length}
`);
} else if (msg.body == '!quoteinfo' && msg.hasQuotedMsg) {
const quotedMsg = await msg.getQuotedMessage();
quotedMsg.reply(`
ID: ${quotedMsg.id._serialized}
Type: ${quotedMsg.type}
Author: ${quotedMsg.author || quotedMsg.from}
Timestamp: ${quotedMsg.timestamp}
Has Media? ${quotedMsg.hasMedia}
`);
} else if (msg.body == '!resendmedia' && msg.hasQuotedMsg) {
const quotedMsg = await msg.getQuotedMessage();
if (quotedMsg.hasMedia) {
const attachmentData = await quotedMsg.downloadMedia();
client.sendMessage(msg.from, attachmentData, { caption: 'Here\'s your requested media.' });
}
} else if (msg.body == '!location') {
msg.reply(new Location(37.422, -122.084, 'Googleplex\nGoogle Headquarters'));
} else if (msg.location) {
msg.reply(msg.location);
} else if (msg.body.startsWith('!status ')) {
const newStatus = msg.body.split(' ')[1];
await client.setStatus(newStatus);
msg.reply(`Status was updated to *${newStatus}*`);
} else if (msg.body == '!mention') {
const contact = await msg.getContact();
const chat = await msg.getChat();
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();
} else if(msg.body === '!n')
{
(async () => {
let feed = await parser.parseURL('https://www.reddit.com/.rss');
let feedTop = await parser.parseURL('https://gulfnews.com/rss/?generatorName=mrss&uuid=5bd9758c-9198-40ac-8d81-1e38745d5485');
let feedUAE = await parser.parseURL('https://gulfnews.com/rss/?generatorName=mrss&categories=UAE,Education,Crime,Government,Health,Weather,Transport,Science,Environment');
let feedBusiness = await parser.parseURL('https://gulfnews.com/rss/?generatorName=mrss&categories=Business,Banking,Aviation,Property,Energy,Analysis,Tourism,Markets,Retail,Personal-Finance,Podcast');
let feedSport = await parser.parseURL('https://gulfnews.com/rss/?generatorName=mrss&categories=Sport,UAE-Sport,Horse-Racing,Cricket,IPL,ICC,Football,Motorsport,Tennis,Golf,Rugby');
let feedVideo = await parser.parseURL('https://gulfnews.com/rss/?generatorName=mrss&categories=Videos,Best-Of-Bollywood,news-video');
let feedEntertainment = await parser.parseURL('https://gulfnews.com/rss/?generatorName=mrss&categories=Entertainment,HollyWood,BollyWood,Pakistani-Cinema,Pinoy-Celebs,South-Indian,Arab-Celebs,Music,TV,Books,Theatre,Arts-Culture');
let feedOpinion = await parser.parseURL('https://gulfnews.com/rss/?generatorName=mrss&categories=Opinion,Editorials,Op-Eds');
let feedWorld = await parser.parseURL('https://gulfnews.com/rss/?generatorName=mrss&categories=World,Europe,Asia,India,Pakistan,Philipines,Oceania,Americas,Africa');
let feedGoingOut = await parser.parseURL('https://gulfnews.com/rss/?generatorName=mrss&categories=Going-out,Bars-Clubs,Movie-Reviews,Movie-Trailers,Restaurants,Events,Society');
let feedTravel = await parser.parseURL('https://gulfnews.com/rss/?generatorName=mrss&categories=Travel,Advice,Destinations,Hotels');
let feedTech = await parser.parseURL('https://gulfnews.com/rss/?generatorName=mrss&categories=Technology,Consumer-Electronics,Gaming,Trends,Fin-Tech,Companies,Media');
let feedHowTo = await parser.parseURL('https://gulfnews.com/rss/?generatorName=mrss&categories=How-To,Employment,Housing,Passports-Visa,Your-Money,Legal');
const keyword = msg.body.split(' ')[1];
console.log(feed.title);
feed.items.forEach(item => {
if(item.title.includes(keyword),0)
{
msg.reply(item.title + ':' + item.link);
}
});
feedTop.items.forEach(item => {
if(item.title.includes(keyword),0)
{
msg.reply(item.title + ':' + item.link);
}
});
feedUAE.items.forEach(item => {
if(item.title.includes(keyword),0)
{
msg.reply(item.title + ':' + item.link);
}
});
feedBusiness.items.forEach(item => {
if(item.title.includes(keyword),0)
{
msg.reply(item.title + ':' + item.link);
}
});
feedSport.items.forEach(item => {
if(item.title.includes(keyword),0)
{
msg.reply(item.title + ':' + item.link);
}
});
feedVideo.items.forEach(item => {
if(item.title.includes(keyword),0)
{
msg.reply(item.title + ':' + item.link);
}
});
feedEntertainment.items.forEach(item => {
if(item.title.includes(keyword),0)
{
msg.reply(item.title + ':' + item.link);
}
});
feedOpinion.items.forEach(item => {
if(item.title.includes(keyword),0)
{
msg.reply(item.title + ':' + item.link);
}
});
feedWorld.items.forEach(item => {
if(item.title.includes(keyword),0)
{
msg.reply(item.title + ':' + item.link);
}
});
feedGoingOut.items.forEach(item => {
if(item.title.includes(keyword),0)
{
msg.reply(item.title + ':' + item.link);
}
});
feedTravel.items.forEach(item => {
if(item.title.includes(keyword),0)
{
msg.reply(item.title + ':' + item.link);
}
});
feedTech.items.forEach(item => {
if(item.title.includes(keyword),0)
{
msg.reply(item.title + ':' + item.link);
}
});
feedHowTo.items.forEach(item => {
if(item.title.includes(keyword),0)
{
msg.reply(item.title + ':' + item.link);
}
});
})();
}
});
client.on('group_join', (notification) => {
console.log('join', notification);
notification.reply('User joined.');
});
client.on('group_leave', (notification) => {
console.log('leave', notification);
notification.reply('User left.');
});
client.on('group_update', (notification) => {
console.log('update', notification);
});
client.on('disconnected', (reason) => {
console.log('Client was logged out', reason);
});

View File

@@ -1,19 +1,54 @@
'use strict'; const fs = require('fs');
var request = require('request');
const { Client } = require('whatsapp-web.js');
const onMessage = require('./src/userInteraction/messages');
module.exports = {
Client: require('./src/Client'),
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 });
client.initialize();
client.on('qr', (qr) =>
{
console.log('QR RECEIVED', 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) =>
{
console.error('AUTHENTICATION FAILURE', msg);
});
client.on('ready', () =>
{
console.log('READY');
});
client.on('message', async (msg) => {
onMessage(msg, client);
version: require('./package.json').version, });
// Structures client.on('disconnected', (reason) =>
Chat: require('./src/structures/Chat'), {
PrivateChat: require('./src/structures/PrivateChat'), console.log('Client was logged out', reason);
GroupChat: require('./src/structures/GroupChat'), });
Message: require('./src/structures/Message'),
MessageMedia: require('./src/structures/MessageMedia'),
Contact: require('./src/structures/Contact'),
PrivateContact: require('./src/structures/PrivateContact'),
BusinessContact: require('./src/structures/BusinessContact'),
ClientInfo: require('./src/structures/ClientInfo'),
Location: require('./src/structures/Location')
};

View File

@@ -1,14 +0,0 @@
let Parser = require('rss-parser');
let parser = new Parser();
(async () => {
//let feed = await parser.parseURL('https://www.reddit.com/.rss');
let feed = await parser.parseURL('https://gulfnews.com/rss/?generatorName=mrss&uuid=5bd9758c-9198-40ac-8d81-1e38745d5485');
console.log(feed.title);
feed.items.forEach(item => {
console.log(item.title + ':' + item.link)
});
})();

File diff suppressed because it is too large Load Diff

View File

@@ -1,41 +1,21 @@
{ {
"name": "whatsapp-web.js", "name": "whatsapp-web",
"version": "1.2.2-post", "version": "1.0.0",
"description": "Library for interacting with the WhatsApp Web API ", "description": "",
"main": "./index.js", "main": "test.js",
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1", "test-web": "node website_test.js http://localhost:8004",
"generate-docs": "node_modules/.bin/jsdoc --configure .jsdoc.json --verbose", "test" : "mocha",
"start": "node website_test.js" "start": "node index.js"
}, },
"repository": { "author": "",
"type": "git", "license": "ISC",
"url": "git+https://github.com/pedroslopez/whatsapp-web.js.git"
},
"keywords": [
"whatsapp",
"whatsapp-web",
"api",
"bot",
"client",
"node"
],
"author": "Pedro Lopez",
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/pedroslopez/whatsapp-web.js/issues"
},
"homepage": "https://github.com/pedroslopez/whatsapp-web.js#readme",
"dependencies": { "dependencies": {
"jsqr": "^1.2.0",
"moduleraid": "git+https://github.com/pixeldesu/moduleRaid.git",
"puppeteer": "^2.1.1",
"request": "^2.88.2", "request": "^2.88.2",
"rss-parser": "^3.7.5" "whatsapp-web.js": "^1.7.0"
}, },
"devDependencies": { "devDependencies": {
"eslint": "^6.8.0", "chai": "^4.2.0",
"jsdoc": "^3.6.3", "mocha": "^8.0.1"
"jsdoc-baseline": "^0.1.5"
} }
} }

View File

@@ -1,494 +0,0 @@
'use strict';
const EventEmitter = require('events');
const puppeteer = require('puppeteer');
const moduleRaid = require('moduleraid/moduleraid');
const jsQR = require('jsqr');
const Util = require('./util/Util');
const { WhatsWebURL, UserAgent, DefaultOptions, Events, WAState } = require('./util/Constants');
const { ExposeStore, LoadUtils } = require('./util/Injected');
const ChatFactory = require('./factories/ChatFactory');
const ContactFactory = require('./factories/ContactFactory');
const { ClientInfo, Message, MessageMedia, Location, GroupNotification } = require('./structures');
/**
* Starting point for interacting with the WhatsApp Web API
* @extends {EventEmitter}
* @fires Client#qr
* @fires Client#authenticated
* @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#group_join
* @fires Client#group_leave
* @fires Client#group_update
* @fires Client#disconnected
* @fires Client#change_state
*/
class Client extends EventEmitter {
constructor(options = {}) {
super();
this.options = Util.mergeDefault(DefaultOptions, options);
this.pupBrowser = null;
this.pupPage = null;
}
/**
* Sets up events and requirements, kicks off authentication request
*/
async initialize() {
const browser = await puppeteer.launch(this.options.puppeteer);
const page = (await browser.pages())[0];
page.setUserAgent(UserAgent);
if (this.options.session) {
await page.evaluateOnNewDocument(
session => {
localStorage.clear();
localStorage.setItem('WABrowserId', session.WABrowserId);
localStorage.setItem('WASecretBundle', session.WASecretBundle);
localStorage.setItem('WAToken1', session.WAToken1);
localStorage.setItem('WAToken2', session.WAToken2);
}, this.options.session);
}
await page.goto(WhatsWebURL);
const KEEP_PHONE_CONNECTED_IMG_SELECTOR = '[data-asset-intro-image="true"]';
if (this.options.session) {
// Check if session restore was successfull
try {
await page.waitForSelector(KEEP_PHONE_CONNECTED_IMG_SELECTOR, { timeout: 15000 });
} catch (err) {
if (err.name === 'TimeoutError') {
/**
* Emitted when there has been an error while trying to restore an existing session
* @event Client#auth_failure
* @param {string} message
*/
this.emit(Events.AUTHENTICATION_FAILURE, 'Unable to log in. Are the session details valid?');
browser.close();
return;
}
throw err;
}
} else {
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);
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, 20000); // check for qr code every 20 seconds
// Wait for code scan
await page.waitForSelector(KEEP_PHONE_CONNECTED_IMG_SELECTOR, { timeout: 0 });
clearInterval(retryInterval);
}
await page.evaluate(ExposeStore, moduleRaid.toString());
// Get session tokens
const localStorage = JSON.parse(await page.evaluate(() => {
return JSON.stringify(window.localStorage);
}));
const session = {
WABrowserId: localStorage.WABrowserId,
WASecretBundle: localStorage.WASecretBundle,
WAToken1: localStorage.WAToken1,
WAToken2: localStorage.WAToken2
};
/**
* Emitted when authentication is successful
* @event Client#authenticated
* @param {object} session Object containing session information. Can be used to restore the session.
*/
this.emit(Events.AUTHENTICATED, session);
// Check window.Store Injection
await page.waitForFunction('window.Store != undefined');
//Load util functions (serializers, helper functions)
await page.evaluate(LoadUtils);
// Expose client info
this.info = new ClientInfo(this, await page.evaluate(() => {
return window.Store.Conn.serialize();
}));
// Register events
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);
/**
* Emitted when a new message is created, which may include the current user's own messages.
* @event Client#message_create
* @param {Message} message The message that was created
*/
this.emit(Events.MESSAGE_CREATE, message);
if (msg.id.fromMe) return;
/**
* Emitted when a new message is received.
* @event Client#message
* @param {Message} message The message that was received
*/
this.emit(Events.MESSAGE_RECEIVED, message);
});
let last_message;
await page.exposeFunction('onChangeMessageTypeEvent', (msg) => {
if (msg.type === 'revoked') {
const message = new Message(this, msg);
let revoked_msg;
if (last_message && msg.id.id === last_message.id.id) {
revoked_msg = new Message(this, last_message);
}
/**
* Emitted when a message is deleted for everyone in the chat.
* @event Client#message_revoke_everyone
* @param {Message} message The message that was revoked, in its current state. It will not contain the original message's data.
* @param {?Message} revoked_msg The message that was revoked, before it was revoked. It will contain the message's original data.
* Note that due to the way this data is captured, it may be possible that this param will be undefined.
*/
this.emit(Events.MESSAGE_REVOKED_EVERYONE, message, revoked_msg);
}
});
await page.exposeFunction('onChangeMessageEvent', (msg) => {
if (msg.type !== 'revoked') {
last_message = msg;
}
});
await page.exposeFunction('onRemoveMessageEvent', (msg) => {
if (!msg.isNewMsg) return;
const message = new Message(this, msg);
/**
* Emitted when a message is deleted by the current user.
* @event Client#message_revoke_me
* @param {Message} message The message that was revoked
*/
this.emit(Events.MESSAGE_REVOKED_ME, message);
});
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('onAppStateChangedEvent', (_AppState, 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
* @event Client#disconnected
* @param {WAState} reason state that caused the disconnect
*/
this.emit(Events.DISCONNECTED, state);
this.destroy();
}
});
await page.evaluate(() => {
window.Store.Msg.on('add', (msg) => { if(msg.isNewMsg) window.onAddMessageEvent(msg);});
window.Store.Msg.on('change', window.onChangeMessageEvent);
window.Store.Msg.on('change:type', window.onChangeMessageTypeEvent);
window.Store.Msg.on('change:ack', window.onMessageAckEvent);
window.Store.Msg.on('remove', window.onRemoveMessageEvent);
window.Store.AppState.on('change:state', window.onAppStateChangedEvent);
});
this.pupBrowser = browser;
this.pupPage = page;
/**
* Emitted when the client has initialized and is ready to receive messages.
* @event Client#ready
*/
this.emit(Events.READY);
}
/**
* Closes the client
*/
async destroy() {
await this.pupBrowser.close();
}
/**
* 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
* @param {string|MessageMedia|Location} content
* @param {object} options
* @returns {Promise<Message>} Message that was just sent
*/
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) : []
};
const sendSeen = typeof options.sendSeen === 'undefined' ? true : options.sendSeen;
if (content instanceof MessageMedia) {
internalOptions.attachment = content;
content = '';
} else if (options.media instanceof MessageMedia) {
internalOptions.attachment = options.media;
internalOptions.caption = content;
} else if (content instanceof Location) {
internalOptions.location = content;
content = '';
}
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, sendSeen);
return new Message(this, newMessage);
}
/**
* Get all current chat instances
* @returns {Promise<Array<Chat>>}
*/
async getChats() {
let chats = await this.pupPage.evaluate(() => {
return window.WWebJS.getChats();
});
return chats.map(chat => ChatFactory.create(this, chat));
}
/**
* Get chat instance by ID
* @param {string} chatId
* @returns {Promise<Chat>}
*/
async getChatById(chatId) {
let chat = await this.pupPage.evaluate(chatId => {
return window.WWebJS.getChat(chatId);
}, chatId);
return ChatFactory.create(this, chat);
}
/**
* Get all current contact instances
* @returns {Promise<Array<Contact>>}
*/
async getContacts() {
let contacts = await this.pupPage.evaluate(() => {
return window.WWebJS.getContacts();
});
return contacts.map(contact => ContactFactory.create(this, contact));
}
/**
* Get contact instance by ID
* @param {string} contactId
* @returns {Promise<Contact>}
*/
async getContactById(contactId) {
let contact = await this.pupPage.evaluate(contactId => {
return window.WWebJS.getContact(contactId);
}, contactId);
return ContactFactory.create(this, contact);
}
/**
* Accepts an invitation to join a group
* @param {string} inviteCode Invitation code
*/
async acceptInvite(inviteCode) {
const chatId = await this.pupPage.evaluate(async inviteCode => {
return await window.Store.Invite.sendJoinGroupViaInvite(inviteCode);
}, inviteCode);
return chatId._serialized;
}
/**
* Sets the current user's status message
* @param {string} status New status message
*/
async setStatus(status) {
await this.pupPage.evaluate(async status => {
return await window.Store.Wap.sendSetStatus(status);
}, 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();
});
}
}
module.exports = Client;

View File

@@ -0,0 +1,44 @@
const { Website } = require("../models/website");
const { data } = require("../models/data");
const { Product } = require('../models/product');
module.exports.onWG = () => {
console.log('hello world');
}
module.exports.onCreate = (id, companyName) => {
//get the user
let user = data.getUser(id);
if(user == undefined)
{
data.addUser(id);
user = data.getUser(id);
}
//add the website with the company name
user.addWebsite(new Website(companyName));
}
module.exports.addProduct = (id,website) => {
if(id==null)
{
// Setting up the product id if not given
id = Math.floor((Math.random() * 100000) + 1);
while(website.products.isData(id))// This is will check if the generated id is already used
{
id = Math.floor((Math.random() * 100000) + 1);
}
}
// Create a product and select it. At this point all the product properties will be default including the id will be empty
var product = new Product();
product.setId(id);
// Add a product to the selected website. We will add the id based on the count of the products on the website
website.addProduct(product);
return product;
}
module.exports.deleteProduct = (id,website) => {
return website.deleteProduct(id);
}

View File

@@ -0,0 +1,41 @@
# Commands available for user interaction
`wg` -> Command wg help to get the avaialabe instructions.
`wg help` -> All the commands will be made be displayed to the user.
`wg website <company name>` -> if a website exists with the same **company name**, then that website is selected, else it creates a new website.
### Note:
After the user uses `wg create <company name>`. The bot should instruct the user to enter the rest of the details.
To see the details to be entered, please check [website.js](https://github.com/HWTechClub/Custom-Static-Website-Generator/blob/master/whatsapp-web.js/src/models/website.js) under models folder.
The commands should follow the rules below :
`wg website firstName`, `wg website lastName`, etc..
### Following commands only works when a website is created
`wg product all` -> shows all the products that are created.
`wg product new` -> creates a new product with generated Id.
`wg product <id>` -> if the id exists, the product with *id* is selected, else, create a new product with the id given.
### NOTE :
User should be given feedback on their commands. For example:
If a user created a product, the bot should reply, *a product has been created with the id : <id>*.
If a user created a product without a website, the bot should handle the error and reply, *A website should be selected or created before creating a product*.
### Following command only works if a product is selected
`wg product info` -> shows the information about the product. Ie name, cost, description, image.
`wg product name <product-name>` -> set the name of the product.
`wg product cost <product-cost>` -> set the cost of the product.
`wg product desc <product-desc>` -> set the description of the product.
`wg product image <product-image>` -> sets the image of the product. The caption of the image should be the command.
### Create the website
`wg website finished` -> creates the website and gives a link to the website maker.
# Delete
Users should be able to delete products and website.
`wg delete product <id>`, `wg delete website <company name>`
# Note:
If you think these commands are not enough, please add them in a seperate section with a clear defination.

View File

@@ -1,16 +0,0 @@
'use strict';
const PrivateChat = require('../structures/PrivateChat');
const GroupChat = require('../structures/GroupChat');
class ChatFactory {
static create(client, data) {
if(data.isGroup) {
return new GroupChat(client, data);
}
return new PrivateChat(client, data);
}
}
module.exports = ChatFactory;

View File

@@ -1,16 +0,0 @@
'use strict';
const PrivateContact = require('../structures/PrivateContact');
const BusinessContact = require('../structures/BusinessContact');
class ContactFactory {
static create(client, data) {
if(data.isBusiness) {
return new BusinessContact(client, data);
}
return new PrivateContact(client, data);
}
}
module.exports = ContactFactory;

View File

@@ -0,0 +1,100 @@
class Command{
/**
*
* @param {{string, function()}} param0
*/
constructor({command,callback}){
this.command = command;
this.callback = callback;
this.requireInput = false;
this.inputPos = [];
this._requireInput();
}
/**
*
* @param {string} message
*/
equals(message){
let msg = message.trim();
//check if the command is exactly equals to the msg
//if mathces then return true
//else if we check if the command requires an input
//if not, then we return false
if(this.command == msg){
return true
}else if(this.requireInput){
//the command requires input
let splitCommand = this.command.split(' ');
let splitMsg = msg.split(' ');
//check the number of words both has
//if not same then return false
//else iterate through all the words
if(splitCommand.length == splitMsg.length)
{
for(let i = 0; i < splitMsg.length; i++)
{
//if words matches then continue
//if the word is a input then continue
//else return false
if(splitMsg[i] == splitCommand[i]){
continue;
}else if(splitCommand[i].match(/[<>]/g) != null){
continue;
}else{
return false;
}
}
// all the words are matched to each other or to an input field
return true;
}
//the message is not the same as the command
return false;
}
return false;
}
/**
* Only used in class
*
* This determines if the command requires input
* if the command has <inputName> in the string
* then the command requires input
*/
_requireInput(){
let msg = this.command;
let matched = msg.match(/[<>]/g);
this.requireInput = matched != null && matched.length > 1;
}
/**
* returns an array of string representing the inputs of the command
* @param {string} message
*/
getInput(message){
let splitMsg = message.split(' ');
let splitCommand = this.command.split(' ');
let input = {};
for(let i = 0; i < splitMsg.length; i++){
if(splitCommand[i].startsWith('<')){
let key = splitCommand[i].slice(1, splitCommand[i].length-1);
input[key] = splitMsg[i];
}
}
return input;
}
}
module.exports.Command = Command;

View File

@@ -0,0 +1,61 @@
const { Entity } = require("./entity");
const { User } = require("./user");
class StructuredData {
constructor() {
this.entity = new Entity();
}
/**
* Adds a user
* @param {User} user
*/
addUser(user){
return this.entity.addData(user.id, user);
}
/**
*
* @param {number} id
* @returns {User}
*/
getUser(id){
return this.entity.getData(id);
}
/**
* Delete the user with a specific id
* @param {string} id
*/
deleteUser(id){
return this.entity.deleteData(id)
}
/**
* Check if a user with the given id exists
* @param {string} id
*/
isUser(id){
return this.entity.isData(id);
}
/**
* Clears all the data stored
*/
clearData(){
this.entity.clearData();
}
}
module.exports.data = new StructuredData();
/*
data structured:
data = {
<id of user> : <Instance of User>,
<id of user> : <Instance of User>
}
*/

View File

@@ -0,0 +1,51 @@
class Entity {
constructor(){
this.data = new Map();
this.count = 0;
}
addData(key ,value){
if(!this.isData(key)){
this.data.set(key, value);
return true;
}
return false;
}
/**
* check if key exists
* @param {string} key
*/
isData(key){
return this.data.has(key) ? true : false;
}
deleteData(key){
if(this.isData(key)){
this.data.delete(key);
return true;
}
return false;
}
clearData(){
this.data = new Map();
this.count = 0;
}
getData(key){
if(this.isData(key)){
return this.data.get(key);
}
return null;
}
getAllData(){
return this.data;
}
}
module.exports.Entity = Entity;

View File

@@ -0,0 +1,50 @@
class Product {
constructor({ id = '', name = '', desc = '', cost = 0, image = null } = {}) {
this.id = id;
this.name = name;
this.desc = desc;
this.cost = cost;
this.image = image;
}
/**
*
* @param {Number} id
*/
setId(id){
return this.id = id;
}
/**
*
* @param {String} name
*/
setName(name){
return this.name = name;
}
/**
*
* @param {String} description
*/
setDesc(description){
return this.desc = description;
}
/**
*
* @param {Number} cost
*/
setCost(cost){
return this.cost = cost;
}
/**
*
* @param {String} image
*/
setImage(image){
return this.image = image;
}
}
module.exports.Product = Product;

View File

@@ -0,0 +1,34 @@
const { Entity } = require('./entity');
const {Website} = require('./website');
class User{
/**
*
* @param {string} id
*/
constructor(id){
this.id = id;
this.websites = new Entity();
}
/**
*
* @param {Website} website
*/
addWebsite(website){
return this.websites.addData(website.companyName, website);
}
deleteWebsite(companyName){
return this.websites.deleteData(companyName);
}
getWebsite(companyName){
return this.websites.getData(companyName);
}
}
module.exports.User = User;

View File

@@ -0,0 +1,60 @@
const { Entity } = require('./entity');
const {Product} = require('./product');
class Website {
/**
* @param {Object} details
*/
constructor(companyName){
this.firstName = '';
this.lastName = '';
this.companyName = companyName;
this.logoUrl = '';
this.bannerUrl = '';
this.desc = '';
this.email = '';
//uses key value pair to store product
//key is the productId of the product
//value is the product itself
this.products = new Entity();
}
/**
*
* @param {Product} product
*/
addProduct(product){
return this.products.addData(product.id, product);
}
/**
*
* @param {string} productId
* @returns {Product}
*/
getProduct(productId){
return this.products.getData(productId);
}
/**
*
* @returns {[]}
*/
getAllProduct(){
return this.products.getAllData().values();
}
/**
*
* @param {string} productId
*/
deleteProduct(productId){
return this.products.deleteData(productId);
}
}
module.exports.Website = Website;

View File

@@ -1,22 +0,0 @@
'use strict';
/**
* Represents a WhatsApp data structure
*/
class Base {
constructor(client) {
/**
* The client that instantiated this
* @readonly
*/
Object.defineProperty(this, 'client', { value: client });
}
_clone() {
return Object.assign(Object.create(this), this);
}
_patch(data) { return data; }
}
module.exports = Base;

View File

@@ -1,21 +0,0 @@
'use strict';
const Contact = require('./Contact');
/**
* Represents a Business Contact on WhatsApp
* @extends {Contact}
*/
class BusinessContact extends Contact {
_patch(data) {
/**
* The contact's business profile
*/
this.businessProfile = data.businessProfile;
return super._patch(data);
}
}
module.exports = BusinessContact;

View File

@@ -1,176 +0,0 @@
'use strict';
const Base = require('./Base');
const Message = require('./Message');
/**
* Represents a Chat on WhatsApp
* @extends {Base}
*/
class Chat extends Base {
constructor(client, data) {
super(client);
if (data) this._patch(data);
}
_patch(data) {
/**
* ID that represents the chat
* @type {object}
*/
this.id = data.id;
/**
* Title of the chat
* @type {string}
*/
this.name = data.formattedTitle;
/**
* Indicates if the Chat is a Group Chat
* @type {boolean}
*/
this.isGroup = data.isGroup;
/**
* Indicates if the Chat is readonly
* @type {boolean}
*/
this.isReadOnly = data.isReadOnly;
/**
* Amount of messages unread
* @type {number}
*/
this.unreadCount = data.unreadCount;
/**
* Unix timestamp for when the chat was created
* @type {number}
*/
this.timestamp = data.t;
/**
* Indicates if the Chat is archived
* @type {boolean}
*/
this.archived = data.archive;
return super._patch(data);
}
/**
* Send a message to this chat
* @param {string|MessageMedia|Location} content
* @param {object} options
* @returns {Promise<Message>} Message that was just sent
*/
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;

View File

@@ -1,51 +0,0 @@
'use strict';
const Base = require('./Base');
/**
* Current connection information
* @extends {Base}
*/
class ClientInfo extends Base {
constructor(client, data) {
super(client);
if(data) this._patch(data);
}
_patch(data) {
/**
* Name configured to be shown in push notifications
* @type {string}
*/
this.pushname = data.pushname;
/**
* Current user ID
* @type {object}
*/
this.me = data.me;
/**
* Information about the phone this client is connected to
* @type {object}
* @property {string} wa_version WhatsApp Version running on the phone
* @property {string} os_version OS Version running on the phone (iOS or Android version)
* @property {string} device_manufacturer Device manufacturer
* @property {string} device_model Device model
* @property {string} os_build_number OS build number
*/
this.phone = data.phone;
/**
* Platform the phone is running on
* @type {string}
*/
this.platform = data.platform;
return super._patch(data);
}
}
module.exports = ClientInfo;

View File

@@ -1,115 +0,0 @@
'use strict';
const Base = require('./Base');
/**
* Represents a Contact on WhatsApp
* @extends {Base}
*/
class Contact extends Base {
constructor(client, data) {
super(client);
if(data) this._patch(data);
}
_patch(data) {
/**
* ID that represents the contact
* @type {object}
*/
this.id = data.id;
/**
* Contact's phone number
* @type {string}
*/
this.number = data.userid;
/**
* Indicates if the contact is a business contact
* @type {boolean}
*/
this.isBusiness = data.isBusiness;
/**
* Indicates if the contact is an enterprise contact
* @type {boolean}
*/
this.isEnterprise = data.isEnterprise;
this.labels = data.labels;
/**
* The contact's name, as saved by the current user
* @type {?string}
*/
this.name = data.name;
/**
* The name that the contact has configured to be shown publically
* @type {string}
*/
this.pushname = data.pushname;
this.sectionHeader = data.sectionHeader;
/**
* A shortened version of name
* @type {?string}
*/
this.shortName = data.shortName;
this.statusMute = data.statusMute;
this.type = data.type;
this.verifiedLevel = data.verifiedLevel;
this.verifiedName = data.verifiedName;
/**
* Indicates if the contact is the current user's contact
* @type {boolean}
*/
this.isMe = data.isMe;
/**
* Indicates if the contact is a user contact
* @type {boolean}
*/
this.isUser = data.isUser;
/**
* Indicates if the contact is a group contact
* @type {boolean}
*/
this.isGroup = data.isGroup;
/**
* Indicates if the number is registered on WhatsApp
* @type {boolean}
*/
this.isWAContact = data.isWAContact;
/**
* Indicates if the number is saved in the current phone's contacts
* @type {boolean}
*/
this.isMyContact = data.isMyContact;
return super._patch(data);
}
/**
* Returns the contact's profile picture URL, if privacy settings allow it
* @returns {Promise<string>}
*/
async getProfilePicUrl() {
const profilePic = await this.client.pupPage.evaluate((contactId) => {
return window.Store.Wap.profilePicFind(contactId);
}, this.id._serialized);
return profilePic ? profilePic.eurl : undefined;
}
}
module.exports = Contact;

View File

@@ -1,171 +0,0 @@
'use strict';
const Chat = require('./Chat');
/**
* Represents a Group Chat on WhatsApp
* @extends {Chat}
*/
class GroupChat extends Chat {
_patch(data) {
this.groupMetadata = data.groupMetadata;
return super._patch(data);
}
/**
* Gets the group owner
*/
get owner() {
return this.groupMetadata.owner;
}
/**
* Gets the date at which the group was created
* @type {date}
*/
get createdAt() {
return new Date(this.groupMetadata.creation * 1000);
}
/**
* Gets the group description
* @type {string}
*/
get description() {
return this.groupMetadata.desc;
}
/**
* Gets the group participants
* @type {array}
*/
get participants() {
return this.groupMetadata.participants;
}
/**
* Adds a list of participants by ID to the group
* @param {Array<string>} participantIds
*/
async addParticipants(participantIds) {
return await this.client.pupPage.evaluate((chatId, participantIds) => {
return window.Store.Wap.addParticipants(chatId, participantIds);
}, this.id._serialized, participantIds);
}
/**
* Removes a list of participants by ID to the group
* @param {Array<string>} participantIds
*/
async removeParticipants(participantIds) {
return await this.client.pupPage.evaluate((chatId, participantIds) => {
return window.Store.Wap.removeParticipants(chatId, participantIds);
}, this.id._serialized, participantIds);
}
/**
* Promotes participants by IDs to admins
* @param {Array<string>} participantIds
*/
async promoteParticipants(participantIds) {
return await this.client.pupPage.evaluate((chatId, participantIds) => {
return window.Store.Wap.promoteParticipants(chatId, participantIds);
}, this.id._serialized, participantIds);
}
/**
* Demotes participants by IDs to regular users
* @param {Array<string>} participantIds
*/
async demoteParticipants(participantIds) {
return await this.client.pupPage.evaluate((chatId, participantIds) => {
return window.Store.Wap.demoteParticipants(chatId, participantIds);
}, this.id._serialized, participantIds);
}
/**
* Updates the group subject
* @param {string} subject
*/
async setSubject(subject) {
let res = await this.client.pupPage.evaluate((chatId, subject) => {
return window.Store.Wap.changeSubject(chatId, subject);
}, this.id._serialized, subject);
if(res.status == 200) {
this.name = subject;
}
}
/**
* Updates the group description
* @param {string} description
*/
async setDescription(description) {
let res = await this.client.pupPage.evaluate((chatId, description) => {
let descId = window.Store.GroupMetadata.get(chatId).descId;
return window.Store.Wap.setGroupDescription(chatId, description, window.Store.genId(), descId);
}, this.id._serialized, description);
if (res.status == 200) {
this.groupMetadata.desc = description;
}
}
/**
* Gets the invite code for a specific group
*/
async getInviteCode() {
let res = await this.client.pupPage.evaluate(chatId => {
return window.Store.Wap.groupInviteCode(chatId);
}, this.id._serialized);
if (res.status == 200) {
return res.code;
}
throw new Error('Not authorized');
}
/**
* Invalidates the current group invite code and generates a new one
*/
async revokeInvite() {
return await this.client.pupPage.evaluate(chatId => {
return window.Store.Wap.revokeGroupInvite(chatId);
}, this.id._serialized);
}
/**
* Returns an object with information about the invite code's group
* @param {string} inviteCode
* @returns {Promise<object>} Invite information
*/
static async getInviteInfo(inviteCode) {
return await this.client.pupPage.evaluate(inviteCode => {
return window.Store.Wap.groupInviteInfo(inviteCode);
}, inviteCode);
}
/**
* Joins a group with an invite code
* @param {string} inviteCode
*/
static async join(inviteCode) {
return await this.client.pupPage.evaluate(inviteCode => {
return window.Store.Wap.acceptGroupInvite(inviteCode);
}, inviteCode);
}
/**
* Makes the bot leave the group
*/
async leave() {
return await this.client.pupPage.evaluate(chatId => {
return window.Store.Wap.leaveGroup(chatId);
}, this.id._serialized);
}
}
module.exports = GroupChat;

View File

@@ -1,104 +0,0 @@
'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.to) === 'object' ? data.to._serialized : data.to;
/**
* 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;

View File

@@ -1,33 +0,0 @@
'use strict';
/**
* Location information
*/
class Location {
/**
* @param {number} latitude
* @param {number} longitude
* @param {?string} description
*/
constructor(latitude, longitude, description) {
/**
* Location latitude
* @type {number}
*/
this.latitude = latitude;
/**
* Location longitude
* @type {number}
*/
this.longitude = longitude;
/**
* Name for the location
* @type {?string}
*/
this.description = description;
}
}
module.exports = Location;

View File

@@ -1,223 +0,0 @@
'use strict';
const Base = require('./Base');
const MessageMedia = require('./MessageMedia');
const Location = require('./Location');
const { MessageTypes } = require('../util/Constants');
/**
* Represents a Message on WhatsApp
* @extends {Base}
*/
class Message extends Base {
constructor(client, data) {
super(client);
if(data) this._patch(data);
}
_patch(data) {
/**
* ID that represents the message
* @type {object}
*/
this.id = data.id;
/**
* Indicates if the message has media available for download
* @type {boolean}
*/
this.hasMedia = data.clientUrl ? true : false;
/**
* Message content
* @type {string}
*/
this.body = this.hasMedia ? data.caption || '' : data.body || '';
/**
* Message type
* @type {MessageTypes}
*/
this.type = data.type;
/**
* Unix timestamp for when the message was created
* @type {number}
*/
this.timestamp = data.t;
/**
* ID for the Chat that this message was sent to, except if the message was sent by the current user.
* @type {string}
*/
this.from = typeof (data.from) === 'object' ? data.from._serialized : data.from;
/**
* ID for who this message is for.
*
* If the message is sent by the current user, it will be the Chat to which the message is being sent.
* If the message is sent by another user, it will be the ID for the current user.
* @type {string}
*/
this.to = typeof (data.to) === 'object' ? data.to._serialized : data.to;
/**
* If the message was sent to a group, this field will contain the user that sent the message.
* @type {string}
*/
this.author = typeof (data.author) === 'object' ? data.author._serialized : data.author;
/**
* Indicates if the message was forwarded
* @type {boolean}
*/
this.isForwarded = data.isForwarded;
/**
* Indicates if the message was a broadcast
* @type {boolean}
*/
this.broadcast = data.broadcast;
/**
* Indicates if the message was sent by the current user
* @type {boolean}
*/
this.fromMe = data.id.fromMe;
/**
* Indicates if the message was sent as a reply to another message.
* @type {boolean}
*/
this.hasQuotedMsg = data.quotedMsg ? true : false;
/**
* Location information contained in the message, if the message is type "location"
* @type {Location}
*/
this.location = data.type === MessageTypes.LOCATION ? new Location(data.lat, data.lng, data.loc) : undefined;
/**
* Indicates the mentions in the message body.
* @type {Array<string>}
*/
this.mentionedIds = [];
if (data.mentionedJidList) {
this.mentionedIds = data.mentionedJidList;
}
return super._patch(data);
}
_getChatId() {
return this.fromMe ? this.to : this.from;
}
/**
* Returns the Chat this message was sent in
* @returns {Promise<Chat>}
*/
getChat() {
return this.client.getChatById(this._getChatId());
}
/**
* Returns the Contact this message was sent from
* @returns {Promise<Contact>}
*/
getContact() {
return this.client.getContactById(this.author || this.from);
}
/**
* Returns the Contacts mentioned in this message
* @returns {Promise<Array<Contact>>}
*/
async getMentions() {
return await Promise.all(this.mentionedIds.map(async m => await this.client.getContactById(m)));
}
/**
* Returns the quoted message, if any
* @returns {Promise<Message>}
*/
async getQuotedMessage() {
if (!this.hasQuotedMsg) return undefined;
const quotedMsg = await this.client.pupPage.evaluate((msgId) => {
let msg = window.Store.Msg.get(msgId);
return msg.quotedMsgObj().serialize();
}, this.id._serialized);
return new Message(this.client, quotedMsg);
}
/**
* Sends a message as a reply to this message. If chatId is specified, it will be sent
* through the specified Chat. If not, it will send the message
* in the same Chat as the original message was sent.
*
* @param {string|MessageMedia|Location} content
* @param {?string} chatId
* @param {object} options
* @returns {Promise<Message>}
*/
async reply(content, chatId, options={}) {
if (!chatId) {
chatId = this._getChatId();
}
options = {
...options,
quotedMessageId: this.id._serialized
};
return this.client.sendMessage(chatId, content, options);
}
/**
* Downloads and returns the attatched message media
* @returns {Promise<MessageMedia>}
*/
async downloadMedia() {
if (!this.hasMedia) {
return undefined;
}
const {data, mimetype, filename} = await this.client.pupPage.evaluate(async (msgId) => {
const msg = window.Store.Msg.get(msgId);
const buffer = await window.WWebJS.downloadBuffer(msg.clientUrl);
const decrypted = await window.Store.CryptoLib.decryptE2EMedia(msg.type, buffer, msg.mediaKey, msg.mimetype);
const data = await window.WWebJS.readBlobAsync(decrypted._blob);
return {
data: data.split(',')[1],
mimetype: msg.mimetype,
filename: msg.filename
};
}, this.id._serialized);
return new MessageMedia(mimetype, data, 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);
}
}
module.exports = Message;

View File

@@ -1,31 +0,0 @@
'use strict';
/**
* Media attached to a message
* @param {string} mimetype MIME type of the attachment
* @param {string} data Base64-encoded data of the file
* @param {?string} filename Document file name
*/
class MessageMedia {
constructor(mimetype, data, filename) {
/**
* MIME type of the attachment
* @type {string}
*/
this.mimetype = mimetype;
/**
* Base64 encoded data that represents the file
* @type {string}
*/
this.data = data;
/**
* Name of the file (for documents)
* @type {?string}
*/
this.filename = filename;
}
}
module.exports = MessageMedia;

View File

@@ -1,13 +0,0 @@
'use strict';
const Chat = require('./Chat');
/**
* Represents a Private Chat on WhatsApp
* @extends {Chat}
*/
class PrivateChat extends Chat {
}
module.exports = PrivateChat;

View File

@@ -1,13 +0,0 @@
'use strict';
const Contact = require('./Contact');
/**
* Represents a Private Contact on WhatsApp
* @extends {Contact}
*/
class PrivateContact extends Contact {
}
module.exports = PrivateContact;

View File

@@ -1,13 +0,0 @@
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'),
};

View File

@@ -0,0 +1,6 @@
1. add the commands
2. add the logic for every commands
3. add the messages with the logic on the command callback function

View File

@@ -0,0 +1,297 @@
const { Command } = require("../models/commands");
const logic = require("../businessLogic/logic");
const { Website } = require("../models/website");
const { Product } = require('../models/product');
var selected_product = null;// Will keep track of the selected product
var selected_website = null; // Selected website.
///////////
//add the commands here
///////////
const commands = [
new Command({
//User command
command: 'wg',
//function to be executed
callback : (input) => {
logic.onWG();
//mesage to be sent to the user
let message = [
`stop it and get some help by using the following command *wg help*`,
`Hope everything works well`
];
return message;
}
}),
new Command({
//User command
command: `wg product new <id>`,
//function to be executed
callback : (input) => {
if(selected_website==null)
{
let message = [
`A website should be selected or created before creating a product `
];
return message;
}
selected_product= logic.addProduct(input['id'],selected_website);
//mesage to be sent to the user
let message = [
`The product has been created with the id : ` + selected_product.id ,
`This product has been selected . \nNow you can make change to the product with the following commands : \n1. wg product info \n2. wg product name <product-name> \n3. wg product cost <product-cost> \n4. wg product desc <product-desc> \n5. wg product image <product-image>`
];
return message;
}
}),
new Command({
//User command
command: `wg product delete <id>`,
//function to be executed
callback : (input) => {
if(selected_website==null)
{
let message = [
`A website should be selected or created before deleting a product `
];
return message;
}
if(logic.deleteProduct(input['id'],selected_website) == false)
{
let message = [
`No product with the given id`
];
return message;
}
let message = [
`The product has been deleted with the id : ` + id
];
return message;
}
}),
new Command({
//User command
command: `wg product select <id>`,
//function to be executed
callback : (input) => {
if(selected_website==null)
{
let message = [
`A website should be selected or created before selecting a product `
];
return message;
}
// Find the product with the given id
selected_product = selected_website.getProduct(input['id']);
if(selected_product == null)
{
logic.addProduct(input['id'],selected_website);
selected_product = selected_website.getProduct(input['id']);
let message = [
`There was no product with the give id. So a new product was created and selected with the id : ` + selected_product.id ,
`Now you can make change to the product with the following commands : \n1. wg product info \n2. wg product name <product-name> \n3. wg product cost <product-cost> \n4. wg product desc <product-desc> \n5. wg product image <product-image>`
];
return message;
}
let message = [
`The product has been selected with the id : ` + selected_product.id ,
'Now you can make change to the product with the following commands : \n1. wg product info \n2. wg product name <product-name> \n3. wg product cost <product-cost> \n4. wg product desc <product-desc> \n5. wg product image <product-image>'
];
return message;
}
}),
new Command({
//User command
command: `wg product all`,
//function to be executed
callback : () => {
if(selected_website==null)
{
let message = [
`A website should be selected or created `
];
return message;
}
let message = [
'Your website has following products: '
];
for(let p of selected_website.getAllProduct())
{
let m = 'Product id: ' + p.id + '\nProduct Name : ' + p.name + '\nProduct description : '+ p.desc + '\nProduct Cost: ' + p.cost + '\nProduct Image : '+ p.image;
message.push(m);
}
return message;
}
}),
new Command({
//User command
command: `wg product info`,
//function to be executed
callback : () => {
if(selected_product == null)
{
let message = [
`A product should be selected `
];
return message;
}
let message = [
'Product id: ' + selected_product.id,
'Product Name : ' + selected_product.name ,
'Product description : '+ selected_product.desc ,
'Product Cost: ' + selected_product.cost ,
'Product Image : '+ selected_product.image
];
return message;
}
}),
new Command({
//User command
command: `wg product name <product-name>`,
//function to be executed
callback : (input) => {
if(selected_product == null)
{
let message = [
`A product should be selected `
];
return message;
}
selected_product.setName(input['product-name']);
let message = [
'The product name has been set to '+ selected_product.name
];
return message;
}
}),
new Command({
//User command
command: `wg product cost <product-cost>`,
//function to be executed
callback : (input) => {
if(selected_product == null)
{
let message = [
`A product should be selected `
];
return message;
}
selected_product.setCost(input['product-cost']);
let message = [
'The product cost has been set to '+ selected_product.cost
];
return message;
}
}),
new Command({
//User command
command: 'wg product desc <product-desc>',
//function to be executed
callback : (input) => {
if(selected_product == null)
{
let message = [
`A product should be selected `
];
return message;
}
selected_product.setDesc(input['product-desc']);
let message = [
'The product description has been set to : '+ selected_product.desc
];
return message;
}
}),
new Command({
//User command
command: 'wg product image <product-image>',
//function to be executed
callback : (input) => {
if(selected_product == null)
{
let message = [
`A product should be selected `
];
return message;
}
selected_product.setImage(input['product-image']);
let message = [
'The product image has been set to : '+ selected_product.image
];
return message;
}
}),
];
module.exports= onMessage = (message, client) => {
let command = null;
//if the message start with wg then proceed
if(message.body.startsWith("wg"))
{
for (let c of commands){
if(c.equals(message.body))
{
command = c;
break;
}
}
if(command != null){
let input = {};
if(command.requireInput){
input = command.getInput(message.body);
}
let messageToBeSent = command.callback(input);
for (let msg of messageToBeSent)
{
client.sendMessage(message.from, msg, new Object());
}
}
}
};
//export default onMessage;

View File

@@ -1,127 +0,0 @@
'use strict';
exports.WhatsWebURL = 'https://web.whatsapp.com/';
exports.UserAgent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.109 Safari/537.36';
exports.DefaultOptions = {
puppeteer: {
headless: true
},
session: false
};
/**
* Client status
* @readonly
* @enum {number}
*/
exports.Status = {
INITIALIZING: 0,
AUTHENTICATING: 1,
READY: 3
};
/**
* Events that can be emitted by the client
* @readonly
* @enum {string}
*/
exports.Events = {
AUTHENTICATED: 'authenticated',
AUTHENTICATION_FAILURE: 'auth_failure',
READY: 'ready',
MESSAGE_RECEIVED: 'message',
MESSAGE_CREATE: 'message_create',
MESSAGE_REVOKED_EVERYONE: 'message_revoke_everyone',
MESSAGE_REVOKED_ME: 'message_revoke_me',
MESSAGE_ACK: 'message_ack',
GROUP_JOIN: 'group_join',
GROUP_LEAVE: 'group_leave',
GROUP_UPDATE: 'group_update',
QR_RECEIVED: 'qr',
DISCONNECTED: 'disconnected',
STATE_CHANGED: 'change_state',
};
/**
* Message types
* @readonly
* @enum {string}
*/
exports.MessageTypes = {
TEXT: 'chat',
AUDIO: 'audio',
VOICE: 'ptt',
IMAGE: 'image',
VIDEO: 'video',
DOCUMENT: 'document',
STICKER: 'sticker',
LOCATION: 'location',
CONTACT_CARD: 'vcard',
CONTACT_CARD_MULTI: 'multi_vcard',
REVOKED: 'revoked',
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
* @enum {string}
*/
exports.ChatTypes = {
SOLO: 'solo',
GROUP: 'group',
UNKNOWN: 'unknown'
};
/**
* WhatsApp state
* @readonly
* @enum {string}
*/
exports.WAState = {
CONFLICT: 'CONFLICT',
CONNECTED: 'CONNECTED',
DEPRECATED_VERSION: 'DEPRECATED_VERSION',
OPENING: 'OPENING',
PAIRING: 'PAIRING',
PROXYBLOCK: 'PROXYBLOCK',
SMB_TOS_BLOCK: 'SMB_TOS_BLOCK',
TIMEOUT: 'TIMEOUT',
TOS_BLOCK: 'TOS_BLOCK',
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,
};

View File

@@ -1,304 +0,0 @@
'use strict';
// Exposes the internal Store to the WhatsApp Web client
exports.ExposeStore = (moduleRaidStr) => {
eval('var moduleRaid = ' + moduleRaidStr);
// eslint-disable-next-line no-undef
window.mR = moduleRaid();
window.Store = window.mR.findModule('Chat')[1].default;
window.Store.AppState = window.mR.findModule('STREAM')[0].default;
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;
window.Store.Invite = window.mR.findModule('sendJoinGroupViaInvite')[0];
window.Store.OpaqueData = window.mR.findModule('getOrCreateOpaqueDataForPath')[0];
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) => {
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);
delete options.attachment;
}
let quotedMsgOptions = {};
if (options.quotedMessageId) {
let quotedMessage = window.Store.Msg.get(options.quotedMessageId);
if (quotedMessage.canReply()) {
quotedMsgOptions = quotedMessage.msgContextInfo(chat);
}
delete options.quotedMessageId;
}
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,
lng: options.location.longitude
};
delete options.location;
}
const newMsgId = new window.Store.MsgKey({
from: window.Store.Conn.me,
to: chat.id,
id: window.Store.genId(),
});
const message = {
...options,
id: newMsgId,
ack: 0,
body: content,
from: window.Store.Conn.me,
to: chat.id,
local: true,
self: 'out',
t: parseInt(new Date().getTime() / 1000),
isNewMsg: true,
type: 'chat',
...locationOptions,
...attOptions,
...quotedMsgOptions
};
await window.Store.SendMessage.addAndSendMsgToChat(chat, message);
return window.Store.Msg.get(newMsgId._serialized);
};
window.WWebJS.processMediaData = async (mediaInfo) => {
const file = window.WWebJS.mediaInfoToFile(mediaInfo);
const mData = await window.Store.OpaqueData.default.createFromData(file, file.type);
const mediaPrep = window.Store.MediaPrep.prepRawMedia(mData, {});
const mediaData = await mediaPrep.waitForPrep();
const mediaObject = window.Store.MediaObject.getOrCreateMediaObject(mediaData.filehash);
const mediaType = window.Store.MediaTypes.msgToMediaType({
type: mediaData.type,
isGif: mediaData.isGif
});
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(mediaData.mimetype, mediaObject, mediaType);
if (!uploadedMedia) {
throw new Error('upload failed: media entry was not created');
}
mediaData.set({
clientUrl: uploadedMedia.mmsUrl,
directPath: uploadedMedia.directPath,
mediaKey: uploadedMedia.mediaKey,
mediaKeyTimestamp: uploadedMedia.mediaKeyTimestamp,
filehash: mediaObject.filehash,
uploadhash: uploadedMedia.uploadHash,
size: mediaObject.size,
streamingSidecar: uploadedMedia.sidecar,
firstFrameSidecar: uploadedMedia.firstFrameSidecar
});
return mediaData;
};
window.WWebJS.getChatModel = chat => {
let res = chat.serialize();
res.isGroup = chat.isGroup;
res.formattedTitle = chat.formattedTitle;
if (chat.groupMetadata) {
res.groupMetadata = chat.groupMetadata.serialize();
}
return res;
};
window.WWebJS.getChat = chatId => {
const chat = window.Store.Chat.get(chatId);
return window.WWebJS.getChatModel(chat);
};
window.WWebJS.getChats = () => {
const chats = window.Store.Chat.models;
return chats.map(chat => window.WWebJS.getChatModel(chat));
};
window.WWebJS.getContactModel = contact => {
let res = contact.serialize();
res.isBusiness = contact.isBusiness;
if (contact.businessProfile) {
res.businessProfile = contact.businessProfile.serialize();
}
res.isMe = contact.isMe;
res.isUser = contact.isUser;
res.isGroup = contact.isGroup;
res.isWAContact = contact.isWAContact;
res.isMyContact = contact.isMyContact;
res.userid = contact.userid;
return res;
};
window.WWebJS.getContact = contactId => {
const contact = window.Store.Contact.get(contactId);
return window.WWebJS.getContactModel(contact);
};
window.WWebJS.getContacts = () => {
const contacts = window.Store.Contact.models;
return contacts.map(contact => window.WWebJS.getContactModel(contact));
};
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++) {
view[i] = binaryData.charCodeAt(i);
}
const blob = new Blob([buffer], { type: mimetype });
return new File([blob], filename, {
type: mimetype,
lastModified: Date.now()
});
};
window.WWebJS.downloadBuffer = (url) => {
return new Promise(function (resolve, reject) {
let xhr = new XMLHttpRequest();
xhr.open('GET', url);
xhr.responseType = 'arraybuffer';
xhr.onload = function () {
if (xhr.status == 200) {
resolve(xhr.response);
} else {
reject({
status: this.status,
statusText: xhr.statusText
});
}
};
xhr.onerror = function () {
reject({
status: this.status,
statusText: xhr.statusText
});
};
xhr.send(null);
});
};
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 = () => {
let Chats = window.Store.Chat.models;
for (let chatIndex in Chats) {
if (isNaN(chatIndex)) {
continue;
}
let chat = Chats[chatIndex];
if (chat.unreadCount > 0) {
chat.markSeen();
window.Store.Wap.sendConversationSeen(chat.id, chat.getLastMsgKeyForAction(), chat.unreadCount - chat.pendingSeenCount);
}
}
};

View File

@@ -1,35 +0,0 @@
'use strict';
const has = (o, k) => Object.prototype.hasOwnProperty.call(o, k);
/**
* Utility methods
*/
class Util {
constructor() {
throw new Error(`The ${this.constructor.name} class may not be instantiated.`);
}
/**
* Sets default properties on an object that aren't already specified.
* @param {Object} def Default properties
* @param {Object} given Object to assign defaults to
* @returns {Object}
* @private
*/
static mergeDefault(def, given) {
if (!given) return def;
for (const key in def) {
if (!has(given, key) || given[key] === undefined) {
given[key] = def[key];
} else if (given[key] === Object(given[key])) {
given[key] = Util.mergeDefault(def[key], given[key]);
}
}
return given;
}
}
module.exports = Util;

View File

@@ -0,0 +1,169 @@
const { Command } = require('../src/models/commands');
const expect = require('chai').expect;
describe('Command', () => {
it('Test : requireInput() without input', () => {
let a = new Command({
command: "wg create",
callback: () => {
}
});
expect(a.requireInput).to.false;
});
it('Test : requireInput() with input', () => {
let a = new Command({
command: "wg create <id>",
callback: () => {
}
});
expect(a.requireInput).to.true;
});
it('Test : requireInput() with 2 inputs', () => {
let a = new Command({
command: "wg create <id> <name>",
callback: () => {
}
});
expect(a.requireInput).to.true;
});
it('Test : equals() without input', () => {
let message = 'wg website';
let a = new Command({
command: "wg create <id>",
callback: () => {
}
});
let b = new Command({
command: "wg website",
callback: () => {
}
});
let c = new Command({
command: "wg product p12",
callback: () => {
}
});
let d = new Command({
command: "wg",
callback: () => {
}
});
expect(a.equals(message)).to.false;
expect(b.equals(message)).to.true;
expect(c.equals(message)).to.false;
expect(d.equals(message)).to.false;
});
it('Test : equals() with input', () => {
let message = 'wg create p12';
let a = new Command({
command: "wg create <id>",
callback: () => {
}
});
expect(a.equals(message)).to.true;
});
it('Test : equals() with different message', () => {
let message = 'wg website web';
let a = new Command({
command: "wg create <id>",
callback: () => {
}
});
expect(a.equals(message)).to.false;
});
it('Test : equals() with spelling error', () => {
let message = 'wg websit';
let b = new Command({
command: "wg website",
callback: () => {
}
});
expect(b.equals(message)).to.false;
});
it('Test : equals() with extra inputs', () => {
let message = 'wg create p12 pr';
let a = new Command({
command: "wg create <id>",
callback: () => {
}
});
expect(a.equals(message)).to.false;
});
it('Test : getInput() with 1 input', () => {
let message = 'wg create p12'
let a = new Command({
command: "wg create <id>",
callback: () => {
}
});
expect(a.getInput(message)['id']).to.equal('p12');
});
it('Test : getInput() with 2 input', () => {
let message = 'wg create p12 pikachu'
let a = new Command({
command: "wg create <id> <name>",
callback: () => {
}
});
expect(a.getInput(message)['id']).to.equal('p12');
expect(a.getInput(message)['name']).to.equal('pikachu');
});
});

View File

@@ -0,0 +1,68 @@
const expect = require('chai').expect;
const {data} = require('../src/models/data')
const {Entity} = require('../src/models/entity');
const { Website } = require('../src/models/website');
describe('Entity', () => {
it('Test : addData', () => {
let a = new Entity();
a.addData('hello', new Website('hello'));
expect(a.isData('hello')).to.true;
expect(a.count).to.equal(0);
});
it('Test : clearData()', () => {
let a = new Entity();
a.addData('hello world', new Website('hello world'));
a.addData('gada', new Website('gada'));
a.addData('pagol', new Website('pagol'));
a.clearData();
expect(a.count).to.equal(0);
expect(a.isData("kruta")).to.false;
expect(a.isData("hello")).to.false;
expect(a.isData('pagol')).to.false;
expect(a.isData('hello world')).to.false;
});
it('Test: getData', () => {
let a = new Entity();
a.addData('hello world', new Website('hello world'));
a.addData('gada', new Website('gada'));
a.addData('pagol', new Website('pagol'));
expect(a.getData('hello world').companyName).to.equal('hello world');
expect(a.getData('gada').companyName).to.equal('gada');
expect(a.getData('chu chu')).to.null;
})
it('Test: deleteData', () => {
let a = new Entity();
a.addData('hello world', new Website('hello world'));
a.addData('gada', new Website('gada'));
a.addData('pagol', new Website('pagol'));
a.deleteData('gada');
expect(a.getData('gada')).to.null;
})
it('Test: getAllData', () => {
let a = new Entity();
a.addData('hello world', new Website('hello world'));
a.addData('gada', new Website('gada'));
a.addData('pagol', new Website('pagol'));
let websitegen = a.getAllData().values();
for(let t of websitegen)
{
console.log(t.companyName);
}
})
})

View File

@@ -1,7 +1,6 @@
const fs = require('fs'); const fs = require('fs');
var request = require('request'); var request = require('request');
const { Client, Location } = require('./index'); const { Client} = require('whatsapp-web.js');
const MessageMedia = require('./src/structures/MessageMedia');
// Data structure to store basic information : To ensure that user gets the website genreated with the data which he wrote // Data structure to store basic information : To ensure that user gets the website genreated with the data which he wrote
/* /*
@@ -35,6 +34,7 @@ if (fs.existsSync(SESSION_FILE_PATH))
const client = new Client({ puppeteer: { headless: false }, session: sessionCfg }); const client = new Client({ puppeteer: { headless: false }, session: sessionCfg });
client.initialize(); client.initialize();
client.on('qr', (qr) => client.on('qr', (qr) =>
{ {
console.log('QR RECEIVED', qr); console.log('QR RECEIVED', qr);