@another-trial/whatsapp-web.js 1.34.1 → 1.35.0-alpha.2
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 +2 -2
- package/CODE_OF_CONDUCT.md +133 -133
- package/LICENSE +201 -201
- package/README.md +155 -185
- package/example.js +699 -690
- package/index.d.ts +2248 -2202
- package/index.js +35 -35
- package/package.json +59 -59
- package/shell.js +36 -36
- package/src/Client.js +2447 -2361
- package/src/authStrategies/BaseAuthStrategy.js +26 -26
- package/src/authStrategies/LocalAuth.js +58 -58
- package/src/authStrategies/NoAuth.js +11 -11
- package/src/authStrategies/RemoteAuth.js +210 -210
- package/src/factories/ChatFactory.js +21 -21
- package/src/factories/ContactFactory.js +15 -15
- package/src/structures/Base.js +21 -21
- package/src/structures/Broadcast.js +69 -69
- package/src/structures/BusinessContact.js +20 -20
- package/src/structures/Buttons.js +81 -81
- package/src/structures/Call.js +75 -75
- package/src/structures/Channel.js +382 -382
- package/src/structures/Chat.js +329 -299
- package/src/structures/ClientInfo.js +70 -70
- package/src/structures/Contact.js +208 -208
- package/src/structures/GroupChat.js +485 -485
- package/src/structures/GroupNotification.js +104 -104
- package/src/structures/Label.js +49 -49
- package/src/structures/List.js +79 -79
- package/src/structures/Location.js +61 -61
- package/src/structures/Message.js +780 -747
- package/src/structures/MessageMedia.js +111 -111
- package/src/structures/Order.js +51 -51
- package/src/structures/Payment.js +79 -79
- package/src/structures/Poll.js +44 -44
- package/src/structures/PollVote.js +75 -75
- package/src/structures/PrivateChat.js +12 -12
- package/src/structures/PrivateContact.js +12 -12
- package/src/structures/Product.js +67 -67
- package/src/structures/ProductMetadata.js +24 -24
- package/src/structures/Reaction.js +68 -68
- package/src/structures/ScheduledEvent.js +71 -71
- package/src/structures/index.js +27 -27
- package/src/util/Constants.js +186 -183
- package/src/util/Injected/AuthStore/AuthStore.js +16 -16
- package/src/util/Injected/AuthStore/LegacyAuthStore.js +21 -21
- package/src/util/Injected/LegacyStore.js +145 -145
- package/src/util/Injected/Store.js +257 -233
- package/src/util/Injected/Utils.js +1168 -1169
- package/src/util/InterfaceController.js +126 -126
- package/src/util/Puppeteer.js +23 -23
- package/src/util/Util.js +186 -186
- package/src/webCache/LocalWebCache.js +40 -40
- package/src/webCache/RemoteWebCache.js +39 -39
- package/src/webCache/WebCache.js +13 -13
- package/src/webCache/WebCacheFactory.js +19 -19
package/index.js
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
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
|
-
Channel: require('./src/structures/Channel'),
|
|
15
|
-
Message: require('./src/structures/Message'),
|
|
16
|
-
MessageMedia: require('./src/structures/MessageMedia'),
|
|
17
|
-
Contact: require('./src/structures/Contact'),
|
|
18
|
-
PrivateContact: require('./src/structures/PrivateContact'),
|
|
19
|
-
BusinessContact: require('./src/structures/BusinessContact'),
|
|
20
|
-
ClientInfo: require('./src/structures/ClientInfo'),
|
|
21
|
-
Location: require('./src/structures/Location'),
|
|
22
|
-
Poll: require('./src/structures/Poll'),
|
|
23
|
-
ScheduledEvent: require('./src/structures/ScheduledEvent'),
|
|
24
|
-
ProductMetadata: require('./src/structures/ProductMetadata'),
|
|
25
|
-
List: require('./src/structures/List'),
|
|
26
|
-
Buttons: require('./src/structures/Buttons'),
|
|
27
|
-
Broadcast: require('./src/structures/Broadcast'),
|
|
28
|
-
|
|
29
|
-
// Auth Strategies
|
|
30
|
-
NoAuth: require('./src/authStrategies/NoAuth'),
|
|
31
|
-
LocalAuth: require('./src/authStrategies/LocalAuth'),
|
|
32
|
-
RemoteAuth: require('./src/authStrategies/RemoteAuth'),
|
|
33
|
-
|
|
34
|
-
...Constants
|
|
35
|
-
};
|
|
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
|
+
Channel: require('./src/structures/Channel'),
|
|
15
|
+
Message: require('./src/structures/Message'),
|
|
16
|
+
MessageMedia: require('./src/structures/MessageMedia'),
|
|
17
|
+
Contact: require('./src/structures/Contact'),
|
|
18
|
+
PrivateContact: require('./src/structures/PrivateContact'),
|
|
19
|
+
BusinessContact: require('./src/structures/BusinessContact'),
|
|
20
|
+
ClientInfo: require('./src/structures/ClientInfo'),
|
|
21
|
+
Location: require('./src/structures/Location'),
|
|
22
|
+
Poll: require('./src/structures/Poll'),
|
|
23
|
+
ScheduledEvent: require('./src/structures/ScheduledEvent'),
|
|
24
|
+
ProductMetadata: require('./src/structures/ProductMetadata'),
|
|
25
|
+
List: require('./src/structures/List'),
|
|
26
|
+
Buttons: require('./src/structures/Buttons'),
|
|
27
|
+
Broadcast: require('./src/structures/Broadcast'),
|
|
28
|
+
|
|
29
|
+
// Auth Strategies
|
|
30
|
+
NoAuth: require('./src/authStrategies/NoAuth'),
|
|
31
|
+
LocalAuth: require('./src/authStrategies/LocalAuth'),
|
|
32
|
+
RemoteAuth: require('./src/authStrategies/RemoteAuth'),
|
|
33
|
+
|
|
34
|
+
...Constants
|
|
35
|
+
};
|
package/package.json
CHANGED
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@another-trial/whatsapp-web.js",
|
|
3
|
-
"version": "1.
|
|
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": "npx jsdoc --configure .jsdoc.json --verbose"
|
|
12
|
-
},
|
|
13
|
-
"repository": {
|
|
14
|
-
"type": "git",
|
|
15
|
-
"url": "git+https://github.com/pedroslopez/whatsapp-web.js.git"
|
|
16
|
-
},
|
|
17
|
-
"keywords": [
|
|
18
|
-
"whatsapp",
|
|
19
|
-
"whatsapp-web",
|
|
20
|
-
"api",
|
|
21
|
-
"bot",
|
|
22
|
-
"client",
|
|
23
|
-
"node"
|
|
24
|
-
],
|
|
25
|
-
"author": "Pedro Lopez",
|
|
26
|
-
"license": "Apache-2.0",
|
|
27
|
-
"bugs": {
|
|
28
|
-
"url": "https://github.com/pedroslopez/whatsapp-web.js/issues"
|
|
29
|
-
},
|
|
30
|
-
"homepage": "https://wwebjs.dev/",
|
|
31
|
-
"dependencies": {
|
|
32
|
-
"@pedroslopez/moduleraid": "^5.0.2",
|
|
33
|
-
"fluent-ffmpeg": "2.1.3",
|
|
34
|
-
"mime": "^3.0.0",
|
|
35
|
-
"node-fetch": "^2.6.9",
|
|
36
|
-
"node-webpmux": "3.1.7",
|
|
37
|
-
"puppeteer": "^18.2.1"
|
|
38
|
-
},
|
|
39
|
-
"devDependencies": {
|
|
40
|
-
"@types/node-fetch": "^2.5.12",
|
|
41
|
-
"chai": "^4.3.4",
|
|
42
|
-
"chai-as-promised": "^7.1.1",
|
|
43
|
-
"dotenv": "^16.0.0",
|
|
44
|
-
"eslint": "^8.4.1",
|
|
45
|
-
"eslint-plugin-mocha": "^10.0.3",
|
|
46
|
-
"jsdoc": "^3.6.4",
|
|
47
|
-
"jsdoc-baseline": "^0.1.5",
|
|
48
|
-
"mocha": "^9.0.2",
|
|
49
|
-
"sinon": "^13.0.1"
|
|
50
|
-
},
|
|
51
|
-
"engines": {
|
|
52
|
-
"node": ">=18.0.0"
|
|
53
|
-
},
|
|
54
|
-
"optionalDependencies": {
|
|
55
|
-
"archiver": "^5.3.1",
|
|
56
|
-
"fs-extra": "^10.1.0",
|
|
57
|
-
"unzipper": "^0.10.11"
|
|
58
|
-
}
|
|
59
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@another-trial/whatsapp-web.js",
|
|
3
|
+
"version": "1.35.0-alpha.2",
|
|
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": "npx jsdoc --configure .jsdoc.json --verbose"
|
|
12
|
+
},
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git+https://github.com/pedroslopez/whatsapp-web.js.git"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"whatsapp",
|
|
19
|
+
"whatsapp-web",
|
|
20
|
+
"api",
|
|
21
|
+
"bot",
|
|
22
|
+
"client",
|
|
23
|
+
"node"
|
|
24
|
+
],
|
|
25
|
+
"author": "Pedro Lopez",
|
|
26
|
+
"license": "Apache-2.0",
|
|
27
|
+
"bugs": {
|
|
28
|
+
"url": "https://github.com/pedroslopez/whatsapp-web.js/issues"
|
|
29
|
+
},
|
|
30
|
+
"homepage": "https://wwebjs.dev/",
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@pedroslopez/moduleraid": "^5.0.2",
|
|
33
|
+
"fluent-ffmpeg": "2.1.3",
|
|
34
|
+
"mime": "^3.0.0",
|
|
35
|
+
"node-fetch": "^2.6.9",
|
|
36
|
+
"node-webpmux": "3.1.7",
|
|
37
|
+
"puppeteer": "^18.2.1"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@types/node-fetch": "^2.5.12",
|
|
41
|
+
"chai": "^4.3.4",
|
|
42
|
+
"chai-as-promised": "^7.1.1",
|
|
43
|
+
"dotenv": "^16.0.0",
|
|
44
|
+
"eslint": "^8.4.1",
|
|
45
|
+
"eslint-plugin-mocha": "^10.0.3",
|
|
46
|
+
"jsdoc": "^3.6.4",
|
|
47
|
+
"jsdoc-baseline": "^0.1.5",
|
|
48
|
+
"mocha": "^9.0.2",
|
|
49
|
+
"sinon": "^13.0.1"
|
|
50
|
+
},
|
|
51
|
+
"engines": {
|
|
52
|
+
"node": ">=18.0.0"
|
|
53
|
+
},
|
|
54
|
+
"optionalDependencies": {
|
|
55
|
+
"archiver": "^5.3.1",
|
|
56
|
+
"fs-extra": "^10.1.0",
|
|
57
|
+
"unzipper": "^0.10.11"
|
|
58
|
+
}
|
|
59
|
+
}
|
package/shell.js
CHANGED
|
@@ -1,36 +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
|
-
});
|
|
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
|
+
});
|