@open-wa/wa-automate 4.23.7 → 4.23.8
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/README.md
CHANGED
@@ -36,7 +36,7 @@
|
|
36
36
|
Use this command to install the library for the first time and to keep the library up to date.
|
37
37
|
|
38
38
|
```bash
|
39
|
-
> npm i --save @open-wa/wa-automate@latest
|
39
|
+
> npm i --save @open-wa/wa-automate@latest --multi-device
|
40
40
|
```
|
41
41
|
|
42
42
|
## Usage
|
@@ -65,6 +65,7 @@ const wa = require('@open-wa/wa-automate');
|
|
65
65
|
|
66
66
|
wa.create({
|
67
67
|
sessionId: "COVID_HELPER",
|
68
|
+
multiDevice: true, //required to enable multiDevice support
|
68
69
|
authTimeout: 60, //wait only 60 seconds to get a connection with the host account device
|
69
70
|
blockCrashLogs: true,
|
70
71
|
disableSpins: true,
|
@@ -97,6 +98,10 @@ Want to convert your WA account to an API instantly? You can now with the CLI. F
|
|
97
98
|
> npx @open-wa/wa-automate --help
|
98
99
|
```
|
99
100
|
|
101
|
+
## Multi Device Support
|
102
|
+
|
103
|
+
We're currently in a weird transitionary period where some people are being forced to adopt Multi Device (MD). Once the transition is complete, the library default will be to turn on MD support. For now, you have to set it yourself explicitly either by using the `--multi-device` flag (with the [CLI](#CLI)) or setting `multiDevice: true` in your config (with your custom code)
|
104
|
+
|
100
105
|
### Latest Changes
|
101
106
|
|
102
107
|
With the constant updates from WA. It is advisable to always use the latest version of `@open-wa/wa-automate`.
|
package/dist/api/Client.d.ts
CHANGED
@@ -158,7 +158,7 @@ export declare class Client {
|
|
158
158
|
* @param fn callback
|
159
159
|
* @fires [[Message]]
|
160
160
|
*/
|
161
|
-
onButton(fn: (
|
161
|
+
onButton(fn: (message: Message) => void): Promise<Listener | boolean>;
|
162
162
|
/**
|
163
163
|
* Listens to battery changes
|
164
164
|
*
|
@@ -15,6 +15,10 @@ export interface Message {
|
|
15
15
|
* The body of the message. If the message type is `chat` , `body` will be the text of the chat. If the message type is some sort of media, then this body will be the thumbnail of the media.
|
16
16
|
*/
|
17
17
|
body: string;
|
18
|
+
/**
|
19
|
+
* a convenient way to get the main text content from a message.
|
20
|
+
*/
|
21
|
+
text: string;
|
18
22
|
/**
|
19
23
|
* The type of the message, see [[MessageTypes]]
|
20
24
|
*/
|
@@ -369,7 +369,9 @@ function create(config = {}) {
|
|
369
369
|
//@ts-ignore
|
370
370
|
const metrics = yield waPage.evaluate(({ config }) => WAPI.launchMetrics(config), { config });
|
371
371
|
const purgedMessage = (metrics === null || metrics === void 0 ? void 0 : metrics.purged) ? Object.entries(metrics.purged).filter(([, e]) => e > 0).map(([k, e]) => `${e} ${k}`).join(" and ") : "";
|
372
|
-
|
372
|
+
if (metrics.isMd && !(config === null || config === void 0 ? void 0 : config.multiDevice))
|
373
|
+
spinner.info("!!!Please set multiDevice: true in the config or use the --mutli-Device flag!!!");
|
374
|
+
spinner.succeed(`Client loaded for ${metrics.isBiz ? "business" : "normal"} account ${metrics.isMd && "[MD] " || ''}with ${metrics.contacts} contacts, ${metrics.chats} chats & ${metrics.messages} messages ${purgedMessage ? `+ purged ${purgedMessage} ` : ``}in ${LAUNCH_TIME_MS / 1000}s`);
|
373
375
|
if ((config === null || config === void 0 ? void 0 : config.deleteSessionDataOnLogout) || (config === null || config === void 0 ? void 0 : config.killClientOnLogout))
|
374
376
|
config.eventMode = true;
|
375
377
|
const client = new Client_1.Client(waPage, config, debugInfo);
|
package/package.json
CHANGED