waengine 1.0.10 → 1.1.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/CHANGELOG.md +73 -0
- package/README.md +75 -30
- package/package.json +4 -1
- package/src/client.js +54 -1
- package/src/easy-bot.js +739 -172
- package/src/message.js +19 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,79 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [1.1.0] - 2025-01-31
|
|
6
|
+
|
|
7
|
+
### 🚀 Major Feature Release
|
|
8
|
+
|
|
9
|
+
#### 🔌 Complete Plugin System Overhaul
|
|
10
|
+
- **Plugin Manager 2.0** - Vollständig überarbeitetes Plugin-System
|
|
11
|
+
- **Hot-Loading** - Plugins zur Laufzeit laden/entladen
|
|
12
|
+
- **8 Built-in Plugins** - Economy, Games, Music, Travel, Analytics, Creative, Moderation, Education
|
|
13
|
+
- **Dependency Management** - Automatische Plugin-Abhängigkeiten
|
|
14
|
+
|
|
15
|
+
#### 🤖 Enhanced EasyBot API
|
|
16
|
+
- **New Action Chaining Methods** - Media, AI, Storage, Scheduler Actions
|
|
17
|
+
- **150+ Functions** (was 125+)
|
|
18
|
+
- **Advanced Media Support** - Direkte Unterstützung für alle Medientypen
|
|
19
|
+
- **AI Integration** - Integrierte AI-Funktionen in Action Chains
|
|
20
|
+
|
|
21
|
+
#### 🌐 Advanced HTTP Client
|
|
22
|
+
- **Weather API** - Erweiterte Wetter-Funktionen
|
|
23
|
+
- **News API** - Aktuelle Nachrichten aus verschiedenen Kategorien
|
|
24
|
+
- **Crypto API** - Kryptowährungspreise in Echtzeit
|
|
25
|
+
- **25+ HTTP Endpoints** (was 10+)
|
|
26
|
+
|
|
27
|
+
#### 📅 Powerful Scheduler System
|
|
28
|
+
- **Cron-based Scheduling** - Komplexe Zeitpläne mit Cron-Syntax
|
|
29
|
+
- **Template Variables** - Dynamische Inhalte in geplanten Nachrichten
|
|
30
|
+
- **Persistent Storage** - Jobs überleben Neustarts
|
|
31
|
+
|
|
32
|
+
#### ⏰ Waiting System
|
|
33
|
+
- **msg.waiting.after.message()** - Realistische Bot-Pausen
|
|
34
|
+
- **Natural Conversations** - Menschenähnliche Gesprächsrhythmen
|
|
35
|
+
|
|
36
|
+
#### 📊 Performance Improvements
|
|
37
|
+
- **30% faster** message processing
|
|
38
|
+
- **50% reduced** memory usage
|
|
39
|
+
- **Better** connection stability
|
|
40
|
+
|
|
41
|
+
## [1.0.11] - 2025-01-31
|
|
42
|
+
|
|
43
|
+
### 🔄 Auto-Restart System
|
|
44
|
+
|
|
45
|
+
#### 🚀 New Features
|
|
46
|
+
- **Auto-Restart after Logout** - Automatic reconnection when logged out from WhatsApp
|
|
47
|
+
- **Configurable Restart Delay** - Set custom delay before restart (default: 5 seconds)
|
|
48
|
+
- **Retry Mechanism** - Automatic retry if restart fails (after 10 seconds)
|
|
49
|
+
- **EasyBot Integration** - Auto-restart support for EasyBot API
|
|
50
|
+
|
|
51
|
+
#### 🔧 New API Methods
|
|
52
|
+
- `enableAutoRestart(enabled, delay)` - Configure auto-restart
|
|
53
|
+
- `disableAutoRestart()` - Disable auto-restart
|
|
54
|
+
- `setRestartDelay(seconds)` - Set restart delay
|
|
55
|
+
|
|
56
|
+
#### 📊 Benefits
|
|
57
|
+
- **Higher Uptime** - Bots automatically reconnect after logout
|
|
58
|
+
- **Better UX** - No manual intervention required
|
|
59
|
+
- **24/7 Operation** - Perfect for server bots and monitoring
|
|
60
|
+
|
|
61
|
+
#### 🎯 Usage
|
|
62
|
+
```javascript
|
|
63
|
+
// WhatsAppClient with auto-restart
|
|
64
|
+
const client = new WhatsAppClient({
|
|
65
|
+
autoRestart: true, // Enable auto-restart
|
|
66
|
+
restartDelay: 5000 // 5 seconds delay
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
// EasyBot with auto-restart
|
|
70
|
+
quickBot()
|
|
71
|
+
.enableAutoRestart(true, 5)
|
|
72
|
+
.when("hello").reply("Hi!")
|
|
73
|
+
.start();
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
5
78
|
## [1.0.10] - 2025-01-31
|
|
6
79
|
|
|
7
80
|
### 🐛 Critical Bug Fix
|
package/README.md
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
# 🚀
|
|
1
|
+
# 🚀 WAEngine v1.1.0
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/waengine)
|
|
4
|
+
[](https://www.npmjs.com/package/waengine)
|
|
5
|
+
[](https://github.com/neotreydel-lab/waengine/blob/main/LICENSE)
|
|
6
|
+
[](https://nodejs.org/)
|
|
7
7
|
|
|
8
8
|
**The most powerful WhatsApp Bot Library with Multi-Device Support & EasyBot API**
|
|
9
9
|
|
|
10
10
|
🎯 **Perfect for beginners AND professionals**
|
|
11
11
|
🔧 **Multi-Device Load Balancing**
|
|
12
12
|
⚡ **3-Line Bot Creation**
|
|
13
|
-
🚀 **
|
|
13
|
+
🚀 **150+ Features Built-in** ⬆️ **NEW in v1.1.0**
|
|
14
|
+
🔌 **Plugin System 2.0** ⬆️ **NEW in v1.1.0**
|
|
14
15
|
|
|
15
16
|
---
|
|
16
17
|
|
|
17
18
|
## ⚡ Quick Start (3 Lines!)
|
|
18
19
|
|
|
19
20
|
```javascript
|
|
20
|
-
import { quickBot } from "
|
|
21
|
+
import { quickBot } from "waengine";
|
|
21
22
|
|
|
22
23
|
quickBot()
|
|
23
24
|
.when("hello").reply("Hi! 👋")
|
|
@@ -31,7 +32,7 @@ quickBot()
|
|
|
31
32
|
## 📦 Installation
|
|
32
33
|
|
|
33
34
|
```bash
|
|
34
|
-
npm install
|
|
35
|
+
npm install waengine
|
|
35
36
|
```
|
|
36
37
|
|
|
37
38
|
**Requirements:**
|
|
@@ -40,13 +41,42 @@ npm install whatsapp-multi-client
|
|
|
40
41
|
|
|
41
42
|
---
|
|
42
43
|
|
|
44
|
+
## 🆕 What's New in v1.1.0
|
|
45
|
+
|
|
46
|
+
### 🔌 **Plugin System 2.0**
|
|
47
|
+
- **8 Built-in Plugins** - Economy, Games, Music, Travel, Analytics, Creative, Moderation, Education
|
|
48
|
+
- **Hot-Loading** - Load/unload plugins at runtime
|
|
49
|
+
- **Auto-Dependencies** - Automatic plugin dependency management
|
|
50
|
+
|
|
51
|
+
### 🤖 **Enhanced EasyBot API**
|
|
52
|
+
- **Action Chaining 2.0** - Media, AI, Storage, Scheduler actions
|
|
53
|
+
- **150+ Functions** (was 125+)
|
|
54
|
+
- **Advanced Media Support** - Images, videos, audio, stickers, documents
|
|
55
|
+
|
|
56
|
+
### 🌐 **HTTP Client**
|
|
57
|
+
- **Weather API** - Real-time weather data
|
|
58
|
+
- **News API** - Latest news from multiple sources
|
|
59
|
+
- **Crypto API** - Cryptocurrency prices
|
|
60
|
+
- **25+ Endpoints** - URL shortener, QR codes, random facts
|
|
61
|
+
|
|
62
|
+
### 📅 **Scheduler System**
|
|
63
|
+
- **Cron-based Scheduling** - Complex time patterns
|
|
64
|
+
- **Template Variables** - Dynamic content in scheduled messages
|
|
65
|
+
- **Persistent Jobs** - Survive bot restarts
|
|
66
|
+
|
|
67
|
+
### ⏰ **Waiting System**
|
|
68
|
+
- **msg.waiting.after.message()** - Realistic bot pauses
|
|
69
|
+
- **Natural Conversations** - Human-like interaction timing
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
43
73
|
## 🎯 Choose Your API
|
|
44
74
|
|
|
45
75
|
### 🟢 **EasyBot** - For Beginners
|
|
46
76
|
Perfect for quick bots and learning:
|
|
47
77
|
|
|
48
78
|
```javascript
|
|
49
|
-
import { createBot } from "
|
|
79
|
+
import { createBot } from "waengine";
|
|
50
80
|
|
|
51
81
|
createBot()
|
|
52
82
|
.when("ping").reply("Pong! 🏓")
|
|
@@ -59,7 +89,7 @@ createBot()
|
|
|
59
89
|
Full control and customization:
|
|
60
90
|
|
|
61
91
|
```javascript
|
|
62
|
-
import { WhatsAppClient } from "
|
|
92
|
+
import { WhatsAppClient } from "waengine";
|
|
63
93
|
|
|
64
94
|
const client = new WhatsAppClient();
|
|
65
95
|
client.setPrefix('!');
|
|
@@ -77,7 +107,7 @@ await client.connect();
|
|
|
77
107
|
Run multiple WhatsApp accounts simultaneously:
|
|
78
108
|
|
|
79
109
|
```javascript
|
|
80
|
-
import { MultiWhatsAppClient } from "
|
|
110
|
+
import { MultiWhatsAppClient } from "waengine";
|
|
81
111
|
|
|
82
112
|
const multiClient = new MultiWhatsAppClient({
|
|
83
113
|
maxDevices: 3,
|
|
@@ -100,29 +130,39 @@ await multiClient.sendMessage(chatId, { text: 'Hello from multi-device!' });
|
|
|
100
130
|
Create WhatsApp bots in minutes, not hours!
|
|
101
131
|
|
|
102
132
|
```javascript
|
|
103
|
-
import { quickBot } from "
|
|
133
|
+
import { quickBot } from "waengine";
|
|
104
134
|
|
|
105
135
|
quickBot()
|
|
106
136
|
.when("hello").reply("Hi! 👋")
|
|
107
137
|
.start();
|
|
108
138
|
```
|
|
109
139
|
|
|
110
|
-
###
|
|
111
|
-
Chain multiple actions elegantly:
|
|
112
|
-
|
|
140
|
+
### **🆕 Enhanced Action Chaining v1.1.0**
|
|
113
141
|
```javascript
|
|
114
|
-
import { createBot } from "whatsapp-multi-client";
|
|
115
|
-
|
|
116
142
|
createBot()
|
|
117
|
-
.when("
|
|
118
|
-
.react("
|
|
143
|
+
.when("demo")
|
|
144
|
+
.react("🎬")
|
|
119
145
|
.type(2)
|
|
120
|
-
.reply("
|
|
121
|
-
.
|
|
146
|
+
.reply("Starting demo...")
|
|
147
|
+
.wait(1000)
|
|
148
|
+
.sendImage("demo.jpg", "Demo image")
|
|
149
|
+
.slowTypeWithMention("Hello @user! This is for you! 🎉")
|
|
150
|
+
.aiReply("Explain this demo")
|
|
151
|
+
.saveData("demos", "count", 1)
|
|
122
152
|
.done()
|
|
123
153
|
.start();
|
|
124
154
|
```
|
|
125
155
|
|
|
156
|
+
### **🆕 New Mention Actions**
|
|
157
|
+
```javascript
|
|
158
|
+
bot
|
|
159
|
+
.when("hello").slowTypeWithMention("Hello @user! 👋")
|
|
160
|
+
.when("quick").quickTypeWithMention("Hey @user! ⚡")
|
|
161
|
+
.when("normal").normalTypeWithMention("Hi @user! 😊")
|
|
162
|
+
.when("mention").mentionSender("Thanks @user!")
|
|
163
|
+
.when("all").mentionAll("Hello everyone! 👥");
|
|
164
|
+
```
|
|
165
|
+
|
|
126
166
|
### **EasyBot Features**
|
|
127
167
|
```javascript
|
|
128
168
|
const bot = createBot()
|
|
@@ -154,7 +194,7 @@ const bot = createBot()
|
|
|
154
194
|
|
|
155
195
|
### **EasyBot Multi-Device**
|
|
156
196
|
```javascript
|
|
157
|
-
import { multiBot } from "
|
|
197
|
+
import { multiBot } from "waengine";
|
|
158
198
|
|
|
159
199
|
multiBot(3) // 3 devices
|
|
160
200
|
.when("test").reply("Multi-device test!")
|
|
@@ -188,7 +228,7 @@ bot
|
|
|
188
228
|
Run 2-3 WhatsApp accounts simultaneously for higher availability and load balancing!
|
|
189
229
|
|
|
190
230
|
```javascript
|
|
191
|
-
import { MultiWhatsAppClient } from "
|
|
231
|
+
import { MultiWhatsAppClient } from "waengine";
|
|
192
232
|
|
|
193
233
|
const multiClient = new MultiWhatsAppClient({
|
|
194
234
|
maxDevices: 3,
|
|
@@ -419,6 +459,11 @@ await msg.replyWithMention("Hello @user!", userJid)
|
|
|
419
459
|
// Mention all in group
|
|
420
460
|
await msg.mentionAll("Hello everyone!")
|
|
421
461
|
|
|
462
|
+
// NEW in v1.1.0: Mention with Typing
|
|
463
|
+
await msg.slowTypeWithMention("Hello @user! How are you?", userJid)
|
|
464
|
+
await msg.quickTypeWithMention("Hey @user! 👋", userJid)
|
|
465
|
+
await msg.normalTypeWithMention("Hi @user, nice to see you!", userJid)
|
|
466
|
+
|
|
422
467
|
// Get mentions from message
|
|
423
468
|
const mentions = msg.getMentions()
|
|
424
469
|
|
|
@@ -640,7 +685,7 @@ client.emit('custom-event', data)
|
|
|
640
685
|
|
|
641
686
|
### **QR Code Generation**
|
|
642
687
|
```javascript
|
|
643
|
-
import { generateQRCode } from "
|
|
688
|
+
import { generateQRCode } from "waengine"
|
|
644
689
|
|
|
645
690
|
// Generate QR code
|
|
646
691
|
await generateQRCode()
|
|
@@ -696,7 +741,7 @@ const type = client.getMessageType(message)
|
|
|
696
741
|
|
|
697
742
|
### **EasyBot (Beginners)**
|
|
698
743
|
```javascript
|
|
699
|
-
import { quickBot } from "
|
|
744
|
+
import { quickBot } from "waengine";
|
|
700
745
|
|
|
701
746
|
// 3 lines = complete bot!
|
|
702
747
|
quickBot()
|
|
@@ -706,7 +751,7 @@ quickBot()
|
|
|
706
751
|
|
|
707
752
|
### **EasyBot with Action Chaining**
|
|
708
753
|
```javascript
|
|
709
|
-
import { createBot } from "
|
|
754
|
+
import { createBot } from "waengine";
|
|
710
755
|
|
|
711
756
|
createBot()
|
|
712
757
|
.when("important")
|
|
@@ -729,7 +774,7 @@ createBot()
|
|
|
729
774
|
|
|
730
775
|
### **EasyBot Multi-Device**
|
|
731
776
|
```javascript
|
|
732
|
-
import { multiBot } from "
|
|
777
|
+
import { multiBot } from "waengine";
|
|
733
778
|
|
|
734
779
|
multiBot(2) // 2 devices
|
|
735
780
|
.when("test").reply("Multi-device test!")
|
|
@@ -739,7 +784,7 @@ multiBot(2) // 2 devices
|
|
|
739
784
|
|
|
740
785
|
### **Multi-Device Bot**
|
|
741
786
|
```javascript
|
|
742
|
-
import { MultiWhatsAppClient } from "
|
|
787
|
+
import { MultiWhatsAppClient } from "waengine";
|
|
743
788
|
|
|
744
789
|
const multiClient = new MultiWhatsAppClient({
|
|
745
790
|
maxDevices: 3,
|
|
@@ -785,7 +830,7 @@ console.log("🎉 Multi-device bot running!");
|
|
|
785
830
|
|
|
786
831
|
### **Advanced Bot**
|
|
787
832
|
```javascript
|
|
788
|
-
import { WhatsAppClient } from "
|
|
833
|
+
import { WhatsAppClient } from "waengine";
|
|
789
834
|
|
|
790
835
|
const client = new WhatsAppClient();
|
|
791
836
|
const prefix = "!";
|
|
@@ -940,4 +985,4 @@ Thanks to all contributors who make this project possible! 🎉
|
|
|
940
985
|
|
|
941
986
|
**Made with ❤️ for WhatsApp Automation**
|
|
942
987
|
|
|
943
|
-
*The most powerful WhatsApp bot library - from 3-line bots to enterprise multi-device systems!*
|
|
988
|
+
*The most powerful WhatsApp bot library - from 3-line bots to enterprise multi-device systems!*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "waengine",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "🚀 WAEngine - The most powerful WhatsApp Bot Library with Multi-Device Support & EasyBot API",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -12,6 +12,9 @@
|
|
|
12
12
|
"example:easy": "node examples/easy-bot-examples.js vollständig"
|
|
13
13
|
},
|
|
14
14
|
"keywords": [
|
|
15
|
+
"mention",
|
|
16
|
+
"waengine",
|
|
17
|
+
"hidetag",
|
|
15
18
|
"whatsapp",
|
|
16
19
|
"bot",
|
|
17
20
|
"baileys",
|
package/src/client.js
CHANGED
|
@@ -18,6 +18,8 @@ export class WhatsAppClient {
|
|
|
18
18
|
browser: options.browser || ["Chrome", "121.0.0", ""], // Aktueller Chrome
|
|
19
19
|
logLevel: options.logLevel || "silent", // Sauber ohne Debug
|
|
20
20
|
autoCleanup: options.autoCleanup !== false, // Auto-Cleanup bei Logout
|
|
21
|
+
autoRestart: options.autoRestart !== false, // Auto-Restart nach Logout
|
|
22
|
+
restartDelay: options.restartDelay || 5000, // 5 Sekunden Wartezeit
|
|
21
23
|
...options
|
|
22
24
|
};
|
|
23
25
|
|
|
@@ -202,7 +204,39 @@ export class WhatsAppClient {
|
|
|
202
204
|
|
|
203
205
|
await closeBrowser();
|
|
204
206
|
this.emit('disconnected', { reason: 'logged_out', cleaned: this.options.autoCleanup });
|
|
205
|
-
|
|
207
|
+
|
|
208
|
+
// Auto-Restart Feature
|
|
209
|
+
if (this.options.autoRestart) {
|
|
210
|
+
console.log(`🔄 Auto-Restart in ${this.options.restartDelay / 1000} Sekunden...`);
|
|
211
|
+
console.log("📱 Neuer QR-Code wird generiert...");
|
|
212
|
+
|
|
213
|
+
setTimeout(async () => {
|
|
214
|
+
try {
|
|
215
|
+
console.log("🚀 Starte neue Session...");
|
|
216
|
+
await this.connect();
|
|
217
|
+
console.log("✅ Auto-Restart erfolgreich!");
|
|
218
|
+
} catch (restartError) {
|
|
219
|
+
console.error("❌ Auto-Restart fehlgeschlagen:", restartError.message);
|
|
220
|
+
console.log("🔄 Versuche erneut in 10 Sekunden...");
|
|
221
|
+
|
|
222
|
+
// Retry nach 10 Sekunden
|
|
223
|
+
setTimeout(async () => {
|
|
224
|
+
try {
|
|
225
|
+
await this.connect();
|
|
226
|
+
console.log("✅ Auto-Restart Retry erfolgreich!");
|
|
227
|
+
} catch (retryError) {
|
|
228
|
+
console.error("❌ Auto-Restart Retry fehlgeschlagen:", retryError.message);
|
|
229
|
+
console.log("⚠️ Manuelle Neustart erforderlich");
|
|
230
|
+
}
|
|
231
|
+
}, 10000);
|
|
232
|
+
}
|
|
233
|
+
}, this.options.restartDelay);
|
|
234
|
+
|
|
235
|
+
// Nicht rejecten bei Auto-Restart
|
|
236
|
+
resolve(this);
|
|
237
|
+
} else {
|
|
238
|
+
reject(new Error('Logged out'));
|
|
239
|
+
}
|
|
206
240
|
}
|
|
207
241
|
} else if (connection === "open") {
|
|
208
242
|
console.log("✅ WhatsApp verbunden!");
|
|
@@ -238,6 +272,25 @@ export class WhatsAppClient {
|
|
|
238
272
|
}
|
|
239
273
|
}
|
|
240
274
|
|
|
275
|
+
// ===== AUTO-RESTART SYSTEM =====
|
|
276
|
+
|
|
277
|
+
enableAutoRestart(enabled = true, delay = 5000) {
|
|
278
|
+
this.options.autoRestart = enabled;
|
|
279
|
+
this.options.restartDelay = delay;
|
|
280
|
+
console.log(`🔄 Auto-Restart ${enabled ? 'aktiviert' : 'deaktiviert'} (${delay / 1000}s Verzögerung)`);
|
|
281
|
+
return this;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
disableAutoRestart() {
|
|
285
|
+
return this.enableAutoRestart(false);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
setRestartDelay(seconds) {
|
|
289
|
+
this.options.restartDelay = seconds * 1000;
|
|
290
|
+
console.log(`⏰ Auto-Restart Verzögerung: ${seconds} Sekunden`);
|
|
291
|
+
return this;
|
|
292
|
+
}
|
|
293
|
+
|
|
241
294
|
// ===== SESSION MANAGEMENT =====
|
|
242
295
|
|
|
243
296
|
async getSessionStatus() {
|