@another-trial/whatsapp-web.js 1.34.1 → 1.34.5-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/.env.example +2 -2
  2. package/CODE_OF_CONDUCT.md +133 -133
  3. package/LICENSE +201 -201
  4. package/README.md +155 -185
  5. package/example.js +706 -690
  6. package/index.d.ts +2259 -2202
  7. package/index.js +35 -35
  8. package/package.json +59 -59
  9. package/shell.js +36 -36
  10. package/src/Client.js +2533 -2361
  11. package/src/authStrategies/BaseAuthStrategy.js +26 -26
  12. package/src/authStrategies/LocalAuth.js +58 -58
  13. package/src/authStrategies/NoAuth.js +11 -11
  14. package/src/authStrategies/RemoteAuth.js +210 -210
  15. package/src/factories/ChatFactory.js +21 -21
  16. package/src/factories/ContactFactory.js +15 -15
  17. package/src/structures/Base.js +21 -21
  18. package/src/structures/Broadcast.js +69 -69
  19. package/src/structures/BusinessContact.js +20 -20
  20. package/src/structures/Buttons.js +81 -81
  21. package/src/structures/Call.js +75 -75
  22. package/src/structures/Channel.js +382 -382
  23. package/src/structures/Chat.js +329 -299
  24. package/src/structures/ClientInfo.js +70 -70
  25. package/src/structures/Contact.js +215 -208
  26. package/src/structures/GroupChat.js +485 -485
  27. package/src/structures/GroupNotification.js +104 -104
  28. package/src/structures/Label.js +49 -49
  29. package/src/structures/List.js +79 -79
  30. package/src/structures/Location.js +61 -61
  31. package/src/structures/Message.js +787 -747
  32. package/src/structures/MessageMedia.js +111 -111
  33. package/src/structures/Order.js +51 -51
  34. package/src/structures/Payment.js +79 -79
  35. package/src/structures/Poll.js +44 -44
  36. package/src/structures/PollVote.js +75 -75
  37. package/src/structures/PrivateChat.js +12 -12
  38. package/src/structures/PrivateContact.js +12 -12
  39. package/src/structures/Product.js +67 -67
  40. package/src/structures/ProductMetadata.js +24 -24
  41. package/src/structures/Reaction.js +68 -68
  42. package/src/structures/ScheduledEvent.js +71 -71
  43. package/src/structures/index.js +27 -27
  44. package/src/util/Constants.js +186 -183
  45. package/src/util/Injected/AuthStore/AuthStore.js +16 -16
  46. package/src/util/Injected/AuthStore/LegacyAuthStore.js +21 -21
  47. package/src/util/Injected/LegacyStore.js +145 -145
  48. package/src/util/Injected/Store.js +263 -233
  49. package/src/util/Injected/Utils.js +1221 -1169
  50. package/src/util/InterfaceController.js +126 -126
  51. package/src/util/Puppeteer.js +23 -23
  52. package/src/util/Util.js +186 -186
  53. package/src/webCache/LocalWebCache.js +40 -40
  54. package/src/webCache/RemoteWebCache.js +39 -39
  55. package/src/webCache/WebCache.js +13 -13
  56. package/src/webCache/WebCacheFactory.js +19 -19
package/README.md CHANGED
@@ -1,185 +1,155 @@
1
- <div align="center">
2
- <br />
3
- <p>
4
- <a href="https://wwebjs.dev"><img src="https://github.com/wwebjs/logos/blob/main/4_Full%20Logo%20Lockup_Small/small_banner_blue.png?raw=true" title="whatsapp-web.js" alt="WWebJS Website" width="500" /></a>
5
- </p>
6
- <br />
7
- <p>
8
- <a href="https://www.npmjs.com/package/whatsapp-web.js"><img src="https://img.shields.io/npm/v/whatsapp-web.js.svg" alt="npm" /></a>
9
- <a href="https://depfu.com/github/pedroslopez/whatsapp-web.js?project_id=9765"><img src="https://badges.depfu.com/badges/4a65a0de96ece65fdf39e294e0c8dcba/overview.svg" alt="Depfu" /></a>
10
- <img src="https://img.shields.io/badge/WhatsApp_Web-2.3000.1017054665-brightgreen.svg" alt="WhatsApp_Web 2.2346.52" />
11
- <a href="https://discord.gg/H7DqQs4"><img src="https://img.shields.io/discord/698610475432411196.svg?logo=discord" alt="Discord server" /></a>
12
- </p>
13
- <br />
14
- </div>
15
-
16
- ## About
17
- **A WhatsApp API client that connects through the WhatsApp Web browser app**
18
-
19
- The library works by launching the WhatsApp Web browser application and managing it using Puppeteer to create an instance of WhatsApp Web, thereby mitigating the risk of being blocked. The WhatsApp API client connects through the WhatsApp Web browser app, accessing its internal functions. This grants you access to nearly all the features available on WhatsApp Web, enabling dynamic handling similar to any other Node.js application.
20
-
21
- > [!IMPORTANT]
22
- > **It is not guaranteed you will not be blocked by using this method. WhatsApp does not allow bots or unofficial clients on their platform, so this shouldn't be considered totally safe.**
23
-
24
- ## Links
25
-
26
- * [Website][website]
27
- * [Guide][guide] ([source][guide-source]) _(work in progress)_
28
- * [Documentation][documentation] ([source][documentation-source])
29
- * [WWebJS Discord][discord]
30
- * [GitHub][gitHub]
31
- * [npm][npm]
32
-
33
- ## Installation
34
-
35
- The module is now available on npm! `npm i whatsapp-web.js`
36
-
37
- > [!NOTE]
38
- > **Node ``v18+`` is required.**
39
-
40
- ## QUICK STEPS TO UPGRADE NODE
41
-
42
- ### Windows
43
-
44
- #### Manual
45
- Just get the latest LTS from the [official node website][nodejs].
46
-
47
- #### npm
48
- ```powershell
49
- sudo npm install -g n
50
- sudo n stable
51
- ```
52
-
53
- #### Choco
54
- ```powershell
55
- choco install nodejs-lts
56
- ```
57
-
58
- #### Winget
59
- ```powershell
60
- winget install OpenJS.NodeJS.LTS
61
- ```
62
-
63
- ### Ubuntu / Debian
64
- ```bash
65
- curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash - &&\
66
- sudo apt-get install -y nodejs
67
- ```
68
-
69
- ## Example usage
70
-
71
- ```js
72
- const { Client } = require('whatsapp-web.js');
73
-
74
- const client = new Client();
75
-
76
- client.on('qr', (qr) => {
77
- // Generate and scan this code with your phone
78
- console.log('QR RECEIVED', qr);
79
- });
80
-
81
- client.on('ready', () => {
82
- console.log('Client is ready!');
83
- });
84
-
85
- client.on('message', msg => {
86
- if (msg.body == '!ping') {
87
- msg.reply('pong');
88
- }
89
- });
90
-
91
- client.initialize();
92
- ```
93
-
94
- Take a look at [example.js][examples] for another examples with additional use cases.
95
- For further details on saving and restoring sessions, explore the provided [Authentication Strategies][auth-strategies].
96
-
97
-
98
- ## Supported features
99
-
100
- | Feature | Status |
101
- | ------------- | ------------- |
102
- | Multi Device | ✅ |
103
- | Send messages | |
104
- | Receive messages | |
105
- | Send media (images/audio/documents) | ✅ |
106
- | Send media (video) | [(requires Google Chrome)][google-chrome] |
107
- | Send stickers | ✅ |
108
- | Receive media (images/audio/video/documents) | ✅ |
109
- | Send contact cards | ✅ |
110
- | Send location | |
111
- | Send buttons | ❌ [(DEPRECATED)][deprecated-video] |
112
- | Send lists | ❌ [(DEPRECATED)][deprecated-video] |
113
- | Receive location | ✅ |
114
- | Message replies | |
115
- | Join groups by invite | ✅ |
116
- | Get invite for group | ✅ |
117
- | Modify group info (subject, description) | ✅ |
118
- | Modify group settings (send messages, edit info) | ✅ |
119
- | Add group participants | ✅ |
120
- | Kick group participants | ✅ |
121
- | Promote/demote group participants | ✅ |
122
- | Mention users | |
123
- | Mention groups | ✅ |
124
- | Mute/unmute chats | ✅ |
125
- | Block/unblock contacts | ✅ |
126
- | Get contact info | ✅ |
127
- | Get profile pictures | ✅ |
128
- | Set user status message | |
129
- | React to messages | |
130
- | Create polls | |
131
- | Channels | ✅ |
132
- | Vote in polls | 🔜 |
133
- | Communities | 🔜 |
134
-
135
- Something missing? Make an issue and let us know!
136
-
137
- ## Contributing
138
-
139
- Feel free to open pull requests; we welcome contributions! However, for significant changes, it's best to open an issue beforehand. Make sure to review our [contribution guidelines][contributing] before creating a pull request. Before creating your own issue or pull request, always check to see if one already exists!
140
-
141
- ## Supporting the project
142
-
143
- You can support the maintainer of this project through the links below
144
-
145
- - [Support via GitHub Sponsors][gitHub-sponsors]
146
- - [Support via PayPal][support-payPal]
147
- - [Sign up for DigitalOcean][digitalocean] and get $200 in credit when you sign up (Referral)
148
-
149
- ## Disclaimer
150
-
151
- 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 [whatsapp.com][whatsapp]. "WhatsApp" as well as related names, marks, emblems and images are registered trademarks of their respective owners. Also it is not guaranteed you will not be blocked by using this method. WhatsApp does not allow bots or unofficial clients on their platform, so this shouldn't be considered totally safe.
152
-
153
- ## License
154
-
155
- Copyright 2019 Pedro S Lopez
156
-
157
- Licensed under the Apache License, Version 2.0 (the "License");
158
- you may not use this project except in compliance with the License.
159
- You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
160
-
161
- Unless required by applicable law or agreed to in writing, software
162
- distributed under the License is distributed on an "AS IS" BASIS,
163
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
164
- See the License for the specific language governing permissions and
165
- limitations under the License.
166
-
167
-
168
- [website]: https://wwebjs.dev
169
- [guide]: https://guide.wwebjs.dev/guide
170
- [guide-source]: https://github.com/wwebjs/wwebjs.dev/tree/main
171
- [documentation]: https://docs.wwebjs.dev/
172
- [documentation-source]: https://github.com/pedroslopez/whatsapp-web.js/tree/main/docs
173
- [discord]: https://discord.gg/H7DqQs4
174
- [gitHub]: https://github.com/pedroslopez/whatsapp-web.js
175
- [npm]: https://npmjs.org/package/whatsapp-web.js
176
- [nodejs]: https://nodejs.org/en/download/
177
- [examples]: https://github.com/pedroslopez/whatsapp-web.js/blob/master/example.js
178
- [auth-strategies]: https://wwebjs.dev/guide/creating-your-bot/authentication.html
179
- [google-chrome]: https://wwebjs.dev/guide/creating-your-bot/handling-attachments.html#caveat-for-sending-videos-and-gifs
180
- [deprecated-video]: https://www.youtube.com/watch?v=hv1R1rLeVVE
181
- [gitHub-sponsors]: https://github.com/sponsors/pedroslopez
182
- [support-payPal]: https://www.paypal.me/psla/
183
- [digitalocean]: https://m.do.co/c/73f906a36ed4
184
- [contributing]: https://github.com/pedroslopez/whatsapp-web.js/blob/main/CODE_OF_CONDUCT.md
185
- [whatsapp]: https://whatsapp.com
1
+ <div align="center">
2
+ <br />
3
+ <p>
4
+ <a href="https://wwebjs.dev"><img src="https://github.com/wwebjs/assets/blob/main/Collection/GitHub/wwebjs.png?raw=true" title="whatsapp-web.js" alt="WWebJS Website" width="500" /></a>
5
+ </p>
6
+ <br />
7
+ <p>
8
+ <a href="https://www.npmjs.com/package/whatsapp-web.js"><img src="https://img.shields.io/npm/v/whatsapp-web.js.svg" alt="npm" /></a>
9
+ <a href="https://depfu.com/github/pedroslopez/whatsapp-web.js?project_id=9765"><img src="https://badges.depfu.com/badges/4a65a0de96ece65fdf39e294e0c8dcba/overview.svg" alt="Depfu" /></a>
10
+ <img src="https://img.shields.io/badge/WhatsApp_Web-2.3000.1017054665-brightgreen.svg" alt="WhatsApp_Web 2.2346.52" />
11
+ <a href="https://discord.gg/H7DqQs4"><img src="https://img.shields.io/discord/698610475432411196.svg?logo=discord" alt="Discord server" /></a>
12
+ </p>
13
+ <br />
14
+ </div>
15
+
16
+ ## About
17
+ **A WhatsApp API client that operates via the WhatsApp Web browser.**
18
+
19
+ The library launches the WhatsApp Web browser app via Puppeteer, accessing its internal functions and creating a managed instance to reduce the risk of being blocked. This gives the API client nearly all WhatsApp Web features for dynamic use in a Node.js application.
20
+
21
+ > [!IMPORTANT]
22
+ > **It is not guaranteed you will not be blocked by using this method. WhatsApp does not allow bots or unofficial clients on their platform, so this shouldn't be considered totally safe.**
23
+
24
+ ## Links
25
+
26
+ * [GitHub][gitHub]
27
+ * [Guide][guide] ([source][guide-source])
28
+ * [Documentation][documentation] ([source][documentation-source])
29
+ * [Discord Server][discord]
30
+ * [npm][npm]
31
+
32
+ ## Installation
33
+
34
+ The module is available on [npm][npm] via `npm i whatsapp-web.js`!
35
+
36
+ > [!NOTE]
37
+ > **Node ``v18`` or higher, is required.**
38
+ > See the [Guide][guide] for quick upgrade instructions.
39
+
40
+ ## Example usage
41
+
42
+ ```js
43
+ const { Client } = require('whatsapp-web.js');
44
+
45
+ const client = new Client();
46
+
47
+ client.on('qr', (qr) => {
48
+ // Generate and scan this code with your phone
49
+ console.log('QR RECEIVED', qr);
50
+ });
51
+
52
+ client.on('ready', () => {
53
+ console.log('Client is ready!');
54
+ });
55
+
56
+ client.on('message', msg => {
57
+ if (msg.body == '!ping') {
58
+ msg.reply('pong');
59
+ }
60
+ });
61
+
62
+ client.initialize();
63
+ ```
64
+
65
+ Take a look at [example.js][examples] for another examples with additional use cases.
66
+ For further details on saving and restoring sessions, explore the provided [Authentication Strategies][auth-strategies].
67
+
68
+
69
+ ## Supported features
70
+
71
+ | Feature | Status |
72
+ | ------------- | ------------- |
73
+ | Multi Device | ✅ |
74
+ | Send messages | ✅ |
75
+ | Receive messages | ✅ |
76
+ | Send media (images/audio/documents) | ✅ |
77
+ | Send media (video) | [(requires Google Chrome)][google-chrome] |
78
+ | Send stickers | ✅ |
79
+ | Receive media (images/audio/video/documents) | ✅ |
80
+ | Send contact cards | ✅ |
81
+ | Send location | ✅ |
82
+ | Send buttons | ❌ [(DEPRECATED)][deprecated-video] |
83
+ | Send lists | ❌ [(DEPRECATED)][deprecated-video] |
84
+ | Receive location | ✅ |
85
+ | Message replies | ✅ |
86
+ | Join groups by invite | ✅ |
87
+ | Get invite for group | ✅ |
88
+ | Modify group info (subject, description) | ✅ |
89
+ | Modify group settings (send messages, edit info) | ✅ |
90
+ | Add group participants | ✅ |
91
+ | Kick group participants | ✅ |
92
+ | Promote/demote group participants | ✅ |
93
+ | Mention users | ✅ |
94
+ | Mention groups | |
95
+ | Mute/unmute chats | |
96
+ | Block/unblock contacts | ✅ |
97
+ | Get contact info | ✅ |
98
+ | Get profile pictures | ✅ |
99
+ | Set user status message | ✅ |
100
+ | React to messages | |
101
+ | Create polls | |
102
+ | Channels | ✅ |
103
+ | Vote in polls | 🔜 |
104
+ | Communities | 🔜 |
105
+
106
+ Something missing? Make an issue and let us know!
107
+
108
+ ## Contributing
109
+
110
+ Feel free to open pull requests; we welcome contributions! However, for significant changes, it's best to open an issue beforehand. Make sure to review our [contribution guidelines][contributing] before creating a pull request. Before creating your own issue or pull request, always check to see if one already exists!
111
+
112
+ ## Supporting the project
113
+
114
+ You can support the maintainer of this project through the links below
115
+
116
+ - [Support via GitHub Sponsors][gitHub-sponsors]
117
+ - [Support via PayPal][support-payPal]
118
+ - [Sign up for DigitalOcean][digitalocean] and get $200 in credit when you sign up (Referral)
119
+
120
+ ## Disclaimer
121
+
122
+ 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 [whatsapp.com][whatsapp]. "WhatsApp" as well as related names, marks, emblems and images are registered trademarks of their respective owners. Also it is not guaranteed you will not be blocked by using this method. WhatsApp does not allow bots or unofficial clients on their platform, so this shouldn't be considered totally safe.
123
+
124
+ ## License
125
+
126
+ Copyright 2019 Pedro S Lopez
127
+
128
+ Licensed under the Apache License, Version 2.0 (the "License");
129
+ you may not use this project except in compliance with the License.
130
+ You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
131
+
132
+ Unless required by applicable law or agreed to in writing, software
133
+ distributed under the License is distributed on an "AS IS" BASIS,
134
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
135
+ See the License for the specific language governing permissions and
136
+ limitations under the License.
137
+
138
+
139
+ [guide]: https://guide.wwebjs.dev/guide
140
+ [guide-source]: https://github.com/wwebjs/wwebjs.dev/tree/main
141
+ [documentation]: https://docs.wwebjs.dev/
142
+ [documentation-source]: https://github.com/pedroslopez/whatsapp-web.js/tree/main/docs
143
+ [discord]: https://discord.gg/H7DqQs4
144
+ [gitHub]: https://github.com/pedroslopez/whatsapp-web.js
145
+ [npm]: https://npmjs.org/package/whatsapp-web.js
146
+ [nodejs]: https://nodejs.org/en/download/
147
+ [examples]: https://github.com/pedroslopez/whatsapp-web.js/blob/master/example.js
148
+ [auth-strategies]: https://wwebjs.dev/guide/creating-your-bot/authentication.html
149
+ [google-chrome]: https://wwebjs.dev/guide/creating-your-bot/handling-attachments.html#caveat-for-sending-videos-and-gifs
150
+ [deprecated-video]: https://www.youtube.com/watch?v=hv1R1rLeVVE
151
+ [gitHub-sponsors]: https://github.com/sponsors/pedroslopez
152
+ [support-payPal]: https://www.paypal.me/psla/
153
+ [digitalocean]: https://m.do.co/c/73f906a36ed4
154
+ [contributing]: https://github.com/pedroslopez/whatsapp-web.js/blob/main/CODE_OF_CONDUCT.md
155
+ [whatsapp]: https://whatsapp.com