mirror of
https://github.com/cheveguerra/whatsapp-web.js.git
synced 2026-04-18 11:39:14 +00:00
Compare commits
381 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3a2acf71c2 | ||
|
|
f32f3c71ba | ||
|
|
017dd4b783 | ||
|
|
fa9f6610d7 | ||
|
|
e9104b390d | ||
|
|
a23c285f3c | ||
|
|
281aec40ad | ||
|
|
2e4890d113 | ||
|
|
0bd8eb9d96 | ||
|
|
2718c1328c | ||
|
|
24f8b4622b | ||
|
|
9ab9c48f7b | ||
|
|
b96607338a | ||
|
|
ea2cc81d47 | ||
|
|
56644f4f03 | ||
|
|
fcb78a1cd4 | ||
|
|
f88bd274be | ||
|
|
c45fae5c15 | ||
|
|
1b75d0d243 | ||
|
|
cc78e9863d | ||
|
|
fc205ff530 | ||
|
|
6ab98a5365 | ||
|
|
3c24df085a | ||
|
|
979e97ea42 | ||
|
|
1f4328c7a3 | ||
|
|
6691d25282 | ||
|
|
12d9735b73 | ||
|
|
ab5167c4ad | ||
|
|
52c8336236 | ||
|
|
9fe91692cf | ||
|
|
f6de161c7d | ||
|
|
0d55d40885 | ||
|
|
8ef37b68ae | ||
|
|
bd5cfdc936 | ||
|
|
f0e49efcf9 | ||
|
|
5d83b45ed4 | ||
|
|
e29354fca3 | ||
|
|
66283da903 | ||
|
|
d7f7889b0f | ||
|
|
11955e9f03 | ||
|
|
444abc2c76 | ||
|
|
20f3bc7a8b | ||
|
|
93c8a2b05e | ||
|
|
70ca073f38 | ||
|
|
7e36cceaf0 | ||
|
|
303ea3ab6b | ||
|
|
4aae8b0f32 | ||
|
|
64803c2ba6 | ||
|
|
aa9e19a19e | ||
|
|
7631400de1 | ||
|
|
d7478de68a | ||
|
|
a9b2a1aab8 | ||
|
|
3b4632201d | ||
|
|
2200390d4c | ||
|
|
b1f7ff01bc | ||
|
|
21d565154a | ||
|
|
09cbee0e65 | ||
|
|
fa9f5aba38 | ||
|
|
c859ac39ce | ||
|
|
221d29736a | ||
|
|
078933f061 | ||
|
|
f149516d0d | ||
|
|
2f1c894a34 | ||
|
|
32e47d818a | ||
|
|
20aee44c3b | ||
|
|
bb2ef88e0a | ||
|
|
6878598a5d | ||
|
|
4e6a00dffe | ||
|
|
b93c7b4b76 | ||
|
|
a37ff69692 | ||
|
|
3705d1fea9 | ||
|
|
7950aae5d1 | ||
|
|
bdff59fb44 | ||
|
|
d05803074a | ||
|
|
d86c39de3c | ||
|
|
46ba9c5e9a | ||
|
|
d7a493e68a | ||
|
|
da95d927b9 | ||
|
|
92bc5e62ab | ||
|
|
73a3e28a4b | ||
|
|
4f376fc2fa | ||
|
|
a20c8ef8f8 | ||
|
|
2052e0479d | ||
|
|
c55db82f73 | ||
|
|
4e837b00f9 | ||
|
|
89a06b15a8 | ||
|
|
55247576da | ||
|
|
8a1f6f0648 | ||
|
|
254ca884aa | ||
|
|
3958105926 | ||
|
|
818bf48e5d | ||
|
|
d71544566c | ||
|
|
187aa50131 | ||
|
|
e11e00d938 | ||
|
|
d9dd89ccaf | ||
|
|
3aa0e4f7b3 | ||
|
|
d82cf448d9 | ||
|
|
3f576c990c | ||
|
|
d44a525b02 | ||
|
|
d8217029ba | ||
|
|
2a7337b142 | ||
|
|
1fcfaa0362 | ||
|
|
c434e04e41 | ||
|
|
97a1d399ee | ||
|
|
dbf9bf2158 | ||
|
|
353af130d0 | ||
|
|
06107af67d | ||
|
|
4338664590 | ||
|
|
95facee885 | ||
|
|
1f38b762ed | ||
|
|
b60029ed09 | ||
|
|
ab415ff9be | ||
|
|
7beeff4901 | ||
|
|
022c87f3c7 | ||
|
|
e527fe74fd | ||
|
|
7597608f9d | ||
|
|
be018e651d | ||
|
|
64189d2d67 | ||
|
|
38e31a07cf | ||
|
|
40cec51956 | ||
|
|
d9ccb6f276 | ||
|
|
628b6e4d49 | ||
|
|
8e56aef3ce | ||
|
|
cd774bef17 | ||
|
|
9c2592e164 | ||
|
|
ae6d61bda9 | ||
|
|
98acd2312d | ||
|
|
62c7c15f44 | ||
|
|
e12c53f6ce | ||
|
|
811008da4b | ||
|
|
863284c9d1 | ||
|
|
ec95483518 | ||
|
|
ff2eb95751 | ||
|
|
1b5e9d2392 | ||
|
|
340e9764fe | ||
|
|
084525ddfa | ||
|
|
3398501ee6 | ||
|
|
cdede835af | ||
|
|
449d0f01d8 | ||
|
|
4ed9312eb7 | ||
|
|
76deaad2fd | ||
|
|
284903dce4 | ||
|
|
a03cc41d22 | ||
|
|
04d2308bbc | ||
|
|
dc9b7e5f3d | ||
|
|
cc7a729223 | ||
|
|
2ec46f674a | ||
|
|
22993fc23d | ||
|
|
cd52075447 | ||
|
|
54a07fa22f | ||
|
|
1d49f74ab4 | ||
|
|
ea4dfb17f3 | ||
|
|
efa6cf98d2 | ||
|
|
9d715735ed | ||
|
|
4afff38713 | ||
|
|
b13dea0339 | ||
|
|
0ef6061d7e | ||
|
|
0465507009 | ||
|
|
2fd96e76b9 | ||
|
|
caab11cfe4 | ||
|
|
ebba1b9ab9 | ||
|
|
cdc00e934d | ||
|
|
795570a697 | ||
|
|
0465742ffb | ||
|
|
38976558f5 | ||
|
|
b895437458 | ||
|
|
0a061f982c | ||
|
|
63d11d3f84 | ||
|
|
5177a257cf | ||
|
|
f506c171c1 | ||
|
|
64e2cc48fc | ||
|
|
6c66ab2bef | ||
|
|
efc7018f9a | ||
|
|
5991b28b88 | ||
|
|
2894832b00 | ||
|
|
6cece4a006 | ||
|
|
f1e2f32988 | ||
|
|
f564e41781 | ||
|
|
e6015162c5 | ||
|
|
bc90ffcb19 | ||
|
|
2702757dce | ||
|
|
56171f957e | ||
|
|
204a1c79af | ||
|
|
168c84250e | ||
|
|
d96e8e5eb5 | ||
|
|
0cbb0373ad | ||
|
|
1f756142e4 | ||
|
|
4047afe332 | ||
|
|
89029ac916 | ||
|
|
fa4923db98 | ||
|
|
559133c3c4 | ||
|
|
e2acd03efc | ||
|
|
c6974295a6 | ||
|
|
6590c75c8a | ||
|
|
1bdc7335d8 | ||
|
|
bb9d160f72 | ||
|
|
cea1830dde | ||
|
|
f639c53f0a | ||
|
|
3e32fe27ea | ||
|
|
5c6195738f | ||
|
|
32575490da | ||
|
|
5a0ccc8b17 | ||
|
|
1b946940f4 | ||
|
|
71dbe99023 | ||
|
|
8b101d1f3d | ||
|
|
e2a642a81b | ||
|
|
0c0a5a752b | ||
|
|
e141a5df97 | ||
|
|
576768e390 | ||
|
|
87cb5a0519 | ||
|
|
274d24002b | ||
|
|
563f73d290 | ||
|
|
4b3079d2c1 | ||
|
|
7b0e356fcc | ||
|
|
467f2af7d8 | ||
|
|
19b1b9fdef | ||
|
|
a1d09e0e21 | ||
|
|
d86ccec5d1 | ||
|
|
f359ad40ee | ||
|
|
db7a8bcd3b | ||
|
|
edbf4139e7 | ||
|
|
709c43cc9f | ||
|
|
054ef4a84f | ||
|
|
c9bc0a1c8b | ||
|
|
6b3c8465e9 | ||
|
|
43aa6b3716 | ||
|
|
7738f7910b | ||
|
|
fc7a1a9974 | ||
|
|
b0465ceeff | ||
|
|
2abe4a157d | ||
|
|
e520a96b20 | ||
|
|
75296b652b | ||
|
|
b15ec768d3 | ||
|
|
42dd866a53 | ||
|
|
20e07c43d7 | ||
|
|
9b096db784 | ||
|
|
668106be2d | ||
|
|
cc5d85b2b1 | ||
|
|
3d06babed9 | ||
|
|
0ca909233d | ||
|
|
f4a2c44ed7 | ||
|
|
604656cf73 | ||
|
|
aedf41b762 | ||
|
|
bf2775d1f0 | ||
|
|
0b112004d5 | ||
|
|
336fb9b551 | ||
|
|
ba6ec7feab | ||
|
|
51a1028588 | ||
|
|
1c31139434 | ||
|
|
ee21e14547 | ||
|
|
cbf8fb7cf5 | ||
|
|
c7d5eb67ee | ||
|
|
7fcd43f100 | ||
|
|
a60f0ce139 | ||
|
|
ab0db80063 | ||
|
|
e7c76fe069 | ||
|
|
233382ce7a | ||
|
|
e08dd7d835 | ||
|
|
a1e8e8cf51 | ||
|
|
a1e0970e1e | ||
|
|
c827b32328 | ||
|
|
2345b5c4ee | ||
|
|
8627fc3d71 | ||
|
|
502b22f6d7 | ||
|
|
590ecc2351 | ||
|
|
7da8345722 | ||
|
|
4344df6152 | ||
|
|
382259488b | ||
|
|
7180beda2e | ||
|
|
34aa136bf9 | ||
|
|
2a58cfe8e2 | ||
|
|
9da553ecb9 | ||
|
|
97705b1865 | ||
|
|
fbdfd2c4dd | ||
|
|
5c84a1651d | ||
|
|
bfea74f567 | ||
|
|
a10b458cd5 | ||
|
|
de2c441870 | ||
|
|
bff60bc9f6 | ||
|
|
9cc668e4d9 | ||
|
|
753b6772ab | ||
|
|
300b367fa0 | ||
|
|
b0baeaa8da | ||
|
|
ad9ae1f703 | ||
|
|
b89f0e146f | ||
|
|
6c7a3f9899 | ||
|
|
d7459eac23 | ||
|
|
2abd3729d8 | ||
|
|
810ff4603b | ||
|
|
4d5619019c | ||
|
|
84213cc781 | ||
|
|
bf94d20db3 | ||
|
|
2e3b2f2a43 | ||
|
|
9c9b3c4441 | ||
|
|
832e402671 | ||
|
|
47011a32a5 | ||
|
|
a7ca628775 | ||
|
|
aa60e89911 | ||
|
|
d922e4df2f | ||
|
|
c032ea4387 | ||
|
|
a80fcfa740 | ||
|
|
44f837c42a | ||
|
|
4beeab9b2c | ||
|
|
cca74ec8b9 | ||
|
|
8b656c2caf | ||
|
|
4d09a4b60c | ||
|
|
7d2c89cf84 | ||
|
|
0928f48762 | ||
|
|
eb82e80343 | ||
|
|
f5a0de7def | ||
|
|
d6637d662a | ||
|
|
4188734839 | ||
|
|
207ea200b4 | ||
|
|
b062f9f82f | ||
|
|
4d7a6ee4c2 | ||
|
|
e528e8c50e | ||
|
|
bcd02aa5e4 | ||
|
|
686c99f0c7 | ||
|
|
59ee68b227 | ||
|
|
f40c8d4ffe | ||
|
|
bab54aea8b | ||
|
|
f0a1e05600 | ||
|
|
303d814376 | ||
|
|
044f62216b | ||
|
|
2b3c3e971a | ||
|
|
8528d9b0b6 | ||
|
|
7eb7fa8e28 | ||
|
|
8714e90df9 | ||
|
|
478f7136d9 | ||
|
|
20bbe3d0c4 | ||
|
|
33db17e67d | ||
|
|
1c2b4592b5 | ||
|
|
ce0a80383c | ||
|
|
97e488b10a | ||
|
|
ef507fcb95 | ||
|
|
8e011e0233 | ||
|
|
470c7aea04 | ||
|
|
f92f1ec6bf | ||
|
|
702a0ab103 | ||
|
|
d9fb5693d1 | ||
|
|
3cbf1e9c2f | ||
|
|
93a617336a | ||
|
|
1780436b93 | ||
|
|
7acbd3d800 | ||
|
|
67435b2244 | ||
|
|
743ac93f6e | ||
|
|
0a7412cf17 | ||
|
|
d1e357d23b | ||
|
|
3610cef926 | ||
|
|
4e5eeace2f | ||
|
|
6c43a2d2ed | ||
|
|
001c045c08 | ||
|
|
c3ba79464b | ||
|
|
237331b656 | ||
|
|
9d0b58a847 | ||
|
|
842c4f0e06 | ||
|
|
2dddc781c5 | ||
|
|
d8cd2d1d83 | ||
|
|
80d5783f22 | ||
|
|
cb54487197 | ||
|
|
d08b343815 | ||
|
|
ec1a80dfb4 | ||
|
|
56ed020d65 | ||
|
|
25b96378c7 | ||
|
|
5934ec531f | ||
|
|
65542f6025 | ||
|
|
00c603e623 | ||
|
|
bcd18428eb | ||
|
|
995abbf4a6 | ||
|
|
8599a6d918 | ||
|
|
5e9deff8a9 | ||
|
|
539849732c | ||
|
|
4fe7fa93b9 | ||
|
|
2820d3e72a | ||
|
|
cde5719bb6 | ||
|
|
8bdecadba4 | ||
|
|
b41414cfbf | ||
|
|
c61f447a93 | ||
|
|
49aacec4a7 | ||
|
|
d7a3e1a9a3 | ||
|
|
e14b49c5df |
3
.env.example
Normal file
3
.env.example
Normal file
@@ -0,0 +1,3 @@
|
||||
WWEBJS_TEST_REMOTE_ID=XXXXXXXXXX@c.us
|
||||
WWEBJS_TEST_CLIENT_ID=authenticated
|
||||
WWEBJS_TEST_MD=1
|
||||
@@ -5,14 +5,16 @@
|
||||
"es6": true,
|
||||
"node": true
|
||||
},
|
||||
"extends": "eslint:recommended",
|
||||
"extends": ["eslint:recommended", "plugin:mocha/recommended"],
|
||||
"globals": {
|
||||
"Atomics": "readonly",
|
||||
"SharedArrayBuffer": "readonly"
|
||||
},
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 2018
|
||||
"ecmaVersion": 2020
|
||||
},
|
||||
"plugins": ["mocha"],
|
||||
"ignorePatterns": ["docs"],
|
||||
"rules": {
|
||||
"indent": [
|
||||
"error",
|
||||
|
||||
105
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
Normal file
105
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
Normal file
@@ -0,0 +1,105 @@
|
||||
name: '🐛 Bug report'
|
||||
description: Create a report to help us improve
|
||||
labels: bug
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thank you for reporting an issue :pray:.
|
||||
|
||||
This issue tracker is for reporting bugs found in [`whatsapp-web.js`](https://github.com/pedroslopez/whatsapp-web.js).
|
||||
|
||||
If you have a question about how to achieve something and are struggling, please post a question in our [Discord server](https://discord.gg/wyKybbF) instead.
|
||||
|
||||
Before submitting a new bug/issue, please check the links below to see if there is a solution or question posted there already:
|
||||
- `whatsapp-web.js` [Issues tab](https://github.com/pedroslopez/whatsapp-web.js/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc)
|
||||
- `whatsapp-web.js` [closed Issues tab](https://github.com/pedroslopez/whatsapp-web.js/issues?q=is%3Aissue+sort%3Aupdated-desc+is%3Aclosed)
|
||||
|
||||
The more information you fill in, the better the community can help you.
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: Is there an existing issue for this?
|
||||
description: Please search to see if an issue already exists for the bug you encountered.
|
||||
options:
|
||||
- label: I have searched the existing issues
|
||||
required: true
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
label: Describe the bug
|
||||
description: Provide a clear and concise description of the challenge you are running into.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: expected
|
||||
attributes:
|
||||
label: Expected behavior
|
||||
description: Provide a clear and concise description of what you expected to happen.
|
||||
placeholder: |
|
||||
As a user, I expected ___ behavior but I am seeing ___
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: steps
|
||||
attributes:
|
||||
label: Steps to Reproduce the Bug or Issue
|
||||
description: Describe the steps we have to take to reproduce the behavior.
|
||||
placeholder: |
|
||||
1. Do X
|
||||
2. Do Y
|
||||
3. Do Z
|
||||
4. See error
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: relevant_code
|
||||
attributes:
|
||||
label: Relevant Code
|
||||
description: If applicable, add code snippets to help explain your problem.
|
||||
validations:
|
||||
required: false
|
||||
- type: dropdown
|
||||
id: browser_type
|
||||
attributes:
|
||||
label: Browser Type
|
||||
description: What web browser are you using?
|
||||
options:
|
||||
- Chromium
|
||||
- Google Chrome
|
||||
- Other (please write in Additional Context)
|
||||
validations:
|
||||
required: true
|
||||
- type: dropdown
|
||||
id: whatsapp_type
|
||||
attributes:
|
||||
label: WhatsApp Account Type
|
||||
options:
|
||||
- Standard
|
||||
- WhatsApp Business
|
||||
validations:
|
||||
required: true
|
||||
- type: dropdown
|
||||
id: multidevice
|
||||
attributes:
|
||||
label: Does your WhatsApp account have multidevice enabled?
|
||||
options:
|
||||
- Yes, I am using Multi Device
|
||||
- No, I am not using Multi Device
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Environment
|
||||
description: |
|
||||
- OS: [e.g. Mac, Windows, Linux, Docker + Ubuntu 18, etc]
|
||||
- Phone OS: [e.g. Android, iOS]
|
||||
- whatsapp-web.js version [e.g. 1.2.3]
|
||||
- WhatsApp Web version [run `await client.getWWebVersion()`]:
|
||||
- Node.js Version [e.g. 1.2.3]
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: additional
|
||||
attributes:
|
||||
label: Additional context
|
||||
description: Add any other context about the problem here.
|
||||
5
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
5
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: Official WWebJS Discord Server
|
||||
url: https://discord.gg/H7DqQs4
|
||||
about: Please ask and answer questions here.
|
||||
42
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
Normal file
42
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
name: 🚀 Feature request
|
||||
description: Suggest an idea for this project
|
||||
labels: enhancement
|
||||
|
||||
body:
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: Is there an existing issue for this?
|
||||
description: Please search to see if an issue related to this feature request already exists.
|
||||
options:
|
||||
- label: I have searched the existing issues
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Is your feature request related to a problem? Please describe.
|
||||
description: A concise description of the problem you are facing or the motivetion behind this feature request.
|
||||
placeholder: I faced a problem due to ...
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Describe the solution you'd like.
|
||||
description: A concise description of the solution for the issue.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Describe an alternate solution.
|
||||
description: Is there any other approach to solve the problem?
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Additional context
|
||||
description: |
|
||||
Links? Screenshots? References? Anything that will give us more context about what you would like to see!
|
||||
validations:
|
||||
required: false
|
||||
7
.github/dependabot.yml
vendored
Normal file
7
.github/dependabot.yml
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "npm"
|
||||
directory: "/"
|
||||
open-pull-requests-limit: 10
|
||||
schedule:
|
||||
interval: "monthly"
|
||||
20
.github/workflows/lint.yml
vendored
20
.github/workflows/lint.yml
vendored
@@ -6,19 +6,15 @@ on:
|
||||
|
||||
jobs:
|
||||
eslint:
|
||||
name: eslint
|
||||
name: ESLint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: install node v12
|
||||
uses: actions/setup-node@v1
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install node v14
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 12
|
||||
- name: npm install
|
||||
node-version: '14'
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
- name: eslint
|
||||
uses: icrawl/action-eslint@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
job-name: eslint
|
||||
- name: Run ESLint
|
||||
run: ./node_modules/.bin/eslint .
|
||||
|
||||
39
.github/workflows/update.yml
vendored
Normal file
39
.github/workflows/update.yml
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
name: Update
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0/15 * * * *"
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
update:
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ./tools/version-checker
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install node v16
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '16'
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
- name: Run Updater
|
||||
run: ./update-version
|
||||
- name: Store WA Version
|
||||
run: echo WA_VERSION=`cat ./.version` >> $GITHUB_ENV
|
||||
- name: Create Pull Request
|
||||
uses: peter-evans/create-pull-request@v3
|
||||
with:
|
||||
branch: auto-wa-web-update/patch
|
||||
delete-branch: true
|
||||
commit-message: Update supported WhatsApp Web version to v${{ env.WA_VERSION }}
|
||||
title: Update WhatsApp Web Version (${{ env.WA_VERSION }})
|
||||
body: |
|
||||
A new version of WhatsApp Web has been detected!
|
||||
|
||||
Tests should be run against this new version before merging.
|
||||
labels: WhatsApp Change
|
||||
reviewers: pedroslopez
|
||||
12
.gitignore
vendored
12
.gitignore
vendored
@@ -36,6 +36,10 @@ build/Release
|
||||
node_modules/
|
||||
jspm_packages/
|
||||
|
||||
# Lock files
|
||||
package-lock.json
|
||||
yarn.lock
|
||||
|
||||
# TypeScript v1 declaration files
|
||||
typings/
|
||||
|
||||
@@ -59,3 +63,11 @@ typings/
|
||||
|
||||
# next.js build output
|
||||
.next
|
||||
|
||||
# macOS
|
||||
._*
|
||||
.DS_Store
|
||||
|
||||
# Test sessions
|
||||
*session.json
|
||||
.wwebjs_auth/
|
||||
19
.npmignore
Normal file
19
.npmignore
Normal file
@@ -0,0 +1,19 @@
|
||||
docs/*
|
||||
.github/*
|
||||
|
||||
.eslintrc.json
|
||||
.jsdoc.json
|
||||
.editorconfig
|
||||
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
*session.json
|
||||
.wwebjs_auth/
|
||||
|
||||
.env
|
||||
tools/
|
||||
tests/
|
||||
133
CODE_OF_CONDUCT.md
Normal file
133
CODE_OF_CONDUCT.md
Normal file
@@ -0,0 +1,133 @@
|
||||
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
We as members, contributors, and leaders pledge to make participation in our
|
||||
community a harassment-free experience for everyone, regardless of age, body
|
||||
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
||||
identity and expression, level of experience, education, socio-economic status,
|
||||
nationality, personal appearance, race, religion, or sexual identity
|
||||
and orientation.
|
||||
|
||||
We pledge to act and interact in ways that contribute to an open, welcoming,
|
||||
diverse, inclusive, and healthy community.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to a positive environment for our
|
||||
community include:
|
||||
|
||||
* Demonstrating empathy and kindness toward other people
|
||||
* Being respectful of differing opinions, viewpoints, and experiences
|
||||
* Giving and gracefully accepting constructive feedback
|
||||
* Accepting responsibility and apologizing to those affected by our mistakes,
|
||||
and learning from the experience
|
||||
* Focusing on what is best not just for us as individuals, but for the
|
||||
overall community
|
||||
|
||||
Examples of unacceptable behavior include:
|
||||
|
||||
* The use of sexualized language or imagery, and sexual attention or
|
||||
advances of any kind
|
||||
* Trolling, insulting or derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or email
|
||||
address, without their explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Enforcement Responsibilities
|
||||
|
||||
Community leaders are responsible for clarifying and enforcing our standards of
|
||||
acceptable behavior and will take appropriate and fair corrective action in
|
||||
response to any behavior that they deem inappropriate, threatening, offensive,
|
||||
or harmful.
|
||||
|
||||
Community leaders have the right and responsibility to remove, edit, or reject
|
||||
comments, commits, code, wiki edits, issues, and other contributions that are
|
||||
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
||||
decisions when appropriate.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies within all community spaces, and also applies when
|
||||
an individual is officially representing the community in public spaces.
|
||||
Examples of representing our community include using an official e-mail address,
|
||||
posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported to the community leaders responsible for enforcement at
|
||||
[pedroslopez@me.com](mailto:pedroslopez@me.com).
|
||||
All complaints will be reviewed and investigated promptly and fairly.
|
||||
|
||||
All community leaders are obligated to respect the privacy and security of the
|
||||
reporter of any incident.
|
||||
|
||||
## Enforcement Guidelines
|
||||
|
||||
Community leaders will follow these Community Impact Guidelines in determining
|
||||
the consequences for any action they deem in violation of this Code of Conduct:
|
||||
|
||||
### 1. Correction
|
||||
|
||||
**Community Impact**: Use of inappropriate language or other behavior deemed
|
||||
unprofessional or unwelcome in the community.
|
||||
|
||||
**Consequence**: A private, written warning from community leaders, providing
|
||||
clarity around the nature of the violation and an explanation of why the
|
||||
behavior was inappropriate. A public apology may be requested.
|
||||
|
||||
### 2. Warning
|
||||
|
||||
**Community Impact**: A violation through a single incident or series
|
||||
of actions.
|
||||
|
||||
**Consequence**: A warning with consequences for continued behavior. No
|
||||
interaction with the people involved, including unsolicited interaction with
|
||||
those enforcing the Code of Conduct, for a specified period of time. This
|
||||
includes avoiding interactions in community spaces as well as external channels
|
||||
like social media. Violating these terms may lead to a temporary or
|
||||
permanent ban.
|
||||
|
||||
### 3. Temporary Ban
|
||||
|
||||
**Community Impact**: A serious violation of community standards, including
|
||||
sustained inappropriate behavior.
|
||||
|
||||
**Consequence**: A temporary ban from any sort of interaction or public
|
||||
communication with the community for a specified period of time. No public or
|
||||
private interaction with the people involved, including unsolicited interaction
|
||||
with those enforcing the Code of Conduct, is allowed during this period.
|
||||
Violating these terms may lead to a permanent ban.
|
||||
|
||||
### 4. Permanent Ban
|
||||
|
||||
**Community Impact**: Demonstrating a pattern of violation of community
|
||||
standards, including sustained inappropriate behavior, harassment of an
|
||||
individual, or aggression toward or disparagement of classes of individuals.
|
||||
|
||||
**Consequence**: A permanent ban from any sort of public interaction within
|
||||
the community.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
||||
version 2.0, available at
|
||||
[https://www.contributor-covenant.org/version/2/0/code_of_conduct.html][v2.0].
|
||||
|
||||
Community Impact Guidelines were inspired by
|
||||
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
||||
|
||||
For answers to common questions about this code of conduct, see the FAQ at
|
||||
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available
|
||||
at [https://www.contributor-covenant.org/translations][translations].
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
[v2.0]: https://www.contributor-covenant.org/version/2/0/code_of_conduct.html
|
||||
[Mozilla CoC]: https://github.com/mozilla/diversity
|
||||
[FAQ]: https://www.contributor-covenant.org/faq
|
||||
[translations]: https://www.contributor-covenant.org/translations
|
||||
58
README.md
58
README.md
@@ -1,4 +1,4 @@
|
||||
[](https://www.npmjs.com/package/whatsapp-web.js) [](https://depfu.com/github/pedroslopez/whatsapp-web.js?project_id=9765) 
|
||||
[](https://www.npmjs.com/package/whatsapp-web.js) [](https://depfu.com/github/pedroslopez/whatsapp-web.js?project_id=9765)  [](https://discord.gg/H7DqQs4)
|
||||
|
||||
# whatsapp-web.js
|
||||
A WhatsApp API client that connects through the WhatsApp Web browser app
|
||||
@@ -7,16 +7,24 @@ It uses Puppeteer to run a real instance of Whatsapp Web to avoid getting blocke
|
||||
|
||||
**NOTE:** I can't guarantee you will not be blocked by using this method, although it has worked for me. WhatsApp does not allow bots or unofficial clients on their platform, so this shouldn't be considered totally safe.
|
||||
|
||||
## Quick Links
|
||||
|
||||
* [Guide / Getting Started](https://wwebjs.dev/guide) _(work in progress)_
|
||||
* [Reference documentation](https://docs.wwebjs.dev/)
|
||||
* [GitHub](https://github.com/pedroslopez/whatsapp-web.js)
|
||||
* [npm](https://npmjs.org/package/whatsapp-web.js)
|
||||
|
||||
## Installation
|
||||
|
||||
The module is now available on npm! `npm i whatsapp-web.js`
|
||||
|
||||
Please note that Node v8+ is required due to Puppeteer.
|
||||
Please note that Node v12+ is required.
|
||||
|
||||
## Example usage
|
||||
|
||||
```js
|
||||
const { Client } = require('whatsapp-web.js');
|
||||
|
||||
const client = new Client();
|
||||
|
||||
client.on('qr', (qr) => {
|
||||
@@ -39,38 +47,68 @@ 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.
|
||||
|
||||
For more information on saving and restoring sessions, check out the available [Authentication Strategies](https://wwebjs.dev/guide/authentication.html).
|
||||
|
||||
|
||||
## Supported features
|
||||
|
||||
| Feature | Status |
|
||||
| ------------- | ------------- |
|
||||
| Multi Device | ✅ |
|
||||
| Send messages | ✅ |
|
||||
| Receive messages | ✅ |
|
||||
| Send media (images/audio/documents) | ✅ |
|
||||
| Send media (video) | ✅ (requires google chrome) |
|
||||
| Send stickers | _pending_ |
|
||||
| Send media (video) | ✅ [(requires google chrome)](https://wwebjs.dev/guide/handling-attachments.html#caveat-for-sending-videos-and-gifs) |
|
||||
| Send stickers | ✅ |
|
||||
| Receive media (images/audio/video/documents) | ✅ |
|
||||
| Send contact cards | _pending_ |
|
||||
| Send contact cards | ✅ |
|
||||
| Send location | ✅ |
|
||||
| Send buttons | ✅ |
|
||||
| Send lists | ✅ (business accounts not supported) |
|
||||
| Receive location | ✅ |
|
||||
| Message replies | ✅ |
|
||||
| Join groups by invite | ✅ |
|
||||
| Get invite for group | ✅ |
|
||||
| Modify group info (subject, description) | ✅ |
|
||||
| Modify group settings (send messages, edit info) | ✅ |
|
||||
| Add group participants | ✅ |
|
||||
| Kick group participants | ✅ |
|
||||
| Promote/demote group participants | ✅ |
|
||||
| Mention users | ✅ |
|
||||
| Mute/unmute chats | ✅ |
|
||||
| Block/unblock contacts | ✅ |
|
||||
| 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.
|
||||
|
||||
## Supporting the project
|
||||
|
||||
You can support the maintainer of this project through the links below
|
||||
|
||||
- [Support via GitHub Sponsors](https://github.com/sponsors/pedroslopez)
|
||||
- [Support via PayPal](https://www.paypal.me/psla/)
|
||||
- [Sign up for DigitalOcean](https://m.do.co/c/73f906a36ed4) and get $100 in credit when you sign up (Referral)
|
||||
|
||||
## Disclaimer
|
||||
|
||||
This project is not affiliated, associated, authorized, endorsed by, or in any way officially connected with WhatsApp or any of its subsidiaries or its affiliates. The official WhatsApp website can be found at https://whatsapp.com. "WhatsApp" as well as related names, marks, emblems and images are registered trademarks of their respective owners.
|
||||
|
||||
## License
|
||||
|
||||
Copyright 2019 Pedro S Lopez
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this project except in compliance with the License.
|
||||
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -2,9 +2,9 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta name="generator" content="JSDoc 3.6.7">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.2.0 » Class: Base</title>
|
||||
<title>whatsapp-web.js 1.16.5 » Class: Base</title>
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
||||
@@ -15,7 +15,7 @@
|
||||
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
||||
<div id="jsdoc-navbar-container">
|
||||
<div id="jsdoc-navbar-content">
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>2.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>16.<wbr>5</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -26,7 +26,7 @@
|
||||
<header class="page-header">
|
||||
<div class="symbol-detail-labels"><span class="label label-kind">class</span></div>
|
||||
<h1><small></small><span class="symbol-name">Base</span></h1>
|
||||
<p class="source-link">Source: <a href="structures_Base.js.html#source-line-7">structures/<wbr>Base.<wbr>js:7</a></p>
|
||||
<p class="source-link">Source: <a href="structures_Base.js.html#source-line-6">structures/<wbr>Base.<wbr>js:6</a></p>
|
||||
<div class="symbol-classdesc">
|
||||
<p>Represents a WhatsApp data structure</p>
|
||||
</div>
|
||||
@@ -50,7 +50,7 @@
|
||||
<footer id="jsdoc-footer" class="jsdoc-footer">
|
||||
<div id="jsdoc-footer-container">
|
||||
<p>
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on March 1, 2020.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 28, 2022.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
65
docs/BaseAuthStrategy.html
Normal file
65
docs/BaseAuthStrategy.html
Normal file
@@ -0,0 +1,65 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.7">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.16.5 » Class: BaseAuthStrategy</title>
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
||||
<link href="css/baseline.css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<body onload="prettyPrint()">
|
||||
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
||||
<div id="jsdoc-navbar-container">
|
||||
<div id="jsdoc-navbar-content">
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>16.<wbr>5</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div id="jsdoc-body-container">
|
||||
<div id="jsdoc-content">
|
||||
<div id="jsdoc-content-container">
|
||||
<div id="jsdoc-main" role="main">
|
||||
<header class="page-header">
|
||||
<div class="symbol-detail-labels"><span class="label label-kind">class</span></div>
|
||||
<h1><small></small><span class="symbol-name">BaseAuthStrategy</span></h1>
|
||||
<p class="source-link">Source: <a href="authStrategies_BaseAuthStrategy.js.html#source-line-6">authStrategies/<wbr>BaseAuthStrategy.<wbr>js:6</a></p>
|
||||
<div class="symbol-classdesc">
|
||||
<p>Base class which all authentication strategies extend</p>
|
||||
</div>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
</header>
|
||||
<section id="summary">
|
||||
</section>
|
||||
<section>
|
||||
<h2 id="BaseAuthStrategy">new <span class="symbol-name">BaseAuthStrategy</span><span class="signature"><span class="signature-params">()</span></span></h2>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
</section>
|
||||
<section>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
<nav id="jsdoc-toc-nav" role="navigation"></nav>
|
||||
</div>
|
||||
</div>
|
||||
<footer id="jsdoc-footer" class="jsdoc-footer">
|
||||
<div id="jsdoc-footer-container">
|
||||
<p>
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 28, 2022.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
<script src="scripts/jquery.min.js"></script>
|
||||
<script src="scripts/tree.jquery.js"></script>
|
||||
<script src="scripts/prettify.js"></script>
|
||||
<script src="scripts/jsdoc-toc.js"></script>
|
||||
<script src="scripts/linenumber.js"></script>
|
||||
<script src="scripts/scrollanchor.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -2,9 +2,9 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta name="generator" content="JSDoc 3.6.7">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.2.0 » Class: BusinessContact</title>
|
||||
<title>whatsapp-web.js 1.16.5 » Class: BusinessContact</title>
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
||||
@@ -15,7 +15,7 @@
|
||||
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
||||
<div id="jsdoc-navbar-container">
|
||||
<div id="jsdoc-navbar-content">
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>2.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>16.<wbr>5</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -45,19 +45,22 @@
|
||||
<dt><a href="BusinessContact.html#id">id</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="BusinessContact.html#isBlocked">isBlocked</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#isGroup">isGroup</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="BusinessContact.html#isMe">isMe</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
@@ -70,13 +73,13 @@
|
||||
<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#name">name</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="BusinessContact.html#number">number</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
@@ -91,18 +94,43 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="summary-callout">
|
||||
<h2 class="summary-callout-heading">Method</h2>
|
||||
<h2 class="summary-callout-heading">Methods</h2>
|
||||
<div class="summary-content">
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="BusinessContact.html#getProfilePicUrl">getProfilePicUrl()</a></dt>
|
||||
<dt><a href="BusinessContact.html#block">block()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="BusinessContact.html#getAbout">getAbout()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="BusinessContact.html#getChat">getChat()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="BusinessContact.html#getCommonGroups">getCommonGroups()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="BusinessContact.html#getCountryCode">getCountryCode()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="BusinessContact.html#getFormattedNumber">getFormattedNumber()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="BusinessContact.html#getProfilePicUrl">getProfilePicUrl()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="BusinessContact.html#unblock">unblock()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -128,6 +156,13 @@
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Contact.html#id">Contact#id</a></dd>
|
||||
</dl>
|
||||
<h3 id="isBlocked"><span class="symbol-name">isBlocked</span><small class="property-type">
|
||||
unknown</small></h3>
|
||||
<p>Indicates if you have blocked this contact</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Contact.html#isBlocked">Contact#isBlocked</a></dd>
|
||||
</dl>
|
||||
<h3 id="isBusiness"><span class="symbol-name">isBusiness</span><small class="property-type">
|
||||
unknown</small></h3>
|
||||
<p>Indicates if the contact is a business contact</p>
|
||||
@@ -206,8 +241,63 @@
|
||||
<dd><a href="Contact.html#shortName">Contact#shortName</a></dd>
|
||||
</dl>
|
||||
</section>
|
||||
<h2>Method</h2>
|
||||
<h2>Methods</h2>
|
||||
<section>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="block"><span class="symbol-name">block</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing boolean</span></span></h3>
|
||||
<p>Blocks this contact from WhatsApp</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Contact.html#block">Contact#block</a></dd>
|
||||
<dt>Returns</dt>
|
||||
<dd></dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="getAbout"><span class="symbol-name">getAbout</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing nullable string</span></span></h3>
|
||||
<p>Gets the Contact's current "about" info. Returns null if you don't have permission to read their status.</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Contact.html#getAbout">Contact#getAbout</a></dd>
|
||||
<dt>Returns</dt>
|
||||
<dd></dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="getChat"><span class="symbol-name">getChat</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing <a href="Chat.html">Chat</a></span></span></h3>
|
||||
<p>Returns the Chat that corresponds to this Contact.
|
||||
Will return null when getting chat for currently logged in user.</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Contact.html#getChat">Contact#getChat</a></dd>
|
||||
<dt>Returns</dt>
|
||||
<dd></dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="getCommonGroups"><span class="symbol-name">getCommonGroups</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing Array of WAWebJS.ChatId</span></span></h3>
|
||||
<p>Gets the Contact's common groups with you. Returns empty array if you don't have any common group.</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Contact.html#getCommonGroups">Contact#getCommonGroups</a></dd>
|
||||
<dt>Returns</dt>
|
||||
<dd></dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="getCountryCode"><span class="symbol-name">getCountryCode</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing string</span></span></h3>
|
||||
<p>Returns the contact's countrycode, (1541859685@c.us) => (1)</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Contact.html#getCountryCode">Contact#getCountryCode</a></dd>
|
||||
<dt>Returns</dt>
|
||||
<dd></dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="getFormattedNumber"><span class="symbol-name">getFormattedNumber</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing string</span></span></h3>
|
||||
<p>Returns the contact's formatted phone number, (12345678901@c.us) => (+1 (234) 5678-901)</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Contact.html#getFormattedNumber">Contact#getFormattedNumber</a></dd>
|
||||
<dt>Returns</dt>
|
||||
<dd></dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="getProfilePicUrl"><span class="symbol-name">getProfilePicUrl</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing string</span></span></h3>
|
||||
<p>Returns the contact's profile picture URL, if privacy settings allow it</p>
|
||||
@@ -217,6 +307,15 @@
|
||||
<dt>Returns</dt>
|
||||
<dd></dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="unblock"><span class="symbol-name">unblock</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing boolean</span></span></h3>
|
||||
<p>Unblocks this contact from WhatsApp</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Contact.html#unblock">Contact#unblock</a></dd>
|
||||
<dt>Returns</dt>
|
||||
<dd></dd>
|
||||
</dl>
|
||||
</section>
|
||||
</section>
|
||||
</div>
|
||||
@@ -227,7 +326,7 @@
|
||||
<footer id="jsdoc-footer" class="jsdoc-footer">
|
||||
<div id="jsdoc-footer-container">
|
||||
<p>
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on March 1, 2020.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 28, 2022.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
249
docs/Buttons.html
Normal file
249
docs/Buttons.html
Normal file
@@ -0,0 +1,249 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.7">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.16.5 » Class: Buttons</title>
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
||||
<link href="css/baseline.css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<body onload="prettyPrint()">
|
||||
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
||||
<div id="jsdoc-navbar-container">
|
||||
<div id="jsdoc-navbar-content">
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>16.<wbr>5</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div id="jsdoc-body-container">
|
||||
<div id="jsdoc-content">
|
||||
<div id="jsdoc-content-container">
|
||||
<div id="jsdoc-main" role="main">
|
||||
<header class="page-header">
|
||||
<div class="symbol-detail-labels"><span class="label label-kind">class</span></div>
|
||||
<h1><small></small><span class="symbol-name">Buttons</span></h1>
|
||||
<p class="source-link">Source: <a href="structures_Buttons.js.html#source-line-23">structures/<wbr>Buttons.<wbr>js:23</a></p>
|
||||
<div class="symbol-classdesc">
|
||||
<p>Message type buttons</p>
|
||||
</div>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
</header>
|
||||
<section id="summary">
|
||||
<div class="summary-callout">
|
||||
<h2 class="summary-callout-heading">Properties</h2>
|
||||
<div class="summary-content">
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="Buttons.html#body">body</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Buttons.html#buttons">buttons</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="Buttons.html#footer">footer</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Buttons.html#title">title</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="summary-callout">
|
||||
<h2 class="summary-callout-heading">Method</h2>
|
||||
<div class="summary-content">
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="Buttons.html#_format">_format(buttons)</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section>
|
||||
<h2 id="Buttons">new <span class="symbol-name">Buttons</span><span class="signature"><span class="signature-params">(body, buttons, title, footer)</span></span></h2>
|
||||
<section>
|
||||
<h3>Parameters</h3>
|
||||
<table class="jsdoc-details-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Optional</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>body</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>buttons</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p>See <a href="global.html#ButtonSpec"><code>ButtonSpec</code></a></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>title</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Value can be null.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>footer</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Value can be null.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
</section>
|
||||
<section>
|
||||
<h2>Properties</h2>
|
||||
<section>
|
||||
<h3 id="body"><span class="symbol-name">body</span><small class="property-type">
|
||||
(string or <a href="MessageMedia.html">MessageMedia</a>)</small></h3>
|
||||
<p>Message body</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="buttons"><span class="symbol-name">buttons</span><small class="property-type">
|
||||
Array of <a href="global.html#FormattedButtonSpec">FormattedButtonSpec</a></small></h3>
|
||||
<p>buttons of message</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="footer"><span class="symbol-name">footer</span><small class="property-type">
|
||||
string</small></h3>
|
||||
<p>footer of message</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="title"><span class="symbol-name">title</span><small class="property-type">
|
||||
string</small></h3>
|
||||
<p>title of message</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
</section>
|
||||
<h2>Method</h2>
|
||||
<section>
|
||||
<h3 id="_format"><span class="symbol-name">_format</span><span class="signature"><span class="signature-params">(buttons)</span> → <span class="signature-returns"> Array of <a href="global.html#FormattedButtonSpec">FormattedButtonSpec</a></span></span></h3>
|
||||
<p>Creates button array from simple array</p>
|
||||
<section>
|
||||
<h4>
|
||||
Example
|
||||
</h4>
|
||||
<div>
|
||||
<pre class="prettyprint"><code>Input: [{id:'customId',body:'button1'},{body:'button2'},{body:'button3'},{body:'button4'}]
|
||||
Returns: [{ buttonId:'customId',buttonText:{'displayText':'button1'},type: 1 },{buttonId:'n3XKsL',buttonText:{'displayText':'button2'},type:1},{buttonId:'NDJk0a',buttonText:{'displayText':'button3'},type:1}]</code></pre>
|
||||
</div>
|
||||
</section>
|
||||
<section>
|
||||
<h4>Parameter</h4>
|
||||
<table class="jsdoc-details-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Optional</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>buttons</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Array of <a href="global.html#ButtonSpec">ButtonSpec</a></p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<dl class="dl-compact">
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p><code>Array of <a href="global.html#FormattedButtonSpec">FormattedButtonSpec</a></code> </p>
|
||||
</dd>
|
||||
</dl>
|
||||
</section>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
<nav id="jsdoc-toc-nav" role="navigation"></nav>
|
||||
</div>
|
||||
</div>
|
||||
<footer id="jsdoc-footer" class="jsdoc-footer">
|
||||
<div id="jsdoc-footer-container">
|
||||
<p>
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 28, 2022.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
<script src="scripts/jquery.min.js"></script>
|
||||
<script src="scripts/tree.jquery.js"></script>
|
||||
<script src="scripts/prettify.js"></script>
|
||||
<script src="scripts/jsdoc-toc.js"></script>
|
||||
<script src="scripts/linenumber.js"></script>
|
||||
<script src="scripts/scrollanchor.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
1
docs/CNAME
Normal file
1
docs/CNAME
Normal file
@@ -0,0 +1 @@
|
||||
docs.wwebjs.dev
|
||||
159
docs/Call.html
Normal file
159
docs/Call.html
Normal file
@@ -0,0 +1,159 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.7">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.16.5 » Class: Call</title>
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
||||
<link href="css/baseline.css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<body onload="prettyPrint()">
|
||||
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
||||
<div id="jsdoc-navbar-container">
|
||||
<div id="jsdoc-navbar-content">
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>16.<wbr>5</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div id="jsdoc-body-container">
|
||||
<div id="jsdoc-content">
|
||||
<div id="jsdoc-content-container">
|
||||
<div id="jsdoc-main" role="main">
|
||||
<header class="page-header">
|
||||
<div class="symbol-detail-labels"><span class="label label-kind">class</span></div>
|
||||
<h1><small></small><span class="symbol-name">Call</span></h1>
|
||||
<p class="source-link">Source: <a href="structures_Call.js.html#source-line-9">structures/<wbr>Call.<wbr>js:9</a></p>
|
||||
<div class="symbol-classdesc">
|
||||
<p>Represents a Call on WhatsApp</p>
|
||||
</div>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
</header>
|
||||
<section id="summary">
|
||||
<div class="summary-callout">
|
||||
<h2 class="summary-callout-heading">Properties</h2>
|
||||
<div class="summary-content">
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="Call.html#canHandleLocally">canHandleLocally</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Call.html#from">from</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Call.html#fromMe">fromMe</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="Call.html#id">id</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Call.html#isGroup">isGroup</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Call.html#isVideo">isVideo</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="Call.html#participants">participants</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Call.html#timestamp">timestamp</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Call.html#webClientShouldHandle">webClientShouldHandle</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section>
|
||||
<h2 id="Call">new <span class="symbol-name">Call</span><span class="signature"><span class="signature-params">()</span></span></h2>
|
||||
<dl class="dl-compact">
|
||||
<dt>Extends</dt>
|
||||
<dd><a href="Base.html">Base</a></dd>
|
||||
</dl>
|
||||
</section>
|
||||
<section>
|
||||
<h2>Properties</h2>
|
||||
<section>
|
||||
<h3 id="canHandleLocally"><span class="symbol-name">canHandleLocally</span><small class="property-type">
|
||||
boolean</small></h3>
|
||||
<p>Indicates if the call can be handled in waweb</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="from"><span class="symbol-name">from</span><small class="property-type">
|
||||
string</small></h3>
|
||||
<p>From</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="fromMe"><span class="symbol-name">fromMe</span><small class="property-type">
|
||||
boolean</small></h3>
|
||||
<p>Indicates if the call was sent by the current user</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="id"><span class="symbol-name">id</span><small class="property-type">
|
||||
string</small></h3>
|
||||
<p>Call ID</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="isGroup"><span class="symbol-name">isGroup</span><small class="property-type">
|
||||
boolean</small></h3>
|
||||
<p>Is Group</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="isVideo"><span class="symbol-name">isVideo</span><small class="property-type">
|
||||
boolean</small></h3>
|
||||
<p>Is video</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="participants"><span class="symbol-name">participants</span><small class="property-type">
|
||||
object</small></h3>
|
||||
<p>Object with participants</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="timestamp"><span class="symbol-name">timestamp</span><small class="property-type">
|
||||
number</small></h3>
|
||||
<p>Unix timestamp for when the call was created</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="webClientShouldHandle"><span class="symbol-name">webClientShouldHandle</span><small class="property-type">
|
||||
boolean</small></h3>
|
||||
<p>Indicates if the call Should be handled in waweb</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
</section>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
<nav id="jsdoc-toc-nav" role="navigation"></nav>
|
||||
</div>
|
||||
</div>
|
||||
<footer id="jsdoc-footer" class="jsdoc-footer">
|
||||
<div id="jsdoc-footer-container">
|
||||
<p>
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 28, 2022.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
<script src="scripts/jquery.min.js"></script>
|
||||
<script src="scripts/tree.jquery.js"></script>
|
||||
<script src="scripts/prettify.js"></script>
|
||||
<script src="scripts/jsdoc-toc.js"></script>
|
||||
<script src="scripts/linenumber.js"></script>
|
||||
<script src="scripts/scrollanchor.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
175
docs/Chat.html
175
docs/Chat.html
@@ -2,9 +2,9 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta name="generator" content="JSDoc 3.6.7">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.2.0 » Class: Chat</title>
|
||||
<title>whatsapp-web.js 1.16.5 » Class: Chat</title>
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
||||
@@ -15,7 +15,7 @@
|
||||
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
||||
<div id="jsdoc-navbar-container">
|
||||
<div id="jsdoc-navbar-content">
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>2.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>16.<wbr>5</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -26,7 +26,7 @@
|
||||
<header class="page-header">
|
||||
<div class="symbol-detail-labels"><span class="label label-kind">class</span></div>
|
||||
<h1><small></small><span class="symbol-name">Chat</span></h1>
|
||||
<p class="source-link">Source: <a href="structures_Chat.js.html#source-line-11">structures/<wbr>Chat.<wbr>js:11</a></p>
|
||||
<p class="source-link">Source: <a href="structures_Chat.js.html#source-line-10">structures/<wbr>Chat.<wbr>js:10</a></p>
|
||||
<div class="symbol-classdesc">
|
||||
<p>Represents a Chat on WhatsApp</p>
|
||||
</div>
|
||||
@@ -48,6 +48,9 @@
|
||||
<dt><a href="Chat.html#isGroup">isGroup</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Chat.html#isMuted">isMuted</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
@@ -55,16 +58,22 @@
|
||||
<dt><a href="Chat.html#isReadOnly">isReadOnly</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Chat.html#muteExpiration">muteExpiration</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Chat.html#name">name</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Chat.html#timestamp">timestamp</a></dt>
|
||||
<dt><a href="Chat.html#pinned">pinned</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="Chat.html#timestamp">timestamp</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Chat.html#unreadCount">unreadCount</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
@@ -89,32 +98,53 @@
|
||||
<dt><a href="Chat.html#delete">delete()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Chat.html#fetchMessages">fetchMessages(searchOptions)</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Chat.html#getContact">getContact()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="Chat.html#fetchMessages">fetchMessages(searchOptions)</a></dt>
|
||||
<dt><a href="Chat.html#getLabels">getLabels()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Chat.html#sendMessage">sendMessage(content, options)</a></dt>
|
||||
<dt><a href="Chat.html#markUnread">markUnread()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Chat.html#mute">mute(unmuteDate)</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Chat.html#pin">pin()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Chat.html#sendMessage">sendMessage(content[, options])</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<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#sendStateRecording">sendStateRecording()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Chat.html#sendStateTyping">sendStateTyping()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Chat.html#unarchive">unarchive()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Chat.html#unmute">unmute()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Chat.html#unpin">unpin()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
@@ -145,19 +175,34 @@
|
||||
<p>Indicates if the Chat is a Group Chat</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="isMuted"><span class="symbol-name">isMuted</span><small class="property-type">
|
||||
boolean</small></h3>
|
||||
<p>Indicates if the chat is muted or not</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="isReadOnly"><span class="symbol-name">isReadOnly</span><small class="property-type">
|
||||
boolean</small></h3>
|
||||
<p>Indicates if the Chat is readonly</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="muteExpiration"><span class="symbol-name">muteExpiration</span><small class="property-type">
|
||||
number</small></h3>
|
||||
<p>Unix timestamp for when the mute expires</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="name"><span class="symbol-name">name</span><small class="property-type">
|
||||
string</small></h3>
|
||||
<p>Title of the chat</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="pinned"><span class="symbol-name">pinned</span><small class="property-type">
|
||||
boolean</small></h3>
|
||||
<p>Indicates if the Chat is pinned</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="timestamp"><span class="symbol-name">timestamp</span><small class="property-type">
|
||||
number</small></h3>
|
||||
<p>Unix timestamp for when the chat was created</p>
|
||||
<p>Unix timestamp for when the last activity occurred</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="unreadCount"><span class="symbol-name">unreadCount</span><small class="property-type">
|
||||
@@ -179,7 +224,8 @@
|
||||
<dl class="dl-compact">
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p><code>Promise containing Boolean</code> <p>result</p>
|
||||
<p><code>Promise containing Boolean</code>
|
||||
<p>result</p>
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
@@ -194,7 +240,8 @@
|
||||
<dl class="dl-compact">
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p><code>Promise containing Boolean</code> <p>result</p>
|
||||
<p><code>Promise containing Boolean</code>
|
||||
<p>result</p>
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
@@ -247,8 +294,7 @@
|
||||
<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>
|
||||
<p>The amount of messages to return. If no limit is specified, the available messages will be returned. Note that the actual number of returned messages may be smaller if there aren't enough messages in the conversation. Set this to Infinity to load all messages.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@@ -265,7 +311,76 @@
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="sendMessage"><span class="symbol-name">sendMessage</span><span class="signature"><span class="signature-params">(content, options)</span> → <span class="signature-returns"> Promise containing <a href="Message.html">Message</a></span></span></h3>
|
||||
<h3 id="getContact"><span class="symbol-name">getContact</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing <a href="Contact.html">Contact</a></span></span></h3>
|
||||
<p>Returns the Contact that corresponds to this Chat.</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p><code>Promise containing <a href="Contact.html">Contact</a></code> </p>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="getLabels"><span class="symbol-name">getLabels</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing Array of <a href="Label.html">Label</a></span></span></h3>
|
||||
<p>Returns array of all Labels assigned to this Chat</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p><code>Promise containing Array of <a href="Label.html">Label</a></code> </p>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="markUnread"><span class="symbol-name">markUnread</span><span class="signature"><span class="signature-params">()</span></span></h3>
|
||||
<p>Mark this chat as unread</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="mute"><span class="symbol-name">mute</span><span class="signature"><span class="signature-params">(unmuteDate)</span></span></h3>
|
||||
<p>Mutes this chat forever, unless a date is specified</p>
|
||||
<section>
|
||||
<h4>Parameter</h4>
|
||||
<table class="jsdoc-details-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Optional</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>unmuteDate</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Date</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Date at which the Chat will be unmuted, leave as is to mute forever</p>
|
||||
<p>Value can be null.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="pin"><span class="symbol-name">pin</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing boolean</span></span></h3>
|
||||
<p>Pins this chat</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p><code>Promise containing boolean</code>
|
||||
<p>New pin state. Could be false if the max number of pinned chats was reached.</p>
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="sendMessage"><span class="symbol-name">sendMessage</span><span class="signature"><span class="signature-params">(content[, options])</span> → <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>
|
||||
@@ -297,10 +412,10 @@
|
||||
<p>options</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>object</p>
|
||||
<p><a href="global.html#MessageSendOptions">MessageSendOptions</a></p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
<p>Yes</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
@@ -311,7 +426,8 @@
|
||||
<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><code>Promise containing <a href="Message.html">Message</a></code>
|
||||
<p>Message that was just sent</p>
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
@@ -321,7 +437,8 @@
|
||||
<dl class="dl-compact">
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p><code>Promise containing Boolean</code> <p>result</p>
|
||||
<p><code>Promise containing Boolean</code>
|
||||
<p>result</p>
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
@@ -340,6 +457,22 @@
|
||||
<p>un-archives this chat</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="unmute"><span class="symbol-name">unmute</span><span class="signature"><span class="signature-params">()</span></span></h3>
|
||||
<p>Unmutes this chat</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="unpin"><span class="symbol-name">unpin</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing boolean</span></span></h3>
|
||||
<p>Unpins this chat</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p><code>Promise containing boolean</code>
|
||||
<p>New pin state</p>
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</section>
|
||||
</section>
|
||||
</div>
|
||||
@@ -350,7 +483,7 @@
|
||||
<footer id="jsdoc-footer" class="jsdoc-footer">
|
||||
<div id="jsdoc-footer-container">
|
||||
<p>
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on March 1, 2020.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 28, 2022.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
1409
docs/Client.html
1409
docs/Client.html
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -2,9 +2,9 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta name="generator" content="JSDoc 3.6.7">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.2.0 » Class: ClientInfo</title>
|
||||
<title>whatsapp-web.js 1.16.5 » Class: ClientInfo</title>
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
||||
@@ -15,7 +15,7 @@
|
||||
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
||||
<div id="jsdoc-navbar-container">
|
||||
<div id="jsdoc-navbar-content">
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>2.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>16.<wbr>5</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -26,7 +26,7 @@
|
||||
<header class="page-header">
|
||||
<div class="symbol-detail-labels"><span class="label label-kind">class</span></div>
|
||||
<h1><small></small><span class="symbol-name">ClientInfo</span></h1>
|
||||
<p class="source-link">Source: <a href="structures_ClientInfo.js.html#source-line-10">structures/<wbr>ClientInfo.<wbr>js:10</a></p>
|
||||
<p class="source-link">Source: <a href="structures_ClientInfo.js.html#source-line-9">structures/<wbr>ClientInfo.<wbr>js:9</a></p>
|
||||
<div class="symbol-classdesc">
|
||||
<p>Current connection information</p>
|
||||
</div>
|
||||
@@ -57,6 +57,27 @@
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="ClientInfo.html#wid">wid</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="summary-callout">
|
||||
<h2 class="summary-callout-heading">Method</h2>
|
||||
<div class="summary-content">
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="ClientInfo.html#getBatteryStatus">getBatteryStatus()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
</div>
|
||||
</div>
|
||||
@@ -74,12 +95,13 @@
|
||||
<section>
|
||||
<h3 id="me"><span class="symbol-name">me</span><small class="property-type">
|
||||
object</small></h3>
|
||||
<p>Current user ID</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Deprecated</dt>
|
||||
<dd>Use .wid instead</dd>
|
||||
</dl>
|
||||
<h3 id="phone"><span class="symbol-name">phone</span><small class="property-type">
|
||||
object</small></h3>
|
||||
<p>Information about the phone this client is connected to</p>
|
||||
<p>Information about the phone this client is connected to. Not available in multi-device.</p>
|
||||
<section>
|
||||
<h4>Properties</h4>
|
||||
<table class="jsdoc-details-table">
|
||||
@@ -166,10 +188,12 @@
|
||||
</table>
|
||||
</section>
|
||||
<dl class="dl-compact">
|
||||
<dt>Deprecated</dt>
|
||||
<dd></dd>
|
||||
</dl>
|
||||
<h3 id="platform"><span class="symbol-name">platform</span><small class="property-type">
|
||||
string</small></h3>
|
||||
<p>Platform the phone is running on</p>
|
||||
<p>Platform WhatsApp is running on</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="pushname"><span class="symbol-name">pushname</span><small class="property-type">
|
||||
@@ -177,6 +201,37 @@
|
||||
<p>Name configured to be shown in push notifications</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="wid"><span class="symbol-name">wid</span><small class="property-type">
|
||||
object</small></h3>
|
||||
<p>Current user ID</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
</section>
|
||||
<h2>Method</h2>
|
||||
<section>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="getBatteryStatus"><span class="symbol-name">getBatteryStatus</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> (object, number, or boolean)</span></span></h3>
|
||||
<p>Get current battery percentage and charging status for the attached device</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Deprecated</dt>
|
||||
<dd></dd>
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p><code>object</code>
|
||||
<p>batteryStatus</p>
|
||||
</p>
|
||||
</dd>
|
||||
<dd>
|
||||
<p><code>number</code>
|
||||
<p>batteryStatus.battery - The current battery percentage</p>
|
||||
</p>
|
||||
</dd>
|
||||
<dd>
|
||||
<p><code>boolean</code>
|
||||
<p>batteryStatus.plugged - Indicates if the phone is plugged in (true) or not (false)</p>
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</section>
|
||||
</section>
|
||||
</div>
|
||||
@@ -187,7 +242,7 @@
|
||||
<footer id="jsdoc-footer" class="jsdoc-footer">
|
||||
<div id="jsdoc-footer-container">
|
||||
<p>
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on March 1, 2020.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 28, 2022.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta name="generator" content="JSDoc 3.6.7">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.2.0 » Class: Contact</title>
|
||||
<title>whatsapp-web.js 1.16.5 » Class: Contact</title>
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
||||
@@ -15,7 +15,7 @@
|
||||
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
||||
<div id="jsdoc-navbar-container">
|
||||
<div id="jsdoc-navbar-content">
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>2.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>16.<wbr>5</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -26,7 +26,7 @@
|
||||
<header class="page-header">
|
||||
<div class="symbol-detail-labels"><span class="label label-kind">class</span></div>
|
||||
<h1><small></small><span class="symbol-name">Contact</span></h1>
|
||||
<p class="source-link">Source: <a href="structures_Contact.js.html#source-line-10">structures/<wbr>Contact.<wbr>js:10</a></p>
|
||||
<p class="source-link">Source: <a href="structures_Contact.js.html#source-line-17">structures/<wbr>Contact.<wbr>js:17</a></p>
|
||||
<div class="symbol-classdesc">
|
||||
<p>Represents a Contact on WhatsApp</p>
|
||||
</div>
|
||||
@@ -42,6 +42,9 @@
|
||||
<dt><a href="Contact.html#id">id</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Contact.html#isBlocked">isBlocked</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Contact.html#isBusiness">isBusiness</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
@@ -67,13 +70,13 @@
|
||||
<dt><a href="Contact.html#isWAContact">isWAContact</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Contact.html#name">name</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>
|
||||
@@ -88,18 +91,43 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="summary-callout">
|
||||
<h2 class="summary-callout-heading">Method</h2>
|
||||
<h2 class="summary-callout-heading">Methods</h2>
|
||||
<div class="summary-content">
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="Contact.html#getProfilePicUrl">getProfilePicUrl()</a></dt>
|
||||
<dt><a href="Contact.html#block">block()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Contact.html#getAbout">getAbout()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Contact.html#getChat">getChat()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="Contact.html#getCommonGroups">getCommonGroups()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Contact.html#getCountryCode">getCountryCode()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Contact.html#getFormattedNumber">getFormattedNumber()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="Contact.html#getProfilePicUrl">getProfilePicUrl()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Contact.html#unblock">unblock()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -115,10 +143,15 @@
|
||||
<h2>Properties</h2>
|
||||
<section>
|
||||
<h3 id="id"><span class="symbol-name">id</span><small class="property-type">
|
||||
object</small></h3>
|
||||
<a href="global.html#ContactId">ContactId</a></small></h3>
|
||||
<p>ID that represents the contact</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="isBlocked"><span class="symbol-name">isBlocked</span><small class="property-type">
|
||||
boolean</small></h3>
|
||||
<p>Indicates if you have blocked this contact</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="isBusiness"><span class="symbol-name">isBusiness</span><small class="property-type">
|
||||
boolean</small></h3>
|
||||
<p>Indicates if the contact is a business contact</p>
|
||||
@@ -175,8 +208,63 @@
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
</section>
|
||||
<h2>Method</h2>
|
||||
<h2>Methods</h2>
|
||||
<section>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="block"><span class="symbol-name">block</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing boolean</span></span></h3>
|
||||
<p>Blocks this contact from WhatsApp</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p><code>Promise containing boolean</code> </p>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="getAbout"><span class="symbol-name">getAbout</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing nullable string</span></span></h3>
|
||||
<p>Gets the Contact's current "about" info. Returns null if you don't have permission to read their status.</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p><code>Promise containing nullable string</code> </p>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="getChat"><span class="symbol-name">getChat</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing <a href="Chat.html">Chat</a></span></span></h3>
|
||||
<p>Returns the Chat that corresponds to this Contact.
|
||||
Will return null when getting chat for currently logged in user.</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p><code>Promise containing <a href="Chat.html">Chat</a></code> </p>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="getCommonGroups"><span class="symbol-name">getCommonGroups</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing Array of WAWebJS.ChatId</span></span></h3>
|
||||
<p>Gets the Contact's common groups with you. Returns empty array if you don't have any common group.</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p><code>Promise containing Array of WAWebJS.ChatId</code> </p>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="getCountryCode"><span class="symbol-name">getCountryCode</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing string</span></span></h3>
|
||||
<p>Returns the contact's countrycode, (1541859685@c.us) => (1)</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p><code>Promise containing string</code> </p>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="getFormattedNumber"><span class="symbol-name">getFormattedNumber</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing string</span></span></h3>
|
||||
<p>Returns the contact's formatted phone number, (12345678901@c.us) => (+1 (234) 5678-901)</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p><code>Promise containing string</code> </p>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="getProfilePicUrl"><span class="symbol-name">getProfilePicUrl</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing string</span></span></h3>
|
||||
<p>Returns the contact's profile picture URL, if privacy settings allow it</p>
|
||||
@@ -186,6 +274,15 @@
|
||||
<p><code>Promise containing string</code> </p>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="unblock"><span class="symbol-name">unblock</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing boolean</span></span></h3>
|
||||
<p>Unblocks this contact from WhatsApp</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p><code>Promise containing boolean</code> </p>
|
||||
</dd>
|
||||
</dl>
|
||||
</section>
|
||||
</section>
|
||||
</div>
|
||||
@@ -196,7 +293,7 @@
|
||||
<footer id="jsdoc-footer" class="jsdoc-footer">
|
||||
<div id="jsdoc-footer-container">
|
||||
<p>
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on March 1, 2020.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 28, 2022.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta name="generator" content="JSDoc 3.6.7">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.2.0 » Class: GroupChat</title>
|
||||
<title>whatsapp-web.js 1.16.5 » Class: GroupChat</title>
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
||||
@@ -15,7 +15,7 @@
|
||||
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
||||
<div id="jsdoc-navbar-container">
|
||||
<div id="jsdoc-navbar-content">
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>2.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>16.<wbr>5</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -26,7 +26,7 @@
|
||||
<header class="page-header">
|
||||
<div class="symbol-detail-labels"><span class="label label-kind">class</span></div>
|
||||
<h1><small></small><span class="symbol-name">GroupChat</span></h1>
|
||||
<p class="source-link">Source: <a href="structures_GroupChat.js.html#source-line-9">structures/<wbr>GroupChat.<wbr>js:9</a></p>
|
||||
<p class="source-link">Source: <a href="structures_GroupChat.js.html#source-line-17">structures/<wbr>GroupChat.<wbr>js:17</a></p>
|
||||
<div class="symbol-classdesc">
|
||||
<p>Represents a Group Chat on WhatsApp</p>
|
||||
</div>
|
||||
@@ -51,16 +51,22 @@
|
||||
<dt><a href="GroupChat.html#id">id</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="GroupChat.html#isGroup">isGroup</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="GroupChat.html#isGroup">isGroup</a></dt>
|
||||
<dt><a href="GroupChat.html#isMuted">isMuted</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="GroupChat.html#isReadOnly">isReadOnly</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="GroupChat.html#muteExpiration">muteExpiration</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="GroupChat.html#name">name</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
@@ -74,6 +80,9 @@
|
||||
<dt><a href="GroupChat.html#participants">participants</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="GroupChat.html#pinned">pinned</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="GroupChat.html#timestamp">timestamp</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
@@ -89,12 +98,6 @@
|
||||
<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>
|
||||
@@ -110,22 +113,37 @@
|
||||
<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#getContact">getContact()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="GroupChat.html#getInviteCode">getInviteCode()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="GroupChat.html#getLabels">getLabels()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="GroupChat.html#leave">leave()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="GroupChat.html#markUnread">markUnread()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="GroupChat.html#mute">mute(unmuteDate)</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="GroupChat.html#pin">pin()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="GroupChat.html#promoteParticipants">promoteParticipants(participantIds)</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
@@ -135,11 +153,7 @@
|
||||
<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>
|
||||
<dt><a href="GroupChat.html#sendMessage">sendMessage(content[, options])</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="GroupChat.html#sendSeen">sendSeen()</a></dt>
|
||||
@@ -148,18 +162,34 @@
|
||||
<dt><a href="GroupChat.html#sendStateRecording">sendStateRecording()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<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#setInfoAdminsOnly">setInfoAdminsOnly([adminsOnly])</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="GroupChat.html#setMessagesAdminsOnly">setMessagesAdminsOnly([adminsOnly])</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="GroupChat.html#setSubject">setSubject(subject)</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="GroupChat.html#unarchive">unarchive()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="GroupChat.html#unmute">unmute()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="GroupChat.html#unpin">unpin()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
@@ -206,6 +236,13 @@
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Chat.html#isGroup">Chat#isGroup</a></dd>
|
||||
</dl>
|
||||
<h3 id="isMuted"><span class="symbol-name">isMuted</span><small class="property-type">
|
||||
unknown</small></h3>
|
||||
<p>Indicates if the chat is muted or not</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Chat.html#isMuted">Chat#isMuted</a></dd>
|
||||
</dl>
|
||||
<h3 id="isReadOnly"><span class="symbol-name">isReadOnly</span><small class="property-type">
|
||||
unknown</small></h3>
|
||||
<p>Indicates if the Chat is readonly</p>
|
||||
@@ -213,6 +250,13 @@
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Chat.html#isReadOnly">Chat#isReadOnly</a></dd>
|
||||
</dl>
|
||||
<h3 id="muteExpiration"><span class="symbol-name">muteExpiration</span><small class="property-type">
|
||||
unknown</small></h3>
|
||||
<p>Unix timestamp for when the mute expires</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Chat.html#muteExpiration">Chat#muteExpiration</a></dd>
|
||||
</dl>
|
||||
<h3 id="name"><span class="symbol-name">name</span><small class="property-type">
|
||||
unknown</small></h3>
|
||||
<p>Title of the chat</p>
|
||||
@@ -220,18 +264,26 @@
|
||||
<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>
|
||||
<h3 id="owner"><span class="symbol-name">owner</span><small class="property-type">
|
||||
<a href="global.html#ContactId">ContactId</a></small></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">
|
||||
array</small></h3>
|
||||
Array of <a href="global.html#GroupParticipant">GroupParticipant</a></small></h3>
|
||||
<p>Gets the group participants</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="pinned"><span class="symbol-name">pinned</span><small class="property-type">
|
||||
unknown</small></h3>
|
||||
<p>Indicates if the Chat is pinned</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Chat.html#pinned">Chat#pinned</a></dd>
|
||||
</dl>
|
||||
<h3 id="timestamp"><span class="symbol-name">timestamp</span><small class="property-type">
|
||||
unknown</small></h3>
|
||||
<p>Unix timestamp for when the chat was created</p>
|
||||
<p>Unix timestamp for when the last activity occurred</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Chat.html#timestamp">Chat#timestamp</a></dd>
|
||||
@@ -246,79 +298,8 @@
|
||||
</section>
|
||||
<h2>Methods</h2>
|
||||
<section>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span> <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> → <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> </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> <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> </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>
|
||||
<h3 id="addParticipants"><span class="symbol-name">addParticipants</span><span class="signature"><span class="signature-params">(participantIds)</span> → <span class="signature-returns"> Promise containing Object</span></span></h3>
|
||||
<p>Adds a list of participants by ID to the group</p>
|
||||
<section>
|
||||
<h4>Parameter</h4>
|
||||
@@ -349,6 +330,10 @@
|
||||
</table>
|
||||
</section>
|
||||
<dl class="dl-compact">
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p><code>Promise containing Object</code> </p>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="archive"><span class="symbol-name">archive</span><span class="signature"><span class="signature-params">()</span></span></h3>
|
||||
@@ -387,7 +372,7 @@
|
||||
</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>
|
||||
<h3 id="demoteParticipants"><span class="symbol-name">demoteParticipants</span><span class="signature"><span class="signature-params">(participantIds)</span> → <span class="signature-returns"> Promise containing {status: number}</span></span></h3>
|
||||
<p>Demotes participants by IDs to regular users</p>
|
||||
<section>
|
||||
<h4>Parameter</h4>
|
||||
@@ -418,6 +403,12 @@
|
||||
</table>
|
||||
</section>
|
||||
<dl class="dl-compact">
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p><code>Promise containing {status: number}</code>
|
||||
<p>Object with status code indicating if the operation was successful</p>
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="fetchMessages"><span class="symbol-name">fetchMessages</span><span class="signature"><span class="signature-params">(searchOptions)</span> → <span class="signature-returns"> Promise containing Array of <a href="Message.html">Message</a></span></span></h3>
|
||||
@@ -468,8 +459,7 @@
|
||||
<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>
|
||||
<p>The amount of messages to return. If no limit is specified, the available messages will be returned. Note that the actual number of returned messages may be smaller if there aren't enough messages in the conversation. Set this to Infinity to load all messages.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@@ -486,17 +476,100 @@
|
||||
<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>
|
||||
<h3 id="getContact"><span class="symbol-name">getContact</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing <a href="Contact.html">Contact</a></span></span></h3>
|
||||
<p>Returns the Contact that corresponds to this Chat.</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Chat.html#getContact">Chat#getContact</a></dd>
|
||||
<dt>Returns</dt>
|
||||
<dd></dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="getInviteCode"><span class="symbol-name">getInviteCode</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing string</span></span></h3>
|
||||
<p>Gets the invite code for a specific group</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p><code>Promise containing string</code>
|
||||
<p>Group's invite code</p>
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="leave"><span class="symbol-name">leave</span><span class="signature"><span class="signature-params">()</span></span></h3>
|
||||
<h3 id="getLabels"><span class="symbol-name">getLabels</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing Array of <a href="Label.html">Label</a></span></span></h3>
|
||||
<p>Returns array of all Labels assigned to this Chat</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Chat.html#getLabels">Chat#getLabels</a></dd>
|
||||
<dt>Returns</dt>
|
||||
<dd></dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="leave"><span class="symbol-name">leave</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise</span></span></h3>
|
||||
<p>Makes the bot leave the group</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p><code>Promise</code> </p>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="promoteParticipants"><span class="symbol-name">promoteParticipants</span><span class="signature"><span class="signature-params">(participantIds)</span></span></h3>
|
||||
<h3 id="markUnread"><span class="symbol-name">markUnread</span><span class="signature"><span class="signature-params">()</span></span></h3>
|
||||
<p>Mark this chat as unread</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Chat.html#markUnread">Chat#markUnread</a></dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="mute"><span class="symbol-name">mute</span><span class="signature"><span class="signature-params">(unmuteDate)</span></span></h3>
|
||||
<p>Mutes this chat forever, unless a date is specified</p>
|
||||
<section>
|
||||
<h4>Parameter</h4>
|
||||
<table class="jsdoc-details-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Optional</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>unmuteDate</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Date at which the Chat will be unmuted, leave as is to mute forever</p>
|
||||
<p>Value can be null.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Chat.html#mute">Chat#mute</a></dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="pin"><span class="symbol-name">pin</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing boolean</span></span></h3>
|
||||
<p>Pins this chat</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Chat.html#pin">Chat#pin</a></dd>
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p>New pin state. Could be false if the max number of pinned chats was reached.</p>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="promoteParticipants"><span class="symbol-name">promoteParticipants</span><span class="signature"><span class="signature-params">(participantIds)</span> → <span class="signature-returns"> Promise containing {status: number}</span></span></h3>
|
||||
<p>Promotes participants by IDs to admins</p>
|
||||
<section>
|
||||
<h4>Parameter</h4>
|
||||
@@ -527,9 +600,15 @@
|
||||
</table>
|
||||
</section>
|
||||
<dl class="dl-compact">
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p><code>Promise containing {status: number}</code>
|
||||
<p>Object with status code indicating if the operation was successful</p>
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="removeParticipants"><span class="symbol-name">removeParticipants</span><span class="signature"><span class="signature-params">(participantIds)</span></span></h3>
|
||||
<h3 id="removeParticipants"><span class="symbol-name">removeParticipants</span><span class="signature"><span class="signature-params">(participantIds)</span> → <span class="signature-returns"> Promise containing Object</span></span></h3>
|
||||
<p>Removes a list of participants by ID to the group</p>
|
||||
<section>
|
||||
<h4>Parameter</h4>
|
||||
@@ -560,14 +639,24 @@
|
||||
</table>
|
||||
</section>
|
||||
<dl class="dl-compact">
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p><code>Promise containing Object</code> </p>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="revokeInvite"><span class="symbol-name">revokeInvite</span><span class="signature"><span class="signature-params">()</span></span></h3>
|
||||
<h3 id="revokeInvite"><span class="symbol-name">revokeInvite</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing string</span></span></h3>
|
||||
<p>Invalidates the current group invite code and generates a new one</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p><code>Promise containing string</code>
|
||||
<p>New invite code</p>
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="sendMessage"><span class="symbol-name">sendMessage</span><span class="signature"><span class="signature-params">(content, options)</span> → <span class="signature-returns"> Promise containing <a href="Message.html">Message</a></span></span></h3>
|
||||
<h3 id="sendMessage"><span class="symbol-name">sendMessage</span><span class="signature"><span class="signature-params">(content[, options])</span> → <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>
|
||||
@@ -602,7 +691,7 @@
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
<p>Yes</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
@@ -644,7 +733,7 @@
|
||||
<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>
|
||||
<h3 id="setDescription"><span class="symbol-name">setDescription</span><span class="signature"><span class="signature-params">(description)</span> → <span class="signature-returns"> Promise containing boolean</span></span></h3>
|
||||
<p>Updates the group description</p>
|
||||
<section>
|
||||
<h4>Parameter</h4>
|
||||
@@ -675,9 +764,97 @@
|
||||
</table>
|
||||
</section>
|
||||
<dl class="dl-compact">
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p><code>Promise containing boolean</code>
|
||||
<p>Returns true if the description was properly updated. This can return false if the user does not have the necessary permissions.</p>
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="setSubject"><span class="symbol-name">setSubject</span><span class="signature"><span class="signature-params">(subject)</span></span></h3>
|
||||
<h3 id="setInfoAdminsOnly"><span class="symbol-name">setInfoAdminsOnly</span><span class="signature"><span class="signature-params">([adminsOnly])</span> → <span class="signature-returns"> Promise containing boolean</span></span></h3>
|
||||
<p>Updates the group settings to only allow admins to edit group info (title, description, photo).</p>
|
||||
<section>
|
||||
<h4>Parameter</h4>
|
||||
<table class="jsdoc-details-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Optional</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>adminsOnly</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>boolean</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Yes</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Enable or disable this option</p>
|
||||
<p>Defaults to <code>true</code>.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<dl class="dl-compact">
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p><code>Promise containing boolean</code>
|
||||
<p>Returns true if the setting was properly updated. This can return false if the user does not have the necessary permissions.</p>
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="setMessagesAdminsOnly"><span class="symbol-name">setMessagesAdminsOnly</span><span class="signature"><span class="signature-params">([adminsOnly])</span> → <span class="signature-returns"> Promise containing boolean</span></span></h3>
|
||||
<p>Updates the group settings to only allow admins to send messages.</p>
|
||||
<section>
|
||||
<h4>Parameter</h4>
|
||||
<table class="jsdoc-details-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Optional</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>adminsOnly</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>boolean</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Yes</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Enable or disable this option</p>
|
||||
<p>Defaults to <code>true</code>.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<dl class="dl-compact">
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p><code>Promise containing boolean</code>
|
||||
<p>Returns true if the setting was properly updated. This can return false if the user does not have the necessary permissions.</p>
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="setSubject"><span class="symbol-name">setSubject</span><span class="signature"><span class="signature-params">(subject)</span> → <span class="signature-returns"> Promise containing boolean</span></span></h3>
|
||||
<p>Updates the group subject</p>
|
||||
<section>
|
||||
<h4>Parameter</h4>
|
||||
@@ -708,6 +885,12 @@
|
||||
</table>
|
||||
</section>
|
||||
<dl class="dl-compact">
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p><code>Promise containing boolean</code>
|
||||
<p>Returns true if the subject was properly updated. This can return false if the user does not have the necessary permissions.</p>
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
<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>
|
||||
@@ -716,6 +899,24 @@
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Chat.html#unarchive">Chat#unarchive</a></dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="unmute"><span class="symbol-name">unmute</span><span class="signature"><span class="signature-params">()</span></span></h3>
|
||||
<p>Unmutes this chat</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Chat.html#unmute">Chat#unmute</a></dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="unpin"><span class="symbol-name">unpin</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing boolean</span></span></h3>
|
||||
<p>Unpins this chat</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Chat.html#unpin">Chat#unpin</a></dd>
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p>New pin state</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</section>
|
||||
</section>
|
||||
</div>
|
||||
@@ -726,7 +927,7 @@
|
||||
<footer id="jsdoc-footer" class="jsdoc-footer">
|
||||
<div id="jsdoc-footer-container">
|
||||
<p>
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on March 1, 2020.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 28, 2022.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta name="generator" content="JSDoc 3.6.7">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.2.0 » Class: GroupNotification</title>
|
||||
<title>whatsapp-web.js 1.16.5 » Class: GroupNotification</title>
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
||||
@@ -15,7 +15,7 @@
|
||||
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
||||
<div id="jsdoc-navbar-container">
|
||||
<div id="jsdoc-navbar-content">
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>2.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>16.<wbr>5</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -26,7 +26,7 @@
|
||||
<header class="page-header">
|
||||
<div class="symbol-detail-labels"><span class="label label-kind">class</span></div>
|
||||
<h1><small></small><span class="symbol-name">GroupNotification</span></h1>
|
||||
<p class="source-link">Source: <a href="structures_GroupNotification.js.html#source-line-10">structures/<wbr>GroupNotification.<wbr>js:10</a></p>
|
||||
<p class="source-link">Source: <a href="structures_GroupNotification.js.html#source-line-9">structures/<wbr>GroupNotification.<wbr>js:9</a></p>
|
||||
<div class="symbol-classdesc">
|
||||
<p>Represents a GroupNotification on WhatsApp</p>
|
||||
</div>
|
||||
@@ -233,7 +233,7 @@
|
||||
<footer id="jsdoc-footer" class="jsdoc-footer">
|
||||
<div id="jsdoc-footer-container">
|
||||
<p>
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on March 1, 2020.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 28, 2022.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
397
docs/InterfaceController.html
Normal file
397
docs/InterfaceController.html
Normal file
@@ -0,0 +1,397 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.7">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.16.5 » Class: InterfaceController</title>
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
||||
<link href="css/baseline.css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<body onload="prettyPrint()">
|
||||
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
||||
<div id="jsdoc-navbar-container">
|
||||
<div id="jsdoc-navbar-content">
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>16.<wbr>5</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div id="jsdoc-body-container">
|
||||
<div id="jsdoc-content">
|
||||
<div id="jsdoc-content-container">
|
||||
<div id="jsdoc-main" role="main">
|
||||
<header class="page-header">
|
||||
<div class="symbol-detail-labels"><span class="label label-kind">class</span></div>
|
||||
<h1><small></small><span class="symbol-name">InterfaceController</span></h1>
|
||||
<p class="source-link">Source: <a href="util_InterfaceController.js.html#source-line-6">util/<wbr>InterfaceController.<wbr>js:6</a></p>
|
||||
<div class="symbol-classdesc">
|
||||
<p>Interface Controller</p>
|
||||
</div>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
</header>
|
||||
<section id="summary">
|
||||
<div class="summary-callout">
|
||||
<h2 class="summary-callout-heading">Methods</h2>
|
||||
<div class="summary-content">
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="InterfaceController.html#checkFeatureStatus">checkFeatureStatus(feature)</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="InterfaceController.html#closeRightDrawer">closeRightDrawer()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="InterfaceController.html#disableFeatures">disableFeatures(features)</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="InterfaceController.html#enableFeatures">enableFeatures(features)</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="InterfaceController.html#getFeatures">getFeatures()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="InterfaceController.html#openChatDrawer">openChatDrawer(chatId)</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="InterfaceController.html#openChatSearch">openChatSearch(chatId)</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="InterfaceController.html#openChatWindow">openChatWindow(chatId)</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="InterfaceController.html#openChatWindowAt">openChatWindowAt(msgId)</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="InterfaceController.html#openMessageDrawer">openMessageDrawer(msgId)</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section>
|
||||
<h2 id="InterfaceController">new <span class="symbol-name">InterfaceController</span><span class="signature"><span class="signature-params">()</span></span></h2>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
</section>
|
||||
<section>
|
||||
<h2>Methods</h2>
|
||||
<section>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="checkFeatureStatus"><span class="symbol-name">checkFeatureStatus</span><span class="signature"><span class="signature-params">(feature)</span></span></h3>
|
||||
<p>Check if Feature is enabled</p>
|
||||
<section>
|
||||
<h4>Parameter</h4>
|
||||
<table class="jsdoc-details-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Optional</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>feature</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>string</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p>status to check</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="closeRightDrawer"><span class="symbol-name">closeRightDrawer</span><span class="signature"><span class="signature-params">()</span></span></h3>
|
||||
<p>Closes the Right Drawer</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="disableFeatures"><span class="symbol-name">disableFeatures</span><span class="signature"><span class="signature-params">(features)</span></span></h3>
|
||||
<p>Disable Features</p>
|
||||
<section>
|
||||
<h4>Parameter</h4>
|
||||
<table class="jsdoc-details-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Optional</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>features</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Array of string</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p>to be disabled</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="enableFeatures"><span class="symbol-name">enableFeatures</span><span class="signature"><span class="signature-params">(features)</span></span></h3>
|
||||
<p>Enable Features</p>
|
||||
<section>
|
||||
<h4>Parameter</h4>
|
||||
<table class="jsdoc-details-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Optional</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>features</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Array of string</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p>to be enabled</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="getFeatures"><span class="symbol-name">getFeatures</span><span class="signature"><span class="signature-params">()</span></span></h3>
|
||||
<p>Get all Features</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="openChatDrawer"><span class="symbol-name">openChatDrawer</span><span class="signature"><span class="signature-params">(chatId)</span></span></h3>
|
||||
<p>Opens the Chat Drawer</p>
|
||||
<section>
|
||||
<h4>Parameter</h4>
|
||||
<table class="jsdoc-details-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Optional</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>chatId</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>string</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p>ID of the chat drawer that will be opened</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="openChatSearch"><span class="symbol-name">openChatSearch</span><span class="signature"><span class="signature-params">(chatId)</span></span></h3>
|
||||
<p>Opens the Chat Search</p>
|
||||
<section>
|
||||
<h4>Parameter</h4>
|
||||
<table class="jsdoc-details-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Optional</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>chatId</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>string</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p>ID of the chat search that will be opened</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="openChatWindow"><span class="symbol-name">openChatWindow</span><span class="signature"><span class="signature-params">(chatId)</span></span></h3>
|
||||
<p>Opens the Chat Window</p>
|
||||
<section>
|
||||
<h4>Parameter</h4>
|
||||
<table class="jsdoc-details-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Optional</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>chatId</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>string</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p>ID of the chat window that will be opened</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="openChatWindowAt"><span class="symbol-name">openChatWindowAt</span><span class="signature"><span class="signature-params">(msgId)</span></span></h3>
|
||||
<p>Opens or Scrolls the Chat Window to the position of the message</p>
|
||||
<section>
|
||||
<h4>Parameter</h4>
|
||||
<table class="jsdoc-details-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Optional</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>msgId</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>string</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p>ID of the message that will be scrolled to</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="openMessageDrawer"><span class="symbol-name">openMessageDrawer</span><span class="signature"><span class="signature-params">(msgId)</span></span></h3>
|
||||
<p>Opens the Message Drawer</p>
|
||||
<section>
|
||||
<h4>Parameter</h4>
|
||||
<table class="jsdoc-details-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Optional</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>msgId</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>string</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p>ID of the message drawer that will be opened</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
</section>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
<nav id="jsdoc-toc-nav" role="navigation"></nav>
|
||||
</div>
|
||||
</div>
|
||||
<footer id="jsdoc-footer" class="jsdoc-footer">
|
||||
<div id="jsdoc-footer-container">
|
||||
<p>
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 28, 2022.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
<script src="scripts/jquery.min.js"></script>
|
||||
<script src="scripts/tree.jquery.js"></script>
|
||||
<script src="scripts/prettify.js"></script>
|
||||
<script src="scripts/jsdoc-toc.js"></script>
|
||||
<script src="scripts/linenumber.js"></script>
|
||||
<script src="scripts/scrollanchor.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
178
docs/Label.html
Normal file
178
docs/Label.html
Normal file
@@ -0,0 +1,178 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.7">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.16.5 » Class: Label</title>
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
||||
<link href="css/baseline.css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<body onload="prettyPrint()">
|
||||
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
||||
<div id="jsdoc-navbar-container">
|
||||
<div id="jsdoc-navbar-content">
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>16.<wbr>5</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div id="jsdoc-body-container">
|
||||
<div id="jsdoc-content">
|
||||
<div id="jsdoc-content-container">
|
||||
<div id="jsdoc-main" role="main">
|
||||
<header class="page-header">
|
||||
<div class="symbol-detail-labels"><span class="label label-kind">class</span></div>
|
||||
<h1><small></small><span class="symbol-name">Label</span></h1>
|
||||
<p class="source-link">Source: <a href="structures_Label.js.html#source-line-10">structures/<wbr>Label.<wbr>js:10</a></p>
|
||||
<div class="symbol-classdesc">
|
||||
<p>WhatsApp Business Label information</p>
|
||||
</div>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
</header>
|
||||
<section id="summary">
|
||||
<div class="summary-callout">
|
||||
<h2 class="summary-callout-heading">Properties</h2>
|
||||
<div class="summary-content">
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="Label.html#hexColor">hexColor</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="Label.html#id">id</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="Label.html#name">name</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="summary-callout">
|
||||
<h2 class="summary-callout-heading">Method</h2>
|
||||
<div class="summary-content">
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="Label.html#getChats">getChats()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section>
|
||||
<h2 id="Label">new <span class="symbol-name">Label</span><span class="signature"><span class="signature-params">(client, labelData)</span></span></h2>
|
||||
<section>
|
||||
<h3>Parameters</h3>
|
||||
<table class="jsdoc-details-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Optional</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>client</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>labelData</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
</section>
|
||||
<section>
|
||||
<h2>Properties</h2>
|
||||
<section>
|
||||
<h3 id="hexColor"><span class="symbol-name">hexColor</span><small class="property-type">
|
||||
string</small></h3>
|
||||
<p>Label hex color</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="id"><span class="symbol-name">id</span><small class="property-type">
|
||||
string</small></h3>
|
||||
<p>Label ID</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="name"><span class="symbol-name">name</span><small class="property-type">
|
||||
string</small></h3>
|
||||
<p>Label name</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
</section>
|
||||
<h2>Method</h2>
|
||||
<section>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="getChats"><span class="symbol-name">getChats</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing Array of <a href="Chat.html">Chat</a></span></span></h3>
|
||||
<p>Get all chats that have been assigned this Label</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p><code>Promise containing Array of <a href="Chat.html">Chat</a></code> </p>
|
||||
</dd>
|
||||
</dl>
|
||||
</section>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
<nav id="jsdoc-toc-nav" role="navigation"></nav>
|
||||
</div>
|
||||
</div>
|
||||
<footer id="jsdoc-footer" class="jsdoc-footer">
|
||||
<div id="jsdoc-footer-container">
|
||||
<p>
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 28, 2022.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
<script src="scripts/jquery.min.js"></script>
|
||||
<script src="scripts/tree.jquery.js"></script>
|
||||
<script src="scripts/prettify.js"></script>
|
||||
<script src="scripts/jsdoc-toc.js"></script>
|
||||
<script src="scripts/linenumber.js"></script>
|
||||
<script src="scripts/scrollanchor.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
188
docs/LegacySessionAuth.html
Normal file
188
docs/LegacySessionAuth.html
Normal file
@@ -0,0 +1,188 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.7">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.16.5 » Class: LegacySessionAuth</title>
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
||||
<link href="css/baseline.css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<body onload="prettyPrint()">
|
||||
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
||||
<div id="jsdoc-navbar-container">
|
||||
<div id="jsdoc-navbar-content">
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>16.<wbr>5</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div id="jsdoc-body-container">
|
||||
<div id="jsdoc-content">
|
||||
<div id="jsdoc-content-container">
|
||||
<div id="jsdoc-main" role="main">
|
||||
<header class="page-header">
|
||||
<div class="symbol-detail-labels"><span class="label label-kind">class</span></div>
|
||||
<h1><small></small><span class="symbol-name">LegacySessionAuth</span></h1>
|
||||
<p class="source-link">Source: <a href="authStrategies_LegacySessionAuth.js.html#source-line-16">authStrategies/<wbr>LegacySessionAuth.<wbr>js:16</a></p>
|
||||
<div class="symbol-classdesc">
|
||||
<p>Legacy session auth strategy
|
||||
Not compatible with multi-device accounts.</p>
|
||||
</div>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
</header>
|
||||
<section id="summary">
|
||||
</section>
|
||||
<section>
|
||||
<h2 id="LegacySessionAuth">new <span class="symbol-name">LegacySessionAuth</span><span class="signature"><span class="signature-params">(options)</span></span></h2>
|
||||
<section>
|
||||
<h3>Parameters</h3>
|
||||
<table class="jsdoc-details-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Optional</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>options</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p>options</p>
|
||||
<p>Values in <code>options</code> have the following properties:</p>
|
||||
<table class="jsdoc-details-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Optional</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>restartOnAuthFail</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Restart client with a new session (i.e. use null 'session' var) if authentication fails</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>session</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Whatsapp session to restore. If not set, will start a new session</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>session.WABrowserId</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>session.WASecretBundle</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>session.WAToken1</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>session.WAToken2</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
</section>
|
||||
<section>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
<nav id="jsdoc-toc-nav" role="navigation"></nav>
|
||||
</div>
|
||||
</div>
|
||||
<footer id="jsdoc-footer" class="jsdoc-footer">
|
||||
<div id="jsdoc-footer-container">
|
||||
<p>
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 28, 2022.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
<script src="scripts/jquery.min.js"></script>
|
||||
<script src="scripts/tree.jquery.js"></script>
|
||||
<script src="scripts/prettify.js"></script>
|
||||
<script src="scripts/jsdoc-toc.js"></script>
|
||||
<script src="scripts/linenumber.js"></script>
|
||||
<script src="scripts/scrollanchor.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
271
docs/List.html
Normal file
271
docs/List.html
Normal file
@@ -0,0 +1,271 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.7">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.16.5 » Class: List</title>
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
||||
<link href="css/baseline.css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<body onload="prettyPrint()">
|
||||
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
||||
<div id="jsdoc-navbar-container">
|
||||
<div id="jsdoc-navbar-content">
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>16.<wbr>5</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div id="jsdoc-body-container">
|
||||
<div id="jsdoc-content">
|
||||
<div id="jsdoc-content-container">
|
||||
<div id="jsdoc-main" role="main">
|
||||
<header class="page-header">
|
||||
<div class="symbol-detail-labels"><span class="label label-kind">class</span></div>
|
||||
<h1><small></small><span class="symbol-name">List</span></h1>
|
||||
<p class="source-link">Source: <a href="structures_List.js.html#source-line-8">structures/<wbr>List.<wbr>js:8</a></p>
|
||||
<div class="symbol-classdesc">
|
||||
<p>Message type List</p>
|
||||
</div>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
</header>
|
||||
<section id="summary">
|
||||
<div class="summary-callout">
|
||||
<h2 class="summary-callout-heading">Properties</h2>
|
||||
<div class="summary-content">
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="List.html#buttonText">buttonText</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="List.html#description">description</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="List.html#footer">footer</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="List.html#sections">sections</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="List.html#title">title</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="summary-callout">
|
||||
<h2 class="summary-callout-heading">Method</h2>
|
||||
<div class="summary-content">
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="List.html#_format">_format(sections)</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section>
|
||||
<h2 id="List">new <span class="symbol-name">List</span><span class="signature"><span class="signature-params">(body, buttonText, sections, title, footer)</span></span></h2>
|
||||
<section>
|
||||
<h3>Parameters</h3>
|
||||
<table class="jsdoc-details-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Optional</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>body</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>buttonText</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>sections</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>title</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Value can be null.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>footer</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Value can be null.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
</section>
|
||||
<section>
|
||||
<h2>Properties</h2>
|
||||
<section>
|
||||
<h3 id="buttonText"><span class="symbol-name">buttonText</span><small class="property-type">
|
||||
string</small></h3>
|
||||
<p>List button text</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="description"><span class="symbol-name">description</span><small class="property-type">
|
||||
string</small></h3>
|
||||
<p>Message body</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="footer"><span class="symbol-name">footer</span><small class="property-type">
|
||||
string</small></h3>
|
||||
<p>footer of message</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="sections"><span class="symbol-name">sections</span><small class="property-type">
|
||||
Array of any</small></h3>
|
||||
<p>sections of message</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="title"><span class="symbol-name">title</span><small class="property-type">
|
||||
string</small></h3>
|
||||
<p>title of message</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
</section>
|
||||
<h2>Method</h2>
|
||||
<section>
|
||||
<h3 id="_format"><span class="symbol-name">_format</span><span class="signature"><span class="signature-params">(sections)</span> → <span class="signature-returns"> Array of any</span></span></h3>
|
||||
<p>Creates section array from simple array</p>
|
||||
<section>
|
||||
<h4>
|
||||
Example
|
||||
</h4>
|
||||
<div>
|
||||
<pre class="prettyprint"><code>Input: [{title:'sectionTitle',rows:[{id:'customId', title:'ListItem2', description: 'desc'},{title:'ListItem2'}]}}]
|
||||
Returns: [{'title':'sectionTitle','rows':[{'rowId':'customId','title':'ListItem1','description':'desc'},{'rowId':'oGSRoD','title':'ListItem2','description':''}]}]</code></pre>
|
||||
</div>
|
||||
</section>
|
||||
<section>
|
||||
<h4>Parameter</h4>
|
||||
<table class="jsdoc-details-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Optional</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>sections</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Array of any</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<dl class="dl-compact">
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p><code>Array of any</code> </p>
|
||||
</dd>
|
||||
</dl>
|
||||
</section>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
<nav id="jsdoc-toc-nav" role="navigation"></nav>
|
||||
</div>
|
||||
</div>
|
||||
<footer id="jsdoc-footer" class="jsdoc-footer">
|
||||
<div id="jsdoc-footer-container">
|
||||
<p>
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 28, 2022.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
<script src="scripts/jquery.min.js"></script>
|
||||
<script src="scripts/tree.jquery.js"></script>
|
||||
<script src="scripts/prettify.js"></script>
|
||||
<script src="scripts/jsdoc-toc.js"></script>
|
||||
<script src="scripts/linenumber.js"></script>
|
||||
<script src="scripts/scrollanchor.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
135
docs/LocalAuth.html
Normal file
135
docs/LocalAuth.html
Normal file
@@ -0,0 +1,135 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.7">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.16.5 » Class: LocalAuth</title>
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
||||
<link href="css/baseline.css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<body onload="prettyPrint()">
|
||||
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
||||
<div id="jsdoc-navbar-container">
|
||||
<div id="jsdoc-navbar-content">
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>16.<wbr>5</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div id="jsdoc-body-container">
|
||||
<div id="jsdoc-content">
|
||||
<div id="jsdoc-content-container">
|
||||
<div id="jsdoc-main" role="main">
|
||||
<header class="page-header">
|
||||
<div class="symbol-detail-labels"><span class="label label-kind">class</span></div>
|
||||
<h1><small></small><span class="symbol-name">LocalAuth</span></h1>
|
||||
<p class="source-link">Source: <a href="authStrategies_LocalAuth.js.html#source-line-13">authStrategies/<wbr>LocalAuth.<wbr>js:13</a></p>
|
||||
<div class="symbol-classdesc">
|
||||
<p>Local directory-based authentication</p>
|
||||
</div>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
</header>
|
||||
<section id="summary">
|
||||
</section>
|
||||
<section>
|
||||
<h2 id="LocalAuth">new <span class="symbol-name">LocalAuth</span><span class="signature"><span class="signature-params">(options)</span></span></h2>
|
||||
<section>
|
||||
<h3>Parameters</h3>
|
||||
<table class="jsdoc-details-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Optional</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>options</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p>options</p>
|
||||
<p>Values in <code>options</code> have the following properties:</p>
|
||||
<table class="jsdoc-details-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Optional</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>clientId</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Client id to distinguish instances if you are using multiple, otherwise keep null if you are using only one instance</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>dataPath</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Change the default path for saving session files, default is: "./.wwebjs_auth/"</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
</section>
|
||||
<section>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
<nav id="jsdoc-toc-nav" role="navigation"></nav>
|
||||
</div>
|
||||
</div>
|
||||
<footer id="jsdoc-footer" class="jsdoc-footer">
|
||||
<div id="jsdoc-footer-container">
|
||||
<p>
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 28, 2022.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
<script src="scripts/jquery.min.js"></script>
|
||||
<script src="scripts/tree.jquery.js"></script>
|
||||
<script src="scripts/prettify.js"></script>
|
||||
<script src="scripts/jsdoc-toc.js"></script>
|
||||
<script src="scripts/linenumber.js"></script>
|
||||
<script src="scripts/scrollanchor.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -2,9 +2,9 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta name="generator" content="JSDoc 3.6.7">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.2.0 » Class: Location</title>
|
||||
<title>whatsapp-web.js 1.16.5 » Class: Location</title>
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
||||
@@ -15,7 +15,7 @@
|
||||
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
||||
<div id="jsdoc-navbar-container">
|
||||
<div id="jsdoc-navbar-content">
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>2.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>16.<wbr>5</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -26,7 +26,7 @@
|
||||
<header class="page-header">
|
||||
<div class="symbol-detail-labels"><span class="label label-kind">class</span></div>
|
||||
<h1><small></small><span class="symbol-name">Location</span></h1>
|
||||
<p class="source-link">Source: <a href="structures_Location.js.html#source-line-12">structures/<wbr>Location.<wbr>js:12</a></p>
|
||||
<p class="source-link">Source: <a href="structures_Location.js.html#source-line-6">structures/<wbr>Location.<wbr>js:6</a></p>
|
||||
<div class="symbol-classdesc">
|
||||
<p>Location information</p>
|
||||
</div>
|
||||
@@ -149,7 +149,7 @@
|
||||
<footer id="jsdoc-footer" class="jsdoc-footer">
|
||||
<div id="jsdoc-footer-container">
|
||||
<p>
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on March 1, 2020.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 28, 2022.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta name="generator" content="JSDoc 3.6.7">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.2.0 » Class: Message</title>
|
||||
<title>whatsapp-web.js 1.16.5 » Class: Message</title>
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
||||
@@ -15,7 +15,7 @@
|
||||
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
||||
<div id="jsdoc-navbar-container">
|
||||
<div id="jsdoc-navbar-content">
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>2.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>16.<wbr>5</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -26,7 +26,7 @@
|
||||
<header class="page-header">
|
||||
<div class="symbol-detail-labels"><span class="label label-kind">class</span></div>
|
||||
<h1><small></small><span class="symbol-name">Message</span></h1>
|
||||
<p class="source-link">Source: <a href="structures_Message.js.html#source-line-13">structures/<wbr>Message.<wbr>js:13</a></p>
|
||||
<p class="source-link">Source: <a href="structures_Message.js.html#source-line-14">structures/<wbr>Message.<wbr>js:14</a></p>
|
||||
<div class="symbol-classdesc">
|
||||
<p>Represents a Message on WhatsApp</p>
|
||||
</div>
|
||||
@@ -39,6 +39,9 @@
|
||||
<div class="summary-content">
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="Message.html#ack">ack</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Message.html#author">author</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
@@ -48,28 +51,55 @@
|
||||
<dt><a href="Message.html#broadcast">broadcast</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Message.html#deviceType">deviceType</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Message.html#duration">duration</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Message.html#forwardingScore">forwardingScore</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Message.html#from">from</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Message.html#fromMe">fromMe</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Message.html#hasMedia">hasMedia</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#inviteV4">inviteV4</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Message.html#isEphemeral">isEphemeral</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Message.html#isForwarded">isForwarded</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Message.html#isGif">isGif</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Message.html#isStarred">isStarred</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Message.html#isStatus">isStatus</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Message.html#links">links</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Message.html#location">location</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
@@ -77,18 +107,33 @@
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="Message.html#mediaKey">mediaKey</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Message.html#mentionedIds">mentionedIds</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Message.html#orderId">orderId</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Message.html#rawData">rawData</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Message.html#timestamp">timestamp</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Message.html#to">to</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Message.html#token">token</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Message.html#type">type</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Message.html#vCards">vCards</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
@@ -98,12 +143,18 @@
|
||||
<div class="summary-content">
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="Message.html#acceptGroupV4Invite">acceptGroupV4Invite()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Message.html#delete">delete(everyone)</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Message.html#downloadMedia">downloadMedia()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Message.html#forward">forward(chat)</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Message.html#getChat">getChat()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
@@ -114,17 +165,35 @@
|
||||
<dt><a href="Message.html#getContact">getContact()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Message.html#getInfo">getInfo()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Message.html#getMentions">getMentions()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Message.html#getQuotedMessage">getQuotedMessage()</a></dt>
|
||||
<dt><a href="Message.html#getOrder">getOrder()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Message.html#getPayment">getPayment()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="Message.html#reply">reply(content, chatId, options)</a></dt>
|
||||
<dt><a href="Message.html#getQuotedMessage">getQuotedMessage()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Message.html#reload">reload()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Message.html#reply">reply(content[, chatId][, options])</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Message.html#star">star()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Message.html#unstar">unstar()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
@@ -142,6 +211,11 @@
|
||||
<section>
|
||||
<h2>Properties</h2>
|
||||
<section>
|
||||
<h3 id="ack"><span class="symbol-name">ack</span><small class="property-type">
|
||||
<a href="global.html#MessageAck">MessageAck</a></small></h3>
|
||||
<p>ACK status for the message</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="author"><span class="symbol-name">author</span><small class="property-type">
|
||||
string</small></h3>
|
||||
<p>If the message was sent to a group, this field will contain the user that sent the message.</p>
|
||||
@@ -157,6 +231,22 @@
|
||||
<p>Indicates if the message was a broadcast</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="deviceType"><span class="symbol-name">deviceType</span><small class="property-type">
|
||||
string</small></h3>
|
||||
<p>String that represents from which device type the message was sent</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="duration"><span class="symbol-name">duration</span><small class="property-type">
|
||||
string</small></h3>
|
||||
<p>Indicates the duration of the message in seconds</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="forwardingScore"><span class="symbol-name">forwardingScore</span><small class="property-type">
|
||||
number</small></h3>
|
||||
<p>Indicates how many times the message was forwarded.</p>
|
||||
<p>The maximum value is 127.</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="from"><span class="symbol-name">from</span><small class="property-type">
|
||||
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>
|
||||
@@ -182,21 +272,66 @@
|
||||
<p>ID that represents the message</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="inviteV4"><span class="symbol-name">inviteV4</span><small class="property-type">
|
||||
object</small></h3>
|
||||
<p>Group Invite Data</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="isEphemeral"><span class="symbol-name">isEphemeral</span><small class="property-type">
|
||||
boolean</small></h3>
|
||||
<p>Indicates if the message will disappear after it expires</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="isForwarded"><span class="symbol-name">isForwarded</span><small class="property-type">
|
||||
boolean</small></h3>
|
||||
<p>Indicates if the message was forwarded</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="isGif"><span class="symbol-name">isGif</span><small class="property-type">
|
||||
boolean</small></h3>
|
||||
<p>Indicates whether the message is a Gif</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="isStarred"><span class="symbol-name">isStarred</span><small class="property-type">
|
||||
boolean</small></h3>
|
||||
<p>Indicates if the message was starred</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="isStatus"><span class="symbol-name">isStatus</span><small class="property-type">
|
||||
boolean</small></h3>
|
||||
<p>Indicates if the message is a status update</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="links"><span class="symbol-name">links</span><small class="property-type">
|
||||
Array of {link: string, isSuspicious: boolean}</small></h3>
|
||||
<p>Links included in the message.</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="location"><span class="symbol-name">location</span><small class="property-type">
|
||||
<a href="Location.html">Location</a></small></h3>
|
||||
<p>Location information contained in the message, if the message is type "location"</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="mediaKey"><span class="symbol-name">mediaKey</span><small class="property-type">
|
||||
string</small></h3>
|
||||
<p>MediaKey that represents the sticker 'ID'</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="mentionedIds"><span class="symbol-name">mentionedIds</span><small class="property-type">
|
||||
Array of string</small></h3>
|
||||
<p>Indicates the mentions in the message body.</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="orderId"><span class="symbol-name">orderId</span><small class="property-type">
|
||||
string</small></h3>
|
||||
<p>Order ID for message type ORDER</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="rawData"><span class="symbol-name">rawData</span><small class="property-type">
|
||||
Object</small></h3>
|
||||
<p>Returns message in a raw format</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="timestamp"><span class="symbol-name">timestamp</span><small class="property-type">
|
||||
number</small></h3>
|
||||
<p>Unix timestamp for when the message was created</p>
|
||||
@@ -209,14 +344,33 @@
|
||||
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="token"><span class="symbol-name">token</span><small class="property-type">
|
||||
string</small></h3>
|
||||
<p>Order Token for message type ORDER</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="type"><span class="symbol-name">type</span><small class="property-type">
|
||||
<a href="global.html#MessageTypes">MessageTypes</a></small></h3>
|
||||
<p>Message type</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="vCards"><span class="symbol-name">vCards</span><small class="property-type">
|
||||
Array of string</small></h3>
|
||||
<p>List of vCards contained in the message.</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="acceptGroupV4Invite"><span class="symbol-name">acceptGroupV4Invite</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing Object</span></span></h3>
|
||||
<p>Accept Group V4 Invite</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p><code>Promise containing Object</code> </p>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<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>
|
||||
@@ -261,6 +415,44 @@
|
||||
<p><code>Promise containing <a href="MessageMedia.html">MessageMedia</a></code> </p>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="forward"><span class="symbol-name">forward</span><span class="signature"><span class="signature-params">(chat)</span> → <span class="signature-returns"> Promise</span></span></h3>
|
||||
<p>Forwards this message to another chat</p>
|
||||
<section>
|
||||
<h4>Parameter</h4>
|
||||
<table class="jsdoc-details-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Optional</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>chat</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>(string or <a href="Chat.html">Chat</a>)</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Chat model or chat ID to which the message will be forwarded</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<dl class="dl-compact">
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p><code>Promise</code> </p>
|
||||
</dd>
|
||||
</dl>
|
||||
<h3 id="getChat"><span class="symbol-name">getChat</span><span class="signature"><span class="signature-params">()</span> → <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">
|
||||
@@ -278,6 +470,15 @@
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="getInfo"><span class="symbol-name">getInfo</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing nullable <a href="global.html#MessageInfo">MessageInfo</a></span></span></h3>
|
||||
<p>Get information about message delivery status. May return null if the message does not exist or is not sent by you.</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p><code>Promise containing nullable <a href="global.html#MessageInfo">MessageInfo</a></code> </p>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="getMentions"><span class="symbol-name">getMentions</span><span class="signature"><span class="signature-params">()</span> → <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">
|
||||
@@ -287,6 +488,24 @@
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="getOrder"><span class="symbol-name">getOrder</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing <a href="Order.html">Order</a></span></span></h3>
|
||||
<p>Gets the order associated with a given message</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p><code>Promise containing <a href="Order.html">Order</a></code> </p>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="getPayment"><span class="symbol-name">getPayment</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing <a href="Payment.html">Payment</a></span></span></h3>
|
||||
<p>Gets the payment details associated with a given message</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p><code>Promise containing <a href="Payment.html">Payment</a></code> </p>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="getQuotedMessage"><span class="symbol-name">getQuotedMessage</span><span class="signature"><span class="signature-params">()</span> → <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">
|
||||
@@ -296,7 +515,17 @@
|
||||
</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> → <span class="signature-returns"> Promise containing <a href="Message.html">Message</a></span></span></h3>
|
||||
<h3 id="reload"><span class="symbol-name">reload</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing <a href="Message.html">Message</a></span></span></h3>
|
||||
<p>Reloads this Message object's data in-place with the latest values from WhatsApp Web.
|
||||
Note that the Message must still be in the web app cache for this to work, otherwise will return null.</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p><code>Promise containing <a href="Message.html">Message</a></code> </p>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="reply"><span class="symbol-name">reply</span><span class="signature"><span class="signature-params">(content[, chatId][, options])</span> → <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>
|
||||
@@ -333,10 +562,9 @@
|
||||
<p>string</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
<p>Yes</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Value can be null.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -344,10 +572,10 @@
|
||||
<p>options</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>object</p>
|
||||
<p><a href="global.html#MessageSendOptions">MessageSendOptions</a></p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
<p>Yes</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
@@ -361,6 +589,16 @@
|
||||
<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="star"><span class="symbol-name">star</span><span class="signature"><span class="signature-params">()</span></span></h3>
|
||||
<p>Stars this message</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="unstar"><span class="symbol-name">unstar</span><span class="signature"><span class="signature-params">()</span></span></h3>
|
||||
<p>Unstars this message</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
</section>
|
||||
</section>
|
||||
</div>
|
||||
@@ -371,7 +609,7 @@
|
||||
<footer id="jsdoc-footer" class="jsdoc-footer">
|
||||
<div id="jsdoc-footer-container">
|
||||
<p>
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on March 1, 2020.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 28, 2022.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta name="generator" content="JSDoc 3.6.7">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.2.0 » Class: MessageMedia</title>
|
||||
<title>whatsapp-web.js 1.16.5 » Class: MessageMedia</title>
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
||||
@@ -15,7 +15,7 @@
|
||||
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
||||
<div id="jsdoc-navbar-container">
|
||||
<div id="jsdoc-navbar-content">
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>2.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>16.<wbr>5</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -26,7 +26,7 @@
|
||||
<header class="page-header">
|
||||
<div class="symbol-detail-labels"><span class="label label-kind">class</span></div>
|
||||
<h1><small></small><span class="symbol-name">MessageMedia</span></h1>
|
||||
<p class="source-link">Source: <a href="structures_MessageMedia.js.html#source-line-10">structures/<wbr>MessageMedia.<wbr>js:10</a></p>
|
||||
<p class="source-link">Source: <a href="structures_MessageMedia.js.html#source-line-15">structures/<wbr>MessageMedia.<wbr>js:15</a></p>
|
||||
<div class="symbol-classdesc">
|
||||
<p>Media attached to a message</p>
|
||||
</div>
|
||||
@@ -60,6 +60,27 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="summary-callout">
|
||||
<h2 class="summary-callout-heading">Methods</h2>
|
||||
<div class="summary-content">
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="MessageMedia.html#.fromFilePath">fromFilePath(filePath)</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="MessageMedia.html#.fromUrl">fromUrl(url[, options])</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section>
|
||||
<h2 id="MessageMedia">new <span class="symbol-name">MessageMedia</span><span class="signature"><span class="signature-params">(mimetype, data, filename)</span></span></h2>
|
||||
@@ -143,6 +164,176 @@
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
</section>
|
||||
<h2>Methods</h2>
|
||||
<section>
|
||||
<div class="symbol-detail-labels"><span class="label label-static">static</span></div>
|
||||
<h3 id=".fromFilePath"><span class="symbol-name">fromFilePath</span><span class="signature"><span class="signature-params">(filePath)</span> → <span class="signature-returns"> <a href="MessageMedia.html">MessageMedia</a></span></span></h3>
|
||||
<p>Creates a MessageMedia instance from a local file path</p>
|
||||
<section>
|
||||
<h4>Parameter</h4>
|
||||
<table class="jsdoc-details-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Optional</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>filePath</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>string</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<dl class="dl-compact">
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p><code><a href="MessageMedia.html">MessageMedia</a></code> </p>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span> <span class="label label-static">static</span></div>
|
||||
<h3 id=".fromUrl"><span class="symbol-name">fromUrl</span><span class="signature"><span class="signature-params">(url[, options])</span> → <span class="signature-returns"> Promise containing <a href="MessageMedia.html">MessageMedia</a></span></span></h3>
|
||||
<p>Creates a MessageMedia instance from a URL</p>
|
||||
<section>
|
||||
<h4>Parameters</h4>
|
||||
<table class="jsdoc-details-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Optional</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>url</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>string</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>options</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Object</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Yes</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Values in <code>options</code> have the following properties:</p>
|
||||
<table class="jsdoc-details-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Optional</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>unsafeMime</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>boolean</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Yes</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Defaults to <code>false</code>.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>filename</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>string</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Yes</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>client</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>object</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Yes</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>reqOptions</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>object</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Yes</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>reqOptions.size</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>number</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Yes</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Defaults to <code>0</code>.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<dl class="dl-compact">
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p><code>Promise containing <a href="MessageMedia.html">MessageMedia</a></code> </p>
|
||||
</dd>
|
||||
</dl>
|
||||
</section>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
@@ -152,7 +343,7 @@
|
||||
<footer id="jsdoc-footer" class="jsdoc-footer">
|
||||
<div id="jsdoc-footer-container">
|
||||
<p>
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on March 1, 2020.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 28, 2022.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
66
docs/NoAuth.html
Normal file
66
docs/NoAuth.html
Normal file
@@ -0,0 +1,66 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.7">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.16.5 » Class: NoAuth</title>
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
||||
<link href="css/baseline.css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<body onload="prettyPrint()">
|
||||
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
||||
<div id="jsdoc-navbar-container">
|
||||
<div id="jsdoc-navbar-content">
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>16.<wbr>5</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div id="jsdoc-body-container">
|
||||
<div id="jsdoc-content">
|
||||
<div id="jsdoc-content-container">
|
||||
<div id="jsdoc-main" role="main">
|
||||
<header class="page-header">
|
||||
<div class="symbol-detail-labels"><span class="label label-kind">class</span></div>
|
||||
<h1><small></small><span class="symbol-name">NoAuth</span></h1>
|
||||
<p class="source-link">Source: <a href="authStrategies_NoAuth.js.html#source-line-9">authStrategies/<wbr>NoAuth.<wbr>js:9</a></p>
|
||||
<div class="symbol-classdesc">
|
||||
<p>No session restoring functionality
|
||||
Will need to authenticate via QR code every time</p>
|
||||
</div>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
</header>
|
||||
<section id="summary">
|
||||
</section>
|
||||
<section>
|
||||
<h2 id="NoAuth">new <span class="symbol-name">NoAuth</span><span class="signature"><span class="signature-params">()</span></span></h2>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
</section>
|
||||
<section>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
<nav id="jsdoc-toc-nav" role="navigation"></nav>
|
||||
</div>
|
||||
</div>
|
||||
<footer id="jsdoc-footer" class="jsdoc-footer">
|
||||
<div id="jsdoc-footer-container">
|
||||
<p>
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 28, 2022.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
<script src="scripts/jquery.min.js"></script>
|
||||
<script src="scripts/tree.jquery.js"></script>
|
||||
<script src="scripts/prettify.js"></script>
|
||||
<script src="scripts/jsdoc-toc.js"></script>
|
||||
<script src="scripts/linenumber.js"></script>
|
||||
<script src="scripts/scrollanchor.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
117
docs/Order.html
Normal file
117
docs/Order.html
Normal file
@@ -0,0 +1,117 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.7">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.16.5 » Class: Order</title>
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
||||
<link href="css/baseline.css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<body onload="prettyPrint()">
|
||||
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
||||
<div id="jsdoc-navbar-container">
|
||||
<div id="jsdoc-navbar-content">
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>16.<wbr>5</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div id="jsdoc-body-container">
|
||||
<div id="jsdoc-content">
|
||||
<div id="jsdoc-content-container">
|
||||
<div id="jsdoc-main" role="main">
|
||||
<header class="page-header">
|
||||
<div class="symbol-detail-labels"><span class="label label-kind">class</span></div>
|
||||
<h1><small></small><span class="symbol-name">Order</span></h1>
|
||||
<p class="source-link">Source: <a href="structures_Order.js.html#source-line-10">structures/<wbr>Order.<wbr>js:10</a></p>
|
||||
<div class="symbol-classdesc">
|
||||
<p>Represents a Order on WhatsApp</p>
|
||||
</div>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
</header>
|
||||
<section id="summary">
|
||||
<div class="summary-callout">
|
||||
<h2 class="summary-callout-heading">Properties</h2>
|
||||
<div class="summary-content">
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="Order.html#createdAt">createdAt</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Order.html#currency">currency</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="Order.html#subtotal">subtotal</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Order.html#total">total</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section>
|
||||
<h2 id="Order">new <span class="symbol-name">Order</span><span class="signature"><span class="signature-params">()</span></span></h2>
|
||||
<dl class="dl-compact">
|
||||
<dt>Extends</dt>
|
||||
<dd><a href="Base.html">Base</a></dd>
|
||||
</dl>
|
||||
</section>
|
||||
<section>
|
||||
<h2>Properties</h2>
|
||||
<section>
|
||||
<h3 id="createdAt"><span class="symbol-name">createdAt</span><small class="property-type">
|
||||
number</small></h3>
|
||||
<p>Order Created At</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="currency"><span class="symbol-name">currency</span><small class="property-type">
|
||||
string</small></h3>
|
||||
<p>Order Currency</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="subtotal"><span class="symbol-name">subtotal</span><small class="property-type">
|
||||
string</small></h3>
|
||||
<p>Order Subtotal</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="total"><span class="symbol-name">total</span><small class="property-type">
|
||||
string</small></h3>
|
||||
<p>Order Total</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
</section>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
<nav id="jsdoc-toc-nav" role="navigation"></nav>
|
||||
</div>
|
||||
</div>
|
||||
<footer id="jsdoc-footer" class="jsdoc-footer">
|
||||
<div id="jsdoc-footer-container">
|
||||
<p>
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 28, 2022.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
<script src="scripts/jquery.min.js"></script>
|
||||
<script src="scripts/tree.jquery.js"></script>
|
||||
<script src="scripts/prettify.js"></script>
|
||||
<script src="scripts/jsdoc-toc.js"></script>
|
||||
<script src="scripts/linenumber.js"></script>
|
||||
<script src="scripts/scrollanchor.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -2,9 +2,9 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta name="generator" content="JSDoc 3.6.7">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.2.0 » Class: PrivateChat</title>
|
||||
<title>whatsapp-web.js 1.16.5 » Class: PrivateChat</title>
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
||||
@@ -15,7 +15,7 @@
|
||||
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
||||
<div id="jsdoc-navbar-container">
|
||||
<div id="jsdoc-navbar-content">
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>2.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>16.<wbr>5</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -48,6 +48,9 @@
|
||||
<dt><a href="PrivateChat.html#isGroup">isGroup</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="PrivateChat.html#isMuted">isMuted</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
@@ -55,16 +58,22 @@
|
||||
<dt><a href="PrivateChat.html#isReadOnly">isReadOnly</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="PrivateChat.html#muteExpiration">muteExpiration</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="PrivateChat.html#name">name</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="PrivateChat.html#timestamp">timestamp</a></dt>
|
||||
<dt><a href="PrivateChat.html#pinned">pinned</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="PrivateChat.html#timestamp">timestamp</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="PrivateChat.html#unreadCount">unreadCount</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
@@ -89,32 +98,53 @@
|
||||
<dt><a href="PrivateChat.html#delete">delete()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="PrivateChat.html#fetchMessages">fetchMessages(searchOptions)</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="PrivateChat.html#getContact">getContact()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="PrivateChat.html#fetchMessages">fetchMessages(searchOptions)</a></dt>
|
||||
<dt><a href="PrivateChat.html#getLabels">getLabels()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="PrivateChat.html#sendMessage">sendMessage(content, options)</a></dt>
|
||||
<dt><a href="PrivateChat.html#markUnread">markUnread()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="PrivateChat.html#mute">mute(unmuteDate)</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="PrivateChat.html#pin">pin()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="PrivateChat.html#sendMessage">sendMessage(content[, options])</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<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#sendStateRecording">sendStateRecording()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="PrivateChat.html#sendStateTyping">sendStateTyping()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="PrivateChat.html#unarchive">unarchive()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="PrivateChat.html#unmute">unmute()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="PrivateChat.html#unpin">unpin()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
@@ -151,6 +181,13 @@
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Chat.html#isGroup">Chat#isGroup</a></dd>
|
||||
</dl>
|
||||
<h3 id="isMuted"><span class="symbol-name">isMuted</span><small class="property-type">
|
||||
unknown</small></h3>
|
||||
<p>Indicates if the chat is muted or not</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Chat.html#isMuted">Chat#isMuted</a></dd>
|
||||
</dl>
|
||||
<h3 id="isReadOnly"><span class="symbol-name">isReadOnly</span><small class="property-type">
|
||||
unknown</small></h3>
|
||||
<p>Indicates if the Chat is readonly</p>
|
||||
@@ -158,6 +195,13 @@
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Chat.html#isReadOnly">Chat#isReadOnly</a></dd>
|
||||
</dl>
|
||||
<h3 id="muteExpiration"><span class="symbol-name">muteExpiration</span><small class="property-type">
|
||||
unknown</small></h3>
|
||||
<p>Unix timestamp for when the mute expires</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Chat.html#muteExpiration">Chat#muteExpiration</a></dd>
|
||||
</dl>
|
||||
<h3 id="name"><span class="symbol-name">name</span><small class="property-type">
|
||||
unknown</small></h3>
|
||||
<p>Title of the chat</p>
|
||||
@@ -165,9 +209,16 @@
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Chat.html#name">Chat#name</a></dd>
|
||||
</dl>
|
||||
<h3 id="pinned"><span class="symbol-name">pinned</span><small class="property-type">
|
||||
unknown</small></h3>
|
||||
<p>Indicates if the Chat is pinned</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Chat.html#pinned">Chat#pinned</a></dd>
|
||||
</dl>
|
||||
<h3 id="timestamp"><span class="symbol-name">timestamp</span><small class="property-type">
|
||||
unknown</small></h3>
|
||||
<p>Unix timestamp for when the chat was created</p>
|
||||
<p>Unix timestamp for when the last activity occurred</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Chat.html#timestamp">Chat#timestamp</a></dd>
|
||||
@@ -267,8 +318,7 @@
|
||||
<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>
|
||||
<p>The amount of messages to return. If no limit is specified, the available messages will be returned. Note that the actual number of returned messages may be smaller if there aren't enough messages in the conversation. Set this to Infinity to load all messages.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@@ -285,7 +335,80 @@
|
||||
<dd></dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="sendMessage"><span class="symbol-name">sendMessage</span><span class="signature"><span class="signature-params">(content, options)</span> → <span class="signature-returns"> Promise containing <a href="Message.html">Message</a></span></span></h3>
|
||||
<h3 id="getContact"><span class="symbol-name">getContact</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing <a href="Contact.html">Contact</a></span></span></h3>
|
||||
<p>Returns the Contact that corresponds to this Chat.</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Chat.html#getContact">Chat#getContact</a></dd>
|
||||
<dt>Returns</dt>
|
||||
<dd></dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="getLabels"><span class="symbol-name">getLabels</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing Array of <a href="Label.html">Label</a></span></span></h3>
|
||||
<p>Returns array of all Labels assigned to this Chat</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Chat.html#getLabels">Chat#getLabels</a></dd>
|
||||
<dt>Returns</dt>
|
||||
<dd></dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="markUnread"><span class="symbol-name">markUnread</span><span class="signature"><span class="signature-params">()</span></span></h3>
|
||||
<p>Mark this chat as unread</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Chat.html#markUnread">Chat#markUnread</a></dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="mute"><span class="symbol-name">mute</span><span class="signature"><span class="signature-params">(unmuteDate)</span></span></h3>
|
||||
<p>Mutes this chat forever, unless a date is specified</p>
|
||||
<section>
|
||||
<h4>Parameter</h4>
|
||||
<table class="jsdoc-details-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Optional</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>unmuteDate</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Date at which the Chat will be unmuted, leave as is to mute forever</p>
|
||||
<p>Value can be null.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Chat.html#mute">Chat#mute</a></dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="pin"><span class="symbol-name">pin</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing boolean</span></span></h3>
|
||||
<p>Pins this chat</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Chat.html#pin">Chat#pin</a></dd>
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p>New pin state. Could be false if the max number of pinned chats was reached.</p>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="sendMessage"><span class="symbol-name">sendMessage</span><span class="signature"><span class="signature-params">(content[, options])</span> → <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>
|
||||
@@ -320,7 +443,7 @@
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
<p>Yes</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
@@ -368,6 +491,24 @@
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Chat.html#unarchive">Chat#unarchive</a></dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="unmute"><span class="symbol-name">unmute</span><span class="signature"><span class="signature-params">()</span></span></h3>
|
||||
<p>Unmutes this chat</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Chat.html#unmute">Chat#unmute</a></dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="unpin"><span class="symbol-name">unpin</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing boolean</span></span></h3>
|
||||
<p>Unpins this chat</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Chat.html#unpin">Chat#unpin</a></dd>
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p>New pin state</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</section>
|
||||
</section>
|
||||
</div>
|
||||
@@ -378,7 +519,7 @@
|
||||
<footer id="jsdoc-footer" class="jsdoc-footer">
|
||||
<div id="jsdoc-footer-container">
|
||||
<p>
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on March 1, 2020.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 28, 2022.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta name="generator" content="JSDoc 3.6.7">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.2.0 » Class: PrivateContact</title>
|
||||
<title>whatsapp-web.js 1.16.5 » Class: PrivateContact</title>
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
||||
@@ -15,7 +15,7 @@
|
||||
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
||||
<div id="jsdoc-navbar-container">
|
||||
<div id="jsdoc-navbar-content">
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>2.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>16.<wbr>5</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -42,6 +42,9 @@
|
||||
<dt><a href="PrivateContact.html#id">id</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="PrivateContact.html#isBlocked">isBlocked</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="PrivateContact.html#isBusiness">isBusiness</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
@@ -67,13 +70,13 @@
|
||||
<dt><a href="PrivateContact.html#isWAContact">isWAContact</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="PrivateContact.html#name">name</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>
|
||||
@@ -88,18 +91,43 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="summary-callout">
|
||||
<h2 class="summary-callout-heading">Method</h2>
|
||||
<h2 class="summary-callout-heading">Methods</h2>
|
||||
<div class="summary-content">
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="PrivateContact.html#getProfilePicUrl">getProfilePicUrl()</a></dt>
|
||||
<dt><a href="PrivateContact.html#block">block()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="PrivateContact.html#getAbout">getAbout()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="PrivateContact.html#getChat">getChat()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="PrivateContact.html#getCommonGroups">getCommonGroups()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="PrivateContact.html#getCountryCode">getCountryCode()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="PrivateContact.html#getFormattedNumber">getFormattedNumber()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="PrivateContact.html#getProfilePicUrl">getProfilePicUrl()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="PrivateContact.html#unblock">unblock()</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -121,6 +149,13 @@
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Contact.html#id">Contact#id</a></dd>
|
||||
</dl>
|
||||
<h3 id="isBlocked"><span class="symbol-name">isBlocked</span><small class="property-type">
|
||||
unknown</small></h3>
|
||||
<p>Indicates if you have blocked this contact</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Contact.html#isBlocked">Contact#isBlocked</a></dd>
|
||||
</dl>
|
||||
<h3 id="isBusiness"><span class="symbol-name">isBusiness</span><small class="property-type">
|
||||
unknown</small></h3>
|
||||
<p>Indicates if the contact is a business contact</p>
|
||||
@@ -199,8 +234,63 @@
|
||||
<dd><a href="Contact.html#shortName">Contact#shortName</a></dd>
|
||||
</dl>
|
||||
</section>
|
||||
<h2>Method</h2>
|
||||
<h2>Methods</h2>
|
||||
<section>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="block"><span class="symbol-name">block</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing boolean</span></span></h3>
|
||||
<p>Blocks this contact from WhatsApp</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Contact.html#block">Contact#block</a></dd>
|
||||
<dt>Returns</dt>
|
||||
<dd></dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="getAbout"><span class="symbol-name">getAbout</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing nullable string</span></span></h3>
|
||||
<p>Gets the Contact's current "about" info. Returns null if you don't have permission to read their status.</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Contact.html#getAbout">Contact#getAbout</a></dd>
|
||||
<dt>Returns</dt>
|
||||
<dd></dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="getChat"><span class="symbol-name">getChat</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing <a href="Chat.html">Chat</a></span></span></h3>
|
||||
<p>Returns the Chat that corresponds to this Contact.
|
||||
Will return null when getting chat for currently logged in user.</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Contact.html#getChat">Contact#getChat</a></dd>
|
||||
<dt>Returns</dt>
|
||||
<dd></dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="getCommonGroups"><span class="symbol-name">getCommonGroups</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing Array of WAWebJS.ChatId</span></span></h3>
|
||||
<p>Gets the Contact's common groups with you. Returns empty array if you don't have any common group.</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Contact.html#getCommonGroups">Contact#getCommonGroups</a></dd>
|
||||
<dt>Returns</dt>
|
||||
<dd></dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="getCountryCode"><span class="symbol-name">getCountryCode</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing string</span></span></h3>
|
||||
<p>Returns the contact's countrycode, (1541859685@c.us) => (1)</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Contact.html#getCountryCode">Contact#getCountryCode</a></dd>
|
||||
<dt>Returns</dt>
|
||||
<dd></dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="getFormattedNumber"><span class="symbol-name">getFormattedNumber</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing string</span></span></h3>
|
||||
<p>Returns the contact's formatted phone number, (12345678901@c.us) => (+1 (234) 5678-901)</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Contact.html#getFormattedNumber">Contact#getFormattedNumber</a></dd>
|
||||
<dt>Returns</dt>
|
||||
<dd></dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="getProfilePicUrl"><span class="symbol-name">getProfilePicUrl</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing string</span></span></h3>
|
||||
<p>Returns the contact's profile picture URL, if privacy settings allow it</p>
|
||||
@@ -210,6 +300,15 @@
|
||||
<dt>Returns</dt>
|
||||
<dd></dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span></div>
|
||||
<h3 id="unblock"><span class="symbol-name">unblock</span><span class="signature"><span class="signature-params">()</span> → <span class="signature-returns"> Promise containing boolean</span></span></h3>
|
||||
<p>Unblocks this contact from WhatsApp</p>
|
||||
<dl class="dl-compact">
|
||||
<dt>Inherited from</dt>
|
||||
<dd><a href="Contact.html#unblock">Contact#unblock</a></dd>
|
||||
<dt>Returns</dt>
|
||||
<dd></dd>
|
||||
</dl>
|
||||
</section>
|
||||
</section>
|
||||
</div>
|
||||
@@ -220,7 +319,7 @@
|
||||
<footer id="jsdoc-footer" class="jsdoc-footer">
|
||||
<div id="jsdoc-footer-container">
|
||||
<p>
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on March 1, 2020.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 28, 2022.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
142
docs/Product.html
Normal file
142
docs/Product.html
Normal file
@@ -0,0 +1,142 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.7">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.16.5 » Class: Product</title>
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
||||
<link href="css/baseline.css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<body onload="prettyPrint()">
|
||||
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
||||
<div id="jsdoc-navbar-container">
|
||||
<div id="jsdoc-navbar-content">
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>16.<wbr>5</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div id="jsdoc-body-container">
|
||||
<div id="jsdoc-content">
|
||||
<div id="jsdoc-content-container">
|
||||
<div id="jsdoc-main" role="main">
|
||||
<header class="page-header">
|
||||
<div class="symbol-detail-labels"><span class="label label-kind">class</span></div>
|
||||
<h1><small></small><span class="symbol-name">Product</span></h1>
|
||||
<p class="source-link">Source: <a href="structures_Product.js.html#source-line-10">structures/<wbr>Product.<wbr>js:10</a></p>
|
||||
<div class="symbol-classdesc">
|
||||
<p>Represents a Product on WhatsAppBusiness</p>
|
||||
</div>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
</header>
|
||||
<section id="summary">
|
||||
<div class="summary-callout">
|
||||
<h2 class="summary-callout-heading">Properties</h2>
|
||||
<div class="summary-content">
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="Product.html#currency">currency</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Product.html#data">data</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Product.html#id">id</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="Product.html#name">name</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Product.html#price">price</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Product.html#quantity">quantity</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="Product.html#thumbnailUrl">thumbnailUrl</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section>
|
||||
<h2 id="Product">new <span class="symbol-name">Product</span><span class="signature"><span class="signature-params">()</span></span></h2>
|
||||
<dl class="dl-compact">
|
||||
<dt>Extends</dt>
|
||||
<dd><a href="Base.html">Base</a></dd>
|
||||
</dl>
|
||||
</section>
|
||||
<section>
|
||||
<h2>Properties</h2>
|
||||
<section>
|
||||
<h3 id="currency"><span class="symbol-name">currency</span><small class="property-type">
|
||||
string</small></h3>
|
||||
<p>Currency</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="data"><span class="symbol-name">data</span></h3>
|
||||
<p>Product metadata</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="id"><span class="symbol-name">id</span><small class="property-type">
|
||||
string</small></h3>
|
||||
<p>Product ID</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="name"><span class="symbol-name">name</span><small class="property-type">
|
||||
string</small></h3>
|
||||
<p>Product Name</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="price"><span class="symbol-name">price</span><small class="property-type">
|
||||
string</small></h3>
|
||||
<p>Price</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="quantity"><span class="symbol-name">quantity</span><small class="property-type">
|
||||
number</small></h3>
|
||||
<p>Product Quantity</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
<h3 id="thumbnailUrl"><span class="symbol-name">thumbnailUrl</span><small class="property-type">
|
||||
string</small></h3>
|
||||
<p>Product Thumbnail</p>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
</section>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
<nav id="jsdoc-toc-nav" role="navigation"></nav>
|
||||
</div>
|
||||
</div>
|
||||
<footer id="jsdoc-footer" class="jsdoc-footer">
|
||||
<div id="jsdoc-footer-container">
|
||||
<p>
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 28, 2022.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
<script src="scripts/jquery.min.js"></script>
|
||||
<script src="scripts/tree.jquery.js"></script>
|
||||
<script src="scripts/prettify.js"></script>
|
||||
<script src="scripts/jsdoc-toc.js"></script>
|
||||
<script src="scripts/linenumber.js"></script>
|
||||
<script src="scripts/scrollanchor.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
203
docs/Util.html
203
docs/Util.html
@@ -2,9 +2,9 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta name="generator" content="JSDoc 3.6.7">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.2.0 » Class: Util</title>
|
||||
<title>whatsapp-web.js 1.16.5 » Class: Util</title>
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
||||
@@ -15,7 +15,7 @@
|
||||
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
||||
<div id="jsdoc-navbar-container">
|
||||
<div id="jsdoc-navbar-content">
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>2.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>16.<wbr>5</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -26,7 +26,7 @@
|
||||
<header class="page-header">
|
||||
<div class="symbol-detail-labels"><span class="label label-kind">class</span></div>
|
||||
<h1><small></small><span class="symbol-name">Util</span></h1>
|
||||
<p class="source-link">Source: <a href="util_Util.js.html#source-line-10">util/<wbr>Util.<wbr>js:10</a></p>
|
||||
<p class="source-link">Source: <a href="util_Util.js.html#source-line-15">util/<wbr>Util.<wbr>js:15</a></p>
|
||||
<div class="symbol-classdesc">
|
||||
<p>Utility methods</p>
|
||||
</div>
|
||||
@@ -34,6 +34,33 @@
|
||||
</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="Util.html#.formatImageToWebpSticker">formatImageToWebpSticker(media)</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Util.html#.formatToWebpSticker">formatToWebpSticker(media, metadata)</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
<dl class="dl-summary-callout">
|
||||
<dt><a href="Util.html#.formatVideoToWebpSticker">formatVideoToWebpSticker(media)</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><a href="Util.html#.setFfmpegPath">setFfmpegPath(path)</a></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="summary-column">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section>
|
||||
<h2 id="Util">new <span class="symbol-name">Util</span><span class="signature"><span class="signature-params">()</span></span></h2>
|
||||
@@ -41,6 +68,172 @@
|
||||
</dl>
|
||||
</section>
|
||||
<section>
|
||||
<h2>Methods</h2>
|
||||
<section>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span> <span class="label label-static">static</span></div>
|
||||
<h3 id=".formatImageToWebpSticker"><span class="symbol-name">formatImageToWebpSticker</span><span class="signature"><span class="signature-params">(media)</span> → <span class="signature-returns"> Promise containing <a href="MessageMedia.html">MessageMedia</a></span></span></h3>
|
||||
<p>Formats a image to webp</p>
|
||||
<section>
|
||||
<h4>Parameter</h4>
|
||||
<table class="jsdoc-details-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Optional</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>media</p>
|
||||
</td>
|
||||
<td>
|
||||
<p><a href="MessageMedia.html">MessageMedia</a></p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<dl class="dl-compact">
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p><code>Promise containing <a href="MessageMedia.html">MessageMedia</a></code>
|
||||
<p>media in webp format</p>
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span> <span class="label label-static">static</span></div>
|
||||
<h3 id=".formatToWebpSticker"><span class="symbol-name">formatToWebpSticker</span><span class="signature"><span class="signature-params">(media, metadata)</span> → <span class="signature-returns"> Promise containing <a href="MessageMedia.html">MessageMedia</a></span></span></h3>
|
||||
<p>Formats a media to webp</p>
|
||||
<section>
|
||||
<h4>Parameters</h4>
|
||||
<table class="jsdoc-details-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Optional</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>media</p>
|
||||
</td>
|
||||
<td>
|
||||
<p><a href="MessageMedia.html">MessageMedia</a></p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>metadata</p>
|
||||
</td>
|
||||
<td>
|
||||
<p><a href="global.html#StickerMetadata">StickerMetadata</a></p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<dl class="dl-compact">
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p><code>Promise containing <a href="MessageMedia.html">MessageMedia</a></code>
|
||||
<p>media in webp format</p>
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-async">async</span> <span class="label label-static">static</span></div>
|
||||
<h3 id=".formatVideoToWebpSticker"><span class="symbol-name">formatVideoToWebpSticker</span><span class="signature"><span class="signature-params">(media)</span> → <span class="signature-returns"> Promise containing <a href="MessageMedia.html">MessageMedia</a></span></span></h3>
|
||||
<p>Formats a video to webp</p>
|
||||
<section>
|
||||
<h4>Parameter</h4>
|
||||
<table class="jsdoc-details-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Optional</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>media</p>
|
||||
</td>
|
||||
<td>
|
||||
<p><a href="MessageMedia.html">MessageMedia</a></p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<dl class="dl-compact">
|
||||
<dt>Returns</dt>
|
||||
<dd>
|
||||
<p><code>Promise containing <a href="MessageMedia.html">MessageMedia</a></code>
|
||||
<p>media in webp format</p>
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="symbol-detail-labels"><span class="label label-static">static</span></div>
|
||||
<h3 id=".setFfmpegPath"><span class="symbol-name">setFfmpegPath</span><span class="signature"><span class="signature-params">(path)</span></span></h3>
|
||||
<p>Configure ffmpeg path</p>
|
||||
<section>
|
||||
<h4>Parameter</h4>
|
||||
<table class="jsdoc-details-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Optional</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>path</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>string</p>
|
||||
</td>
|
||||
<td>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<dl class="dl-compact">
|
||||
</dl>
|
||||
</section>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
@@ -50,7 +243,7 @@
|
||||
<footer id="jsdoc-footer" class="jsdoc-footer">
|
||||
<div id="jsdoc-footer-container">
|
||||
<p>
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on March 1, 2020.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 28, 2022.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
77
docs/authStrategies_BaseAuthStrategy.js.html
Normal file
77
docs/authStrategies_BaseAuthStrategy.js.html
Normal file
@@ -0,0 +1,77 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.7">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.16.5 » Source: authStrategies/BaseAuthStrategy.js</title>
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
||||
<link href="css/baseline.css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<body onload="prettyPrint()">
|
||||
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
||||
<div id="jsdoc-navbar-container">
|
||||
<div id="jsdoc-navbar-content">
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>16.<wbr>5</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div id="jsdoc-body-container">
|
||||
<div id="jsdoc-content">
|
||||
<div id="jsdoc-content-container">
|
||||
<div id="jsdoc-banner" role="banner">
|
||||
</div>
|
||||
<div id="jsdoc-main" role="main">
|
||||
<header class="page-header">
|
||||
<h1>Source: authStrategies/BaseAuthStrategy.js</h1>
|
||||
</header>
|
||||
<article>
|
||||
<pre class="prettyprint linenums"><code>'use strict';
|
||||
|
||||
/**
|
||||
* Base class which all authentication strategies extend
|
||||
*/
|
||||
class BaseAuthStrategy {
|
||||
constructor() {}
|
||||
setup(client) {
|
||||
this.client = client;
|
||||
}
|
||||
async beforeBrowserInitialized() {}
|
||||
async afterBrowserInitialized() {}
|
||||
async onAuthenticationNeeded() {
|
||||
return {
|
||||
failed: false,
|
||||
restart: false,
|
||||
failureEventPayload: undefined
|
||||
};
|
||||
}
|
||||
async getAuthEventPayload() {}
|
||||
async logout() {}
|
||||
}
|
||||
|
||||
module.exports = BaseAuthStrategy;</code></pre>
|
||||
</article>
|
||||
</div>
|
||||
</div>
|
||||
<nav id="jsdoc-toc-nav" role="navigation"></nav>
|
||||
</div>
|
||||
</div>
|
||||
<footer id="jsdoc-footer" class="jsdoc-footer">
|
||||
<div id="jsdoc-footer-container">
|
||||
<p>
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 28, 2022.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
<script src="scripts/jquery.min.js"></script>
|
||||
<script src="scripts/tree.jquery.js"></script>
|
||||
<script src="scripts/prettify.js"></script>
|
||||
<script src="scripts/jsdoc-toc.js"></script>
|
||||
<script src="scripts/linenumber.js"></script>
|
||||
<script src="scripts/scrollanchor.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
125
docs/authStrategies_LegacySessionAuth.js.html
Normal file
125
docs/authStrategies_LegacySessionAuth.js.html
Normal file
@@ -0,0 +1,125 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.7">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.16.5 » Source: authStrategies/LegacySessionAuth.js</title>
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
||||
<link href="css/baseline.css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<body onload="prettyPrint()">
|
||||
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
||||
<div id="jsdoc-navbar-container">
|
||||
<div id="jsdoc-navbar-content">
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>16.<wbr>5</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div id="jsdoc-body-container">
|
||||
<div id="jsdoc-content">
|
||||
<div id="jsdoc-content-container">
|
||||
<div id="jsdoc-banner" role="banner">
|
||||
</div>
|
||||
<div id="jsdoc-main" role="main">
|
||||
<header class="page-header">
|
||||
<h1>Source: authStrategies/LegacySessionAuth.js</h1>
|
||||
</header>
|
||||
<article>
|
||||
<pre class="prettyprint linenums"><code>'use strict';
|
||||
|
||||
const BaseAuthStrategy = require('./BaseAuthStrategy');
|
||||
|
||||
/**
|
||||
* Legacy session auth strategy
|
||||
* Not compatible with multi-device accounts.
|
||||
* @param {object} options - options
|
||||
* @param {string} options.restartOnAuthFail - Restart client with a new session (i.e. use null 'session' var) if authentication fails
|
||||
* @param {object} options.session - Whatsapp session to restore. If not set, will start a new session
|
||||
* @param {string} options.session.WABrowserId
|
||||
* @param {string} options.session.WASecretBundle
|
||||
* @param {string} options.session.WAToken1
|
||||
* @param {string} options.session.WAToken2
|
||||
*/
|
||||
class LegacySessionAuth extends BaseAuthStrategy {
|
||||
constructor({ session, restartOnAuthFail }={}) {
|
||||
super();
|
||||
this.session = session;
|
||||
this.restartOnAuthFail = restartOnAuthFail;
|
||||
}
|
||||
|
||||
async afterBrowserInitialized() {
|
||||
if(this.session) {
|
||||
await this.client.pupPage.evaluateOnNewDocument(session => {
|
||||
if (document.referrer === 'https://whatsapp.com/') {
|
||||
localStorage.clear();
|
||||
localStorage.setItem('WABrowserId', session.WABrowserId);
|
||||
localStorage.setItem('WASecretBundle', session.WASecretBundle);
|
||||
localStorage.setItem('WAToken1', session.WAToken1);
|
||||
localStorage.setItem('WAToken2', session.WAToken2);
|
||||
}
|
||||
|
||||
localStorage.setItem('remember-me', 'true');
|
||||
}, this.session);
|
||||
}
|
||||
}
|
||||
|
||||
async onAuthenticationNeeded() {
|
||||
if(this.session) {
|
||||
this.session = null;
|
||||
return {
|
||||
failed: true,
|
||||
restart: this.restartOnAuthFail,
|
||||
failureEventPayload: 'Unable to log in. Are the session details valid?'
|
||||
};
|
||||
}
|
||||
|
||||
return { failed: false };
|
||||
}
|
||||
|
||||
async getAuthEventPayload() {
|
||||
const isMD = await this.client.pupPage.evaluate(() => {
|
||||
return window.Store.Features.features.MD_BACKEND;
|
||||
});
|
||||
|
||||
if(isMD) throw new Error('Authenticating via JSON session is not supported for MultiDevice-enabled WhatsApp accounts.');
|
||||
|
||||
const localStorage = JSON.parse(await this.client.pupPage.evaluate(() => {
|
||||
return JSON.stringify(window.localStorage);
|
||||
}));
|
||||
|
||||
return {
|
||||
WABrowserId: localStorage.WABrowserId,
|
||||
WASecretBundle: localStorage.WASecretBundle,
|
||||
WAToken1: localStorage.WAToken1,
|
||||
WAToken2: localStorage.WAToken2
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = LegacySessionAuth;</code></pre>
|
||||
</article>
|
||||
</div>
|
||||
</div>
|
||||
<nav id="jsdoc-toc-nav" role="navigation"></nav>
|
||||
</div>
|
||||
</div>
|
||||
<footer id="jsdoc-footer" class="jsdoc-footer">
|
||||
<div id="jsdoc-footer-container">
|
||||
<p>
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 28, 2022.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
<script src="scripts/jquery.min.js"></script>
|
||||
<script src="scripts/tree.jquery.js"></script>
|
||||
<script src="scripts/prettify.js"></script>
|
||||
<script src="scripts/jsdoc-toc.js"></script>
|
||||
<script src="scripts/linenumber.js"></script>
|
||||
<script src="scripts/scrollanchor.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
106
docs/authStrategies_LocalAuth.js.html
Normal file
106
docs/authStrategies_LocalAuth.js.html
Normal file
@@ -0,0 +1,106 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.7">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.16.5 » Source: authStrategies/LocalAuth.js</title>
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
||||
<link href="css/baseline.css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<body onload="prettyPrint()">
|
||||
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
||||
<div id="jsdoc-navbar-container">
|
||||
<div id="jsdoc-navbar-content">
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>16.<wbr>5</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div id="jsdoc-body-container">
|
||||
<div id="jsdoc-content">
|
||||
<div id="jsdoc-content-container">
|
||||
<div id="jsdoc-banner" role="banner">
|
||||
</div>
|
||||
<div id="jsdoc-main" role="main">
|
||||
<header class="page-header">
|
||||
<h1>Source: authStrategies/LocalAuth.js</h1>
|
||||
</header>
|
||||
<article>
|
||||
<pre class="prettyprint linenums"><code>'use strict';
|
||||
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const BaseAuthStrategy = require('./BaseAuthStrategy');
|
||||
|
||||
/**
|
||||
* Local directory-based authentication
|
||||
* @param {object} options - options
|
||||
* @param {string} options.clientId - Client id to distinguish instances if you are using multiple, otherwise keep null if you are using only one instance
|
||||
* @param {string} options.dataPath - Change the default path for saving session files, default is: "./.wwebjs_auth/"
|
||||
*/
|
||||
class LocalAuth extends BaseAuthStrategy {
|
||||
constructor({ clientId, dataPath }={}) {
|
||||
super();
|
||||
|
||||
const idRegex = /^[-_\w]+$/i;
|
||||
if(clientId &amp;&amp; !idRegex.test(clientId)) {
|
||||
throw new Error('Invalid clientId. Only alphanumeric characters, underscores and hyphens are allowed.');
|
||||
}
|
||||
|
||||
this.dataPath = path.resolve(dataPath || './.wwebjs_auth/');
|
||||
this.clientId = clientId;
|
||||
}
|
||||
|
||||
async beforeBrowserInitialized() {
|
||||
const puppeteerOpts = this.client.options.puppeteer;
|
||||
const sessionDirName = this.clientId ? `session-${this.clientId}` : 'session';
|
||||
const dirPath = path.join(this.dataPath, sessionDirName);
|
||||
|
||||
if(puppeteerOpts.userDataDir &amp;&amp; puppeteerOpts.userDataDir !== dirPath) {
|
||||
throw new Error('LocalAuth is not compatible with a user-supplied userDataDir.');
|
||||
}
|
||||
|
||||
fs.mkdirSync(dirPath, { recursive: true });
|
||||
|
||||
this.client.options.puppeteer = {
|
||||
...puppeteerOpts,
|
||||
userDataDir: dirPath
|
||||
};
|
||||
|
||||
this.userDataDir = dirPath;
|
||||
}
|
||||
|
||||
async logout() {
|
||||
if (this.userDataDir) {
|
||||
return (fs.rmSync ? fs.rmSync : fs.rmdirSync).call(this, this.userDataDir, { recursive: true });
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = LocalAuth;</code></pre>
|
||||
</article>
|
||||
</div>
|
||||
</div>
|
||||
<nav id="jsdoc-toc-nav" role="navigation"></nav>
|
||||
</div>
|
||||
</div>
|
||||
<footer id="jsdoc-footer" class="jsdoc-footer">
|
||||
<div id="jsdoc-footer-container">
|
||||
<p>
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 28, 2022.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
<script src="scripts/jquery.min.js"></script>
|
||||
<script src="scripts/tree.jquery.js"></script>
|
||||
<script src="scripts/prettify.js"></script>
|
||||
<script src="scripts/jsdoc-toc.js"></script>
|
||||
<script src="scripts/linenumber.js"></script>
|
||||
<script src="scripts/scrollanchor.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
65
docs/authStrategies_NoAuth.js.html
Normal file
65
docs/authStrategies_NoAuth.js.html
Normal file
@@ -0,0 +1,65 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.7">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.16.5 » Source: authStrategies/NoAuth.js</title>
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
||||
<link href="css/baseline.css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<body onload="prettyPrint()">
|
||||
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
||||
<div id="jsdoc-navbar-container">
|
||||
<div id="jsdoc-navbar-content">
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>16.<wbr>5</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div id="jsdoc-body-container">
|
||||
<div id="jsdoc-content">
|
||||
<div id="jsdoc-content-container">
|
||||
<div id="jsdoc-banner" role="banner">
|
||||
</div>
|
||||
<div id="jsdoc-main" role="main">
|
||||
<header class="page-header">
|
||||
<h1>Source: authStrategies/NoAuth.js</h1>
|
||||
</header>
|
||||
<article>
|
||||
<pre class="prettyprint linenums"><code>'use strict';
|
||||
|
||||
const BaseAuthStrategy = require('./BaseAuthStrategy');
|
||||
|
||||
/**
|
||||
* No session restoring functionality
|
||||
* Will need to authenticate via QR code every time
|
||||
*/
|
||||
class NoAuth extends BaseAuthStrategy { }
|
||||
|
||||
|
||||
module.exports = NoAuth;</code></pre>
|
||||
</article>
|
||||
</div>
|
||||
</div>
|
||||
<nav id="jsdoc-toc-nav" role="navigation"></nav>
|
||||
</div>
|
||||
</div>
|
||||
<footer id="jsdoc-footer" class="jsdoc-footer">
|
||||
<div id="jsdoc-footer-container">
|
||||
<p>
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 28, 2022.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
<script src="scripts/jquery.min.js"></script>
|
||||
<script src="scripts/tree.jquery.js"></script>
|
||||
<script src="scripts/prettify.js"></script>
|
||||
<script src="scripts/jsdoc-toc.js"></script>
|
||||
<script src="scripts/linenumber.js"></script>
|
||||
<script src="scripts/scrollanchor.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
997
docs/global.html
997
docs/global.html
File diff suppressed because it is too large
Load Diff
1530
docs/index.html
1530
docs/index.html
File diff suppressed because it is too large
Load Diff
@@ -6,7 +6,7 @@
|
||||
treeNode.tree({
|
||||
autoEscape: false,
|
||||
closedIcon: '⇢',
|
||||
data: [{"label":"<a href=\"global.html\">Globals</a>","id":"global","children":[]},{"label":"<a href=\"Base.html\">Base</a>","id":"Base","children":[]},{"label":"<a href=\"BusinessContact.html\">BusinessContact</a>","id":"BusinessContact","children":[]},{"label":"<a href=\"Chat.html\">Chat</a>","id":"Chat","children":[]},{"label":"<a href=\"Client.html\">Client</a>","id":"Client","children":[]},{"label":"<a href=\"ClientInfo.html\">ClientInfo</a>","id":"ClientInfo","children":[]},{"label":"<a href=\"Contact.html\">Contact</a>","id":"Contact","children":[]},{"label":"<a href=\"GroupChat.html\">GroupChat</a>","id":"GroupChat","children":[]},{"label":"<a href=\"GroupNotification.html\">GroupNotification</a>","id":"GroupNotification","children":[]},{"label":"<a href=\"Location.html\">Location</a>","id":"Location","children":[]},{"label":"<a href=\"Message.html\">Message</a>","id":"Message","children":[]},{"label":"<a href=\"MessageMedia.html\">MessageMedia</a>","id":"MessageMedia","children":[]},{"label":"<a href=\"PrivateChat.html\">PrivateChat</a>","id":"PrivateChat","children":[]},{"label":"<a href=\"PrivateContact.html\">PrivateContact</a>","id":"PrivateContact","children":[]},{"label":"<a href=\"Util.html\">Util</a>","id":"Util","children":[]}],
|
||||
data: [{"label":"<a href=\"global.html\">Globals</a>","id":"global","children":[]},{"label":"<a href=\"Base.html\">Base</a>","id":"Base","children":[]},{"label":"<a href=\"BaseAuthStrategy.html\">BaseAuthStrategy</a>","id":"BaseAuthStrategy","children":[]},{"label":"<a href=\"BusinessContact.html\">BusinessContact</a>","id":"BusinessContact","children":[]},{"label":"<a href=\"Buttons.html\">Buttons</a>","id":"Buttons","children":[]},{"label":"<a href=\"Call.html\">Call</a>","id":"Call","children":[]},{"label":"<a href=\"Chat.html\">Chat</a>","id":"Chat","children":[]},{"label":"<a href=\"Client.html\">Client</a>","id":"Client","children":[]},{"label":"<a href=\"ClientInfo.html\">ClientInfo</a>","id":"ClientInfo","children":[]},{"label":"<a href=\"Contact.html\">Contact</a>","id":"Contact","children":[]},{"label":"<a href=\"GroupChat.html\">GroupChat</a>","id":"GroupChat","children":[]},{"label":"<a href=\"GroupNotification.html\">GroupNotification</a>","id":"GroupNotification","children":[]},{"label":"<a href=\"InterfaceController.html\">InterfaceController</a>","id":"InterfaceController","children":[]},{"label":"<a href=\"Label.html\">Label</a>","id":"Label","children":[]},{"label":"<a href=\"LegacySessionAuth.html\">LegacySessionAuth</a>","id":"LegacySessionAuth","children":[]},{"label":"<a href=\"List.html\">List</a>","id":"List","children":[]},{"label":"<a href=\"LocalAuth.html\">LocalAuth</a>","id":"LocalAuth","children":[]},{"label":"<a href=\"Location.html\">Location</a>","id":"Location","children":[]},{"label":"<a href=\"Message.html\">Message</a>","id":"Message","children":[]},{"label":"<a href=\"MessageMedia.html\">MessageMedia</a>","id":"MessageMedia","children":[]},{"label":"<a href=\"NoAuth.html\">NoAuth</a>","id":"NoAuth","children":[]},{"label":"<a href=\"Order.html\">Order</a>","id":"Order","children":[]},{"label":"<a href=\"PrivateChat.html\">PrivateChat</a>","id":"PrivateChat","children":[]},{"label":"<a href=\"PrivateContact.html\">PrivateContact</a>","id":"PrivateContact","children":[]},{"label":"<a href=\"Product.html\">Product</a>","id":"Product","children":[]},{"label":"<a href=\"Util.html\">Util</a>","id":"Util","children":[]}],
|
||||
openedIcon: ' ⇣',
|
||||
saveState: false,
|
||||
useContextMenu: false
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta name="generator" content="JSDoc 3.6.7">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.2.0 » Source: structures/Base.js</title>
|
||||
<title>whatsapp-web.js 1.16.5 » Source: structures/Base.js</title>
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
||||
@@ -15,7 +15,7 @@
|
||||
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
||||
<div id="jsdoc-navbar-container">
|
||||
<div id="jsdoc-navbar-content">
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>2.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>16.<wbr>5</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -60,7 +60,7 @@ module.exports = Base;</code></pre>
|
||||
<footer id="jsdoc-footer" class="jsdoc-footer">
|
||||
<div id="jsdoc-footer-container">
|
||||
<p>
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on March 1, 2020.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 28, 2022.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta name="generator" content="JSDoc 3.6.7">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.2.0 » Source: structures/BusinessContact.js</title>
|
||||
<title>whatsapp-web.js 1.16.5 » Source: structures/BusinessContact.js</title>
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
||||
@@ -15,7 +15,7 @@
|
||||
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
||||
<div id="jsdoc-navbar-container">
|
||||
<div id="jsdoc-navbar-content">
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>2.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>16.<wbr>5</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -59,7 +59,7 @@ module.exports = BusinessContact;</code></pre>
|
||||
<footer id="jsdoc-footer" class="jsdoc-footer">
|
||||
<div id="jsdoc-footer-container">
|
||||
<p>
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on March 1, 2020.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 28, 2022.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
135
docs/structures_Buttons.js.html
Normal file
135
docs/structures_Buttons.js.html
Normal file
@@ -0,0 +1,135 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.7">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.16.5 » Source: structures/Buttons.js</title>
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
||||
<link href="css/baseline.css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<body onload="prettyPrint()">
|
||||
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
||||
<div id="jsdoc-navbar-container">
|
||||
<div id="jsdoc-navbar-content">
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>16.<wbr>5</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div id="jsdoc-body-container">
|
||||
<div id="jsdoc-content">
|
||||
<div id="jsdoc-content-container">
|
||||
<div id="jsdoc-banner" role="banner">
|
||||
</div>
|
||||
<div id="jsdoc-main" role="main">
|
||||
<header class="page-header">
|
||||
<h1>Source: structures/Buttons.js</h1>
|
||||
</header>
|
||||
<article>
|
||||
<pre class="prettyprint linenums"><code>'use strict';
|
||||
|
||||
const MessageMedia = require('./MessageMedia');
|
||||
const Util = require('../util/Util');
|
||||
|
||||
/**
|
||||
* Button spec used in Buttons constructor
|
||||
* @typedef {Object} ButtonSpec
|
||||
* @property {string=} id - Custom ID to set on the button. A random one will be generated if one is not passed.
|
||||
* @property {string} body - The text to show on the button.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} FormattedButtonSpec
|
||||
* @property {string} buttonId
|
||||
* @property {number} type
|
||||
* @property {Object} buttonText
|
||||
*/
|
||||
|
||||
/**
|
||||
* Message type buttons
|
||||
*/
|
||||
class Buttons {
|
||||
/**
|
||||
* @param {string|MessageMedia} body
|
||||
* @param {ButtonSpec[]} buttons - See {@link ButtonSpec}
|
||||
* @param {string?} title
|
||||
* @param {string?} footer
|
||||
*/
|
||||
constructor(body, buttons, title, footer) {
|
||||
/**
|
||||
* Message body
|
||||
* @type {string|MessageMedia}
|
||||
*/
|
||||
this.body = body;
|
||||
|
||||
/**
|
||||
* title of message
|
||||
* @type {string}
|
||||
*/
|
||||
this.title = title;
|
||||
|
||||
/**
|
||||
* footer of message
|
||||
* @type {string}
|
||||
*/
|
||||
this.footer = footer;
|
||||
|
||||
if (body instanceof MessageMedia) {
|
||||
this.type = 'media';
|
||||
this.title = '';
|
||||
}else{
|
||||
this.type = 'chat';
|
||||
}
|
||||
|
||||
/**
|
||||
* buttons of message
|
||||
* @type {FormattedButtonSpec[]}
|
||||
*/
|
||||
this.buttons = this._format(buttons);
|
||||
if(!this.buttons.length){ throw '[BT01] No buttons';}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates button array from simple array
|
||||
* @param {ButtonSpec[]} buttons
|
||||
* @returns {FormattedButtonSpec[]}
|
||||
* @example
|
||||
* Input: [{id:'customId',body:'button1'},{body:'button2'},{body:'button3'},{body:'button4'}]
|
||||
* Returns: [{ buttonId:'customId',buttonText:{'displayText':'button1'},type: 1 },{buttonId:'n3XKsL',buttonText:{'displayText':'button2'},type:1},{buttonId:'NDJk0a',buttonText:{'displayText':'button3'},type:1}]
|
||||
*/
|
||||
_format(buttons){
|
||||
buttons = buttons.slice(0,3); // phone users can only see 3 buttons, so lets limit this
|
||||
return buttons.map((btn) => {
|
||||
return {'buttonId':btn.id ? String(btn.id) : Util.generateHash(6),'buttonText':{'displayText':btn.body},'type':1};
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = Buttons;</code></pre>
|
||||
</article>
|
||||
</div>
|
||||
</div>
|
||||
<nav id="jsdoc-toc-nav" role="navigation"></nav>
|
||||
</div>
|
||||
</div>
|
||||
<footer id="jsdoc-footer" class="jsdoc-footer">
|
||||
<div id="jsdoc-footer-container">
|
||||
<p>
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 28, 2022.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
<script src="scripts/jquery.min.js"></script>
|
||||
<script src="scripts/tree.jquery.js"></script>
|
||||
<script src="scripts/prettify.js"></script>
|
||||
<script src="scripts/jsdoc-toc.js"></script>
|
||||
<script src="scripts/linenumber.js"></script>
|
||||
<script src="scripts/scrollanchor.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
121
docs/structures_Call.js.html
Normal file
121
docs/structures_Call.js.html
Normal file
@@ -0,0 +1,121 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.7">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.16.5 » Source: structures/Call.js</title>
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
||||
<link href="css/baseline.css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<body onload="prettyPrint()">
|
||||
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
||||
<div id="jsdoc-navbar-container">
|
||||
<div id="jsdoc-navbar-content">
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>16.<wbr>5</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div id="jsdoc-body-container">
|
||||
<div id="jsdoc-content">
|
||||
<div id="jsdoc-content-container">
|
||||
<div id="jsdoc-banner" role="banner">
|
||||
</div>
|
||||
<div id="jsdoc-main" role="main">
|
||||
<header class="page-header">
|
||||
<h1>Source: structures/Call.js</h1>
|
||||
</header>
|
||||
<article>
|
||||
<pre class="prettyprint linenums"><code>'use strict';
|
||||
|
||||
const Base = require('./Base');
|
||||
|
||||
/**
|
||||
* Represents a Call on WhatsApp
|
||||
* @extends {Base}
|
||||
*/
|
||||
class Call extends Base {
|
||||
constructor(client, data) {
|
||||
super(client);
|
||||
|
||||
if (data) this._patch(data);
|
||||
}
|
||||
|
||||
_patch(data) {
|
||||
/**
|
||||
* Call ID
|
||||
* @type {string}
|
||||
*/
|
||||
this.id = data.id;
|
||||
/**
|
||||
* From
|
||||
* @type {string}
|
||||
*/
|
||||
this.from = data.peerJid;
|
||||
/**
|
||||
* Unix timestamp for when the call was created
|
||||
* @type {number}
|
||||
*/
|
||||
this.timestamp = data.offerTime;
|
||||
/**
|
||||
* Is video
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.isVideo = data.isVideo;
|
||||
/**
|
||||
* Is Group
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.isGroup = data.isGroup;
|
||||
/**
|
||||
* Indicates if the call was sent by the current user
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.fromMe = data.outgoing;
|
||||
/**
|
||||
* Indicates if the call can be handled in waweb
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.canHandleLocally = data.canHandleLocally;
|
||||
/**
|
||||
* Indicates if the call Should be handled in waweb
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.webClientShouldHandle = data.webClientShouldHandle;
|
||||
/**
|
||||
* Object with participants
|
||||
* @type {object}
|
||||
*/
|
||||
this.participants = data.participants;
|
||||
|
||||
return super._patch(data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = Call;</code></pre>
|
||||
</article>
|
||||
</div>
|
||||
</div>
|
||||
<nav id="jsdoc-toc-nav" role="navigation"></nav>
|
||||
</div>
|
||||
</div>
|
||||
<footer id="jsdoc-footer" class="jsdoc-footer">
|
||||
<div id="jsdoc-footer-container">
|
||||
<p>
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 28, 2022.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
<script src="scripts/jquery.min.js"></script>
|
||||
<script src="scripts/tree.jquery.js"></script>
|
||||
<script src="scripts/prettify.js"></script>
|
||||
<script src="scripts/jsdoc-toc.js"></script>
|
||||
<script src="scripts/linenumber.js"></script>
|
||||
<script src="scripts/scrollanchor.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -2,9 +2,9 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta name="generator" content="JSDoc 3.6.7">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.2.0 » Source: structures/Chat.js</title>
|
||||
<title>whatsapp-web.js 1.16.5 » Source: structures/Chat.js</title>
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
||||
@@ -15,7 +15,7 @@
|
||||
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
||||
<div id="jsdoc-navbar-container">
|
||||
<div id="jsdoc-navbar-content">
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>2.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>16.<wbr>5</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -77,7 +77,7 @@ class Chat extends Base {
|
||||
this.unreadCount = data.unreadCount;
|
||||
|
||||
/**
|
||||
* Unix timestamp for when the chat was created
|
||||
* Unix timestamp for when the last activity occurred
|
||||
* @type {number}
|
||||
*/
|
||||
this.timestamp = data.t;
|
||||
@@ -88,13 +88,31 @@ class Chat extends Base {
|
||||
*/
|
||||
this.archived = data.archive;
|
||||
|
||||
/**
|
||||
* Indicates if the Chat is pinned
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.pinned = !!data.pin;
|
||||
|
||||
/**
|
||||
* Indicates if the chat is muted or not
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.isMuted = data.isMuted;
|
||||
|
||||
/**
|
||||
* Unix timestamp for when the mute expires
|
||||
* @type {number}
|
||||
*/
|
||||
this.muteExpiration = data.muteExpiration;
|
||||
|
||||
return super._patch(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a message to this chat
|
||||
* @param {string|MessageMedia|Location} content
|
||||
* @param {object} options
|
||||
* @param {MessageSendOptions} [options]
|
||||
* @returns {Promise&lt;Message>} Message that was just sent
|
||||
*/
|
||||
async sendMessage(content, options) {
|
||||
@@ -143,36 +161,77 @@ class Chat extends Base {
|
||||
return this.client.unarchiveChat(this.id._serialized);
|
||||
}
|
||||
|
||||
/**
|
||||
* Pins this chat
|
||||
* @returns {Promise&lt;boolean>} New pin state. Could be false if the max number of pinned chats was reached.
|
||||
*/
|
||||
async pin() {
|
||||
return this.client.pinChat(this.id._serialized);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unpins this chat
|
||||
* @returns {Promise&lt;boolean>} New pin state
|
||||
*/
|
||||
async unpin() {
|
||||
return this.client.unpinChat(this.id._serialized);
|
||||
}
|
||||
|
||||
/**
|
||||
* Mutes this chat forever, unless a date is specified
|
||||
* @param {?Date} unmuteDate Date at which the Chat will be unmuted, leave as is to mute forever
|
||||
*/
|
||||
async mute(unmuteDate) {
|
||||
return this.client.muteChat(this.id._serialized, unmuteDate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unmutes this chat
|
||||
*/
|
||||
async unmute() {
|
||||
return this.client.unmuteChat(this.id._serialized);
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark this chat as unread
|
||||
*/
|
||||
async markUnread(){
|
||||
return this.client.markChatUnread(this.id._serialized);
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads chat messages, sorted from earliest to latest.
|
||||
* @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.
|
||||
* @param {Number} [searchOptions.limit] The amount of messages to return. If no limit is specified, the available messages will be returned. Note that the actual number of returned messages may be smaller if there aren't enough messages in the conversation. Set this to Infinity to load all messages.
|
||||
* @returns {Promise&lt;Array&lt;Message>>}
|
||||
*/
|
||||
async fetchMessages(searchOptions) {
|
||||
if(!searchOptions || !searchOptions.limit) {
|
||||
searchOptions = {limit: 50};
|
||||
}
|
||||
let messages = await this.client.pupPage.evaluate(async (chatId, limit) => {
|
||||
let messages = await this.client.pupPage.evaluate(async (chatId, searchOptions) => {
|
||||
const msgFilter = m => !m.isNotification; // dont include notification messages
|
||||
|
||||
|
||||
const chat = window.Store.Chat.get(chatId);
|
||||
let msgs = chat.msgs.models.filter(msgFilter);
|
||||
|
||||
while(msgs.length &lt; limit) {
|
||||
const loadedMessages = await chat.loadEarlierMsgs();
|
||||
if(!loadedMessages) break;
|
||||
msgs = [...msgs, ...loadedMessages.filter(msgFilter)];
|
||||
|
||||
if (searchOptions &amp;&amp; searchOptions.limit > 0) {
|
||||
while (msgs.length &lt; searchOptions.limit) {
|
||||
const loadedMessages = await chat.loadEarlierMsgs();
|
||||
if (!loadedMessages) break;
|
||||
msgs = [...loadedMessages.filter(msgFilter), ...msgs];
|
||||
}
|
||||
|
||||
if (msgs.length > searchOptions.limit) {
|
||||
msgs.sort((a, b) => (a.t > b.t) ? 1 : -1);
|
||||
msgs = msgs.splice(msgs.length - searchOptions.limit);
|
||||
}
|
||||
}
|
||||
|
||||
return msgs.splice(0, limit).map(m => m.serialize());
|
||||
return msgs.map(m => window.WWebJS.getMessageModel(m));
|
||||
|
||||
}, this.id._serialized, searchOptions.limit);
|
||||
}, this.id._serialized, searchOptions);
|
||||
|
||||
messages.sort((a, b) => (a.t > b.t) ? 1 : -1);
|
||||
return messages.map(m => new Message(this.client, m));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Simulate typing in chat. This will last for 25 seconds.
|
||||
*/
|
||||
@@ -182,7 +241,7 @@ class Chat extends Base {
|
||||
return true;
|
||||
}, this.id._serialized);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Simulate recording audio in chat. This will last for 25 seconds.
|
||||
*/
|
||||
@@ -202,6 +261,22 @@ class Chat extends Base {
|
||||
return true;
|
||||
}, this.id._serialized);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Contact that corresponds to this Chat.
|
||||
* @returns {Promise&lt;Contact>}
|
||||
*/
|
||||
async getContact() {
|
||||
return await this.client.getContactById(this.id._serialized);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns array of all Labels assigned to this Chat
|
||||
* @returns {Promise&lt;Array&lt;Label>>}
|
||||
*/
|
||||
async getLabels() {
|
||||
return this.client.getChatLabels(this.id._serialized);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Chat;
|
||||
@@ -215,7 +290,7 @@ module.exports = Chat;
|
||||
<footer id="jsdoc-footer" class="jsdoc-footer">
|
||||
<div id="jsdoc-footer-container">
|
||||
<p>
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on March 1, 2020.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 28, 2022.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta name="generator" content="JSDoc 3.6.7">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.2.0 » Source: structures/ClientInfo.js</title>
|
||||
<title>whatsapp-web.js 1.16.5 » Source: structures/ClientInfo.js</title>
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
||||
@@ -15,7 +15,7 @@
|
||||
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
||||
<div id="jsdoc-navbar-container">
|
||||
<div id="jsdoc-navbar-content">
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>2.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>16.<wbr>5</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -41,7 +41,7 @@ class ClientInfo extends Base {
|
||||
constructor(client, data) {
|
||||
super(client);
|
||||
|
||||
if(data) this._patch(data);
|
||||
if (data) this._patch(data);
|
||||
}
|
||||
|
||||
_patch(data) {
|
||||
@@ -55,21 +55,28 @@ class ClientInfo extends Base {
|
||||
* Current user ID
|
||||
* @type {object}
|
||||
*/
|
||||
this.me = data.me;
|
||||
this.wid = data.wid;
|
||||
|
||||
/**
|
||||
* Information about the phone this client is connected to
|
||||
* @type {object}
|
||||
* @deprecated Use .wid instead
|
||||
*/
|
||||
this.me = data.wid;
|
||||
|
||||
/**
|
||||
* Information about the phone this client is connected to. Not available in multi-device.
|
||||
* @type {object}
|
||||
* @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
|
||||
* @deprecated
|
||||
*/
|
||||
this.phone = data.phone;
|
||||
|
||||
/**
|
||||
* Platform the phone is running on
|
||||
* Platform WhatsApp is running on
|
||||
* @type {string}
|
||||
*/
|
||||
this.platform = data.platform;
|
||||
@@ -77,6 +84,19 @@ class ClientInfo extends Base {
|
||||
return super._patch(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current battery percentage and charging status for the attached device
|
||||
* @returns {object} batteryStatus
|
||||
* @returns {number} batteryStatus.battery - The current battery percentage
|
||||
* @returns {boolean} batteryStatus.plugged - Indicates if the phone is plugged in (true) or not (false)
|
||||
* @deprecated
|
||||
*/
|
||||
async getBatteryStatus() {
|
||||
return await this.client.pupPage.evaluate(() => {
|
||||
const { battery, plugged } = window.Store.Conn;
|
||||
return { battery, plugged };
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ClientInfo;</code></pre>
|
||||
@@ -89,7 +109,7 @@ module.exports = ClientInfo;</code></pre>
|
||||
<footer id="jsdoc-footer" class="jsdoc-footer">
|
||||
<div id="jsdoc-footer-container">
|
||||
<p>
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on March 1, 2020.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 28, 2022.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta name="generator" content="JSDoc 3.6.7">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.2.0 » Source: structures/Contact.js</title>
|
||||
<title>whatsapp-web.js 1.16.5 » Source: structures/Contact.js</title>
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
||||
@@ -15,7 +15,7 @@
|
||||
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
||||
<div id="jsdoc-navbar-container">
|
||||
<div id="jsdoc-navbar-content">
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>2.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>16.<wbr>5</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -33,6 +33,14 @@
|
||||
|
||||
const Base = require('./Base');
|
||||
|
||||
/**
|
||||
* ID that represents a contact
|
||||
* @typedef {Object} ContactId
|
||||
* @property {string} server
|
||||
* @property {string} user
|
||||
* @property {string} _serialized
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents a Contact on WhatsApp
|
||||
* @extends {Base}
|
||||
@@ -47,7 +55,7 @@ class Contact extends Base {
|
||||
_patch(data) {
|
||||
/**
|
||||
* ID that represents the contact
|
||||
* @type {object}
|
||||
* @type {ContactId}
|
||||
*/
|
||||
this.id = data.id;
|
||||
|
||||
@@ -126,6 +134,12 @@ class Contact extends Base {
|
||||
*/
|
||||
this.isMyContact = data.isMyContact;
|
||||
|
||||
/**
|
||||
* Indicates if you have blocked this contact
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.isBlocked = data.isBlocked;
|
||||
|
||||
return super._patch(data);
|
||||
}
|
||||
|
||||
@@ -134,16 +148,94 @@ class Contact extends Base {
|
||||
* @returns {Promise&lt;string>}
|
||||
*/
|
||||
async getProfilePicUrl() {
|
||||
const profilePic = await this.client.pupPage.evaluate((contactId) => {
|
||||
return window.Store.Wap.profilePicFind(contactId);
|
||||
return await this.client.getProfilePicUrl(this.id._serialized);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the contact's formatted phone number, (12345678901@c.us) => (+1 (234) 5678-901)
|
||||
* @returns {Promise&lt;string>}
|
||||
*/
|
||||
async getFormattedNumber() {
|
||||
return await this.client.getFormattedNumber(this.id._serialized);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the contact's countrycode, (1541859685@c.us) => (1)
|
||||
* @returns {Promise&lt;string>}
|
||||
*/
|
||||
async getCountryCode() {
|
||||
return await this.client.getCountryCode(this.id._serialized);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Chat that corresponds to this Contact.
|
||||
* Will return null when getting chat for currently logged in user.
|
||||
* @returns {Promise&lt;Chat>}
|
||||
*/
|
||||
async getChat() {
|
||||
if(this.isMe) return null;
|
||||
|
||||
return await this.client.getChatById(this.id._serialized);
|
||||
}
|
||||
|
||||
/**
|
||||
* Blocks this contact from WhatsApp
|
||||
* @returns {Promise&lt;boolean>}
|
||||
*/
|
||||
async block() {
|
||||
if(this.isGroup) return false;
|
||||
|
||||
await this.client.pupPage.evaluate(async (contactId) => {
|
||||
const contact = window.Store.Contact.get(contactId);
|
||||
await window.Store.BlockContact.blockContact(contact);
|
||||
}, this.id._serialized);
|
||||
|
||||
return profilePic ? profilePic.eurl : undefined;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unblocks this contact from WhatsApp
|
||||
* @returns {Promise&lt;boolean>}
|
||||
*/
|
||||
async unblock() {
|
||||
if(this.isGroup) return false;
|
||||
|
||||
await this.client.pupPage.evaluate(async (contactId) => {
|
||||
const contact = window.Store.Contact.get(contactId);
|
||||
await window.Store.BlockContact.unblockContact(contact);
|
||||
}, this.id._serialized);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Contact's current "about" info. Returns null if you don't have permission to read their status.
|
||||
* @returns {Promise&lt;?string>}
|
||||
*/
|
||||
async getAbout() {
|
||||
const about = await this.client.pupPage.evaluate(async (contactId) => {
|
||||
const wid = window.Store.WidFactory.createWid(contactId);
|
||||
return window.Store.StatusUtils.getStatus(wid);
|
||||
}, this.id._serialized);
|
||||
|
||||
if (typeof about.status !== 'string')
|
||||
return null;
|
||||
|
||||
return about.status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Contact's common groups with you. Returns empty array if you don't have any common group.
|
||||
* @returns {Promise&lt;WAWebJS.ChatId[]>}
|
||||
*/
|
||||
async getCommonGroups() {
|
||||
return await this.client.getCommonGroups(this.id._serialized);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = Contact;</code></pre>
|
||||
module.exports = Contact;
|
||||
</code></pre>
|
||||
</article>
|
||||
</div>
|
||||
</div>
|
||||
@@ -153,7 +245,7 @@ module.exports = Contact;</code></pre>
|
||||
<footer id="jsdoc-footer" class="jsdoc-footer">
|
||||
<div id="jsdoc-footer-container">
|
||||
<p>
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on March 1, 2020.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 28, 2022.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta name="generator" content="JSDoc 3.6.7">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.2.0 » Source: structures/GroupChat.js</title>
|
||||
<title>whatsapp-web.js 1.16.5 » Source: structures/GroupChat.js</title>
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
||||
@@ -15,7 +15,7 @@
|
||||
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
||||
<div id="jsdoc-navbar-container">
|
||||
<div id="jsdoc-navbar-content">
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>2.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>16.<wbr>5</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -33,6 +33,14 @@
|
||||
|
||||
const Chat = require('./Chat');
|
||||
|
||||
/**
|
||||
* Group participant information
|
||||
* @typedef {Object} GroupParticipant
|
||||
* @property {ContactId} id
|
||||
* @property {boolean} isAdmin
|
||||
* @property {boolean} isSuperAdmin
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents a Group Chat on WhatsApp
|
||||
* @extends {Chat}
|
||||
@@ -46,6 +54,7 @@ class GroupChat extends Chat {
|
||||
|
||||
/**
|
||||
* Gets the group owner
|
||||
* @type {ContactId}
|
||||
*/
|
||||
get owner() {
|
||||
return this.groupMetadata.owner;
|
||||
@@ -66,9 +75,10 @@ class GroupChat extends Chat {
|
||||
get description() {
|
||||
return this.groupMetadata.desc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the group participants
|
||||
* @type {array}
|
||||
* @type {Array&lt;GroupParticipant>}
|
||||
*/
|
||||
get participants() {
|
||||
return this.groupMetadata.participants;
|
||||
@@ -77,123 +87,176 @@ class GroupChat extends Chat {
|
||||
/**
|
||||
* Adds a list of participants by ID to the group
|
||||
* @param {Array&lt;string>} participantIds
|
||||
* @returns {Promise&lt;Object>}
|
||||
*/
|
||||
async addParticipants(participantIds) {
|
||||
return await this.client.pupPage.evaluate((chatId, participantIds) => {
|
||||
return window.Store.Wap.addParticipants(chatId, participantIds);
|
||||
const chatWid = window.Store.WidFactory.createWid(chatId);
|
||||
const participantWids = participantIds.map(p => window.Store.WidFactory.createWid(p));
|
||||
return window.Store.GroupParticipants.sendAddParticipants(chatWid, participantWids);
|
||||
}, this.id._serialized, participantIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a list of participants by ID to the group
|
||||
* @param {Array&lt;string>} participantIds
|
||||
* @returns {Promise&lt;Object>}
|
||||
*/
|
||||
async removeParticipants(participantIds) {
|
||||
return await this.client.pupPage.evaluate((chatId, participantIds) => {
|
||||
return window.Store.Wap.removeParticipants(chatId, participantIds);
|
||||
const chatWid = window.Store.WidFactory.createWid(chatId);
|
||||
const participantWids = participantIds.map(p => window.Store.WidFactory.createWid(p));
|
||||
return window.Store.GroupParticipants.sendRemoveParticipants(chatWid, participantWids);
|
||||
}, this.id._serialized, participantIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* Promotes participants by IDs to admins
|
||||
* @param {Array&lt;string>} participantIds
|
||||
* @returns {Promise&lt;{ status: number }>} Object with status code indicating if the operation was successful
|
||||
*/
|
||||
async promoteParticipants(participantIds) {
|
||||
return await this.client.pupPage.evaluate((chatId, participantIds) => {
|
||||
return window.Store.Wap.promoteParticipants(chatId, participantIds);
|
||||
const chatWid = window.Store.WidFactory.createWid(chatId);
|
||||
const participantWids = participantIds.map(p => window.Store.WidFactory.createWid(p));
|
||||
return window.Store.GroupParticipants.sendPromoteParticipants(chatWid, participantWids);
|
||||
}, this.id._serialized, participantIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* Demotes participants by IDs to regular users
|
||||
* @param {Array&lt;string>} participantIds
|
||||
* @returns {Promise&lt;{ status: number }>} Object with status code indicating if the operation was successful
|
||||
*/
|
||||
async demoteParticipants(participantIds) {
|
||||
return await this.client.pupPage.evaluate((chatId, participantIds) => {
|
||||
return window.Store.Wap.demoteParticipants(chatId, participantIds);
|
||||
const chatWid = window.Store.WidFactory.createWid(chatId);
|
||||
const participantWids = participantIds.map(p => window.Store.WidFactory.createWid(p));
|
||||
return window.Store.GroupParticipants.sendDemoteParticipants(chatWid, participantWids);
|
||||
}, this.id._serialized, participantIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the group subject
|
||||
* @param {string} subject
|
||||
* @returns {Promise&lt;boolean>} Returns true if the subject was properly updated. This can return false if the user does not have the necessary permissions.
|
||||
*/
|
||||
async setSubject(subject) {
|
||||
let res = await this.client.pupPage.evaluate((chatId, subject) => {
|
||||
return window.Store.Wap.changeSubject(chatId, subject);
|
||||
const success = await this.client.pupPage.evaluate(async (chatId, subject) => {
|
||||
const chatWid = window.Store.WidFactory.createWid(chatId);
|
||||
try {
|
||||
return await window.Store.GroupUtils.sendSetGroupSubject(chatWid, subject);
|
||||
} catch (err) {
|
||||
if(err.name === 'ServerStatusCodeError') return false;
|
||||
throw err;
|
||||
}
|
||||
}, this.id._serialized, subject);
|
||||
|
||||
if(res.status == 200) {
|
||||
this.name = subject;
|
||||
}
|
||||
if(!success) return false;
|
||||
this.name = subject;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the group description
|
||||
* @param {string} description
|
||||
* @returns {Promise&lt;boolean>} Returns true if the description was properly updated. This can return false if the user does not have the necessary permissions.
|
||||
*/
|
||||
async setDescription(description) {
|
||||
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);
|
||||
const success = await this.client.pupPage.evaluate(async (chatId, description) => {
|
||||
const chatWid = window.Store.WidFactory.createWid(chatId);
|
||||
let descId = window.Store.GroupMetadata.get(chatWid).descId;
|
||||
try {
|
||||
return await window.Store.GroupUtils.sendSetGroupDescription(chatWid, description, window.Store.MsgKey.newId(), descId);
|
||||
} catch (err) {
|
||||
if(err.name === 'ServerStatusCodeError') return false;
|
||||
throw err;
|
||||
}
|
||||
}, this.id._serialized, description);
|
||||
|
||||
if (res.status == 200) {
|
||||
this.groupMetadata.desc = description;
|
||||
}
|
||||
if(!success) return false;
|
||||
this.groupMetadata.desc = description;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the group settings to only allow admins to send messages.
|
||||
* @param {boolean} [adminsOnly=true] Enable or disable this option
|
||||
* @returns {Promise&lt;boolean>} Returns true if the setting was properly updated. This can return false if the user does not have the necessary permissions.
|
||||
*/
|
||||
async setMessagesAdminsOnly(adminsOnly=true) {
|
||||
const success = await this.client.pupPage.evaluate(async (chatId, adminsOnly) => {
|
||||
const chatWid = window.Store.WidFactory.createWid(chatId);
|
||||
try {
|
||||
return await window.Store.GroupUtils.sendSetGroupProperty(chatWid, 'announcement', adminsOnly ? 1 : 0);
|
||||
} catch (err) {
|
||||
if(err.name === 'ServerStatusCodeError') return false;
|
||||
throw err;
|
||||
}
|
||||
}, this.id._serialized, adminsOnly);
|
||||
|
||||
if(!success) return false;
|
||||
|
||||
this.groupMetadata.announce = adminsOnly;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the group settings to only allow admins to edit group info (title, description, photo).
|
||||
* @param {boolean} [adminsOnly=true] Enable or disable this option
|
||||
* @returns {Promise&lt;boolean>} Returns true if the setting was properly updated. This can return false if the user does not have the necessary permissions.
|
||||
*/
|
||||
async setInfoAdminsOnly(adminsOnly=true) {
|
||||
const success = await this.client.pupPage.evaluate(async (chatId, adminsOnly) => {
|
||||
const chatWid = window.Store.WidFactory.createWid(chatId);
|
||||
try {
|
||||
return await window.Store.GroupUtils.sendSetGroupProperty(chatWid, 'restrict', adminsOnly ? 1 : 0);
|
||||
} catch (err) {
|
||||
if(err.name === 'ServerStatusCodeError') return false;
|
||||
throw err;
|
||||
}
|
||||
}, this.id._serialized, adminsOnly);
|
||||
|
||||
if(!success) return false;
|
||||
|
||||
this.groupMetadata.restrict = adminsOnly;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the invite code for a specific group
|
||||
* @returns {Promise&lt;string>} Group's invite code
|
||||
*/
|
||||
async getInviteCode() {
|
||||
let res = await this.client.pupPage.evaluate(chatId => {
|
||||
return window.Store.Wap.groupInviteCode(chatId);
|
||||
const code = await this.client.pupPage.evaluate(async chatId => {
|
||||
const chatWid = window.Store.WidFactory.createWid(chatId);
|
||||
return window.Store.Invite.sendQueryGroupInviteCode(chatWid);
|
||||
}, this.id._serialized);
|
||||
|
||||
if (res.status == 200) {
|
||||
return res.code;
|
||||
}
|
||||
|
||||
throw new Error('Not authorized');
|
||||
return code;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invalidates the current group invite code and generates a new one
|
||||
* @returns {Promise&lt;string>} New invite code
|
||||
*/
|
||||
async revokeInvite() {
|
||||
return await this.client.pupPage.evaluate(chatId => {
|
||||
return window.Store.Wap.revokeGroupInvite(chatId);
|
||||
const code = await this.client.pupPage.evaluate(chatId => {
|
||||
const chatWid = window.Store.WidFactory.createWid(chatId);
|
||||
return window.Store.Invite.sendRevokeGroupInviteCode(chatWid);
|
||||
}, this.id._serialized);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an object with information about the invite code's group
|
||||
* @param {string} inviteCode
|
||||
* @returns {Promise&lt;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);
|
||||
return code;
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes the bot leave the group
|
||||
* @returns {Promise}
|
||||
*/
|
||||
async leave() {
|
||||
return await this.client.pupPage.evaluate(chatId => {
|
||||
return window.Store.Wap.leaveGroup(chatId);
|
||||
await this.client.pupPage.evaluate(chatId => {
|
||||
const chatWid = window.Store.WidFactory.createWid(chatId);
|
||||
return window.Store.GroupUtils.sendExitGroup(chatWid);
|
||||
}, this.id._serialized);
|
||||
}
|
||||
|
||||
@@ -209,7 +272,7 @@ module.exports = GroupChat;</code></pre>
|
||||
<footer id="jsdoc-footer" class="jsdoc-footer">
|
||||
<div id="jsdoc-footer-container">
|
||||
<p>
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on March 1, 2020.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 28, 2022.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta name="generator" content="JSDoc 3.6.7">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.2.0 » Source: structures/GroupNotification.js</title>
|
||||
<title>whatsapp-web.js 1.16.5 » Source: structures/GroupNotification.js</title>
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
||||
@@ -15,7 +15,7 @@
|
||||
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
||||
<div id="jsdoc-navbar-container">
|
||||
<div id="jsdoc-navbar-content">
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>2.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>16.<wbr>5</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -74,7 +74,7 @@ class GroupNotification extends Base {
|
||||
*
|
||||
* @type {string}
|
||||
*/
|
||||
this.chatId = typeof (data.to) === 'object' ? data.to._serialized : data.to;
|
||||
this.chatId = typeof (data.id.remote) === 'object' ? data.id.remote._serialized : data.id.remote;
|
||||
|
||||
/**
|
||||
* ContactId for the user that produced the GroupNotification.
|
||||
@@ -143,7 +143,7 @@ module.exports = GroupNotification;
|
||||
<footer id="jsdoc-footer" class="jsdoc-footer">
|
||||
<div id="jsdoc-footer-container">
|
||||
<p>
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on March 1, 2020.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 28, 2022.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
103
docs/structures_Label.js.html
Normal file
103
docs/structures_Label.js.html
Normal file
@@ -0,0 +1,103 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.7">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.16.5 » Source: structures/Label.js</title>
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
||||
<link href="css/baseline.css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<body onload="prettyPrint()">
|
||||
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
||||
<div id="jsdoc-navbar-container">
|
||||
<div id="jsdoc-navbar-content">
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>16.<wbr>5</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div id="jsdoc-body-container">
|
||||
<div id="jsdoc-content">
|
||||
<div id="jsdoc-content-container">
|
||||
<div id="jsdoc-banner" role="banner">
|
||||
</div>
|
||||
<div id="jsdoc-main" role="main">
|
||||
<header class="page-header">
|
||||
<h1>Source: structures/Label.js</h1>
|
||||
</header>
|
||||
<article>
|
||||
<pre class="prettyprint linenums"><code>'use strict';
|
||||
|
||||
const Base = require('./Base');
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const Chat = require('./Chat');
|
||||
|
||||
/**
|
||||
* WhatsApp Business Label information
|
||||
*/
|
||||
class Label extends Base {
|
||||
/**
|
||||
* @param {Base} client
|
||||
* @param {object} labelData
|
||||
*/
|
||||
constructor(client, labelData){
|
||||
super(client);
|
||||
|
||||
if(labelData) this._patch(labelData);
|
||||
}
|
||||
|
||||
_patch(labelData){
|
||||
/**
|
||||
* Label ID
|
||||
* @type {string}
|
||||
*/
|
||||
this.id = labelData.id;
|
||||
|
||||
/**
|
||||
* Label name
|
||||
* @type {string}
|
||||
*/
|
||||
this.name = labelData.name;
|
||||
|
||||
/**
|
||||
* Label hex color
|
||||
* @type {string}
|
||||
*/
|
||||
this.hexColor = labelData.hexColor;
|
||||
}
|
||||
/**
|
||||
* Get all chats that have been assigned this Label
|
||||
* @returns {Promise&lt;Array&lt;Chat>>}
|
||||
*/
|
||||
async getChats(){
|
||||
return this.client.getChatsByLabelId(this.id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = Label;</code></pre>
|
||||
</article>
|
||||
</div>
|
||||
</div>
|
||||
<nav id="jsdoc-toc-nav" role="navigation"></nav>
|
||||
</div>
|
||||
</div>
|
||||
<footer id="jsdoc-footer" class="jsdoc-footer">
|
||||
<div id="jsdoc-footer-container">
|
||||
<p>
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 28, 2022.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
<script src="scripts/jquery.min.js"></script>
|
||||
<script src="scripts/tree.jquery.js"></script>
|
||||
<script src="scripts/prettify.js"></script>
|
||||
<script src="scripts/jsdoc-toc.js"></script>
|
||||
<script src="scripts/linenumber.js"></script>
|
||||
<script src="scripts/scrollanchor.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
133
docs/structures_List.js.html
Normal file
133
docs/structures_List.js.html
Normal file
@@ -0,0 +1,133 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.7">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.16.5 » Source: structures/List.js</title>
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
||||
<link href="css/baseline.css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<body onload="prettyPrint()">
|
||||
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
||||
<div id="jsdoc-navbar-container">
|
||||
<div id="jsdoc-navbar-content">
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>16.<wbr>5</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div id="jsdoc-body-container">
|
||||
<div id="jsdoc-content">
|
||||
<div id="jsdoc-content-container">
|
||||
<div id="jsdoc-banner" role="banner">
|
||||
</div>
|
||||
<div id="jsdoc-main" role="main">
|
||||
<header class="page-header">
|
||||
<h1>Source: structures/List.js</h1>
|
||||
</header>
|
||||
<article>
|
||||
<pre class="prettyprint linenums"><code>'use strict';
|
||||
|
||||
const Util = require('../util/Util');
|
||||
|
||||
/**
|
||||
* Message type List
|
||||
*/
|
||||
class List {
|
||||
/**
|
||||
* @param {string} body
|
||||
* @param {string} buttonText
|
||||
* @param {Array&lt;any>} sections
|
||||
* @param {string?} title
|
||||
* @param {string?} footer
|
||||
*/
|
||||
constructor(body, buttonText, sections, title, footer) {
|
||||
/**
|
||||
* Message body
|
||||
* @type {string}
|
||||
*/
|
||||
this.description = body;
|
||||
|
||||
/**
|
||||
* List button text
|
||||
* @type {string}
|
||||
*/
|
||||
this.buttonText = buttonText;
|
||||
|
||||
/**
|
||||
* title of message
|
||||
* @type {string}
|
||||
*/
|
||||
this.title = title;
|
||||
|
||||
|
||||
/**
|
||||
* footer of message
|
||||
* @type {string}
|
||||
*/
|
||||
this.footer = footer;
|
||||
|
||||
/**
|
||||
* sections of message
|
||||
* @type {Array&lt;any>}
|
||||
*/
|
||||
this.sections = this._format(sections);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates section array from simple array
|
||||
* @param {Array&lt;any>} sections
|
||||
* @returns {Array&lt;any>}
|
||||
* @example
|
||||
* Input: [{title:'sectionTitle',rows:[{id:'customId', title:'ListItem2', description: 'desc'},{title:'ListItem2'}]}}]
|
||||
* Returns: [{'title':'sectionTitle','rows':[{'rowId':'customId','title':'ListItem1','description':'desc'},{'rowId':'oGSRoD','title':'ListItem2','description':''}]}]
|
||||
*/
|
||||
_format(sections){
|
||||
if(!sections.length){throw '[LT02] List without sections';}
|
||||
if(sections.length > 1 &amp;&amp; sections.filter(s => typeof s.title == 'undefined').length > 1){throw '[LT05] You can\'t have more than one empty title.';}
|
||||
return sections.map( (section) =>{
|
||||
if(!section.rows.length){throw '[LT03] Section without rows';}
|
||||
return {
|
||||
title: section.title ? section.title : undefined,
|
||||
rows: section.rows.map( (row) => {
|
||||
if(!row.title){throw '[LT04] Row without title';}
|
||||
return {
|
||||
rowId: row.id ? row.id : Util.generateHash(6),
|
||||
title: row.title,
|
||||
description: row.description ? row.description : ''
|
||||
};
|
||||
})
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = List;
|
||||
</code></pre>
|
||||
</article>
|
||||
</div>
|
||||
</div>
|
||||
<nav id="jsdoc-toc-nav" role="navigation"></nav>
|
||||
</div>
|
||||
</div>
|
||||
<footer id="jsdoc-footer" class="jsdoc-footer">
|
||||
<div id="jsdoc-footer-container">
|
||||
<p>
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 28, 2022.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
<script src="scripts/jquery.min.js"></script>
|
||||
<script src="scripts/tree.jquery.js"></script>
|
||||
<script src="scripts/prettify.js"></script>
|
||||
<script src="scripts/jsdoc-toc.js"></script>
|
||||
<script src="scripts/linenumber.js"></script>
|
||||
<script src="scripts/scrollanchor.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -2,9 +2,9 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta name="generator" content="JSDoc 3.6.7">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.2.0 » Source: structures/Location.js</title>
|
||||
<title>whatsapp-web.js 1.16.5 » Source: structures/Location.js</title>
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
||||
@@ -15,7 +15,7 @@
|
||||
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
||||
<div id="jsdoc-navbar-container">
|
||||
<div id="jsdoc-navbar-content">
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>2.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>16.<wbr>5</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -71,7 +71,7 @@ module.exports = Location;</code></pre>
|
||||
<footer id="jsdoc-footer" class="jsdoc-footer">
|
||||
<div id="jsdoc-footer-container">
|
||||
<p>
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on March 1, 2020.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 28, 2022.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta name="generator" content="JSDoc 3.6.7">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.2.0 » Source: structures/Message.js</title>
|
||||
<title>whatsapp-web.js 1.16.5 » Source: structures/Message.js</title>
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
||||
@@ -15,7 +15,7 @@
|
||||
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
||||
<div id="jsdoc-navbar-container">
|
||||
<div id="jsdoc-navbar-content">
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>2.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>16.<wbr>5</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -34,6 +34,8 @@
|
||||
const Base = require('./Base');
|
||||
const MessageMedia = require('./MessageMedia');
|
||||
const Location = require('./Location');
|
||||
const Order = require('./Order');
|
||||
const Payment = require('./Payment');
|
||||
const { MessageTypes } = require('../util/Constants');
|
||||
|
||||
/**
|
||||
@@ -44,21 +46,35 @@ class Message extends Base {
|
||||
constructor(client, data) {
|
||||
super(client);
|
||||
|
||||
if(data) this._patch(data);
|
||||
if (data) this._patch(data);
|
||||
}
|
||||
|
||||
_patch(data) {
|
||||
this._data = data;
|
||||
|
||||
/**
|
||||
* MediaKey that represents the sticker 'ID'
|
||||
* @type {string}
|
||||
*/
|
||||
this.mediaKey = data.mediaKey;
|
||||
|
||||
/**
|
||||
* ID that represents the message
|
||||
* @type {object}
|
||||
*/
|
||||
this.id = data.id;
|
||||
|
||||
/**
|
||||
* ACK status for the message
|
||||
* @type {MessageAck}
|
||||
*/
|
||||
this.ack = data.ack;
|
||||
|
||||
/**
|
||||
* Indicates if the message has media available for download
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.hasMedia = data.clientUrl ? true : false;
|
||||
this.hasMedia = Boolean(data.mediaKey &amp;&amp; data.directPath);
|
||||
|
||||
/**
|
||||
* Message content
|
||||
@@ -66,7 +82,7 @@ class Message extends Base {
|
||||
*/
|
||||
this.body = this.hasMedia ? data.caption || '' : data.body || '';
|
||||
|
||||
/**
|
||||
/**
|
||||
* Message type
|
||||
* @type {MessageTypes}
|
||||
*/
|
||||
@@ -82,22 +98,28 @@ class Message extends Base {
|
||||
* ID for the Chat that this message was sent to, except if the message was sent by the current user.
|
||||
* @type {string}
|
||||
*/
|
||||
this.from = typeof (data.from) === 'object' ? data.from._serialized : data.from;
|
||||
this.from = (typeof (data.from) === 'object' &amp;&amp; data.from !== null) ? 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.
|
||||
* 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;
|
||||
this.to = (typeof (data.to) === 'object' &amp;&amp; data.to !== null) ? data.to._serialized : data.to;
|
||||
|
||||
/**
|
||||
* If the message was sent to a group, this field will contain the user that sent the message.
|
||||
* @type {string}
|
||||
*/
|
||||
this.author = typeof (data.author) === 'object' ? data.author._serialized : data.author;
|
||||
this.author = (typeof (data.author) === 'object' &amp;&amp; data.author !== null) ? data.author._serialized : data.author;
|
||||
|
||||
/**
|
||||
* String that represents from which device type the message was sent
|
||||
* @type {string}
|
||||
*/
|
||||
this.deviceType = data.id.id.length > 21 ? 'android' : data.id.id.substring(0, 2) == '3A' ? 'ios' : 'web';
|
||||
|
||||
/**
|
||||
* Indicates if the message was forwarded
|
||||
@@ -105,30 +127,75 @@ class Message extends Base {
|
||||
*/
|
||||
this.isForwarded = data.isForwarded;
|
||||
|
||||
/**
|
||||
* Indicates how many times the message was forwarded.
|
||||
*
|
||||
* The maximum value is 127.
|
||||
* @type {number}
|
||||
*/
|
||||
this.forwardingScore = data.forwardingScore || 0;
|
||||
|
||||
/**
|
||||
* Indicates if the message is a status update
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.isStatus = data.isStatusV3;
|
||||
|
||||
/**
|
||||
* Indicates if the message was starred
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.isStarred = data.star;
|
||||
|
||||
/**
|
||||
* Indicates if the message was a broadcast
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* Indicates the duration of the message in seconds
|
||||
* @type {string}
|
||||
*/
|
||||
this.duration = data.duration ? data.duration : undefined;
|
||||
|
||||
/**
|
||||
* Location information contained in the message, if the message is type "location"
|
||||
* @type {Location}
|
||||
*/
|
||||
this.location = data.type === MessageTypes.LOCATION ? new Location(data.lat, data.lng, data.loc) : undefined;
|
||||
|
||||
/**
|
||||
* List of vCards contained in the message.
|
||||
* @type {Array&lt;string>}
|
||||
*/
|
||||
this.vCards = data.type === MessageTypes.CONTACT_CARD_MULTI ? data.vcardList.map((c) => c.vcard) : data.type === MessageTypes.CONTACT_CARD ? [data.body] : [];
|
||||
|
||||
/**
|
||||
* Group Invite Data
|
||||
* @type {object}
|
||||
*/
|
||||
this.inviteV4 = data.type === MessageTypes.GROUP_INVITE ? {
|
||||
inviteCode: data.inviteCode,
|
||||
inviteCodeExp: data.inviteCodeExp,
|
||||
groupId: data.inviteGrp,
|
||||
groupName: data.inviteGrpName,
|
||||
fromId: data.from._serialized,
|
||||
toId: data.to._serialized
|
||||
} : undefined;
|
||||
|
||||
/**
|
||||
* Indicates the mentions in the message body.
|
||||
* @type {Array&lt;string>}
|
||||
@@ -139,6 +206,71 @@ class Message extends Base {
|
||||
this.mentionedIds = data.mentionedJidList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Order ID for message type ORDER
|
||||
* @type {string}
|
||||
*/
|
||||
this.orderId = data.orderId ? data.orderId : undefined;
|
||||
/**
|
||||
* Order Token for message type ORDER
|
||||
* @type {string}
|
||||
*/
|
||||
this.token = data.token ? data.token : undefined;
|
||||
|
||||
/**
|
||||
* Indicates whether the message is a Gif
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.isGif = Boolean(data.isGif);
|
||||
|
||||
/**
|
||||
* Indicates if the message will disappear after it expires
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.isEphemeral = data.isEphemeral;
|
||||
|
||||
/** Title */
|
||||
if (data.title) {
|
||||
this.title = data.title;
|
||||
}
|
||||
|
||||
/** Description */
|
||||
if (data.description) {
|
||||
this.description = data.description;
|
||||
}
|
||||
|
||||
/** Business Owner JID */
|
||||
if (data.businessOwnerJid) {
|
||||
this.businessOwnerJid = data.businessOwnerJid;
|
||||
}
|
||||
|
||||
/** Product ID */
|
||||
if (data.productId) {
|
||||
this.productId = data.productId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Links included in the message.
|
||||
* @type {Array&lt;{link: string, isSuspicious: boolean}>}
|
||||
*
|
||||
*/
|
||||
this.links = data.links;
|
||||
|
||||
/** Buttons */
|
||||
if (data.dynamicReplyButtons) {
|
||||
this.dynamicReplyButtons = data.dynamicReplyButtons;
|
||||
}
|
||||
|
||||
/** Selected Button Id **/
|
||||
if (data.selectedButtonId) {
|
||||
this.selectedButtonId = data.selectedButtonId;
|
||||
}
|
||||
|
||||
/** Selected List row Id **/
|
||||
if (data.listResponse &amp;&amp; data.listResponse.singleSelectReply.selectedRowId) {
|
||||
this.selectedRowId = data.listResponse.singleSelectReply.selectedRowId;
|
||||
}
|
||||
|
||||
return super._patch(data);
|
||||
}
|
||||
|
||||
@@ -146,6 +278,32 @@ class Message extends Base {
|
||||
return this.fromMe ? this.to : this.from;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reloads this Message object's data in-place with the latest values from WhatsApp Web.
|
||||
* Note that the Message must still be in the web app cache for this to work, otherwise will return null.
|
||||
* @returns {Promise&lt;Message>}
|
||||
*/
|
||||
async reload() {
|
||||
const newData = await this.client.pupPage.evaluate((msgId) => {
|
||||
const msg = window.Store.Msg.get(msgId);
|
||||
if(!msg) return null;
|
||||
return window.WWebJS.getMessageModel(msg);
|
||||
}, this.id._serialized);
|
||||
|
||||
if(!newData) return null;
|
||||
|
||||
this._patch(newData);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns message in a raw format
|
||||
* @type {Object}
|
||||
*/
|
||||
get rawData() {
|
||||
return this._data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Chat this message was sent in
|
||||
* @returns {Promise&lt;Chat>}
|
||||
@@ -186,16 +344,16 @@ class Message extends Base {
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
* 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
|
||||
*
|
||||
* @param {string|MessageMedia|Location} content
|
||||
* @param {string} [chatId]
|
||||
* @param {MessageSendOptions} [options]
|
||||
* @returns {Promise&lt;Message>}
|
||||
*/
|
||||
async reply(content, chatId, options={}) {
|
||||
async reply(content, chatId, options = {}) {
|
||||
if (!chatId) {
|
||||
chatId = this._getChatId();
|
||||
}
|
||||
@@ -208,6 +366,31 @@ class Message extends Base {
|
||||
return this.client.sendMessage(chatId, content, options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Accept Group V4 Invite
|
||||
* @returns {Promise&lt;Object>}
|
||||
*/
|
||||
async acceptGroupV4Invite() {
|
||||
return await this.client.acceptGroupV4Invite(this.inviteV4);
|
||||
}
|
||||
|
||||
/**
|
||||
* Forwards this message to another chat
|
||||
*
|
||||
* @param {string|Chat} chat Chat model or chat ID to which the message will be forwarded
|
||||
* @returns {Promise}
|
||||
*/
|
||||
async forward(chat) {
|
||||
const chatId = typeof chat === 'string' ? chat : chat.id._serialized;
|
||||
|
||||
await this.client.pupPage.evaluate(async (msgId, chatId) => {
|
||||
let msg = window.Store.Msg.get(msgId);
|
||||
let chat = window.Store.Chat.get(chatId);
|
||||
|
||||
return await chat.forwardMessages([msg]);
|
||||
}, this.id._serialized, chatId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Downloads and returns the attatched message media
|
||||
* @returns {Promise&lt;MessageMedia>}
|
||||
@@ -217,21 +400,48 @@ class Message extends Base {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const {data, mimetype, filename} = await this.client.pupPage.evaluate(async (msgId) => {
|
||||
const result = await this.client.pupPage.evaluate(async (msgId) => {
|
||||
const msg = window.Store.Msg.get(msgId);
|
||||
const buffer = await window.WWebJS.downloadBuffer(msg.clientUrl);
|
||||
const decrypted = await window.Store.CryptoLib.decryptE2EMedia(msg.type, buffer, msg.mediaKey, msg.mimetype);
|
||||
const data = await window.WWebJS.readBlobAsync(decrypted._blob);
|
||||
|
||||
return {
|
||||
data: data.split(',')[1],
|
||||
mimetype: msg.mimetype,
|
||||
filename: msg.filename
|
||||
};
|
||||
|
||||
if (msg.mediaData.mediaStage != 'RESOLVED') {
|
||||
// try to resolve media
|
||||
await msg.downloadMedia({
|
||||
downloadEvenIfExpensive: true,
|
||||
rmrReason: 1
|
||||
});
|
||||
}
|
||||
|
||||
if (msg.mediaData.mediaStage.includes('ERROR') || msg.mediaData.mediaStage === 'FETCHING') {
|
||||
// media could not be downloaded
|
||||
return undefined;
|
||||
}
|
||||
|
||||
try {
|
||||
const decryptedMedia = await window.Store.DownloadManager.downloadAndDecrypt({
|
||||
directPath: msg.directPath,
|
||||
encFilehash: msg.encFilehash,
|
||||
filehash: msg.filehash,
|
||||
mediaKey: msg.mediaKey,
|
||||
mediaKeyTimestamp: msg.mediaKeyTimestamp,
|
||||
type: msg.type,
|
||||
signal: (new AbortController).signal
|
||||
});
|
||||
|
||||
const data = window.WWebJS.arrayBufferToBase64(decryptedMedia);
|
||||
|
||||
return {
|
||||
data,
|
||||
mimetype: msg.mimetype,
|
||||
filename: msg.filename
|
||||
};
|
||||
} catch (e) {
|
||||
if(e.status &amp;&amp; e.status === 404) return undefined;
|
||||
throw e;
|
||||
}
|
||||
}, this.id._serialized);
|
||||
|
||||
return new MessageMedia(mimetype, data, filename);
|
||||
if (!result) return undefined;
|
||||
return new MessageMedia(result.mimetype, result.data, result.filename);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -242,13 +452,95 @@ class Message extends Base {
|
||||
await this.client.pupPage.evaluate((msgId, everyone) => {
|
||||
let msg = window.Store.Msg.get(msgId);
|
||||
|
||||
if(everyone &amp;&amp; msg.id.fromMe &amp;&amp; msg.canRevoke()) {
|
||||
return window.Store.Cmd.sendRevokeMsgs(msg.chat, [msg], true);
|
||||
}
|
||||
|
||||
if (everyone &amp;&amp; msg.id.fromMe &amp;&amp; msg._canRevoke()) {
|
||||
return window.Store.Cmd.sendRevokeMsgs(msg.chat, [msg], {type: 'Sender'});
|
||||
}
|
||||
|
||||
return window.Store.Cmd.sendDeleteMsgs(msg.chat, [msg], true);
|
||||
}, this.id._serialized, everyone);
|
||||
}
|
||||
|
||||
/**
|
||||
* Stars this message
|
||||
*/
|
||||
async star() {
|
||||
await this.client.pupPage.evaluate((msgId) => {
|
||||
let msg = window.Store.Msg.get(msgId);
|
||||
|
||||
if (msg.canStar()) {
|
||||
return msg.chat.sendStarMsgs([msg], true);
|
||||
}
|
||||
}, this.id._serialized);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unstars this message
|
||||
*/
|
||||
async unstar() {
|
||||
await this.client.pupPage.evaluate((msgId) => {
|
||||
let msg = window.Store.Msg.get(msgId);
|
||||
|
||||
if (msg.canStar()) {
|
||||
return msg.chat.sendStarMsgs([msg], false);
|
||||
}
|
||||
}, this.id._serialized);
|
||||
}
|
||||
|
||||
/**
|
||||
* Message Info
|
||||
* @typedef {Object} MessageInfo
|
||||
* @property {Array&lt;{id: ContactId, t: number}>} delivery Contacts to which the message has been delivered to
|
||||
* @property {number} deliveryRemaining Amount of people to whom the message has not been delivered to
|
||||
* @property {Array&lt;{id: ContactId, t: number}>} played Contacts who have listened to the voice message
|
||||
* @property {number} playedRemaining Amount of people who have not listened to the message
|
||||
* @property {Array&lt;{id: ContactId, t: number}>} read Contacts who have read the message
|
||||
* @property {number} readRemaining Amount of people who have not read the message
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get information about message delivery status. May return null if the message does not exist or is not sent by you.
|
||||
* @returns {Promise&lt;?MessageInfo>}
|
||||
*/
|
||||
async getInfo() {
|
||||
const info = await this.client.pupPage.evaluate(async (msgId) => {
|
||||
const msg = window.Store.Msg.get(msgId);
|
||||
if (!msg) return null;
|
||||
|
||||
return await window.Store.MessageInfo.sendQueryMsgInfo(msg);
|
||||
}, this.id._serialized);
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the order associated with a given message
|
||||
* @return {Promise&lt;Order>}
|
||||
*/
|
||||
async getOrder() {
|
||||
if (this.type === MessageTypes.ORDER) {
|
||||
const result = await this.client.pupPage.evaluate((orderId, token, chatId) => {
|
||||
return window.WWebJS.getOrderDetail(orderId, token, chatId);
|
||||
}, this.orderId, this.token, this._getChatId());
|
||||
if (!result) return undefined;
|
||||
return new Order(this.client, result);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
/**
|
||||
* Gets the payment details associated with a given message
|
||||
* @return {Promise&lt;Payment>}
|
||||
*/
|
||||
async getPayment() {
|
||||
if (this.type === MessageTypes.PAYMENT) {
|
||||
const msg = await this.client.pupPage.evaluate(async (msgId) => {
|
||||
const msg = window.Store.Msg.get(msgId);
|
||||
if(!msg) return null;
|
||||
return msg.serialize();
|
||||
}, this.id._serialized);
|
||||
return new Payment(this.client, msg);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Message;
|
||||
@@ -262,7 +554,7 @@ module.exports = Message;
|
||||
<footer id="jsdoc-footer" class="jsdoc-footer">
|
||||
<div id="jsdoc-footer-container">
|
||||
<p>
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on March 1, 2020.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 28, 2022.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta name="generator" content="JSDoc 3.6.7">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.2.0 » Source: structures/MessageMedia.js</title>
|
||||
<title>whatsapp-web.js 1.16.5 » Source: structures/MessageMedia.js</title>
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
||||
@@ -15,7 +15,7 @@
|
||||
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
||||
<div id="jsdoc-navbar-container">
|
||||
<div id="jsdoc-navbar-content">
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>2.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>16.<wbr>5</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -31,6 +31,12 @@
|
||||
<article>
|
||||
<pre class="prettyprint linenums"><code>'use strict';
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const mime = require('mime');
|
||||
const fetch = require('node-fetch');
|
||||
const { URL } = require('url');
|
||||
|
||||
/**
|
||||
* Media attached to a message
|
||||
* @param {string} mimetype MIME type of the attachment
|
||||
@@ -57,9 +63,76 @@ class MessageMedia {
|
||||
*/
|
||||
this.filename = filename;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a MessageMedia instance from a local file path
|
||||
* @param {string} filePath
|
||||
* @returns {MessageMedia}
|
||||
*/
|
||||
static fromFilePath(filePath) {
|
||||
const b64data = fs.readFileSync(filePath, {encoding: 'base64'});
|
||||
const mimetype = mime.getType(filePath);
|
||||
const filename = path.basename(filePath);
|
||||
|
||||
return new MessageMedia(mimetype, b64data, filename);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a MessageMedia instance from a URL
|
||||
* @param {string} url
|
||||
* @param {Object} [options]
|
||||
* @param {boolean} [options.unsafeMime=false]
|
||||
* @param {string} [options.filename]
|
||||
* @param {object} [options.client]
|
||||
* @param {object} [options.reqOptions]
|
||||
* @param {number} [options.reqOptions.size=0]
|
||||
* @returns {Promise&lt;MessageMedia>}
|
||||
*/
|
||||
static async fromUrl(url, options = {}) {
|
||||
const pUrl = new URL(url);
|
||||
let mimetype = mime.getType(pUrl.pathname);
|
||||
|
||||
if (!mimetype &amp;&amp; !options.unsafeMime)
|
||||
throw new Error('Unable to determine MIME type using URL. Set unsafeMime to true to download it anyway.');
|
||||
|
||||
async function fetchData (url, options) {
|
||||
const reqOptions = Object.assign({ headers: { accept: 'image/* video/* text/* audio/*' } }, options);
|
||||
const response = await fetch(url, reqOptions);
|
||||
const mime = response.headers.get('Content-Type');
|
||||
|
||||
const contentDisposition = response.headers.get('Content-Disposition');
|
||||
const name = contentDisposition ? contentDisposition.match(/((?&lt;=filename=")(.*)(?="))/) : null;
|
||||
|
||||
let data = '';
|
||||
if (response.buffer) {
|
||||
data = (await response.buffer()).toString('base64');
|
||||
} else {
|
||||
const bArray = new Uint8Array(await response.arrayBuffer());
|
||||
bArray.forEach((b) => {
|
||||
data += String.fromCharCode(b);
|
||||
});
|
||||
data = btoa(data);
|
||||
}
|
||||
|
||||
return { data, mime, name };
|
||||
}
|
||||
|
||||
const res = options.client
|
||||
? (await options.client.pupPage.evaluate(fetchData, url, options.reqOptions))
|
||||
: (await fetchData(url, options.reqOptions));
|
||||
|
||||
const filename = options.filename ||
|
||||
(res.name ? res.name[0] : (pUrl.pathname.split('/').pop() || 'file'));
|
||||
|
||||
if (!mimetype)
|
||||
mimetype = res.mime;
|
||||
|
||||
return new MessageMedia(mimetype, res.data, filename);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = MessageMedia;</code></pre>
|
||||
module.exports = MessageMedia;
|
||||
</code></pre>
|
||||
</article>
|
||||
</div>
|
||||
</div>
|
||||
@@ -69,7 +142,7 @@ module.exports = MessageMedia;</code></pre>
|
||||
<footer id="jsdoc-footer" class="jsdoc-footer">
|
||||
<div id="jsdoc-footer-container">
|
||||
<p>
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on March 1, 2020.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 28, 2022.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
105
docs/structures_Order.js.html
Normal file
105
docs/structures_Order.js.html
Normal file
@@ -0,0 +1,105 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.7">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.16.5 » Source: structures/Order.js</title>
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
||||
<link href="css/baseline.css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<body onload="prettyPrint()">
|
||||
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
||||
<div id="jsdoc-navbar-container">
|
||||
<div id="jsdoc-navbar-content">
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>16.<wbr>5</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div id="jsdoc-body-container">
|
||||
<div id="jsdoc-content">
|
||||
<div id="jsdoc-content-container">
|
||||
<div id="jsdoc-banner" role="banner">
|
||||
</div>
|
||||
<div id="jsdoc-main" role="main">
|
||||
<header class="page-header">
|
||||
<h1>Source: structures/Order.js</h1>
|
||||
</header>
|
||||
<article>
|
||||
<pre class="prettyprint linenums"><code>'use strict';
|
||||
|
||||
const Base = require('./Base');
|
||||
const Product = require('./Product');
|
||||
|
||||
/**
|
||||
* Represents a Order on WhatsApp
|
||||
* @extends {Base}
|
||||
*/
|
||||
class Order extends Base {
|
||||
constructor(client, data) {
|
||||
super(client);
|
||||
|
||||
if (data) this._patch(data);
|
||||
}
|
||||
|
||||
_patch(data) {
|
||||
/**
|
||||
* List of products
|
||||
* @type {Array&lt;Product>}
|
||||
*/
|
||||
if (data.products) {
|
||||
this.products = data.products.map(product => new Product(this.client, product));
|
||||
}
|
||||
/**
|
||||
* Order Subtotal
|
||||
* @type {string}
|
||||
*/
|
||||
this.subtotal = data.subtotal;
|
||||
/**
|
||||
* Order Total
|
||||
* @type {string}
|
||||
*/
|
||||
this.total = data.total;
|
||||
/**
|
||||
* Order Currency
|
||||
* @type {string}
|
||||
*/
|
||||
this.currency = data.currency;
|
||||
/**
|
||||
* Order Created At
|
||||
* @type {number}
|
||||
*/
|
||||
this.createdAt = data.createdAt;
|
||||
|
||||
return super._patch(data);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
module.exports = Order;</code></pre>
|
||||
</article>
|
||||
</div>
|
||||
</div>
|
||||
<nav id="jsdoc-toc-nav" role="navigation"></nav>
|
||||
</div>
|
||||
</div>
|
||||
<footer id="jsdoc-footer" class="jsdoc-footer">
|
||||
<div id="jsdoc-footer-container">
|
||||
<p>
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 28, 2022.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
<script src="scripts/jquery.min.js"></script>
|
||||
<script src="scripts/tree.jquery.js"></script>
|
||||
<script src="scripts/prettify.js"></script>
|
||||
<script src="scripts/jsdoc-toc.js"></script>
|
||||
<script src="scripts/linenumber.js"></script>
|
||||
<script src="scripts/scrollanchor.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
133
docs/structures_Payment.js.html
Normal file
133
docs/structures_Payment.js.html
Normal file
@@ -0,0 +1,133 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.7">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.16.5 » Source: structures/Payment.js</title>
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
||||
<link href="css/baseline.css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<body onload="prettyPrint()">
|
||||
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
||||
<div id="jsdoc-navbar-container">
|
||||
<div id="jsdoc-navbar-content">
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>16.<wbr>5</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div id="jsdoc-body-container">
|
||||
<div id="jsdoc-content">
|
||||
<div id="jsdoc-content-container">
|
||||
<div id="jsdoc-banner" role="banner">
|
||||
</div>
|
||||
<div id="jsdoc-main" role="main">
|
||||
<header class="page-header">
|
||||
<h1>Source: structures/Payment.js</h1>
|
||||
</header>
|
||||
<article>
|
||||
<pre class="prettyprint linenums"><code>const Base = require('./Base');
|
||||
|
||||
class Payment extends Base {
|
||||
constructor(client, data) {
|
||||
super(client);
|
||||
|
||||
if (data) this._patch(data);
|
||||
}
|
||||
|
||||
_patch(data) {
|
||||
/**
|
||||
* The payment Id
|
||||
* @type {object}
|
||||
*/
|
||||
this.id = data.id;
|
||||
|
||||
/**
|
||||
* The payment currency
|
||||
* @type {string}
|
||||
*/
|
||||
this.paymentCurrency = data.paymentCurrency;
|
||||
|
||||
/**
|
||||
* The payment ammount ( R$ 1.00 = 1000 )
|
||||
* @type {number}
|
||||
*/
|
||||
this.paymentAmount1000 = data.paymentAmount1000;
|
||||
|
||||
/**
|
||||
* The payment receiver
|
||||
* @type {object}
|
||||
*/
|
||||
this.paymentMessageReceiverJid = data.paymentMessageReceiverJid;
|
||||
|
||||
/**
|
||||
* The payment transaction timestamp
|
||||
* @type {number}
|
||||
*/
|
||||
this.paymentTransactionTimestamp = data.paymentTransactionTimestamp;
|
||||
|
||||
/**
|
||||
* The paymentStatus
|
||||
*
|
||||
* Possible Status
|
||||
* 0:UNKNOWN_STATUS
|
||||
* 1:PROCESSING
|
||||
* 2:SENT
|
||||
* 3:NEED_TO_ACCEPT
|
||||
* 4:COMPLETE
|
||||
* 5:COULD_NOT_COMPLETE
|
||||
* 6:REFUNDED
|
||||
* 7:EXPIRED
|
||||
* 8:REJECTED
|
||||
* 9:CANCELLED
|
||||
* 10:WAITING_FOR_PAYER
|
||||
* 11:WAITING
|
||||
*
|
||||
* @type {number}
|
||||
*/
|
||||
this.paymentStatus = data.paymentStatus;
|
||||
|
||||
/**
|
||||
* Integer that represents the payment Text
|
||||
* @type {number}
|
||||
*/
|
||||
this.paymentTxnStatus = data.paymentTxnStatus;
|
||||
|
||||
/**
|
||||
* The note sent with the payment
|
||||
* @type {string}
|
||||
*/
|
||||
this.paymentNote = !data.paymentNoteMsg ? undefined : data.paymentNoteMsg.body ? data.paymentNoteMsg.body : undefined ;
|
||||
|
||||
return super._patch(data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = Payment;
|
||||
</code></pre>
|
||||
</article>
|
||||
</div>
|
||||
</div>
|
||||
<nav id="jsdoc-toc-nav" role="navigation"></nav>
|
||||
</div>
|
||||
</div>
|
||||
<footer id="jsdoc-footer" class="jsdoc-footer">
|
||||
<div id="jsdoc-footer-container">
|
||||
<p>
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 28, 2022.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
<script src="scripts/jquery.min.js"></script>
|
||||
<script src="scripts/tree.jquery.js"></script>
|
||||
<script src="scripts/prettify.js"></script>
|
||||
<script src="scripts/jsdoc-toc.js"></script>
|
||||
<script src="scripts/linenumber.js"></script>
|
||||
<script src="scripts/scrollanchor.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -2,9 +2,9 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta name="generator" content="JSDoc 3.6.7">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.2.0 » Source: structures/PrivateChat.js</title>
|
||||
<title>whatsapp-web.js 1.16.5 » Source: structures/PrivateChat.js</title>
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
||||
@@ -15,7 +15,7 @@
|
||||
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
||||
<div id="jsdoc-navbar-container">
|
||||
<div id="jsdoc-navbar-content">
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>2.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>16.<wbr>5</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -51,7 +51,7 @@ module.exports = PrivateChat;</code></pre>
|
||||
<footer id="jsdoc-footer" class="jsdoc-footer">
|
||||
<div id="jsdoc-footer-container">
|
||||
<p>
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on March 1, 2020.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 28, 2022.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta name="generator" content="JSDoc 3.6.7">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.2.0 » Source: structures/PrivateContact.js</title>
|
||||
<title>whatsapp-web.js 1.16.5 » Source: structures/PrivateContact.js</title>
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
||||
@@ -15,7 +15,7 @@
|
||||
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
||||
<div id="jsdoc-navbar-container">
|
||||
<div id="jsdoc-navbar-content">
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>2.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>16.<wbr>5</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -51,7 +51,7 @@ module.exports = PrivateContact;</code></pre>
|
||||
<footer id="jsdoc-footer" class="jsdoc-footer">
|
||||
<div id="jsdoc-footer-container">
|
||||
<p>
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on March 1, 2020.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 28, 2022.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
121
docs/structures_Product.js.html
Normal file
121
docs/structures_Product.js.html
Normal file
@@ -0,0 +1,121 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.7">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.16.5 » Source: structures/Product.js</title>
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
||||
<link href="css/baseline.css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<body onload="prettyPrint()">
|
||||
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
||||
<div id="jsdoc-navbar-container">
|
||||
<div id="jsdoc-navbar-content">
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>16.<wbr>5</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div id="jsdoc-body-container">
|
||||
<div id="jsdoc-content">
|
||||
<div id="jsdoc-content-container">
|
||||
<div id="jsdoc-banner" role="banner">
|
||||
</div>
|
||||
<div id="jsdoc-main" role="main">
|
||||
<header class="page-header">
|
||||
<h1>Source: structures/Product.js</h1>
|
||||
</header>
|
||||
<article>
|
||||
<pre class="prettyprint linenums"><code>'use strict';
|
||||
|
||||
const Base = require('./Base');
|
||||
const ProductMetadata = require('./ProductMetadata');
|
||||
|
||||
/**
|
||||
* Represents a Product on WhatsAppBusiness
|
||||
* @extends {Base}
|
||||
*/
|
||||
class Product extends Base {
|
||||
constructor(client, data) {
|
||||
super(client);
|
||||
|
||||
if (data) this._patch(data);
|
||||
}
|
||||
|
||||
_patch(data) {
|
||||
/**
|
||||
* Product ID
|
||||
* @type {string}
|
||||
*/
|
||||
this.id = data.id;
|
||||
/**
|
||||
* Price
|
||||
* @type {string}
|
||||
*/
|
||||
this.price = data.price ? data.price : '';
|
||||
/**
|
||||
* Product Thumbnail
|
||||
* @type {string}
|
||||
*/
|
||||
this.thumbnailUrl = data.thumbnailUrl;
|
||||
/**
|
||||
* Currency
|
||||
* @type {string}
|
||||
*/
|
||||
this.currency = data.currency;
|
||||
/**
|
||||
* Product Name
|
||||
* @type {string}
|
||||
*/
|
||||
this.name = data.name;
|
||||
/**
|
||||
* Product Quantity
|
||||
* @type {number}
|
||||
*/
|
||||
this.quantity = data.quantity;
|
||||
/** Product metadata */
|
||||
this.data = null;
|
||||
return super._patch(data);
|
||||
}
|
||||
|
||||
async getData() {
|
||||
if (this.data === null) {
|
||||
let result = await this.client.pupPage.evaluate((productId) => {
|
||||
return window.WWebJS.getProductMetadata(productId);
|
||||
}, this.id);
|
||||
if (!result) {
|
||||
this.data = undefined;
|
||||
} else {
|
||||
this.data = new ProductMetadata(this.client, result);
|
||||
}
|
||||
}
|
||||
return this.data;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Product;</code></pre>
|
||||
</article>
|
||||
</div>
|
||||
</div>
|
||||
<nav id="jsdoc-toc-nav" role="navigation"></nav>
|
||||
</div>
|
||||
</div>
|
||||
<footer id="jsdoc-footer" class="jsdoc-footer">
|
||||
<div id="jsdoc-footer-container">
|
||||
<p>
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 28, 2022.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
<script src="scripts/jquery.min.js"></script>
|
||||
<script src="scripts/tree.jquery.js"></script>
|
||||
<script src="scripts/prettify.js"></script>
|
||||
<script src="scripts/jsdoc-toc.js"></script>
|
||||
<script src="scripts/linenumber.js"></script>
|
||||
<script src="scripts/scrollanchor.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
78
docs/structures_ProductMetadata.js.html
Normal file
78
docs/structures_ProductMetadata.js.html
Normal file
@@ -0,0 +1,78 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.7">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.16.5 » Source: structures/ProductMetadata.js</title>
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
||||
<link href="css/baseline.css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<body onload="prettyPrint()">
|
||||
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
||||
<div id="jsdoc-navbar-container">
|
||||
<div id="jsdoc-navbar-content">
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>16.<wbr>5</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div id="jsdoc-body-container">
|
||||
<div id="jsdoc-content">
|
||||
<div id="jsdoc-content-container">
|
||||
<div id="jsdoc-banner" role="banner">
|
||||
</div>
|
||||
<div id="jsdoc-main" role="main">
|
||||
<header class="page-header">
|
||||
<h1>Source: structures/ProductMetadata.js</h1>
|
||||
</header>
|
||||
<article>
|
||||
<pre class="prettyprint linenums"><code>const Base = require('./Base');
|
||||
|
||||
class ProductMetadata extends Base {
|
||||
constructor(client, data) {
|
||||
super(client);
|
||||
|
||||
if (data) this._patch(data);
|
||||
}
|
||||
|
||||
_patch(data) {
|
||||
/** Product ID */
|
||||
this.id = data.id;
|
||||
/** Retailer ID */
|
||||
this.retailer_id = data.retailer_id;
|
||||
/** Product Name */
|
||||
this.name = data.name;
|
||||
/** Product Description */
|
||||
this.description = data.description;
|
||||
|
||||
return super._patch(data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = ProductMetadata;</code></pre>
|
||||
</article>
|
||||
</div>
|
||||
</div>
|
||||
<nav id="jsdoc-toc-nav" role="navigation"></nav>
|
||||
</div>
|
||||
</div>
|
||||
<footer id="jsdoc-footer" class="jsdoc-footer">
|
||||
<div id="jsdoc-footer-container">
|
||||
<p>
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 28, 2022.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
<script src="scripts/jquery.min.js"></script>
|
||||
<script src="scripts/tree.jquery.js"></script>
|
||||
<script src="scripts/prettify.js"></script>
|
||||
<script src="scripts/jsdoc-toc.js"></script>
|
||||
<script src="scripts/linenumber.js"></script>
|
||||
<script src="scripts/scrollanchor.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -2,9 +2,9 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta name="generator" content="JSDoc 3.6.7">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.2.0 » Source: util/Constants.js</title>
|
||||
<title>whatsapp-web.js 1.16.5 » Source: util/Constants.js</title>
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
||||
@@ -15,7 +15,7 @@
|
||||
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
||||
<div id="jsdoc-navbar-container">
|
||||
<div id="jsdoc-navbar-content">
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>2.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>16.<wbr>5</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -33,13 +33,18 @@
|
||||
|
||||
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
|
||||
headless: true,
|
||||
defaultViewport: null
|
||||
},
|
||||
session: false
|
||||
authTimeoutMs: 0,
|
||||
qrMaxRetries: 0,
|
||||
takeoverOnConflict: false,
|
||||
takeoverTimeoutMs: 0,
|
||||
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.109 Safari/537.36',
|
||||
ffmpegPath: 'ffmpeg',
|
||||
bypassCSP: false
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -67,12 +72,15 @@ exports.Events = {
|
||||
MESSAGE_REVOKED_EVERYONE: 'message_revoke_everyone',
|
||||
MESSAGE_REVOKED_ME: 'message_revoke_me',
|
||||
MESSAGE_ACK: 'message_ack',
|
||||
MEDIA_UPLOADED: 'media_uploaded',
|
||||
GROUP_JOIN: 'group_join',
|
||||
GROUP_LEAVE: 'group_leave',
|
||||
GROUP_UPDATE: 'group_update',
|
||||
QR_RECEIVED: 'qr',
|
||||
DISCONNECTED: 'disconnected',
|
||||
STATE_CHANGED: 'change_state',
|
||||
BATTERY_CHANGED: 'change_battery',
|
||||
INCOMING_CALL: 'incoming_call'
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -91,8 +99,31 @@ exports.MessageTypes = {
|
||||
LOCATION: 'location',
|
||||
CONTACT_CARD: 'vcard',
|
||||
CONTACT_CARD_MULTI: 'multi_vcard',
|
||||
ORDER: 'order',
|
||||
REVOKED: 'revoked',
|
||||
UNKNOWN: 'unknown'
|
||||
PRODUCT: 'product',
|
||||
UNKNOWN: 'unknown',
|
||||
GROUP_INVITE: 'groups_v4_invite',
|
||||
LIST: 'list',
|
||||
LIST_RESPONSE: 'list_response',
|
||||
BUTTONS_RESPONSE: 'buttons_response',
|
||||
PAYMENT: 'payment',
|
||||
BROADCAST_NOTIFICATION: 'broadcast_notification',
|
||||
CALL_LOG: 'call_log',
|
||||
CIPHERTEXT: 'ciphertext',
|
||||
DEBUG: 'debug',
|
||||
E2E_NOTIFICATION: 'e2e_notification',
|
||||
GP2: 'gp2',
|
||||
GROUP_NOTIFICATION: 'group_notification',
|
||||
HSM: 'hsm',
|
||||
INTERACTIVE: 'interactive',
|
||||
NATIVE_FLOW: 'native_flow',
|
||||
NOTIFICATION: 'notification',
|
||||
NOTIFICATION_TEMPLATE: 'notification_template',
|
||||
OVERSIZED: 'oversized',
|
||||
PROTOCOL: 'protocol',
|
||||
REACTION: 'reaction',
|
||||
TEMPLATE_BUTTON_REPLY: 'template_button_reply',
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -166,7 +197,7 @@ exports.MessageAck = {
|
||||
<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 1, 2020.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 28, 2022.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
175
docs/util_InterfaceController.js.html
Normal file
175
docs/util_InterfaceController.js.html
Normal file
@@ -0,0 +1,175 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.7">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.16.5 » Source: util/InterfaceController.js</title>
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
||||
<link href="css/baseline.css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<body onload="prettyPrint()">
|
||||
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
||||
<div id="jsdoc-navbar-container">
|
||||
<div id="jsdoc-navbar-content">
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>16.<wbr>5</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div id="jsdoc-body-container">
|
||||
<div id="jsdoc-content">
|
||||
<div id="jsdoc-content-container">
|
||||
<div id="jsdoc-banner" role="banner">
|
||||
</div>
|
||||
<div id="jsdoc-main" role="main">
|
||||
<header class="page-header">
|
||||
<h1>Source: util/InterfaceController.js</h1>
|
||||
</header>
|
||||
<article>
|
||||
<pre class="prettyprint linenums"><code>'use strict';
|
||||
|
||||
/**
|
||||
* Interface Controller
|
||||
*/
|
||||
class InterfaceController {
|
||||
|
||||
constructor(props) {
|
||||
this.pupPage = props.pupPage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens the Chat Window
|
||||
* @param {string} chatId ID of the chat window that will be opened
|
||||
*/
|
||||
async openChatWindow(chatId) {
|
||||
await this.pupPage.evaluate(async chatId => {
|
||||
let chatWid = window.Store.WidFactory.createWid(chatId);
|
||||
let chat = await window.Store.Chat.find(chatWid);
|
||||
await window.Store.Cmd.openChatAt(chat);
|
||||
}, chatId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens the Chat Drawer
|
||||
* @param {string} chatId ID of the chat drawer that will be opened
|
||||
*/
|
||||
async openChatDrawer(chatId) {
|
||||
await this.pupPage.evaluate(async chatId => {
|
||||
let chat = await window.Store.Chat.get(chatId);
|
||||
await window.Store.Cmd.openDrawerMid(chat);
|
||||
}, chatId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens the Chat Search
|
||||
* @param {string} chatId ID of the chat search that will be opened
|
||||
*/
|
||||
async openChatSearch(chatId) {
|
||||
await this.pupPage.evaluate(async chatId => {
|
||||
let chat = await window.Store.Chat.get(chatId);
|
||||
await window.Store.Cmd.chatSearch(chat);
|
||||
}, chatId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens or Scrolls the Chat Window to the position of the message
|
||||
* @param {string} msgId ID of the message that will be scrolled to
|
||||
*/
|
||||
async openChatWindowAt(msgId) {
|
||||
await this.pupPage.evaluate(async msgId => {
|
||||
let msg = await window.Store.Msg.get(msgId);
|
||||
await window.Store.Cmd.openChatAt(msg.chat, msg.chat.getSearchContext(msg));
|
||||
}, msgId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens the Message Drawer
|
||||
* @param {string} msgId ID of the message drawer that will be opened
|
||||
*/
|
||||
async openMessageDrawer(msgId) {
|
||||
await this.pupPage.evaluate(async msgId => {
|
||||
let msg = await window.Store.Msg.get(msgId);
|
||||
await window.Store.Cmd.msgInfoDrawer(msg);
|
||||
}, msgId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the Right Drawer
|
||||
*/
|
||||
async closeRightDrawer() {
|
||||
await this.pupPage.evaluate(async () => {
|
||||
await window.Store.Cmd.closeDrawerRight();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all Features
|
||||
*/
|
||||
async getFeatures() {
|
||||
return await this.pupPage.evaluate(() => {
|
||||
return window.Store.Features.F;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if Feature is enabled
|
||||
* @param {string} feature status to check
|
||||
*/
|
||||
async checkFeatureStatus(feature) {
|
||||
return await this.pupPage.evaluate((feature) => {
|
||||
return window.Store.Features.supportsFeature(feature);
|
||||
}, feature);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable Features
|
||||
* @param {string[]} features to be enabled
|
||||
*/
|
||||
async enableFeatures(features) {
|
||||
await this.pupPage.evaluate((features) => {
|
||||
for (const feature in features) {
|
||||
window.Store.Features.setFeature(features[feature], true);
|
||||
}
|
||||
}, features);
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable Features
|
||||
* @param {string[]} features to be disabled
|
||||
*/
|
||||
async disableFeatures(features) {
|
||||
await this.pupPage.evaluate((features) => {
|
||||
for (const feature in features) {
|
||||
window.Store.Features.setFeature(features[feature], false);
|
||||
}
|
||||
}, features);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = InterfaceController;
|
||||
</code></pre>
|
||||
</article>
|
||||
</div>
|
||||
</div>
|
||||
<nav id="jsdoc-toc-nav" role="navigation"></nav>
|
||||
</div>
|
||||
</div>
|
||||
<footer id="jsdoc-footer" class="jsdoc-footer">
|
||||
<div id="jsdoc-footer-container">
|
||||
<p>
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 28, 2022.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
<script src="scripts/jquery.min.js"></script>
|
||||
<script src="scripts/tree.jquery.js"></script>
|
||||
<script src="scripts/prettify.js"></script>
|
||||
<script src="scripts/jsdoc-toc.js"></script>
|
||||
<script src="scripts/linenumber.js"></script>
|
||||
<script src="scripts/scrollanchor.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -2,9 +2,9 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.3">
|
||||
<meta name="generator" content="JSDoc 3.6.7">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.2.0 » Source: util/Util.js</title>
|
||||
<title>whatsapp-web.js 1.16.5 » Source: util/Util.js</title>
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
||||
@@ -15,7 +15,7 @@
|
||||
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
||||
<div id="jsdoc-navbar-container">
|
||||
<div id="jsdoc-navbar-content">
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>2.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>16.<wbr>5</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -31,17 +31,33 @@
|
||||
<article>
|
||||
<pre class="prettyprint linenums"><code>'use strict';
|
||||
|
||||
const path = require('path');
|
||||
const Crypto = require('crypto');
|
||||
const { tmpdir } = require('os');
|
||||
const ffmpeg = require('fluent-ffmpeg');
|
||||
const webp = require('node-webpmux');
|
||||
const fs = require('fs').promises;
|
||||
|
||||
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.`);
|
||||
}
|
||||
|
||||
static generateHash(length) {
|
||||
var result = '';
|
||||
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||||
var charactersLength = characters.length;
|
||||
for (var i = 0; i &lt; length; i++) {
|
||||
result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets default properties on an object that aren't already specified.
|
||||
* @param {Object} def Default properties
|
||||
@@ -61,9 +77,146 @@ class Util {
|
||||
|
||||
return given;
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats a image to webp
|
||||
* @param {MessageMedia} media
|
||||
*
|
||||
* @returns {Promise&lt;MessageMedia>} media in webp format
|
||||
*/
|
||||
static async formatImageToWebpSticker(media, pupPage) {
|
||||
if (!media.mimetype.includes('image'))
|
||||
throw new Error('media is not a image');
|
||||
|
||||
if (media.mimetype.includes('webp')) {
|
||||
return media;
|
||||
}
|
||||
|
||||
return pupPage.evaluate((media) => {
|
||||
return window.WWebJS.toStickerData(media);
|
||||
}, media);
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats a video to webp
|
||||
* @param {MessageMedia} media
|
||||
*
|
||||
* @returns {Promise&lt;MessageMedia>} media in webp format
|
||||
*/
|
||||
static async formatVideoToWebpSticker(media) {
|
||||
if (!media.mimetype.includes('video'))
|
||||
throw new Error('media is not a video');
|
||||
|
||||
const videoType = media.mimetype.split('/')[1];
|
||||
|
||||
const tempFile = path.join(
|
||||
tmpdir(),
|
||||
`${Crypto.randomBytes(6).readUIntLE(0, 6).toString(36)}.webp`
|
||||
);
|
||||
|
||||
const stream = new (require('stream').Readable)();
|
||||
const buffer = Buffer.from(
|
||||
media.data.replace(`data:${media.mimetype};base64,`, ''),
|
||||
'base64'
|
||||
);
|
||||
stream.push(buffer);
|
||||
stream.push(null);
|
||||
|
||||
await new Promise((resolve, reject) => {
|
||||
ffmpeg(stream)
|
||||
.inputFormat(videoType)
|
||||
.on('error', reject)
|
||||
.on('end', () => resolve(true))
|
||||
.addOutputOptions([
|
||||
'-vcodec',
|
||||
'libwebp',
|
||||
'-vf',
|
||||
// eslint-disable-next-line no-useless-escape
|
||||
'scale=\'iw*min(300/iw\,300/ih)\':\'ih*min(300/iw\,300/ih)\',format=rgba,pad=300:300:\'(300-iw)/2\':\'(300-ih)/2\':\'#00000000\',setsar=1,fps=10',
|
||||
'-loop',
|
||||
'0',
|
||||
'-ss',
|
||||
'00:00:00.0',
|
||||
'-t',
|
||||
'00:00:05.0',
|
||||
'-preset',
|
||||
'default',
|
||||
'-an',
|
||||
'-vsync',
|
||||
'0',
|
||||
'-s',
|
||||
'512:512',
|
||||
])
|
||||
.toFormat('webp')
|
||||
.save(tempFile);
|
||||
});
|
||||
|
||||
const data = await fs.readFile(tempFile, 'base64');
|
||||
await fs.unlink(tempFile);
|
||||
|
||||
return {
|
||||
mimetype: 'image/webp',
|
||||
data: data,
|
||||
filename: media.filename,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Sticker metadata.
|
||||
* @typedef {Object} StickerMetadata
|
||||
* @property {string} [name]
|
||||
* @property {string} [author]
|
||||
* @property {string[]} [categories]
|
||||
*/
|
||||
|
||||
/**
|
||||
* Formats a media to webp
|
||||
* @param {MessageMedia} media
|
||||
* @param {StickerMetadata} metadata
|
||||
*
|
||||
* @returns {Promise&lt;MessageMedia>} media in webp format
|
||||
*/
|
||||
static async formatToWebpSticker(media, metadata, pupPage) {
|
||||
let webpMedia;
|
||||
|
||||
if (media.mimetype.includes('image'))
|
||||
webpMedia = await this.formatImageToWebpSticker(media, pupPage);
|
||||
else if (media.mimetype.includes('video'))
|
||||
webpMedia = await this.formatVideoToWebpSticker(media);
|
||||
else
|
||||
throw new Error('Invalid media format');
|
||||
|
||||
if (metadata.name || metadata.author) {
|
||||
const img = new webp.Image();
|
||||
const hash = this.generateHash(32);
|
||||
const stickerPackId = hash;
|
||||
const packname = metadata.name;
|
||||
const author = metadata.author;
|
||||
const categories = metadata.categories || [''];
|
||||
const json = { 'sticker-pack-id': stickerPackId, 'sticker-pack-name': packname, 'sticker-pack-publisher': author, 'emojis': categories };
|
||||
let exifAttr = Buffer.from([0x49, 0x49, 0x2A, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x41, 0x57, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00]);
|
||||
let jsonBuffer = Buffer.from(JSON.stringify(json), 'utf8');
|
||||
let exif = Buffer.concat([exifAttr, jsonBuffer]);
|
||||
exif.writeUIntLE(jsonBuffer.length, 14, 4);
|
||||
await img.load(Buffer.from(webpMedia.data, 'base64'));
|
||||
img.exif = exif;
|
||||
webpMedia.data = (await img.save(null)).toString('base64');
|
||||
}
|
||||
|
||||
return webpMedia;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure ffmpeg path
|
||||
* @param {string} path
|
||||
*/
|
||||
static setFfmpegPath(path) {
|
||||
ffmpeg.setFfmpegPath(path);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Util;</code></pre>
|
||||
module.exports = Util;
|
||||
</code></pre>
|
||||
</article>
|
||||
</div>
|
||||
</div>
|
||||
@@ -73,7 +226,7 @@ module.exports = Util;</code></pre>
|
||||
<footer id="jsdoc-footer" class="jsdoc-footer">
|
||||
<div id="jsdoc-footer-container">
|
||||
<p>
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.3 on March 1, 2020.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 28, 2022.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
100
example.js
100
example.js
@@ -1,15 +1,9 @@
|
||||
const fs = require('fs');
|
||||
const { Client, Location } = require('./index');
|
||||
const { Client, Location, List, Buttons, LocalAuth } = 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.
|
||||
const client = new Client({
|
||||
authStrategy: new LocalAuth(),
|
||||
puppeteer: { headless: false }
|
||||
});
|
||||
|
||||
client.initialize();
|
||||
|
||||
@@ -18,18 +12,12 @@ 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('authenticated', () => {
|
||||
console.log('AUTHENTICATED');
|
||||
});
|
||||
|
||||
client.on('auth_failure', msg => {
|
||||
// Fired if session restore was unsuccessfull
|
||||
// Fired if session restore was unsuccessful
|
||||
console.error('AUTHENTICATION FAILURE', msg);
|
||||
});
|
||||
|
||||
@@ -40,11 +28,11 @@ client.on('ready', () => {
|
||||
client.on('message', async msg => {
|
||||
console.log('MESSAGE RECEIVED', msg);
|
||||
|
||||
if (msg.body == '!ping reply') {
|
||||
if (msg.body === '!ping reply') {
|
||||
// Send a new message as a reply to the current one
|
||||
msg.reply('pong');
|
||||
|
||||
} else if (msg.body == '!ping') {
|
||||
} else if (msg.body === '!ping') {
|
||||
// Send a new message to the same chat
|
||||
client.sendMessage(msg.from, 'pong');
|
||||
|
||||
@@ -79,7 +67,7 @@ client.on('message', async msg => {
|
||||
} else {
|
||||
msg.reply('This command can only be used in a group!');
|
||||
}
|
||||
} else if (msg.body == '!leave') {
|
||||
} else if (msg.body === '!leave') {
|
||||
// Leave the group
|
||||
let chat = await msg.getChat();
|
||||
if (chat.isGroup) {
|
||||
@@ -95,7 +83,7 @@ client.on('message', async msg => {
|
||||
} catch (e) {
|
||||
msg.reply('That invite code seems to be invalid.');
|
||||
}
|
||||
} else if (msg.body == '!groupinfo') {
|
||||
} else if (msg.body === '!groupinfo') {
|
||||
let chat = await msg.getChat();
|
||||
if (chat.isGroup) {
|
||||
msg.reply(`
|
||||
@@ -109,19 +97,18 @@ client.on('message', async msg => {
|
||||
} else {
|
||||
msg.reply('This command can only be used in a group!');
|
||||
}
|
||||
} else if (msg.body == '!chats') {
|
||||
} else if (msg.body === '!chats') {
|
||||
const chats = await client.getChats();
|
||||
client.sendMessage(msg.from, `The bot has ${chats.length} chats open.`);
|
||||
} else if (msg.body == '!info') {
|
||||
} else if (msg.body === '!info') {
|
||||
let info = client.info;
|
||||
client.sendMessage(msg.from, `
|
||||
*Connection info*
|
||||
User name: ${info.pushname}
|
||||
My number: ${info.me.user}
|
||||
My number: ${info.wid.user}
|
||||
Platform: ${info.platform}
|
||||
WhatsApp version: ${info.phone.wa_version}
|
||||
`);
|
||||
} else if (msg.body == '!mediainfo' && msg.hasMedia) {
|
||||
} else if (msg.body === '!mediainfo' && msg.hasMedia) {
|
||||
const attachmentData = await msg.downloadMedia();
|
||||
msg.reply(`
|
||||
*Media info*
|
||||
@@ -129,7 +116,7 @@ client.on('message', async msg => {
|
||||
Filename: ${attachmentData.filename}
|
||||
Data (length): ${attachmentData.data.length}
|
||||
`);
|
||||
} else if (msg.body == '!quoteinfo' && msg.hasQuotedMsg) {
|
||||
} else if (msg.body === '!quoteinfo' && msg.hasQuotedMsg) {
|
||||
const quotedMsg = await msg.getQuotedMessage();
|
||||
|
||||
quotedMsg.reply(`
|
||||
@@ -139,13 +126,13 @@ client.on('message', async msg => {
|
||||
Timestamp: ${quotedMsg.timestamp}
|
||||
Has Media? ${quotedMsg.hasMedia}
|
||||
`);
|
||||
} else if (msg.body == '!resendmedia' && msg.hasQuotedMsg) {
|
||||
} else if (msg.body === '!resendmedia' && msg.hasQuotedMsg) {
|
||||
const quotedMsg = await msg.getQuotedMessage();
|
||||
if (quotedMsg.hasMedia) {
|
||||
const attachmentData = await quotedMsg.downloadMedia();
|
||||
client.sendMessage(msg.from, attachmentData, { caption: 'Here\'s your requested media.' });
|
||||
}
|
||||
} else if (msg.body == '!location') {
|
||||
} else if (msg.body === '!location') {
|
||||
msg.reply(new Location(37.422, -122.084, 'Googleplex\nGoogle Headquarters'));
|
||||
} else if (msg.location) {
|
||||
msg.reply(msg.location);
|
||||
@@ -153,34 +140,57 @@ client.on('message', async msg => {
|
||||
const newStatus = msg.body.split(' ')[1];
|
||||
await client.setStatus(newStatus);
|
||||
msg.reply(`Status was updated to *${newStatus}*`);
|
||||
} else if (msg.body == '!mention') {
|
||||
} 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 === '!delete') {
|
||||
if (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 === '!pin') {
|
||||
const chat = await msg.getChat();
|
||||
await chat.pin();
|
||||
} else if (msg.body === '!archive') {
|
||||
const chat = await msg.getChat();
|
||||
chat.archive();
|
||||
await chat.archive();
|
||||
} else if (msg.body === '!mute') {
|
||||
const chat = await msg.getChat();
|
||||
// mute the chat for 20 seconds
|
||||
const unmuteDate = new Date();
|
||||
unmuteDate.setSeconds(unmuteDate.getSeconds() + 20);
|
||||
await chat.mute(unmuteDate);
|
||||
} else if (msg.body === '!typing') {
|
||||
const chat = await msg.getChat();
|
||||
// simulates typing in the chat
|
||||
chat.sendStateTyping();
|
||||
chat.sendStateTyping();
|
||||
} else if (msg.body === '!recording') {
|
||||
const chat = await msg.getChat();
|
||||
// simulates recording audio in the chat
|
||||
chat.sendStateRecording();
|
||||
chat.sendStateRecording();
|
||||
} else if (msg.body === '!clearstate') {
|
||||
const chat = await msg.getChat();
|
||||
// stops typing or recording in the chat
|
||||
chat.clearState();
|
||||
chat.clearState();
|
||||
} else if (msg.body === '!jumpto') {
|
||||
if (msg.hasQuotedMsg) {
|
||||
const quotedMsg = await msg.getQuotedMessage();
|
||||
client.interface.openChatWindowAt(quotedMsg.id._serialized);
|
||||
}
|
||||
} else if (msg.body === '!buttons') {
|
||||
let button = new Buttons('Button body',[{body:'bt1'},{body:'bt2'},{body:'bt3'}],'title','footer');
|
||||
client.sendMessage(msg.from, button);
|
||||
} else if (msg.body === '!list') {
|
||||
let sections = [{title:'sectionTitle',rows:[{title:'ListItem1', description: 'desc'},{title:'ListItem2'}]}];
|
||||
let list = new List('List body','btnText',sections,'Title','footer');
|
||||
client.sendMessage(msg.from, list);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -237,6 +247,10 @@ client.on('group_update', (notification) => {
|
||||
console.log('update', notification);
|
||||
});
|
||||
|
||||
client.on('change_state', state => {
|
||||
console.log('CHANGE STATE', state );
|
||||
});
|
||||
|
||||
client.on('disconnected', (reason) => {
|
||||
console.log('Client was logged out', reason);
|
||||
});
|
||||
|
||||
1301
index.d.ts
vendored
Normal file
1301
index.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
16
index.js
16
index.js
@@ -1,5 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
const Constants = require('./src/util/Constants');
|
||||
|
||||
module.exports = {
|
||||
Client: require('./src/Client'),
|
||||
|
||||
@@ -15,5 +17,15 @@ module.exports = {
|
||||
PrivateContact: require('./src/structures/PrivateContact'),
|
||||
BusinessContact: require('./src/structures/BusinessContact'),
|
||||
ClientInfo: require('./src/structures/ClientInfo'),
|
||||
Location: require('./src/structures/Location')
|
||||
};
|
||||
Location: require('./src/structures/Location'),
|
||||
ProductMetadata: require('./src/structures/ProductMetadata'),
|
||||
List: require('./src/structures/List'),
|
||||
Buttons: require('./src/structures/Buttons'),
|
||||
|
||||
// Auth Strategies
|
||||
NoAuth: require('./src/authStrategies/NoAuth'),
|
||||
LocalAuth: require('./src/authStrategies/LocalAuth'),
|
||||
LegacySessionAuth: require('./src/authStrategies/LegacySessionAuth'),
|
||||
|
||||
...Constants
|
||||
};
|
||||
|
||||
1617
package-lock.json
generated
1617
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
35
package.json
35
package.json
@@ -1,10 +1,13 @@
|
||||
{
|
||||
"name": "whatsapp-web.js",
|
||||
"version": "1.2.0",
|
||||
"version": "1.16.5",
|
||||
"description": "Library for interacting with the WhatsApp Web API ",
|
||||
"main": "./index.js",
|
||||
"typings": "./index.d.ts",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"test": "mocha tests --recursive --timeout 5000",
|
||||
"test-single": "mocha",
|
||||
"shell": "node --experimental-repl-await ./shell.js",
|
||||
"generate-docs": "node_modules/.bin/jsdoc --configure .jsdoc.json --verbose"
|
||||
},
|
||||
"repository": {
|
||||
@@ -24,15 +27,29 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/pedroslopez/whatsapp-web.js/issues"
|
||||
},
|
||||
"homepage": "https://github.com/pedroslopez/whatsapp-web.js#readme",
|
||||
"homepage": "https://wwebjs.dev/",
|
||||
"dependencies": {
|
||||
"jsqr": "^1.2.0",
|
||||
"moduleraid": "git+https://github.com/pixeldesu/moduleRaid.git",
|
||||
"puppeteer": "^2.1.1"
|
||||
"@pedroslopez/moduleraid": "^5.0.2",
|
||||
"fluent-ffmpeg": "^2.1.2",
|
||||
"jsqr": "^1.3.1",
|
||||
"mime": "^3.0.0",
|
||||
"node-fetch": "^2.6.5",
|
||||
"node-webpmux": "^3.1.0",
|
||||
"puppeteer": "^13.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^6.8.0",
|
||||
"jsdoc": "^3.6.3",
|
||||
"jsdoc-baseline": "^0.1.5"
|
||||
"@types/node-fetch": "^2.5.12",
|
||||
"chai": "^4.3.4",
|
||||
"chai-as-promised": "^7.1.1",
|
||||
"dotenv": "^16.0.0",
|
||||
"eslint": "^8.4.1",
|
||||
"eslint-plugin-mocha": "^10.0.3",
|
||||
"jsdoc": "^3.6.4",
|
||||
"jsdoc-baseline": "^0.1.5",
|
||||
"mocha": "^9.0.2",
|
||||
"sinon": "^13.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
36
shell.js
Normal file
36
shell.js
Normal file
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* ==== wwebjs-shell ====
|
||||
* Used for quickly testing library features
|
||||
*
|
||||
* Running `npm run shell` will start WhatsApp Web with headless=false
|
||||
* and then drop you into Node REPL with `client` in its context.
|
||||
*/
|
||||
|
||||
const repl = require('repl');
|
||||
|
||||
const { Client, LocalAuth } = require('./index');
|
||||
|
||||
const client = new Client({
|
||||
puppeteer: { headless: false },
|
||||
authStrategy: new LocalAuth()
|
||||
});
|
||||
|
||||
console.log('Initializing...');
|
||||
|
||||
client.initialize();
|
||||
|
||||
client.on('qr', () => {
|
||||
console.log('Please scan the QR code on the browser.');
|
||||
});
|
||||
|
||||
client.on('authenticated', (session) => {
|
||||
console.log(JSON.stringify(session));
|
||||
});
|
||||
|
||||
client.on('ready', () => {
|
||||
const shell = repl.start('wwebjs> ');
|
||||
shell.context.client = client;
|
||||
shell.on('exit', async () => {
|
||||
await client.destroy();
|
||||
});
|
||||
});
|
||||
831
src/Client.js
831
src/Client.js
File diff suppressed because it is too large
Load Diff
24
src/authStrategies/BaseAuthStrategy.js
Normal file
24
src/authStrategies/BaseAuthStrategy.js
Normal file
@@ -0,0 +1,24 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Base class which all authentication strategies extend
|
||||
*/
|
||||
class BaseAuthStrategy {
|
||||
constructor() {}
|
||||
setup(client) {
|
||||
this.client = client;
|
||||
}
|
||||
async beforeBrowserInitialized() {}
|
||||
async afterBrowserInitialized() {}
|
||||
async onAuthenticationNeeded() {
|
||||
return {
|
||||
failed: false,
|
||||
restart: false,
|
||||
failureEventPayload: undefined
|
||||
};
|
||||
}
|
||||
async getAuthEventPayload() {}
|
||||
async logout() {}
|
||||
}
|
||||
|
||||
module.exports = BaseAuthStrategy;
|
||||
72
src/authStrategies/LegacySessionAuth.js
Normal file
72
src/authStrategies/LegacySessionAuth.js
Normal file
@@ -0,0 +1,72 @@
|
||||
'use strict';
|
||||
|
||||
const BaseAuthStrategy = require('./BaseAuthStrategy');
|
||||
|
||||
/**
|
||||
* Legacy session auth strategy
|
||||
* Not compatible with multi-device accounts.
|
||||
* @param {object} options - options
|
||||
* @param {string} options.restartOnAuthFail - Restart client with a new session (i.e. use null 'session' var) if authentication fails
|
||||
* @param {object} options.session - Whatsapp session to restore. If not set, will start a new session
|
||||
* @param {string} options.session.WABrowserId
|
||||
* @param {string} options.session.WASecretBundle
|
||||
* @param {string} options.session.WAToken1
|
||||
* @param {string} options.session.WAToken2
|
||||
*/
|
||||
class LegacySessionAuth extends BaseAuthStrategy {
|
||||
constructor({ session, restartOnAuthFail }={}) {
|
||||
super();
|
||||
this.session = session;
|
||||
this.restartOnAuthFail = restartOnAuthFail;
|
||||
}
|
||||
|
||||
async afterBrowserInitialized() {
|
||||
if(this.session) {
|
||||
await this.client.pupPage.evaluateOnNewDocument(session => {
|
||||
if (document.referrer === 'https://whatsapp.com/') {
|
||||
localStorage.clear();
|
||||
localStorage.setItem('WABrowserId', session.WABrowserId);
|
||||
localStorage.setItem('WASecretBundle', session.WASecretBundle);
|
||||
localStorage.setItem('WAToken1', session.WAToken1);
|
||||
localStorage.setItem('WAToken2', session.WAToken2);
|
||||
}
|
||||
|
||||
localStorage.setItem('remember-me', 'true');
|
||||
}, this.session);
|
||||
}
|
||||
}
|
||||
|
||||
async onAuthenticationNeeded() {
|
||||
if(this.session) {
|
||||
this.session = null;
|
||||
return {
|
||||
failed: true,
|
||||
restart: this.restartOnAuthFail,
|
||||
failureEventPayload: 'Unable to log in. Are the session details valid?'
|
||||
};
|
||||
}
|
||||
|
||||
return { failed: false };
|
||||
}
|
||||
|
||||
async getAuthEventPayload() {
|
||||
const isMD = await this.client.pupPage.evaluate(() => {
|
||||
return window.Store.Features.features.MD_BACKEND;
|
||||
});
|
||||
|
||||
if(isMD) throw new Error('Authenticating via JSON session is not supported for MultiDevice-enabled WhatsApp accounts.');
|
||||
|
||||
const localStorage = JSON.parse(await this.client.pupPage.evaluate(() => {
|
||||
return JSON.stringify(window.localStorage);
|
||||
}));
|
||||
|
||||
return {
|
||||
WABrowserId: localStorage.WABrowserId,
|
||||
WASecretBundle: localStorage.WASecretBundle,
|
||||
WAToken1: localStorage.WAToken1,
|
||||
WAToken2: localStorage.WAToken2
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = LegacySessionAuth;
|
||||
53
src/authStrategies/LocalAuth.js
Normal file
53
src/authStrategies/LocalAuth.js
Normal file
@@ -0,0 +1,53 @@
|
||||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const BaseAuthStrategy = require('./BaseAuthStrategy');
|
||||
|
||||
/**
|
||||
* Local directory-based authentication
|
||||
* @param {object} options - options
|
||||
* @param {string} options.clientId - Client id to distinguish instances if you are using multiple, otherwise keep null if you are using only one instance
|
||||
* @param {string} options.dataPath - Change the default path for saving session files, default is: "./.wwebjs_auth/"
|
||||
*/
|
||||
class LocalAuth extends BaseAuthStrategy {
|
||||
constructor({ clientId, dataPath }={}) {
|
||||
super();
|
||||
|
||||
const idRegex = /^[-_\w]+$/i;
|
||||
if(clientId && !idRegex.test(clientId)) {
|
||||
throw new Error('Invalid clientId. Only alphanumeric characters, underscores and hyphens are allowed.');
|
||||
}
|
||||
|
||||
this.dataPath = path.resolve(dataPath || './.wwebjs_auth/');
|
||||
this.clientId = clientId;
|
||||
}
|
||||
|
||||
async beforeBrowserInitialized() {
|
||||
const puppeteerOpts = this.client.options.puppeteer;
|
||||
const sessionDirName = this.clientId ? `session-${this.clientId}` : 'session';
|
||||
const dirPath = path.join(this.dataPath, sessionDirName);
|
||||
|
||||
if(puppeteerOpts.userDataDir && puppeteerOpts.userDataDir !== dirPath) {
|
||||
throw new Error('LocalAuth is not compatible with a user-supplied userDataDir.');
|
||||
}
|
||||
|
||||
fs.mkdirSync(dirPath, { recursive: true });
|
||||
|
||||
this.client.options.puppeteer = {
|
||||
...puppeteerOpts,
|
||||
userDataDir: dirPath
|
||||
};
|
||||
|
||||
this.userDataDir = dirPath;
|
||||
}
|
||||
|
||||
async logout() {
|
||||
if (this.userDataDir) {
|
||||
return (fs.rmSync ? fs.rmSync : fs.rmdirSync).call(this, this.userDataDir, { recursive: true });
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = LocalAuth;
|
||||
12
src/authStrategies/NoAuth.js
Normal file
12
src/authStrategies/NoAuth.js
Normal file
@@ -0,0 +1,12 @@
|
||||
'use strict';
|
||||
|
||||
const BaseAuthStrategy = require('./BaseAuthStrategy');
|
||||
|
||||
/**
|
||||
* No session restoring functionality
|
||||
* Will need to authenticate via QR code every time
|
||||
*/
|
||||
class NoAuth extends BaseAuthStrategy { }
|
||||
|
||||
|
||||
module.exports = NoAuth;
|
||||
82
src/structures/Buttons.js
Normal file
82
src/structures/Buttons.js
Normal file
@@ -0,0 +1,82 @@
|
||||
'use strict';
|
||||
|
||||
const MessageMedia = require('./MessageMedia');
|
||||
const Util = require('../util/Util');
|
||||
|
||||
/**
|
||||
* Button spec used in Buttons constructor
|
||||
* @typedef {Object} ButtonSpec
|
||||
* @property {string=} id - Custom ID to set on the button. A random one will be generated if one is not passed.
|
||||
* @property {string} body - The text to show on the button.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} FormattedButtonSpec
|
||||
* @property {string} buttonId
|
||||
* @property {number} type
|
||||
* @property {Object} buttonText
|
||||
*/
|
||||
|
||||
/**
|
||||
* Message type buttons
|
||||
*/
|
||||
class Buttons {
|
||||
/**
|
||||
* @param {string|MessageMedia} body
|
||||
* @param {ButtonSpec[]} buttons - See {@link ButtonSpec}
|
||||
* @param {string?} title
|
||||
* @param {string?} footer
|
||||
*/
|
||||
constructor(body, buttons, title, footer) {
|
||||
/**
|
||||
* Message body
|
||||
* @type {string|MessageMedia}
|
||||
*/
|
||||
this.body = body;
|
||||
|
||||
/**
|
||||
* title of message
|
||||
* @type {string}
|
||||
*/
|
||||
this.title = title;
|
||||
|
||||
/**
|
||||
* footer of message
|
||||
* @type {string}
|
||||
*/
|
||||
this.footer = footer;
|
||||
|
||||
if (body instanceof MessageMedia) {
|
||||
this.type = 'media';
|
||||
this.title = '';
|
||||
}else{
|
||||
this.type = 'chat';
|
||||
}
|
||||
|
||||
/**
|
||||
* buttons of message
|
||||
* @type {FormattedButtonSpec[]}
|
||||
*/
|
||||
this.buttons = this._format(buttons);
|
||||
if(!this.buttons.length){ throw '[BT01] No buttons';}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates button array from simple array
|
||||
* @param {ButtonSpec[]} buttons
|
||||
* @returns {FormattedButtonSpec[]}
|
||||
* @example
|
||||
* Input: [{id:'customId',body:'button1'},{body:'button2'},{body:'button3'},{body:'button4'}]
|
||||
* Returns: [{ buttonId:'customId',buttonText:{'displayText':'button1'},type: 1 },{buttonId:'n3XKsL',buttonText:{'displayText':'button2'},type:1},{buttonId:'NDJk0a',buttonText:{'displayText':'button3'},type:1}]
|
||||
*/
|
||||
_format(buttons){
|
||||
buttons = buttons.slice(0,3); // phone users can only see 3 buttons, so lets limit this
|
||||
return buttons.map((btn) => {
|
||||
return {'buttonId':btn.id ? String(btn.id) : Util.generateHash(6),'buttonText':{'displayText':btn.body},'type':1};
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = Buttons;
|
||||
68
src/structures/Call.js
Normal file
68
src/structures/Call.js
Normal file
@@ -0,0 +1,68 @@
|
||||
'use strict';
|
||||
|
||||
const Base = require('./Base');
|
||||
|
||||
/**
|
||||
* Represents a Call on WhatsApp
|
||||
* @extends {Base}
|
||||
*/
|
||||
class Call extends Base {
|
||||
constructor(client, data) {
|
||||
super(client);
|
||||
|
||||
if (data) this._patch(data);
|
||||
}
|
||||
|
||||
_patch(data) {
|
||||
/**
|
||||
* Call ID
|
||||
* @type {string}
|
||||
*/
|
||||
this.id = data.id;
|
||||
/**
|
||||
* From
|
||||
* @type {string}
|
||||
*/
|
||||
this.from = data.peerJid;
|
||||
/**
|
||||
* Unix timestamp for when the call was created
|
||||
* @type {number}
|
||||
*/
|
||||
this.timestamp = data.offerTime;
|
||||
/**
|
||||
* Is video
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.isVideo = data.isVideo;
|
||||
/**
|
||||
* Is Group
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.isGroup = data.isGroup;
|
||||
/**
|
||||
* Indicates if the call was sent by the current user
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.fromMe = data.outgoing;
|
||||
/**
|
||||
* Indicates if the call can be handled in waweb
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.canHandleLocally = data.canHandleLocally;
|
||||
/**
|
||||
* Indicates if the call Should be handled in waweb
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.webClientShouldHandle = data.webClientShouldHandle;
|
||||
/**
|
||||
* Object with participants
|
||||
* @type {object}
|
||||
*/
|
||||
this.participants = data.participants;
|
||||
|
||||
return super._patch(data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = Call;
|
||||
@@ -46,7 +46,7 @@ class Chat extends Base {
|
||||
this.unreadCount = data.unreadCount;
|
||||
|
||||
/**
|
||||
* Unix timestamp for when the chat was created
|
||||
* Unix timestamp for when the last activity occurred
|
||||
* @type {number}
|
||||
*/
|
||||
this.timestamp = data.t;
|
||||
@@ -57,13 +57,31 @@ class Chat extends Base {
|
||||
*/
|
||||
this.archived = data.archive;
|
||||
|
||||
/**
|
||||
* Indicates if the Chat is pinned
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.pinned = !!data.pin;
|
||||
|
||||
/**
|
||||
* Indicates if the chat is muted or not
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.isMuted = data.isMuted;
|
||||
|
||||
/**
|
||||
* Unix timestamp for when the mute expires
|
||||
* @type {number}
|
||||
*/
|
||||
this.muteExpiration = data.muteExpiration;
|
||||
|
||||
return super._patch(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a message to this chat
|
||||
* @param {string|MessageMedia|Location} content
|
||||
* @param {object} options
|
||||
* @param {MessageSendOptions} [options]
|
||||
* @returns {Promise<Message>} Message that was just sent
|
||||
*/
|
||||
async sendMessage(content, options) {
|
||||
@@ -112,36 +130,77 @@ class Chat extends Base {
|
||||
return this.client.unarchiveChat(this.id._serialized);
|
||||
}
|
||||
|
||||
/**
|
||||
* Pins this chat
|
||||
* @returns {Promise<boolean>} New pin state. Could be false if the max number of pinned chats was reached.
|
||||
*/
|
||||
async pin() {
|
||||
return this.client.pinChat(this.id._serialized);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unpins this chat
|
||||
* @returns {Promise<boolean>} New pin state
|
||||
*/
|
||||
async unpin() {
|
||||
return this.client.unpinChat(this.id._serialized);
|
||||
}
|
||||
|
||||
/**
|
||||
* Mutes this chat forever, unless a date is specified
|
||||
* @param {?Date} unmuteDate Date at which the Chat will be unmuted, leave as is to mute forever
|
||||
*/
|
||||
async mute(unmuteDate) {
|
||||
return this.client.muteChat(this.id._serialized, unmuteDate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unmutes this chat
|
||||
*/
|
||||
async unmute() {
|
||||
return this.client.unmuteChat(this.id._serialized);
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark this chat as unread
|
||||
*/
|
||||
async markUnread(){
|
||||
return this.client.markChatUnread(this.id._serialized);
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads chat messages, sorted from earliest to latest.
|
||||
* @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.
|
||||
* @param {Number} [searchOptions.limit] The amount of messages to return. If no limit is specified, the available messages will be returned. Note that the actual number of returned messages may be smaller if there aren't enough messages in the conversation. Set this to Infinity to load all messages.
|
||||
* @returns {Promise<Array<Message>>}
|
||||
*/
|
||||
async fetchMessages(searchOptions) {
|
||||
if(!searchOptions || !searchOptions.limit) {
|
||||
searchOptions = {limit: 50};
|
||||
}
|
||||
let messages = await this.client.pupPage.evaluate(async (chatId, limit) => {
|
||||
let messages = await this.client.pupPage.evaluate(async (chatId, searchOptions) => {
|
||||
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 = [...msgs, ...loadedMessages.filter(msgFilter)];
|
||||
|
||||
if (searchOptions && searchOptions.limit > 0) {
|
||||
while (msgs.length < searchOptions.limit) {
|
||||
const loadedMessages = await chat.loadEarlierMsgs();
|
||||
if (!loadedMessages) break;
|
||||
msgs = [...loadedMessages.filter(msgFilter), ...msgs];
|
||||
}
|
||||
|
||||
if (msgs.length > searchOptions.limit) {
|
||||
msgs.sort((a, b) => (a.t > b.t) ? 1 : -1);
|
||||
msgs = msgs.splice(msgs.length - searchOptions.limit);
|
||||
}
|
||||
}
|
||||
|
||||
return msgs.splice(0, limit).map(m => m.serialize());
|
||||
return msgs.map(m => window.WWebJS.getMessageModel(m));
|
||||
|
||||
}, this.id._serialized, searchOptions.limit);
|
||||
}, this.id._serialized, searchOptions);
|
||||
|
||||
messages.sort((a, b) => (a.t > b.t) ? 1 : -1);
|
||||
return messages.map(m => new Message(this.client, m));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Simulate typing in chat. This will last for 25 seconds.
|
||||
*/
|
||||
@@ -151,7 +210,7 @@ class Chat extends Base {
|
||||
return true;
|
||||
}, this.id._serialized);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Simulate recording audio in chat. This will last for 25 seconds.
|
||||
*/
|
||||
@@ -171,6 +230,22 @@ class Chat extends Base {
|
||||
return true;
|
||||
}, this.id._serialized);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Contact that corresponds to this Chat.
|
||||
* @returns {Promise<Contact>}
|
||||
*/
|
||||
async getContact() {
|
||||
return await this.client.getContactById(this.id._serialized);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns array of all Labels assigned to this Chat
|
||||
* @returns {Promise<Array<Label>>}
|
||||
*/
|
||||
async getLabels() {
|
||||
return this.client.getChatLabels(this.id._serialized);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Chat;
|
||||
|
||||
@@ -10,7 +10,7 @@ class ClientInfo extends Base {
|
||||
constructor(client, data) {
|
||||
super(client);
|
||||
|
||||
if(data) this._patch(data);
|
||||
if (data) this._patch(data);
|
||||
}
|
||||
|
||||
_patch(data) {
|
||||
@@ -24,21 +24,28 @@ class ClientInfo extends Base {
|
||||
* Current user ID
|
||||
* @type {object}
|
||||
*/
|
||||
this.me = data.me;
|
||||
this.wid = data.wid;
|
||||
|
||||
/**
|
||||
* Information about the phone this client is connected to
|
||||
* @type {object}
|
||||
* @deprecated Use .wid instead
|
||||
*/
|
||||
this.me = data.wid;
|
||||
|
||||
/**
|
||||
* Information about the phone this client is connected to. Not available in multi-device.
|
||||
* @type {object}
|
||||
* @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
|
||||
* @deprecated
|
||||
*/
|
||||
this.phone = data.phone;
|
||||
|
||||
/**
|
||||
* Platform the phone is running on
|
||||
* Platform WhatsApp is running on
|
||||
* @type {string}
|
||||
*/
|
||||
this.platform = data.platform;
|
||||
@@ -46,6 +53,19 @@ class ClientInfo extends Base {
|
||||
return super._patch(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current battery percentage and charging status for the attached device
|
||||
* @returns {object} batteryStatus
|
||||
* @returns {number} batteryStatus.battery - The current battery percentage
|
||||
* @returns {boolean} batteryStatus.plugged - Indicates if the phone is plugged in (true) or not (false)
|
||||
* @deprecated
|
||||
*/
|
||||
async getBatteryStatus() {
|
||||
return await this.client.pupPage.evaluate(() => {
|
||||
const { battery, plugged } = window.Store.Conn;
|
||||
return { battery, plugged };
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ClientInfo;
|
||||
@@ -2,6 +2,14 @@
|
||||
|
||||
const Base = require('./Base');
|
||||
|
||||
/**
|
||||
* ID that represents a contact
|
||||
* @typedef {Object} ContactId
|
||||
* @property {string} server
|
||||
* @property {string} user
|
||||
* @property {string} _serialized
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents a Contact on WhatsApp
|
||||
* @extends {Base}
|
||||
@@ -16,7 +24,7 @@ class Contact extends Base {
|
||||
_patch(data) {
|
||||
/**
|
||||
* ID that represents the contact
|
||||
* @type {object}
|
||||
* @type {ContactId}
|
||||
*/
|
||||
this.id = data.id;
|
||||
|
||||
@@ -95,6 +103,12 @@ class Contact extends Base {
|
||||
*/
|
||||
this.isMyContact = data.isMyContact;
|
||||
|
||||
/**
|
||||
* Indicates if you have blocked this contact
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.isBlocked = data.isBlocked;
|
||||
|
||||
return super._patch(data);
|
||||
}
|
||||
|
||||
@@ -103,13 +117,90 @@ class Contact extends Base {
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
async getProfilePicUrl() {
|
||||
const profilePic = await this.client.pupPage.evaluate((contactId) => {
|
||||
return window.Store.Wap.profilePicFind(contactId);
|
||||
return await this.client.getProfilePicUrl(this.id._serialized);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the contact's formatted phone number, (12345678901@c.us) => (+1 (234) 5678-901)
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
async getFormattedNumber() {
|
||||
return await this.client.getFormattedNumber(this.id._serialized);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the contact's countrycode, (1541859685@c.us) => (1)
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
async getCountryCode() {
|
||||
return await this.client.getCountryCode(this.id._serialized);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Chat that corresponds to this Contact.
|
||||
* Will return null when getting chat for currently logged in user.
|
||||
* @returns {Promise<Chat>}
|
||||
*/
|
||||
async getChat() {
|
||||
if(this.isMe) return null;
|
||||
|
||||
return await this.client.getChatById(this.id._serialized);
|
||||
}
|
||||
|
||||
/**
|
||||
* Blocks this contact from WhatsApp
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
async block() {
|
||||
if(this.isGroup) return false;
|
||||
|
||||
await this.client.pupPage.evaluate(async (contactId) => {
|
||||
const contact = window.Store.Contact.get(contactId);
|
||||
await window.Store.BlockContact.blockContact(contact);
|
||||
}, this.id._serialized);
|
||||
|
||||
return profilePic ? profilePic.eurl : undefined;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unblocks this contact from WhatsApp
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
async unblock() {
|
||||
if(this.isGroup) return false;
|
||||
|
||||
await this.client.pupPage.evaluate(async (contactId) => {
|
||||
const contact = window.Store.Contact.get(contactId);
|
||||
await window.Store.BlockContact.unblockContact(contact);
|
||||
}, this.id._serialized);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Contact's current "about" info. Returns null if you don't have permission to read their status.
|
||||
* @returns {Promise<?string>}
|
||||
*/
|
||||
async getAbout() {
|
||||
const about = await this.client.pupPage.evaluate(async (contactId) => {
|
||||
const wid = window.Store.WidFactory.createWid(contactId);
|
||||
return window.Store.StatusUtils.getStatus(wid);
|
||||
}, this.id._serialized);
|
||||
|
||||
if (typeof about.status !== 'string')
|
||||
return null;
|
||||
|
||||
return about.status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Contact's common groups with you. Returns empty array if you don't have any common group.
|
||||
* @returns {Promise<WAWebJS.ChatId[]>}
|
||||
*/
|
||||
async getCommonGroups() {
|
||||
return await this.client.getCommonGroups(this.id._serialized);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = Contact;
|
||||
module.exports = Contact;
|
||||
|
||||
@@ -2,6 +2,14 @@
|
||||
|
||||
const Chat = require('./Chat');
|
||||
|
||||
/**
|
||||
* Group participant information
|
||||
* @typedef {Object} GroupParticipant
|
||||
* @property {ContactId} id
|
||||
* @property {boolean} isAdmin
|
||||
* @property {boolean} isSuperAdmin
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents a Group Chat on WhatsApp
|
||||
* @extends {Chat}
|
||||
@@ -15,6 +23,7 @@ class GroupChat extends Chat {
|
||||
|
||||
/**
|
||||
* Gets the group owner
|
||||
* @type {ContactId}
|
||||
*/
|
||||
get owner() {
|
||||
return this.groupMetadata.owner;
|
||||
@@ -35,9 +44,10 @@ class GroupChat extends Chat {
|
||||
get description() {
|
||||
return this.groupMetadata.desc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the group participants
|
||||
* @type {array}
|
||||
* @type {Array<GroupParticipant>}
|
||||
*/
|
||||
get participants() {
|
||||
return this.groupMetadata.participants;
|
||||
@@ -46,123 +56,176 @@ class GroupChat extends Chat {
|
||||
/**
|
||||
* Adds a list of participants by ID to the group
|
||||
* @param {Array<string>} participantIds
|
||||
* @returns {Promise<Object>}
|
||||
*/
|
||||
async addParticipants(participantIds) {
|
||||
return await this.client.pupPage.evaluate((chatId, participantIds) => {
|
||||
return window.Store.Wap.addParticipants(chatId, participantIds);
|
||||
const chatWid = window.Store.WidFactory.createWid(chatId);
|
||||
const participantWids = participantIds.map(p => window.Store.WidFactory.createWid(p));
|
||||
return window.Store.GroupParticipants.sendAddParticipants(chatWid, participantWids);
|
||||
}, this.id._serialized, participantIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a list of participants by ID to the group
|
||||
* @param {Array<string>} participantIds
|
||||
* @returns {Promise<Object>}
|
||||
*/
|
||||
async removeParticipants(participantIds) {
|
||||
return await this.client.pupPage.evaluate((chatId, participantIds) => {
|
||||
return window.Store.Wap.removeParticipants(chatId, participantIds);
|
||||
const chatWid = window.Store.WidFactory.createWid(chatId);
|
||||
const participantWids = participantIds.map(p => window.Store.WidFactory.createWid(p));
|
||||
return window.Store.GroupParticipants.sendRemoveParticipants(chatWid, participantWids);
|
||||
}, this.id._serialized, participantIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* Promotes participants by IDs to admins
|
||||
* @param {Array<string>} participantIds
|
||||
* @returns {Promise<{ status: number }>} Object with status code indicating if the operation was successful
|
||||
*/
|
||||
async promoteParticipants(participantIds) {
|
||||
return await this.client.pupPage.evaluate((chatId, participantIds) => {
|
||||
return window.Store.Wap.promoteParticipants(chatId, participantIds);
|
||||
const chatWid = window.Store.WidFactory.createWid(chatId);
|
||||
const participantWids = participantIds.map(p => window.Store.WidFactory.createWid(p));
|
||||
return window.Store.GroupParticipants.sendPromoteParticipants(chatWid, participantWids);
|
||||
}, this.id._serialized, participantIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* Demotes participants by IDs to regular users
|
||||
* @param {Array<string>} participantIds
|
||||
* @returns {Promise<{ status: number }>} Object with status code indicating if the operation was successful
|
||||
*/
|
||||
async demoteParticipants(participantIds) {
|
||||
return await this.client.pupPage.evaluate((chatId, participantIds) => {
|
||||
return window.Store.Wap.demoteParticipants(chatId, participantIds);
|
||||
const chatWid = window.Store.WidFactory.createWid(chatId);
|
||||
const participantWids = participantIds.map(p => window.Store.WidFactory.createWid(p));
|
||||
return window.Store.GroupParticipants.sendDemoteParticipants(chatWid, participantWids);
|
||||
}, this.id._serialized, participantIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the group subject
|
||||
* @param {string} subject
|
||||
* @returns {Promise<boolean>} Returns true if the subject was properly updated. This can return false if the user does not have the necessary permissions.
|
||||
*/
|
||||
async setSubject(subject) {
|
||||
let res = await this.client.pupPage.evaluate((chatId, subject) => {
|
||||
return window.Store.Wap.changeSubject(chatId, subject);
|
||||
const success = await this.client.pupPage.evaluate(async (chatId, subject) => {
|
||||
const chatWid = window.Store.WidFactory.createWid(chatId);
|
||||
try {
|
||||
return await window.Store.GroupUtils.sendSetGroupSubject(chatWid, subject);
|
||||
} catch (err) {
|
||||
if(err.name === 'ServerStatusCodeError') return false;
|
||||
throw err;
|
||||
}
|
||||
}, this.id._serialized, subject);
|
||||
|
||||
if(res.status == 200) {
|
||||
this.name = subject;
|
||||
}
|
||||
if(!success) return false;
|
||||
this.name = subject;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the group description
|
||||
* @param {string} description
|
||||
* @returns {Promise<boolean>} Returns true if the description was properly updated. This can return false if the user does not have the necessary permissions.
|
||||
*/
|
||||
async setDescription(description) {
|
||||
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);
|
||||
const success = await this.client.pupPage.evaluate(async (chatId, description) => {
|
||||
const chatWid = window.Store.WidFactory.createWid(chatId);
|
||||
let descId = window.Store.GroupMetadata.get(chatWid).descId;
|
||||
try {
|
||||
return await window.Store.GroupUtils.sendSetGroupDescription(chatWid, description, window.Store.MsgKey.newId(), descId);
|
||||
} catch (err) {
|
||||
if(err.name === 'ServerStatusCodeError') return false;
|
||||
throw err;
|
||||
}
|
||||
}, this.id._serialized, description);
|
||||
|
||||
if (res.status == 200) {
|
||||
this.groupMetadata.desc = description;
|
||||
}
|
||||
if(!success) return false;
|
||||
this.groupMetadata.desc = description;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the group settings to only allow admins to send messages.
|
||||
* @param {boolean} [adminsOnly=true] Enable or disable this option
|
||||
* @returns {Promise<boolean>} Returns true if the setting was properly updated. This can return false if the user does not have the necessary permissions.
|
||||
*/
|
||||
async setMessagesAdminsOnly(adminsOnly=true) {
|
||||
const success = await this.client.pupPage.evaluate(async (chatId, adminsOnly) => {
|
||||
const chatWid = window.Store.WidFactory.createWid(chatId);
|
||||
try {
|
||||
return await window.Store.GroupUtils.sendSetGroupProperty(chatWid, 'announcement', adminsOnly ? 1 : 0);
|
||||
} catch (err) {
|
||||
if(err.name === 'ServerStatusCodeError') return false;
|
||||
throw err;
|
||||
}
|
||||
}, this.id._serialized, adminsOnly);
|
||||
|
||||
if(!success) return false;
|
||||
|
||||
this.groupMetadata.announce = adminsOnly;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the group settings to only allow admins to edit group info (title, description, photo).
|
||||
* @param {boolean} [adminsOnly=true] Enable or disable this option
|
||||
* @returns {Promise<boolean>} Returns true if the setting was properly updated. This can return false if the user does not have the necessary permissions.
|
||||
*/
|
||||
async setInfoAdminsOnly(adminsOnly=true) {
|
||||
const success = await this.client.pupPage.evaluate(async (chatId, adminsOnly) => {
|
||||
const chatWid = window.Store.WidFactory.createWid(chatId);
|
||||
try {
|
||||
return await window.Store.GroupUtils.sendSetGroupProperty(chatWid, 'restrict', adminsOnly ? 1 : 0);
|
||||
} catch (err) {
|
||||
if(err.name === 'ServerStatusCodeError') return false;
|
||||
throw err;
|
||||
}
|
||||
}, this.id._serialized, adminsOnly);
|
||||
|
||||
if(!success) return false;
|
||||
|
||||
this.groupMetadata.restrict = adminsOnly;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the invite code for a specific group
|
||||
* @returns {Promise<string>} Group's invite code
|
||||
*/
|
||||
async getInviteCode() {
|
||||
let res = await this.client.pupPage.evaluate(chatId => {
|
||||
return window.Store.Wap.groupInviteCode(chatId);
|
||||
const code = await this.client.pupPage.evaluate(async chatId => {
|
||||
const chatWid = window.Store.WidFactory.createWid(chatId);
|
||||
return window.Store.Invite.sendQueryGroupInviteCode(chatWid);
|
||||
}, this.id._serialized);
|
||||
|
||||
if (res.status == 200) {
|
||||
return res.code;
|
||||
}
|
||||
|
||||
throw new Error('Not authorized');
|
||||
return code;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invalidates the current group invite code and generates a new one
|
||||
* @returns {Promise<string>} New invite code
|
||||
*/
|
||||
async revokeInvite() {
|
||||
return await this.client.pupPage.evaluate(chatId => {
|
||||
return window.Store.Wap.revokeGroupInvite(chatId);
|
||||
const code = await this.client.pupPage.evaluate(chatId => {
|
||||
const chatWid = window.Store.WidFactory.createWid(chatId);
|
||||
return window.Store.Invite.sendRevokeGroupInviteCode(chatWid);
|
||||
}, 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);
|
||||
return code;
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes the bot leave the group
|
||||
* @returns {Promise}
|
||||
*/
|
||||
async leave() {
|
||||
return await this.client.pupPage.evaluate(chatId => {
|
||||
return window.Store.Wap.leaveGroup(chatId);
|
||||
await this.client.pupPage.evaluate(chatId => {
|
||||
const chatWid = window.Store.WidFactory.createWid(chatId);
|
||||
return window.Store.GroupUtils.sendExitGroup(chatWid);
|
||||
}, this.id._serialized);
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ class GroupNotification extends Base {
|
||||
*
|
||||
* @type {string}
|
||||
*/
|
||||
this.chatId = typeof (data.to) === 'object' ? data.to._serialized : data.to;
|
||||
this.chatId = typeof (data.id.remote) === 'object' ? data.id.remote._serialized : data.id.remote;
|
||||
|
||||
/**
|
||||
* ContactId for the user that produced the GroupNotification.
|
||||
|
||||
50
src/structures/Label.js
Normal file
50
src/structures/Label.js
Normal file
@@ -0,0 +1,50 @@
|
||||
'use strict';
|
||||
|
||||
const Base = require('./Base');
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const Chat = require('./Chat');
|
||||
|
||||
/**
|
||||
* WhatsApp Business Label information
|
||||
*/
|
||||
class Label extends Base {
|
||||
/**
|
||||
* @param {Base} client
|
||||
* @param {object} labelData
|
||||
*/
|
||||
constructor(client, labelData){
|
||||
super(client);
|
||||
|
||||
if(labelData) this._patch(labelData);
|
||||
}
|
||||
|
||||
_patch(labelData){
|
||||
/**
|
||||
* Label ID
|
||||
* @type {string}
|
||||
*/
|
||||
this.id = labelData.id;
|
||||
|
||||
/**
|
||||
* Label name
|
||||
* @type {string}
|
||||
*/
|
||||
this.name = labelData.name;
|
||||
|
||||
/**
|
||||
* Label hex color
|
||||
* @type {string}
|
||||
*/
|
||||
this.hexColor = labelData.hexColor;
|
||||
}
|
||||
/**
|
||||
* Get all chats that have been assigned this Label
|
||||
* @returns {Promise<Array<Chat>>}
|
||||
*/
|
||||
async getChats(){
|
||||
return this.client.getChatsByLabelId(this.id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = Label;
|
||||
79
src/structures/List.js
Normal file
79
src/structures/List.js
Normal file
@@ -0,0 +1,79 @@
|
||||
'use strict';
|
||||
|
||||
const Util = require('../util/Util');
|
||||
|
||||
/**
|
||||
* Message type List
|
||||
*/
|
||||
class List {
|
||||
/**
|
||||
* @param {string} body
|
||||
* @param {string} buttonText
|
||||
* @param {Array<any>} sections
|
||||
* @param {string?} title
|
||||
* @param {string?} footer
|
||||
*/
|
||||
constructor(body, buttonText, sections, title, footer) {
|
||||
/**
|
||||
* Message body
|
||||
* @type {string}
|
||||
*/
|
||||
this.description = body;
|
||||
|
||||
/**
|
||||
* List button text
|
||||
* @type {string}
|
||||
*/
|
||||
this.buttonText = buttonText;
|
||||
|
||||
/**
|
||||
* title of message
|
||||
* @type {string}
|
||||
*/
|
||||
this.title = title;
|
||||
|
||||
|
||||
/**
|
||||
* footer of message
|
||||
* @type {string}
|
||||
*/
|
||||
this.footer = footer;
|
||||
|
||||
/**
|
||||
* sections of message
|
||||
* @type {Array<any>}
|
||||
*/
|
||||
this.sections = this._format(sections);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates section array from simple array
|
||||
* @param {Array<any>} sections
|
||||
* @returns {Array<any>}
|
||||
* @example
|
||||
* Input: [{title:'sectionTitle',rows:[{id:'customId', title:'ListItem2', description: 'desc'},{title:'ListItem2'}]}}]
|
||||
* Returns: [{'title':'sectionTitle','rows':[{'rowId':'customId','title':'ListItem1','description':'desc'},{'rowId':'oGSRoD','title':'ListItem2','description':''}]}]
|
||||
*/
|
||||
_format(sections){
|
||||
if(!sections.length){throw '[LT02] List without sections';}
|
||||
if(sections.length > 1 && sections.filter(s => typeof s.title == 'undefined').length > 1){throw '[LT05] You can\'t have more than one empty title.';}
|
||||
return sections.map( (section) =>{
|
||||
if(!section.rows.length){throw '[LT03] Section without rows';}
|
||||
return {
|
||||
title: section.title ? section.title : undefined,
|
||||
rows: section.rows.map( (row) => {
|
||||
if(!row.title){throw '[LT04] Row without title';}
|
||||
return {
|
||||
rowId: row.id ? row.id : Util.generateHash(6),
|
||||
title: row.title,
|
||||
description: row.description ? row.description : ''
|
||||
};
|
||||
})
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = List;
|
||||
@@ -3,6 +3,8 @@
|
||||
const Base = require('./Base');
|
||||
const MessageMedia = require('./MessageMedia');
|
||||
const Location = require('./Location');
|
||||
const Order = require('./Order');
|
||||
const Payment = require('./Payment');
|
||||
const { MessageTypes } = require('../util/Constants');
|
||||
|
||||
/**
|
||||
@@ -13,21 +15,35 @@ class Message extends Base {
|
||||
constructor(client, data) {
|
||||
super(client);
|
||||
|
||||
if(data) this._patch(data);
|
||||
if (data) this._patch(data);
|
||||
}
|
||||
|
||||
_patch(data) {
|
||||
this._data = data;
|
||||
|
||||
/**
|
||||
* MediaKey that represents the sticker 'ID'
|
||||
* @type {string}
|
||||
*/
|
||||
this.mediaKey = data.mediaKey;
|
||||
|
||||
/**
|
||||
* ID that represents the message
|
||||
* @type {object}
|
||||
*/
|
||||
this.id = data.id;
|
||||
|
||||
/**
|
||||
* ACK status for the message
|
||||
* @type {MessageAck}
|
||||
*/
|
||||
this.ack = data.ack;
|
||||
|
||||
/**
|
||||
* Indicates if the message has media available for download
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.hasMedia = data.clientUrl ? true : false;
|
||||
this.hasMedia = Boolean(data.mediaKey && data.directPath);
|
||||
|
||||
/**
|
||||
* Message content
|
||||
@@ -35,7 +51,7 @@ class Message extends Base {
|
||||
*/
|
||||
this.body = this.hasMedia ? data.caption || '' : data.body || '';
|
||||
|
||||
/**
|
||||
/**
|
||||
* Message type
|
||||
* @type {MessageTypes}
|
||||
*/
|
||||
@@ -51,22 +67,28 @@ class Message extends Base {
|
||||
* ID for the Chat that this message was sent to, except if the message was sent by the current user.
|
||||
* @type {string}
|
||||
*/
|
||||
this.from = typeof (data.from) === 'object' ? data.from._serialized : data.from;
|
||||
this.from = (typeof (data.from) === 'object' && data.from !== null) ? data.from._serialized : data.from;
|
||||
|
||||
/**
|
||||
* ID for who this message is for.
|
||||
*
|
||||
*
|
||||
* If the message is sent by the current user, it will be the Chat to which the message is being sent.
|
||||
* If the message is sent by another user, it will be the ID for the current user.
|
||||
* If the message is sent by another user, it will be the ID for the current user.
|
||||
* @type {string}
|
||||
*/
|
||||
this.to = typeof (data.to) === 'object' ? data.to._serialized : data.to;
|
||||
this.to = (typeof (data.to) === 'object' && data.to !== null) ? data.to._serialized : data.to;
|
||||
|
||||
/**
|
||||
* If the message was sent to a group, this field will contain the user that sent the message.
|
||||
* @type {string}
|
||||
*/
|
||||
this.author = typeof (data.author) === 'object' ? data.author._serialized : data.author;
|
||||
this.author = (typeof (data.author) === 'object' && data.author !== null) ? data.author._serialized : data.author;
|
||||
|
||||
/**
|
||||
* String that represents from which device type the message was sent
|
||||
* @type {string}
|
||||
*/
|
||||
this.deviceType = data.id.id.length > 21 ? 'android' : data.id.id.substring(0, 2) == '3A' ? 'ios' : 'web';
|
||||
|
||||
/**
|
||||
* Indicates if the message was forwarded
|
||||
@@ -74,30 +96,75 @@ class Message extends Base {
|
||||
*/
|
||||
this.isForwarded = data.isForwarded;
|
||||
|
||||
/**
|
||||
* Indicates how many times the message was forwarded.
|
||||
*
|
||||
* The maximum value is 127.
|
||||
* @type {number}
|
||||
*/
|
||||
this.forwardingScore = data.forwardingScore || 0;
|
||||
|
||||
/**
|
||||
* Indicates if the message is a status update
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.isStatus = data.isStatusV3;
|
||||
|
||||
/**
|
||||
* Indicates if the message was starred
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.isStarred = data.star;
|
||||
|
||||
/**
|
||||
* Indicates if the message was a broadcast
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* Indicates the duration of the message in seconds
|
||||
* @type {string}
|
||||
*/
|
||||
this.duration = data.duration ? data.duration : undefined;
|
||||
|
||||
/**
|
||||
* Location information contained in the message, if the message is type "location"
|
||||
* @type {Location}
|
||||
*/
|
||||
this.location = data.type === MessageTypes.LOCATION ? new Location(data.lat, data.lng, data.loc) : undefined;
|
||||
|
||||
/**
|
||||
* List of vCards contained in the message.
|
||||
* @type {Array<string>}
|
||||
*/
|
||||
this.vCards = data.type === MessageTypes.CONTACT_CARD_MULTI ? data.vcardList.map((c) => c.vcard) : data.type === MessageTypes.CONTACT_CARD ? [data.body] : [];
|
||||
|
||||
/**
|
||||
* Group Invite Data
|
||||
* @type {object}
|
||||
*/
|
||||
this.inviteV4 = data.type === MessageTypes.GROUP_INVITE ? {
|
||||
inviteCode: data.inviteCode,
|
||||
inviteCodeExp: data.inviteCodeExp,
|
||||
groupId: data.inviteGrp,
|
||||
groupName: data.inviteGrpName,
|
||||
fromId: data.from._serialized,
|
||||
toId: data.to._serialized
|
||||
} : undefined;
|
||||
|
||||
/**
|
||||
* Indicates the mentions in the message body.
|
||||
* @type {Array<string>}
|
||||
@@ -108,6 +175,71 @@ class Message extends Base {
|
||||
this.mentionedIds = data.mentionedJidList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Order ID for message type ORDER
|
||||
* @type {string}
|
||||
*/
|
||||
this.orderId = data.orderId ? data.orderId : undefined;
|
||||
/**
|
||||
* Order Token for message type ORDER
|
||||
* @type {string}
|
||||
*/
|
||||
this.token = data.token ? data.token : undefined;
|
||||
|
||||
/**
|
||||
* Indicates whether the message is a Gif
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.isGif = Boolean(data.isGif);
|
||||
|
||||
/**
|
||||
* Indicates if the message will disappear after it expires
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.isEphemeral = data.isEphemeral;
|
||||
|
||||
/** Title */
|
||||
if (data.title) {
|
||||
this.title = data.title;
|
||||
}
|
||||
|
||||
/** Description */
|
||||
if (data.description) {
|
||||
this.description = data.description;
|
||||
}
|
||||
|
||||
/** Business Owner JID */
|
||||
if (data.businessOwnerJid) {
|
||||
this.businessOwnerJid = data.businessOwnerJid;
|
||||
}
|
||||
|
||||
/** Product ID */
|
||||
if (data.productId) {
|
||||
this.productId = data.productId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Links included in the message.
|
||||
* @type {Array<{link: string, isSuspicious: boolean}>}
|
||||
*
|
||||
*/
|
||||
this.links = data.links;
|
||||
|
||||
/** Buttons */
|
||||
if (data.dynamicReplyButtons) {
|
||||
this.dynamicReplyButtons = data.dynamicReplyButtons;
|
||||
}
|
||||
|
||||
/** Selected Button Id **/
|
||||
if (data.selectedButtonId) {
|
||||
this.selectedButtonId = data.selectedButtonId;
|
||||
}
|
||||
|
||||
/** Selected List row Id **/
|
||||
if (data.listResponse && data.listResponse.singleSelectReply.selectedRowId) {
|
||||
this.selectedRowId = data.listResponse.singleSelectReply.selectedRowId;
|
||||
}
|
||||
|
||||
return super._patch(data);
|
||||
}
|
||||
|
||||
@@ -115,6 +247,32 @@ class Message extends Base {
|
||||
return this.fromMe ? this.to : this.from;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reloads this Message object's data in-place with the latest values from WhatsApp Web.
|
||||
* Note that the Message must still be in the web app cache for this to work, otherwise will return null.
|
||||
* @returns {Promise<Message>}
|
||||
*/
|
||||
async reload() {
|
||||
const newData = await this.client.pupPage.evaluate((msgId) => {
|
||||
const msg = window.Store.Msg.get(msgId);
|
||||
if(!msg) return null;
|
||||
return window.WWebJS.getMessageModel(msg);
|
||||
}, this.id._serialized);
|
||||
|
||||
if(!newData) return null;
|
||||
|
||||
this._patch(newData);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns message in a raw format
|
||||
* @type {Object}
|
||||
*/
|
||||
get rawData() {
|
||||
return this._data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Chat this message was sent in
|
||||
* @returns {Promise<Chat>}
|
||||
@@ -155,16 +313,16 @@ class Message extends Base {
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
* 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
|
||||
*
|
||||
* @param {string|MessageMedia|Location} content
|
||||
* @param {string} [chatId]
|
||||
* @param {MessageSendOptions} [options]
|
||||
* @returns {Promise<Message>}
|
||||
*/
|
||||
async reply(content, chatId, options={}) {
|
||||
async reply(content, chatId, options = {}) {
|
||||
if (!chatId) {
|
||||
chatId = this._getChatId();
|
||||
}
|
||||
@@ -177,6 +335,31 @@ class Message extends Base {
|
||||
return this.client.sendMessage(chatId, content, options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Accept Group V4 Invite
|
||||
* @returns {Promise<Object>}
|
||||
*/
|
||||
async acceptGroupV4Invite() {
|
||||
return await this.client.acceptGroupV4Invite(this.inviteV4);
|
||||
}
|
||||
|
||||
/**
|
||||
* Forwards this message to another chat
|
||||
*
|
||||
* @param {string|Chat} chat Chat model or chat ID to which the message will be forwarded
|
||||
* @returns {Promise}
|
||||
*/
|
||||
async forward(chat) {
|
||||
const chatId = typeof chat === 'string' ? chat : chat.id._serialized;
|
||||
|
||||
await this.client.pupPage.evaluate(async (msgId, chatId) => {
|
||||
let msg = window.Store.Msg.get(msgId);
|
||||
let chat = window.Store.Chat.get(chatId);
|
||||
|
||||
return await chat.forwardMessages([msg]);
|
||||
}, this.id._serialized, chatId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Downloads and returns the attatched message media
|
||||
* @returns {Promise<MessageMedia>}
|
||||
@@ -186,21 +369,48 @@ class Message extends Base {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const {data, mimetype, filename} = await this.client.pupPage.evaluate(async (msgId) => {
|
||||
const result = await this.client.pupPage.evaluate(async (msgId) => {
|
||||
const msg = window.Store.Msg.get(msgId);
|
||||
const buffer = await window.WWebJS.downloadBuffer(msg.clientUrl);
|
||||
const decrypted = await window.Store.CryptoLib.decryptE2EMedia(msg.type, buffer, msg.mediaKey, msg.mimetype);
|
||||
const data = await window.WWebJS.readBlobAsync(decrypted._blob);
|
||||
|
||||
return {
|
||||
data: data.split(',')[1],
|
||||
mimetype: msg.mimetype,
|
||||
filename: msg.filename
|
||||
};
|
||||
|
||||
if (msg.mediaData.mediaStage != 'RESOLVED') {
|
||||
// try to resolve media
|
||||
await msg.downloadMedia({
|
||||
downloadEvenIfExpensive: true,
|
||||
rmrReason: 1
|
||||
});
|
||||
}
|
||||
|
||||
if (msg.mediaData.mediaStage.includes('ERROR') || msg.mediaData.mediaStage === 'FETCHING') {
|
||||
// media could not be downloaded
|
||||
return undefined;
|
||||
}
|
||||
|
||||
try {
|
||||
const decryptedMedia = await window.Store.DownloadManager.downloadAndDecrypt({
|
||||
directPath: msg.directPath,
|
||||
encFilehash: msg.encFilehash,
|
||||
filehash: msg.filehash,
|
||||
mediaKey: msg.mediaKey,
|
||||
mediaKeyTimestamp: msg.mediaKeyTimestamp,
|
||||
type: msg.type,
|
||||
signal: (new AbortController).signal
|
||||
});
|
||||
|
||||
const data = window.WWebJS.arrayBufferToBase64(decryptedMedia);
|
||||
|
||||
return {
|
||||
data,
|
||||
mimetype: msg.mimetype,
|
||||
filename: msg.filename
|
||||
};
|
||||
} catch (e) {
|
||||
if(e.status && e.status === 404) return undefined;
|
||||
throw e;
|
||||
}
|
||||
}, this.id._serialized);
|
||||
|
||||
return new MessageMedia(mimetype, data, filename);
|
||||
if (!result) return undefined;
|
||||
return new MessageMedia(result.mimetype, result.data, result.filename);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -211,13 +421,95 @@ class Message extends Base {
|
||||
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);
|
||||
}
|
||||
|
||||
if (everyone && msg.id.fromMe && msg._canRevoke()) {
|
||||
return window.Store.Cmd.sendRevokeMsgs(msg.chat, [msg], {type: 'Sender'});
|
||||
}
|
||||
|
||||
return window.Store.Cmd.sendDeleteMsgs(msg.chat, [msg], true);
|
||||
}, this.id._serialized, everyone);
|
||||
}
|
||||
|
||||
/**
|
||||
* Stars this message
|
||||
*/
|
||||
async star() {
|
||||
await this.client.pupPage.evaluate((msgId) => {
|
||||
let msg = window.Store.Msg.get(msgId);
|
||||
|
||||
if (msg.canStar()) {
|
||||
return msg.chat.sendStarMsgs([msg], true);
|
||||
}
|
||||
}, this.id._serialized);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unstars this message
|
||||
*/
|
||||
async unstar() {
|
||||
await this.client.pupPage.evaluate((msgId) => {
|
||||
let msg = window.Store.Msg.get(msgId);
|
||||
|
||||
if (msg.canStar()) {
|
||||
return msg.chat.sendStarMsgs([msg], false);
|
||||
}
|
||||
}, this.id._serialized);
|
||||
}
|
||||
|
||||
/**
|
||||
* Message Info
|
||||
* @typedef {Object} MessageInfo
|
||||
* @property {Array<{id: ContactId, t: number}>} delivery Contacts to which the message has been delivered to
|
||||
* @property {number} deliveryRemaining Amount of people to whom the message has not been delivered to
|
||||
* @property {Array<{id: ContactId, t: number}>} played Contacts who have listened to the voice message
|
||||
* @property {number} playedRemaining Amount of people who have not listened to the message
|
||||
* @property {Array<{id: ContactId, t: number}>} read Contacts who have read the message
|
||||
* @property {number} readRemaining Amount of people who have not read the message
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get information about message delivery status. May return null if the message does not exist or is not sent by you.
|
||||
* @returns {Promise<?MessageInfo>}
|
||||
*/
|
||||
async getInfo() {
|
||||
const info = await this.client.pupPage.evaluate(async (msgId) => {
|
||||
const msg = window.Store.Msg.get(msgId);
|
||||
if (!msg) return null;
|
||||
|
||||
return await window.Store.MessageInfo.sendQueryMsgInfo(msg);
|
||||
}, this.id._serialized);
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the order associated with a given message
|
||||
* @return {Promise<Order>}
|
||||
*/
|
||||
async getOrder() {
|
||||
if (this.type === MessageTypes.ORDER) {
|
||||
const result = await this.client.pupPage.evaluate((orderId, token, chatId) => {
|
||||
return window.WWebJS.getOrderDetail(orderId, token, chatId);
|
||||
}, this.orderId, this.token, this._getChatId());
|
||||
if (!result) return undefined;
|
||||
return new Order(this.client, result);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
/**
|
||||
* Gets the payment details associated with a given message
|
||||
* @return {Promise<Payment>}
|
||||
*/
|
||||
async getPayment() {
|
||||
if (this.type === MessageTypes.PAYMENT) {
|
||||
const msg = await this.client.pupPage.evaluate(async (msgId) => {
|
||||
const msg = window.Store.Msg.get(msgId);
|
||||
if(!msg) return null;
|
||||
return msg.serialize();
|
||||
}, this.id._serialized);
|
||||
return new Payment(this.client, msg);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Message;
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
'use strict';
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const mime = require('mime');
|
||||
const fetch = require('node-fetch');
|
||||
const { URL } = require('url');
|
||||
|
||||
/**
|
||||
* Media attached to a message
|
||||
* @param {string} mimetype MIME type of the attachment
|
||||
@@ -26,6 +32,72 @@ class MessageMedia {
|
||||
*/
|
||||
this.filename = filename;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a MessageMedia instance from a local file path
|
||||
* @param {string} filePath
|
||||
* @returns {MessageMedia}
|
||||
*/
|
||||
static fromFilePath(filePath) {
|
||||
const b64data = fs.readFileSync(filePath, {encoding: 'base64'});
|
||||
const mimetype = mime.getType(filePath);
|
||||
const filename = path.basename(filePath);
|
||||
|
||||
return new MessageMedia(mimetype, b64data, filename);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a MessageMedia instance from a URL
|
||||
* @param {string} url
|
||||
* @param {Object} [options]
|
||||
* @param {boolean} [options.unsafeMime=false]
|
||||
* @param {string} [options.filename]
|
||||
* @param {object} [options.client]
|
||||
* @param {object} [options.reqOptions]
|
||||
* @param {number} [options.reqOptions.size=0]
|
||||
* @returns {Promise<MessageMedia>}
|
||||
*/
|
||||
static async fromUrl(url, options = {}) {
|
||||
const pUrl = new URL(url);
|
||||
let mimetype = mime.getType(pUrl.pathname);
|
||||
|
||||
if (!mimetype && !options.unsafeMime)
|
||||
throw new Error('Unable to determine MIME type using URL. Set unsafeMime to true to download it anyway.');
|
||||
|
||||
async function fetchData (url, options) {
|
||||
const reqOptions = Object.assign({ headers: { accept: 'image/* video/* text/* audio/*' } }, options);
|
||||
const response = await fetch(url, reqOptions);
|
||||
const mime = response.headers.get('Content-Type');
|
||||
|
||||
const contentDisposition = response.headers.get('Content-Disposition');
|
||||
const name = contentDisposition ? contentDisposition.match(/((?<=filename=")(.*)(?="))/) : null;
|
||||
|
||||
let data = '';
|
||||
if (response.buffer) {
|
||||
data = (await response.buffer()).toString('base64');
|
||||
} else {
|
||||
const bArray = new Uint8Array(await response.arrayBuffer());
|
||||
bArray.forEach((b) => {
|
||||
data += String.fromCharCode(b);
|
||||
});
|
||||
data = btoa(data);
|
||||
}
|
||||
|
||||
return { data, mime, name };
|
||||
}
|
||||
|
||||
const res = options.client
|
||||
? (await options.client.pupPage.evaluate(fetchData, url, options.reqOptions))
|
||||
: (await fetchData(url, options.reqOptions));
|
||||
|
||||
const filename = options.filename ||
|
||||
(res.name ? res.name[0] : (pUrl.pathname.split('/').pop() || 'file'));
|
||||
|
||||
if (!mimetype)
|
||||
mimetype = res.mime;
|
||||
|
||||
return new MessageMedia(mimetype, res.data, filename);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = MessageMedia;
|
||||
module.exports = MessageMedia;
|
||||
|
||||
52
src/structures/Order.js
Normal file
52
src/structures/Order.js
Normal file
@@ -0,0 +1,52 @@
|
||||
'use strict';
|
||||
|
||||
const Base = require('./Base');
|
||||
const Product = require('./Product');
|
||||
|
||||
/**
|
||||
* Represents a Order on WhatsApp
|
||||
* @extends {Base}
|
||||
*/
|
||||
class Order extends Base {
|
||||
constructor(client, data) {
|
||||
super(client);
|
||||
|
||||
if (data) this._patch(data);
|
||||
}
|
||||
|
||||
_patch(data) {
|
||||
/**
|
||||
* List of products
|
||||
* @type {Array<Product>}
|
||||
*/
|
||||
if (data.products) {
|
||||
this.products = data.products.map(product => new Product(this.client, product));
|
||||
}
|
||||
/**
|
||||
* Order Subtotal
|
||||
* @type {string}
|
||||
*/
|
||||
this.subtotal = data.subtotal;
|
||||
/**
|
||||
* Order Total
|
||||
* @type {string}
|
||||
*/
|
||||
this.total = data.total;
|
||||
/**
|
||||
* Order Currency
|
||||
* @type {string}
|
||||
*/
|
||||
this.currency = data.currency;
|
||||
/**
|
||||
* Order Created At
|
||||
* @type {number}
|
||||
*/
|
||||
this.createdAt = data.createdAt;
|
||||
|
||||
return super._patch(data);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
module.exports = Order;
|
||||
79
src/structures/Payment.js
Normal file
79
src/structures/Payment.js
Normal file
@@ -0,0 +1,79 @@
|
||||
const Base = require('./Base');
|
||||
|
||||
class Payment extends Base {
|
||||
constructor(client, data) {
|
||||
super(client);
|
||||
|
||||
if (data) this._patch(data);
|
||||
}
|
||||
|
||||
_patch(data) {
|
||||
/**
|
||||
* The payment Id
|
||||
* @type {object}
|
||||
*/
|
||||
this.id = data.id;
|
||||
|
||||
/**
|
||||
* The payment currency
|
||||
* @type {string}
|
||||
*/
|
||||
this.paymentCurrency = data.paymentCurrency;
|
||||
|
||||
/**
|
||||
* The payment ammount ( R$ 1.00 = 1000 )
|
||||
* @type {number}
|
||||
*/
|
||||
this.paymentAmount1000 = data.paymentAmount1000;
|
||||
|
||||
/**
|
||||
* The payment receiver
|
||||
* @type {object}
|
||||
*/
|
||||
this.paymentMessageReceiverJid = data.paymentMessageReceiverJid;
|
||||
|
||||
/**
|
||||
* The payment transaction timestamp
|
||||
* @type {number}
|
||||
*/
|
||||
this.paymentTransactionTimestamp = data.paymentTransactionTimestamp;
|
||||
|
||||
/**
|
||||
* The paymentStatus
|
||||
*
|
||||
* Possible Status
|
||||
* 0:UNKNOWN_STATUS
|
||||
* 1:PROCESSING
|
||||
* 2:SENT
|
||||
* 3:NEED_TO_ACCEPT
|
||||
* 4:COMPLETE
|
||||
* 5:COULD_NOT_COMPLETE
|
||||
* 6:REFUNDED
|
||||
* 7:EXPIRED
|
||||
* 8:REJECTED
|
||||
* 9:CANCELLED
|
||||
* 10:WAITING_FOR_PAYER
|
||||
* 11:WAITING
|
||||
*
|
||||
* @type {number}
|
||||
*/
|
||||
this.paymentStatus = data.paymentStatus;
|
||||
|
||||
/**
|
||||
* Integer that represents the payment Text
|
||||
* @type {number}
|
||||
*/
|
||||
this.paymentTxnStatus = data.paymentTxnStatus;
|
||||
|
||||
/**
|
||||
* The note sent with the payment
|
||||
* @type {string}
|
||||
*/
|
||||
this.paymentNote = !data.paymentNoteMsg ? undefined : data.paymentNoteMsg.body ? data.paymentNoteMsg.body : undefined ;
|
||||
|
||||
return super._patch(data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = Payment;
|
||||
68
src/structures/Product.js
Normal file
68
src/structures/Product.js
Normal file
@@ -0,0 +1,68 @@
|
||||
'use strict';
|
||||
|
||||
const Base = require('./Base');
|
||||
const ProductMetadata = require('./ProductMetadata');
|
||||
|
||||
/**
|
||||
* Represents a Product on WhatsAppBusiness
|
||||
* @extends {Base}
|
||||
*/
|
||||
class Product extends Base {
|
||||
constructor(client, data) {
|
||||
super(client);
|
||||
|
||||
if (data) this._patch(data);
|
||||
}
|
||||
|
||||
_patch(data) {
|
||||
/**
|
||||
* Product ID
|
||||
* @type {string}
|
||||
*/
|
||||
this.id = data.id;
|
||||
/**
|
||||
* Price
|
||||
* @type {string}
|
||||
*/
|
||||
this.price = data.price ? data.price : '';
|
||||
/**
|
||||
* Product Thumbnail
|
||||
* @type {string}
|
||||
*/
|
||||
this.thumbnailUrl = data.thumbnailUrl;
|
||||
/**
|
||||
* Currency
|
||||
* @type {string}
|
||||
*/
|
||||
this.currency = data.currency;
|
||||
/**
|
||||
* Product Name
|
||||
* @type {string}
|
||||
*/
|
||||
this.name = data.name;
|
||||
/**
|
||||
* Product Quantity
|
||||
* @type {number}
|
||||
*/
|
||||
this.quantity = data.quantity;
|
||||
/** Product metadata */
|
||||
this.data = null;
|
||||
return super._patch(data);
|
||||
}
|
||||
|
||||
async getData() {
|
||||
if (this.data === null) {
|
||||
let result = await this.client.pupPage.evaluate((productId) => {
|
||||
return window.WWebJS.getProductMetadata(productId);
|
||||
}, this.id);
|
||||
if (!result) {
|
||||
this.data = undefined;
|
||||
} else {
|
||||
this.data = new ProductMetadata(this.client, result);
|
||||
}
|
||||
}
|
||||
return this.data;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Product;
|
||||
25
src/structures/ProductMetadata.js
Normal file
25
src/structures/ProductMetadata.js
Normal file
@@ -0,0 +1,25 @@
|
||||
const Base = require('./Base');
|
||||
|
||||
class ProductMetadata extends Base {
|
||||
constructor(client, data) {
|
||||
super(client);
|
||||
|
||||
if (data) this._patch(data);
|
||||
}
|
||||
|
||||
_patch(data) {
|
||||
/** Product ID */
|
||||
this.id = data.id;
|
||||
/** Retailer ID */
|
||||
this.retailer_id = data.retailer_id;
|
||||
/** Product Name */
|
||||
this.name = data.name;
|
||||
/** Product Description */
|
||||
this.description = data.description;
|
||||
|
||||
return super._patch(data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = ProductMetadata;
|
||||
@@ -10,4 +10,12 @@ module.exports = {
|
||||
MessageMedia: require('./MessageMedia'),
|
||||
PrivateChat: require('./PrivateChat'),
|
||||
PrivateContact: require('./PrivateContact'),
|
||||
};
|
||||
GroupNotification: require('./GroupNotification'),
|
||||
Label: require('./Label.js'),
|
||||
Order: require('./Order'),
|
||||
Product: require('./Product'),
|
||||
Call: require('./Call'),
|
||||
Buttons: require('./Buttons'),
|
||||
List: require('./List'),
|
||||
Payment: require('./Payment')
|
||||
};
|
||||
|
||||
@@ -2,13 +2,18 @@
|
||||
|
||||
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
|
||||
headless: true,
|
||||
defaultViewport: null
|
||||
},
|
||||
session: false
|
||||
authTimeoutMs: 0,
|
||||
qrMaxRetries: 0,
|
||||
takeoverOnConflict: false,
|
||||
takeoverTimeoutMs: 0,
|
||||
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.109 Safari/537.36',
|
||||
ffmpegPath: 'ffmpeg',
|
||||
bypassCSP: false
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -36,12 +41,15 @@ exports.Events = {
|
||||
MESSAGE_REVOKED_EVERYONE: 'message_revoke_everyone',
|
||||
MESSAGE_REVOKED_ME: 'message_revoke_me',
|
||||
MESSAGE_ACK: 'message_ack',
|
||||
MEDIA_UPLOADED: 'media_uploaded',
|
||||
GROUP_JOIN: 'group_join',
|
||||
GROUP_LEAVE: 'group_leave',
|
||||
GROUP_UPDATE: 'group_update',
|
||||
QR_RECEIVED: 'qr',
|
||||
DISCONNECTED: 'disconnected',
|
||||
STATE_CHANGED: 'change_state',
|
||||
BATTERY_CHANGED: 'change_battery',
|
||||
INCOMING_CALL: 'incoming_call'
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -60,8 +68,31 @@ exports.MessageTypes = {
|
||||
LOCATION: 'location',
|
||||
CONTACT_CARD: 'vcard',
|
||||
CONTACT_CARD_MULTI: 'multi_vcard',
|
||||
ORDER: 'order',
|
||||
REVOKED: 'revoked',
|
||||
UNKNOWN: 'unknown'
|
||||
PRODUCT: 'product',
|
||||
UNKNOWN: 'unknown',
|
||||
GROUP_INVITE: 'groups_v4_invite',
|
||||
LIST: 'list',
|
||||
LIST_RESPONSE: 'list_response',
|
||||
BUTTONS_RESPONSE: 'buttons_response',
|
||||
PAYMENT: 'payment',
|
||||
BROADCAST_NOTIFICATION: 'broadcast_notification',
|
||||
CALL_LOG: 'call_log',
|
||||
CIPHERTEXT: 'ciphertext',
|
||||
DEBUG: 'debug',
|
||||
E2E_NOTIFICATION: 'e2e_notification',
|
||||
GP2: 'gp2',
|
||||
GROUP_NOTIFICATION: 'group_notification',
|
||||
HSM: 'hsm',
|
||||
INTERACTIVE: 'interactive',
|
||||
NATIVE_FLOW: 'native_flow',
|
||||
NOTIFICATION: 'notification',
|
||||
NOTIFICATION_TEMPLATE: 'notification_template',
|
||||
OVERSIZED: 'oversized',
|
||||
PROTOCOL: 'protocol',
|
||||
REACTION: 'reaction',
|
||||
TEMPLATE_BUTTON_REPLY: 'template_button_reply',
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,37 +5,72 @@ 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 = Object.assign({}, window.mR.findModule(m => m.default && m.default.Chat)[0].default);
|
||||
window.Store.AppState = window.mR.findModule('Socket')[0].Socket;
|
||||
window.Store.Conn = window.mR.findModule('Conn')[0].Conn;
|
||||
window.Store.BlockContact = window.mR.findModule('blockContact')[0];
|
||||
window.Store.Call = window.mR.findModule('CallCollection')[0].CallCollection;
|
||||
window.Store.Cmd = window.mR.findModule('Cmd')[0].Cmd;
|
||||
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.DownloadManager = window.mR.findModule('downloadManager')[0].downloadManager;
|
||||
window.Store.Features = window.mR.findModule('FEATURE_CHANGE_EVENT')[0].GK;
|
||||
window.Store.GroupMetadata = window.mR.findModule((module) => module.default && module.default.handlePendingInvite)[0].default;
|
||||
window.Store.Invite = window.mR.findModule('sendJoinGroupViaInvite')[0];
|
||||
window.Store.OpaqueData = window.mR.findModule('getOrCreateOpaqueDataForPath')[0];
|
||||
window.Store.InviteInfo = window.mR.findModule('sendQueryGroupInvite')[0];
|
||||
window.Store.Label = window.mR.findModule('LabelCollection')[0].LabelCollection;
|
||||
window.Store.MediaPrep = window.mR.findModule('MediaPrep')[0];
|
||||
window.Store.MediaObject = window.mR.findModule('getOrCreateMediaObject')[0];
|
||||
window.Store.MediaUpload = window.mR.findModule('uploadMedia')[0];
|
||||
window.Store.Cmd = window.mR.findModule('Cmd')[0].default;
|
||||
window.Store.NumberInfo = window.mR.findModule('formattedPhoneNumber')[0];
|
||||
window.Store.MediaTypes = window.mR.findModule('msgToMediaType')[0];
|
||||
window.Store.MediaUpload = window.mR.findModule('uploadMedia')[0];
|
||||
window.Store.MsgKey = window.mR.findModule((module) => module.default && module.default.fromString)[0].default;
|
||||
window.Store.MessageInfo = window.mR.findModule('sendQueryMsgInfo')[0];
|
||||
window.Store.OpaqueData = window.mR.findModule(module => module.default && module.default.createFromData)[0].default;
|
||||
window.Store.QueryExist = window.mR.findModule('queryExists')[0].queryExists;
|
||||
window.Store.QueryProduct = window.mR.findModule('queryProduct')[0];
|
||||
window.Store.QueryOrder = window.mR.findModule('queryOrder')[0];
|
||||
window.Store.SendClear = window.mR.findModule('sendClear')[0];
|
||||
window.Store.SendDelete = window.mR.findModule('sendDelete')[0];
|
||||
window.Store.SendMessage = window.mR.findModule('addAndSendMsgToChat')[0];
|
||||
window.Store.SendSeen = window.mR.findModule('sendSeen')[0];
|
||||
window.Store.User = window.mR.findModule('getMaybeMeUser')[0];
|
||||
window.Store.UploadUtils = window.mR.findModule((module) => (module.default && module.default.encryptAndUpload) ? module.default : null)[0].default;
|
||||
window.Store.UserConstructor = window.mR.findModule((module) => (module.default && module.default.prototype && module.default.prototype.isServer && module.default.prototype.isUser) ? module.default : null)[0].default;
|
||||
window.Store.Validators = window.mR.findModule('findLinks')[0];
|
||||
window.Store.VCard = window.mR.findModule('vcardFromContactModel')[0];
|
||||
window.Store.Wap = window.mR.findModule('queryLinkPreview')[0].default;
|
||||
window.Store.WidFactory = window.mR.findModule('createWid')[0];
|
||||
window.Store.ProfilePic = window.mR.findModule('profilePicResync')[0];
|
||||
window.Store.PresenceUtils = window.mR.findModule('sendPresenceAvailable')[0];
|
||||
window.Store.ChatState = window.mR.findModule('sendChatStateComposing')[0];
|
||||
window.Store.GroupParticipants = window.mR.findModule('sendPromoteParticipants')[0];
|
||||
window.Store.JoinInviteV4 = window.mR.findModule('sendJoinGroupViaInviteV4')[0];
|
||||
window.Store.findCommonGroups = window.mR.findModule('findCommonGroups')[0].findCommonGroups;
|
||||
window.Store.StatusUtils = window.mR.findModule('setMyStatus')[0];
|
||||
window.Store.StickerTools = {
|
||||
...window.mR.findModule('toWebpSticker')[0],
|
||||
...window.mR.findModule('addWebpMetadata')[0]
|
||||
};
|
||||
|
||||
window.Store.GroupUtils = {
|
||||
...window.mR.findModule('sendCreateGroup')[0],
|
||||
...window.mR.findModule('sendSetGroupSubject')[0],
|
||||
...window.mR.findModule('markExited')[0]
|
||||
};
|
||||
|
||||
if (!window.Store.Chat._find) {
|
||||
window.Store.Chat._find = e => {
|
||||
const target = window.Store.Chat.get(e);
|
||||
return target ? Promise.resolve(target) : Promise.resolve({
|
||||
id: e
|
||||
});
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
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) {
|
||||
@@ -45,11 +80,22 @@ exports.LoadUtils = () => {
|
||||
return false;
|
||||
|
||||
};
|
||||
|
||||
window.WWebJS.sendMessage = async (chat, content, options = {}) => {
|
||||
let attOptions = {};
|
||||
if (options.attachment) {
|
||||
attOptions = await window.WWebJS.processMediaData(options.attachment);
|
||||
attOptions = options.sendMediaAsSticker
|
||||
? await window.WWebJS.processStickerData(options.attachment)
|
||||
: await window.WWebJS.processMediaData(options.attachment, {
|
||||
forceVoice: options.sendAudioAsVoice,
|
||||
forceDocument: options.sendMediaAsDocument,
|
||||
forceGif: options.sendVideoAsGif
|
||||
});
|
||||
|
||||
content = options.sendMediaAsSticker ? undefined : attOptions.preview;
|
||||
|
||||
delete options.attachment;
|
||||
delete options.sendMediaAsSticker;
|
||||
}
|
||||
|
||||
let quotedMsgOptions = {};
|
||||
@@ -76,37 +122,186 @@ exports.LoadUtils = () => {
|
||||
delete options.location;
|
||||
}
|
||||
|
||||
let vcardOptions = {};
|
||||
if (options.contactCard) {
|
||||
let contact = window.Store.Contact.get(options.contactCard);
|
||||
vcardOptions = {
|
||||
body: window.Store.VCard.vcardFromContactModel(contact).vcard,
|
||||
type: 'vcard',
|
||||
vcardFormattedName: contact.formattedName
|
||||
};
|
||||
delete options.contactCard;
|
||||
} else if (options.contactCardList) {
|
||||
let contacts = options.contactCardList.map(c => window.Store.Contact.get(c));
|
||||
let vcards = contacts.map(c => window.Store.VCard.vcardFromContactModel(c));
|
||||
vcardOptions = {
|
||||
type: 'multi_vcard',
|
||||
vcardList: vcards,
|
||||
body: undefined
|
||||
};
|
||||
delete options.contactCardList;
|
||||
} else if (options.parseVCards && typeof (content) === 'string' && content.startsWith('BEGIN:VCARD')) {
|
||||
delete options.parseVCards;
|
||||
try {
|
||||
const parsed = window.Store.VCard.parseVcard(content);
|
||||
if (parsed) {
|
||||
vcardOptions = {
|
||||
type: 'vcard',
|
||||
vcardFormattedName: window.Store.VCard.vcardGetNameFromParsed(parsed)
|
||||
};
|
||||
}
|
||||
} catch (_) {
|
||||
// not a vcard
|
||||
}
|
||||
}
|
||||
|
||||
if (options.linkPreview) {
|
||||
delete options.linkPreview;
|
||||
|
||||
// Not supported yet by WhatsApp Web on MD
|
||||
if(!window.Store.Features.features.MD_BACKEND) {
|
||||
const link = window.Store.Validators.findLink(content);
|
||||
if (link) {
|
||||
const preview = await window.Store.Wap.queryLinkPreview(link.url);
|
||||
preview.preview = true;
|
||||
preview.subtype = 'url';
|
||||
options = { ...options, ...preview };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let buttonOptions = {};
|
||||
if(options.buttons){
|
||||
let caption;
|
||||
if (options.buttons.type === 'chat') {
|
||||
content = options.buttons.body;
|
||||
caption = content;
|
||||
} else {
|
||||
caption = options.caption ? options.caption : ' '; //Caption can't be empty
|
||||
}
|
||||
buttonOptions = {
|
||||
productHeaderImageRejected: false,
|
||||
isFromTemplate: false,
|
||||
isDynamicReplyButtonsMsg: true,
|
||||
title: options.buttons.title ? options.buttons.title : undefined,
|
||||
footer: options.buttons.footer ? options.buttons.footer : undefined,
|
||||
dynamicReplyButtons: options.buttons.buttons,
|
||||
replyButtons: options.buttons.buttons,
|
||||
caption: caption
|
||||
};
|
||||
delete options.buttons;
|
||||
}
|
||||
|
||||
let listOptions = {};
|
||||
if(options.list){
|
||||
if(window.Store.Conn.platform === 'smba' || window.Store.Conn.platform === 'smbi'){
|
||||
throw '[LT01] Whatsapp business can\'t send this yet';
|
||||
}
|
||||
listOptions = {
|
||||
type: 'list',
|
||||
footer: options.list.footer,
|
||||
list: {
|
||||
...options.list,
|
||||
listType: 1
|
||||
},
|
||||
body: options.list.description
|
||||
};
|
||||
delete options.list;
|
||||
delete listOptions.list.footer;
|
||||
}
|
||||
|
||||
const meUser = window.Store.User.getMaybeMeUser();
|
||||
const isMD = window.Store.Features.features.MD_BACKEND;
|
||||
|
||||
const newMsgId = new window.Store.MsgKey({
|
||||
from: window.Store.Conn.me,
|
||||
from: meUser,
|
||||
to: chat.id,
|
||||
id: window.Store.genId(),
|
||||
id: window.Store.MsgKey.newId(),
|
||||
participant: isMD && chat.id.isGroup() ? meUser : undefined,
|
||||
selfDir: 'out',
|
||||
});
|
||||
|
||||
const extraOptions = options.extraOptions || {};
|
||||
delete options.extraOptions;
|
||||
|
||||
const ephemeralSettings = {
|
||||
ephemeralDuration: chat.isEphemeralSettingOn() ? chat.getEphemeralSetting() : undefined,
|
||||
ephemeralSettingTimestamp: chat.getEphemeralSettingTimestamp() || undefined,
|
||||
disappearingModeInitiator: chat.getDisappearingModeInitiator() || undefined,
|
||||
};
|
||||
|
||||
const message = {
|
||||
...options,
|
||||
id: newMsgId,
|
||||
ack: 0,
|
||||
body: content,
|
||||
from: window.Store.Conn.me,
|
||||
from: meUser,
|
||||
to: chat.id,
|
||||
local: true,
|
||||
self: 'out',
|
||||
t: parseInt(new Date().getTime() / 1000),
|
||||
isNewMsg: true,
|
||||
type: 'chat',
|
||||
...ephemeralSettings,
|
||||
...locationOptions,
|
||||
...attOptions,
|
||||
...quotedMsgOptions
|
||||
...quotedMsgOptions,
|
||||
...vcardOptions,
|
||||
...buttonOptions,
|
||||
...listOptions,
|
||||
...extraOptions
|
||||
};
|
||||
|
||||
await window.Store.SendMessage.addAndSendMsgToChat(chat, message);
|
||||
return window.Store.Msg.get(newMsgId._serialized);
|
||||
};
|
||||
|
||||
window.WWebJS.processMediaData = async (mediaInfo) => {
|
||||
window.WWebJS.toStickerData = async (mediaInfo) => {
|
||||
if (mediaInfo.mimetype == 'image/webp') return 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 webpSticker = await window.Store.StickerTools.toWebpSticker(file);
|
||||
const webpBuffer = await webpSticker.arrayBuffer();
|
||||
const data = window.WWebJS.arrayBufferToBase64(webpBuffer);
|
||||
|
||||
return {
|
||||
mimetype: 'image/webp',
|
||||
data
|
||||
};
|
||||
};
|
||||
|
||||
window.WWebJS.processStickerData = async (mediaInfo) => {
|
||||
if (mediaInfo.mimetype !== 'image/webp') throw new Error('Invalid media type');
|
||||
|
||||
const file = window.WWebJS.mediaInfoToFile(mediaInfo);
|
||||
let filehash = await window.WWebJS.getFileHash(file);
|
||||
let mediaKey = await window.WWebJS.generateHash(32);
|
||||
|
||||
const controller = new AbortController();
|
||||
const uploadedInfo = await window.Store.UploadUtils.encryptAndUpload({
|
||||
blob: file,
|
||||
type: 'sticker',
|
||||
signal: controller.signal,
|
||||
mediaKey
|
||||
});
|
||||
|
||||
const stickerInfo = {
|
||||
...uploadedInfo,
|
||||
clientUrl: uploadedInfo.url,
|
||||
deprecatedMms3Url: uploadedInfo.url,
|
||||
uploadhash: uploadedInfo.encFilehash,
|
||||
size: file.size,
|
||||
type: 'sticker',
|
||||
filehash
|
||||
};
|
||||
|
||||
return stickerInfo;
|
||||
};
|
||||
|
||||
window.WWebJS.processMediaData = async (mediaInfo, { forceVoice, forceDocument, forceGif }) => {
|
||||
const file = window.WWebJS.mediaInfoToFile(mediaInfo);
|
||||
const mData = await window.Store.OpaqueData.createFromData(file, file.type);
|
||||
const mediaPrep = window.Store.MediaPrep.prepRawMedia(mData, { asDocument: forceDocument });
|
||||
const mediaData = await mediaPrep.waitForPrep();
|
||||
const mediaObject = window.Store.MediaObject.getOrCreateMediaObject(mediaData.filehash);
|
||||
|
||||
@@ -115,54 +310,115 @@ exports.LoadUtils = () => {
|
||||
isGif: mediaData.isGif
|
||||
});
|
||||
|
||||
if (!(mediaData.mediaBlob instanceof window.Store.OpaqueData.default)) {
|
||||
mediaData.mediaBlob = await window.Store.OpaqueData.default.createFromData(mediaData.mediaBlob, mediaData.mediaBlob.type);
|
||||
if (forceVoice && mediaData.type === 'audio') {
|
||||
mediaData.type = 'ptt';
|
||||
}
|
||||
|
||||
if (forceGif && mediaData.type === 'video') {
|
||||
mediaData.isGif = true;
|
||||
}
|
||||
|
||||
if (forceDocument) {
|
||||
mediaData.type = 'document';
|
||||
}
|
||||
|
||||
if (!(mediaData.mediaBlob instanceof window.Store.OpaqueData)) {
|
||||
mediaData.mediaBlob = await window.Store.OpaqueData.createFromData(mediaData.mediaBlob, mediaData.mediaBlob.type);
|
||||
}
|
||||
|
||||
mediaData.renderableUrl = mediaData.mediaBlob.url();
|
||||
mediaObject.consolidate(mediaData.toJSON());
|
||||
mediaData.mediaBlob.autorelease();
|
||||
|
||||
const uploadedMedia = await window.Store.MediaUpload.uploadMedia(mediaData.mimetype, mediaObject, mediaType);
|
||||
if (!uploadedMedia) {
|
||||
const uploadedMedia = await window.Store.MediaUpload.uploadMedia({
|
||||
mimetype: mediaData.mimetype,
|
||||
mediaObject,
|
||||
mediaType
|
||||
});
|
||||
|
||||
const mediaEntry = uploadedMedia.mediaEntry;
|
||||
if (!mediaEntry) {
|
||||
throw new Error('upload failed: media entry was not created');
|
||||
}
|
||||
|
||||
mediaData.set({
|
||||
clientUrl: uploadedMedia.mmsUrl,
|
||||
directPath: uploadedMedia.directPath,
|
||||
mediaKey: uploadedMedia.mediaKey,
|
||||
mediaKeyTimestamp: uploadedMedia.mediaKeyTimestamp,
|
||||
clientUrl: mediaEntry.mmsUrl,
|
||||
deprecatedMms3Url: mediaEntry.deprecatedMms3Url,
|
||||
directPath: mediaEntry.directPath,
|
||||
mediaKey: mediaEntry.mediaKey,
|
||||
mediaKeyTimestamp: mediaEntry.mediaKeyTimestamp,
|
||||
filehash: mediaObject.filehash,
|
||||
uploadhash: uploadedMedia.uploadHash,
|
||||
encFilehash: mediaEntry.encFilehash,
|
||||
uploadhash: mediaEntry.uploadHash,
|
||||
size: mediaObject.size,
|
||||
streamingSidecar: uploadedMedia.sidecar,
|
||||
firstFrameSidecar: uploadedMedia.firstFrameSidecar
|
||||
streamingSidecar: mediaEntry.sidecar,
|
||||
firstFrameSidecar: mediaEntry.firstFrameSidecar
|
||||
});
|
||||
|
||||
return mediaData;
|
||||
};
|
||||
|
||||
window.WWebJS.getChatModel = chat => {
|
||||
window.WWebJS.getMessageModel = message => {
|
||||
const msg = message.serialize();
|
||||
|
||||
msg.isEphemeral = message.isEphemeral;
|
||||
msg.isStatusV3 = message.isStatusV3;
|
||||
msg.links = (message.getLinks()).map(link => ({
|
||||
link: link.href,
|
||||
isSuspicious: Boolean(link.suspiciousCharacters && link.suspiciousCharacters.size)
|
||||
}));
|
||||
|
||||
if (msg.buttons) {
|
||||
msg.buttons = msg.buttons.serialize();
|
||||
}
|
||||
if (msg.dynamicReplyButtons) {
|
||||
msg.dynamicReplyButtons = JSON.parse(JSON.stringify(msg.dynamicReplyButtons));
|
||||
}
|
||||
if (msg.replyButtons) {
|
||||
msg.replyButtons = JSON.parse(JSON.stringify(msg.replyButtons));
|
||||
}
|
||||
|
||||
if (typeof msg.id.remote === 'object') {
|
||||
msg.id = Object.assign({}, msg.id, { remote: msg.id.remote._serialized });
|
||||
}
|
||||
|
||||
delete msg.pendingAckUpdate;
|
||||
|
||||
return msg;
|
||||
};
|
||||
|
||||
|
||||
window.WWebJS.getChatModel = async chat => {
|
||||
|
||||
let res = chat.serialize();
|
||||
res.isGroup = chat.isGroup;
|
||||
res.formattedTitle = chat.formattedTitle;
|
||||
res.isMuted = chat.mute && chat.mute.isMuted;
|
||||
|
||||
if (chat.groupMetadata) {
|
||||
const chatWid = window.Store.WidFactory.createWid((chat.id._serialized));
|
||||
await window.Store.GroupMetadata.update(chatWid);
|
||||
res.groupMetadata = chat.groupMetadata.serialize();
|
||||
}
|
||||
|
||||
delete res.msgs;
|
||||
delete res.msgUnsyncedButtonReplyMsgs;
|
||||
delete res.unsyncedButtonReplies;
|
||||
|
||||
return res;
|
||||
};
|
||||
|
||||
window.WWebJS.getChat = chatId => {
|
||||
const chat = window.Store.Chat.get(chatId);
|
||||
return window.WWebJS.getChatModel(chat);
|
||||
window.WWebJS.getChat = async chatId => {
|
||||
const chatWid = window.Store.WidFactory.createWid(chatId);
|
||||
const chat = await window.Store.Chat.find(chatWid);
|
||||
return await window.WWebJS.getChatModel(chat);
|
||||
};
|
||||
|
||||
window.WWebJS.getChats = () => {
|
||||
window.WWebJS.getChats = async () => {
|
||||
const chats = window.Store.Chat.models;
|
||||
return chats.map(chat => window.WWebJS.getChatModel(chat));
|
||||
|
||||
const chatPromises = chats.map(chat => window.WWebJS.getChatModel(chat));
|
||||
return await Promise.all(chatPromises);
|
||||
};
|
||||
|
||||
window.WWebJS.getContactModel = contact => {
|
||||
@@ -178,13 +434,15 @@ exports.LoadUtils = () => {
|
||||
res.isGroup = contact.isGroup;
|
||||
res.isWAContact = contact.isWAContact;
|
||||
res.isMyContact = contact.isMyContact;
|
||||
res.isBlocked = contact.isContactBlocked;
|
||||
res.userid = contact.userid;
|
||||
|
||||
return res;
|
||||
};
|
||||
|
||||
window.WWebJS.getContact = contactId => {
|
||||
const contact = window.Store.Contact.get(contactId);
|
||||
window.WWebJS.getContact = async contactId => {
|
||||
const wid = window.Store.WidFactory.createWid(contactId);
|
||||
const contact = await window.Store.Contact.find(wid);
|
||||
return window.WWebJS.getContactModel(contact);
|
||||
};
|
||||
|
||||
@@ -194,7 +452,7 @@ exports.LoadUtils = () => {
|
||||
};
|
||||
|
||||
window.WWebJS.mediaInfoToFile = ({ data, mimetype, filename }) => {
|
||||
const binaryData = atob(data);
|
||||
const binaryData = window.atob(data);
|
||||
|
||||
const buffer = new ArrayBuffer(binaryData.length);
|
||||
const view = new Uint8Array(buffer);
|
||||
@@ -209,43 +467,30 @@ exports.LoadUtils = () => {
|
||||
});
|
||||
};
|
||||
|
||||
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.arrayBufferToBase64 = (arrayBuffer) => {
|
||||
let binary = '';
|
||||
const bytes = new Uint8Array(arrayBuffer);
|
||||
const len = bytes.byteLength;
|
||||
for (let i = 0; i < len; i++) {
|
||||
binary += String.fromCharCode(bytes[i]);
|
||||
}
|
||||
return window.btoa(binary);
|
||||
};
|
||||
|
||||
window.WWebJS.readBlobAsync = (blob) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
let reader = new FileReader();
|
||||
window.WWebJS.getFileHash = async (data) => {
|
||||
let buffer = await data.arrayBuffer();
|
||||
const hashBuffer = await crypto.subtle.digest('SHA-256', buffer);
|
||||
return btoa(String.fromCharCode(...new Uint8Array(hashBuffer)));
|
||||
};
|
||||
|
||||
reader.onload = () => {
|
||||
resolve(reader.result);
|
||||
};
|
||||
|
||||
reader.onerror = reject;
|
||||
|
||||
reader.readAsDataURL(blob);
|
||||
});
|
||||
window.WWebJS.generateHash = async (length) => {
|
||||
var result = '';
|
||||
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||||
var charactersLength = characters.length;
|
||||
for (var i = 0; i < length; i++) {
|
||||
result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
window.WWebJS.sendClearChat = async (chatId) => {
|
||||
@@ -267,38 +512,60 @@ exports.LoadUtils = () => {
|
||||
};
|
||||
|
||||
window.WWebJS.sendChatstate = async (state, chatId) => {
|
||||
switch(state) {
|
||||
if (window.Store.Features.features.MD_BACKEND) {
|
||||
chatId = window.Store.WidFactory.createWid(chatId);
|
||||
}
|
||||
switch (state) {
|
||||
case 'typing':
|
||||
await window.Store.Wap.sendChatstateComposing(chatId);
|
||||
await window.Store.ChatState.sendChatStateComposing(chatId);
|
||||
break;
|
||||
case 'recording':
|
||||
await window.Store.Wap.sendChatstateRecording(chatId);
|
||||
await window.Store.ChatState.sendChatStateRecording(chatId);
|
||||
break;
|
||||
case 'stop':
|
||||
await window.Store.Wap.sendChatstatePaused(chatId);
|
||||
await window.Store.ChatState.sendChatStatePaused(chatId);
|
||||
break;
|
||||
default:
|
||||
throw 'Invalid chatstate';
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
exports.MarkAllRead = () => {
|
||||
let Chats = window.Store.Chat.models;
|
||||
window.WWebJS.getLabelModel = label => {
|
||||
let res = label.serialize();
|
||||
res.hexColor = label.hexColor;
|
||||
|
||||
for (let chatIndex in Chats) {
|
||||
if (isNaN(chatIndex)) {
|
||||
continue;
|
||||
return res;
|
||||
};
|
||||
|
||||
window.WWebJS.getLabels = () => {
|
||||
const labels = window.Store.Label.models;
|
||||
return labels.map(label => window.WWebJS.getLabelModel(label));
|
||||
};
|
||||
|
||||
window.WWebJS.getLabel = (labelId) => {
|
||||
const label = window.Store.Label.get(labelId);
|
||||
return window.WWebJS.getLabelModel(label);
|
||||
};
|
||||
|
||||
window.WWebJS.getChatLabels = async (chatId) => {
|
||||
const chat = await window.WWebJS.getChat(chatId);
|
||||
return (chat.labels || []).map(id => window.WWebJS.getLabel(id));
|
||||
};
|
||||
|
||||
window.WWebJS.getOrderDetail = async (orderId, token, chatId) => {
|
||||
const chatWid = window.Store.WidFactory.createWid(chatId);
|
||||
return window.Store.QueryOrder.queryOrder(chatWid, orderId, 80, 80, token);
|
||||
};
|
||||
|
||||
window.WWebJS.getProductMetadata = async (productId) => {
|
||||
let sellerId = window.Store.Conn.wid;
|
||||
let product = await window.Store.QueryProduct.queryProduct(sellerId, productId);
|
||||
if (product && product.data) {
|
||||
return product.data;
|
||||
}
|
||||
|
||||
let chat = Chats[chatIndex];
|
||||
|
||||
if (chat.unreadCount > 0) {
|
||||
chat.markSeen();
|
||||
window.Store.Wap.sendConversationSeen(chat.id, chat.getLastMsgKeyForAction(), chat.unreadCount - chat.pendingSeenCount);
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
};
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user