whatsauto.js 1.0.2 → 1.0.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.
- package/README.md +49 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -34,7 +34,55 @@ Additionally, WhatsAuto.js uses the Object-Oriented Programming (OOP) paradigm,
|
|
|
34
34
|
|
|
35
35
|
## 🪧 Examples
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
### Make WA Session / Client
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
import AutoWA from "../dist";
|
|
41
|
+
|
|
42
|
+
// using QR (default)
|
|
43
|
+
const autoWA = new AutoWA("session_name", { printQR: true });
|
|
44
|
+
// or
|
|
45
|
+
const autoWA = new AutoWA("session_name");
|
|
46
|
+
// or, using pair code (experimental)
|
|
47
|
+
const autoWA = new AutoWA("session_name", { phoneNumber: "628xxxx" });
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
> See full session parameters [here](#session-parameters)
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
// listen to some event
|
|
54
|
+
const ev = autoWA.event;
|
|
55
|
+
|
|
56
|
+
ev.onConnected(() => {
|
|
57
|
+
console.log("Client Ready!");
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
ev.onMessage(async (msg) => {
|
|
61
|
+
console.log(msg.text);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
// initialize session
|
|
65
|
+
await autoWA.initialize();
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Session Parameters
|
|
69
|
+
|
|
70
|
+
```ts
|
|
71
|
+
{
|
|
72
|
+
/**
|
|
73
|
+
* Print logs into Terminal
|
|
74
|
+
*/
|
|
75
|
+
logging?: boolean; // true, false
|
|
76
|
+
/**
|
|
77
|
+
* Print QR Code into Terminal
|
|
78
|
+
*/
|
|
79
|
+
printQR?: boolean; // true, false
|
|
80
|
+
/**
|
|
81
|
+
* Phone number for session with pairing code
|
|
82
|
+
*/
|
|
83
|
+
phoneNumber?: string; // 62822xxxxx (62 is your country code)
|
|
84
|
+
}
|
|
85
|
+
```
|
|
38
86
|
|
|
39
87
|
## 🧾 Disclaimer
|
|
40
88
|
|