whatsapp-web-sj.js 1.26.0
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.
- package/.env.example +3 -0
- package/CODE_OF_CONDUCT.md +133 -0
- package/LICENSE +201 -0
- package/README.md +185 -0
- package/example.js +634 -0
- package/index.d.ts +1842 -0
- package/index.js +32 -0
- package/package.json +55 -0
- package/shell.js +36 -0
- package/src/Client.js +1747 -0
- package/src/authStrategies/BaseAuthStrategy.js +27 -0
- package/src/authStrategies/LocalAuth.js +56 -0
- package/src/authStrategies/NoAuth.js +12 -0
- package/src/authStrategies/RemoteAuth.js +204 -0
- package/src/factories/ChatFactory.js +16 -0
- package/src/factories/ContactFactory.js +16 -0
- package/src/structures/Base.js +22 -0
- package/src/structures/BusinessContact.js +21 -0
- package/src/structures/Buttons.js +82 -0
- package/src/structures/Call.js +76 -0
- package/src/structures/Chat.js +275 -0
- package/src/structures/ClientInfo.js +71 -0
- package/src/structures/Contact.js +208 -0
- package/src/structures/GroupChat.js +475 -0
- package/src/structures/GroupNotification.js +104 -0
- package/src/structures/Label.js +50 -0
- package/src/structures/List.js +79 -0
- package/src/structures/Location.js +61 -0
- package/src/structures/Message.js +711 -0
- package/src/structures/MessageMedia.js +111 -0
- package/src/structures/Order.js +52 -0
- package/src/structures/Payment.js +79 -0
- package/src/structures/Poll.js +44 -0
- package/src/structures/PollVote.js +61 -0
- package/src/structures/PrivateChat.js +13 -0
- package/src/structures/PrivateContact.js +13 -0
- package/src/structures/Product.js +68 -0
- package/src/structures/ProductMetadata.js +25 -0
- package/src/structures/Reaction.js +69 -0
- package/src/structures/index.js +24 -0
- package/src/util/Constants.js +176 -0
- package/src/util/Injected/AuthStore/AuthStore.js +17 -0
- package/src/util/Injected/AuthStore/LegacyAuthStore.js +22 -0
- package/src/util/Injected/LegacyStore.js +146 -0
- package/src/util/Injected/Store.js +167 -0
- package/src/util/Injected/Utils.js +1017 -0
- package/src/util/InterfaceController.js +127 -0
- package/src/util/Util.js +186 -0
- package/src/webCache/LocalWebCache.js +40 -0
- package/src/webCache/RemoteWebCache.js +40 -0
- package/src/webCache/WebCache.js +14 -0
- package/src/webCache/WebCacheFactory.js +20 -0
package/index.js
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
const Constants = require('./src/util/Constants');
|
4
|
+
|
5
|
+
module.exports = {
|
6
|
+
Client: require('./src/Client'),
|
7
|
+
|
8
|
+
version: require('./package.json').version,
|
9
|
+
|
10
|
+
// Structures
|
11
|
+
Chat: require('./src/structures/Chat'),
|
12
|
+
PrivateChat: require('./src/structures/PrivateChat'),
|
13
|
+
GroupChat: require('./src/structures/GroupChat'),
|
14
|
+
Message: require('./src/structures/Message'),
|
15
|
+
MessageMedia: require('./src/structures/MessageMedia'),
|
16
|
+
Contact: require('./src/structures/Contact'),
|
17
|
+
PrivateContact: require('./src/structures/PrivateContact'),
|
18
|
+
BusinessContact: require('./src/structures/BusinessContact'),
|
19
|
+
ClientInfo: require('./src/structures/ClientInfo'),
|
20
|
+
Location: require('./src/structures/Location'),
|
21
|
+
Poll: require('./src/structures/Poll'),
|
22
|
+
ProductMetadata: require('./src/structures/ProductMetadata'),
|
23
|
+
List: require('./src/structures/List'),
|
24
|
+
Buttons: require('./src/structures/Buttons'),
|
25
|
+
|
26
|
+
// Auth Strategies
|
27
|
+
NoAuth: require('./src/authStrategies/NoAuth'),
|
28
|
+
LocalAuth: require('./src/authStrategies/LocalAuth'),
|
29
|
+
RemoteAuth: require('./src/authStrategies/RemoteAuth'),
|
30
|
+
|
31
|
+
...Constants
|
32
|
+
};
|
package/package.json
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
{
|
2
|
+
"name": "whatsapp-web-sj.js",
|
3
|
+
"version": "1.26.0",
|
4
|
+
"description": "Library for interacting with the WhatsApp Web API ",
|
5
|
+
"main": "./index.js",
|
6
|
+
"typings": "./index.d.ts",
|
7
|
+
"scripts": {
|
8
|
+
"test": "mocha tests --recursive --timeout 5000",
|
9
|
+
"test-single": "mocha",
|
10
|
+
"shell": "node --experimental-repl-await ./shell.js",
|
11
|
+
"generate-docs": "node_modules/.bin/jsdoc --configure .jsdoc.json --verbose"
|
12
|
+
},
|
13
|
+
"keywords": [
|
14
|
+
"whatsapp",
|
15
|
+
"whatsapp-web",
|
16
|
+
"api",
|
17
|
+
"bot",
|
18
|
+
"client",
|
19
|
+
"node"
|
20
|
+
],
|
21
|
+
"author": "Pedro Lopez",
|
22
|
+
"license": "Apache-2.0",
|
23
|
+
"bugs": {
|
24
|
+
"url": "https://github.com/pedroslopez/whatsapp-web.js/issues"
|
25
|
+
},
|
26
|
+
"homepage": "https://wwebjs.dev/",
|
27
|
+
"dependencies": {
|
28
|
+
"@pedroslopez/moduleraid": "^5.0.2",
|
29
|
+
"fluent-ffmpeg": "2.1.2",
|
30
|
+
"mime": "^3.0.0",
|
31
|
+
"node-fetch": "^2.6.9",
|
32
|
+
"node-webpmux": "3.1.7",
|
33
|
+
"puppeteer": "^18.2.1"
|
34
|
+
},
|
35
|
+
"devDependencies": {
|
36
|
+
"@types/node-fetch": "^2.5.12",
|
37
|
+
"chai": "^4.3.4",
|
38
|
+
"chai-as-promised": "^7.1.1",
|
39
|
+
"dotenv": "^16.0.0",
|
40
|
+
"eslint": "^8.4.1",
|
41
|
+
"eslint-plugin-mocha": "^10.0.3",
|
42
|
+
"jsdoc": "^3.6.4",
|
43
|
+
"jsdoc-baseline": "^0.1.5",
|
44
|
+
"mocha": "^9.0.2",
|
45
|
+
"sinon": "^13.0.1"
|
46
|
+
},
|
47
|
+
"engines": {
|
48
|
+
"node": ">=18.0.0"
|
49
|
+
},
|
50
|
+
"optionalDependencies": {
|
51
|
+
"archiver": "^5.3.1",
|
52
|
+
"fs-extra": "^10.1.0",
|
53
|
+
"unzipper": "^0.10.11"
|
54
|
+
}
|
55
|
+
}
|
package/shell.js
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
/**
|
2
|
+
* ==== wwebjs-shell ====
|
3
|
+
* Used for quickly testing library features
|
4
|
+
*
|
5
|
+
* Running `npm run shell` will start WhatsApp Web with headless=false
|
6
|
+
* and then drop you into Node REPL with `client` in its context.
|
7
|
+
*/
|
8
|
+
|
9
|
+
const repl = require('repl');
|
10
|
+
|
11
|
+
const { Client, LocalAuth } = require('./index');
|
12
|
+
|
13
|
+
const client = new Client({
|
14
|
+
puppeteer: { headless: false },
|
15
|
+
authStrategy: new LocalAuth()
|
16
|
+
});
|
17
|
+
|
18
|
+
console.log('Initializing...');
|
19
|
+
|
20
|
+
client.initialize();
|
21
|
+
|
22
|
+
client.on('qr', () => {
|
23
|
+
console.log('Please scan the QR code on the browser.');
|
24
|
+
});
|
25
|
+
|
26
|
+
client.on('authenticated', (session) => {
|
27
|
+
console.log(JSON.stringify(session));
|
28
|
+
});
|
29
|
+
|
30
|
+
client.on('ready', () => {
|
31
|
+
const shell = repl.start('wwebjs> ');
|
32
|
+
shell.context.client = client;
|
33
|
+
shell.on('exit', async () => {
|
34
|
+
await client.destroy();
|
35
|
+
});
|
36
|
+
});
|