@vielhuber/wahelper 1.4.4 → 1.4.6
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 +39 -8
- package/package.json +7 -4
- package/wahelper-daemon.js +711 -0
- package/wahelper.js +189 -501
package/README.MD
CHANGED
|
@@ -29,6 +29,12 @@ composer require vielhuber/wahelper
|
|
|
29
29
|
|
|
30
30
|
## usage
|
|
31
31
|
|
|
32
|
+
### start daemon
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
npx wahelper-daemon --device "xxxxxxxxxxxx"
|
|
36
|
+
```
|
|
37
|
+
|
|
32
38
|
### cli
|
|
33
39
|
|
|
34
40
|
```sh
|
|
@@ -62,18 +68,15 @@ use vielhuber\wahelper\wahelper;
|
|
|
62
68
|
$wahelper = new wahelper();
|
|
63
69
|
|
|
64
70
|
// fetch messages
|
|
65
|
-
$wahelper->fetchMessages(
|
|
66
|
-
device: 'xxxxxxxxxxxx',
|
|
67
|
-
limit: 42
|
|
68
|
-
);
|
|
71
|
+
$wahelper->fetchMessages(device: 'xxxxxxxxxxxx', limit: 42);
|
|
69
72
|
|
|
70
73
|
// send message to user
|
|
71
74
|
$wahelper->sendUser(
|
|
72
75
|
device: 'xxxxxxxxxxxx',
|
|
73
76
|
number: 'xxxxxxxxxxxx',
|
|
74
|
-
message
|
|
77
|
+
message: 'This is a test! 🚀',
|
|
75
78
|
attachments: ['/full/path/to/file.pdf', '/full/path/to/image.png']
|
|
76
|
-
|
|
79
|
+
);
|
|
77
80
|
|
|
78
81
|
// send message to group
|
|
79
82
|
$wahelper->sendGroup(
|
|
@@ -81,7 +84,7 @@ $wahelper->sendGroup(
|
|
|
81
84
|
name: 'Group name',
|
|
82
85
|
message: 'This is a test! 🚀',
|
|
83
86
|
attachments: ['/full/path/to/file.pdf', '/full/path/to/image.png']
|
|
84
|
-
|
|
87
|
+
);
|
|
85
88
|
```
|
|
86
89
|
|
|
87
90
|
### mcp
|
|
@@ -91,8 +94,36 @@ $wahelper->sendGroup(
|
|
|
91
94
|
"mcpServers": {
|
|
92
95
|
"whatsapp": {
|
|
93
96
|
"command": "/usr/bin/php8.1",
|
|
94
|
-
"args": ["/var/www/
|
|
97
|
+
"args": ["/var/www/wahelper/vendor/bin/mcp-server.php"]
|
|
95
98
|
}
|
|
96
99
|
}
|
|
97
100
|
}
|
|
98
101
|
```
|
|
102
|
+
|
|
103
|
+
## daemon
|
|
104
|
+
|
|
105
|
+
```sh
|
|
106
|
+
# install pm2
|
|
107
|
+
npm install -g pm2
|
|
108
|
+
|
|
109
|
+
# start daemon
|
|
110
|
+
pm2 start npx --name wahelper-xxxxxxxxxxxx -- wahelper-daemon --device xxxxxxxxxxxx
|
|
111
|
+
|
|
112
|
+
# optional: autostart
|
|
113
|
+
## save config
|
|
114
|
+
pm2 save
|
|
115
|
+
## linux
|
|
116
|
+
pm2 startup
|
|
117
|
+
## windows
|
|
118
|
+
Windows Task Scheduler > Trigger Bei Systemstart → Aktion "pm2 resurrect"
|
|
119
|
+
|
|
120
|
+
# more commands
|
|
121
|
+
pm2 resurrect
|
|
122
|
+
pm2 unstartup
|
|
123
|
+
pm2 status
|
|
124
|
+
pm2 start wahelper-xxxxxxxxxxxx
|
|
125
|
+
pm2 stop wahelper-xxxxxxxxxxxx
|
|
126
|
+
pm2 restart wahelper-xxxxxxxxxxxx
|
|
127
|
+
pm2 logs wahelper-xxxxxxxxxxxx
|
|
128
|
+
pm2 delete wahelper-xxxxxxxxxxxx
|
|
129
|
+
```
|
package/package.json
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vielhuber/wahelper",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.6",
|
|
4
4
|
"description": "Lightweight whatsapp integration layer.",
|
|
5
5
|
"main": "wahelper.js",
|
|
6
6
|
"files": [
|
|
7
|
-
"wahelper.js"
|
|
7
|
+
"wahelper.js",
|
|
8
|
+
"wahelper-daemon.js"
|
|
8
9
|
],
|
|
9
10
|
"bin": {
|
|
10
|
-
"wahelper": "wahelper.js"
|
|
11
|
+
"wahelper": "wahelper.js",
|
|
12
|
+
"wahelper-daemon": "wahelper-daemon.js"
|
|
11
13
|
},
|
|
12
14
|
"publishConfig": {
|
|
13
15
|
"access": "public"
|
|
@@ -20,7 +22,8 @@
|
|
|
20
22
|
"author": "David Vielhuber <david@vielhuber.de>",
|
|
21
23
|
"license": "MIT",
|
|
22
24
|
"dependencies": {
|
|
23
|
-
"baileys": "^7.0.0-rc.9"
|
|
25
|
+
"baileys": "^7.0.0-rc.9",
|
|
26
|
+
"qrcode-terminal": "^0.12.0"
|
|
24
27
|
},
|
|
25
28
|
"devDependencies": {
|
|
26
29
|
"@prettier/plugin-php": "^0.24.0",
|