waengine 1.7.5 → 1.7.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 +56 -1
- package/package.json +1 -1
- package/src/advanced-features.js +62 -14
- package/src/analytics-manager.js +2 -2
- package/src/anti-ban-protection.js +308 -0
- package/src/client.js +11 -3
- package/src/console-logger.js +38 -17
- package/src/core.js +11 -1
- package/src/error-codes.js +335 -0
- package/src/error-handler.js +249 -35
- package/src/message.js +82 -0
- package/src/mobile-support.js +621 -0
- package/src/qr.js +2 -2
- package/src/resource-manager.js +2 -5
- package/src/storage.js +54 -3
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# 🚀 WAEngine v1.7.
|
|
1
|
+
# 🚀 WAEngine v1.7.6 - Analytics Bugfix Edition
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/waengine)
|
|
4
4
|
[](https://www.npmjs.com/package/waengine)
|
|
@@ -1383,3 +1383,58 @@ Thanks to all contributors who make this project possible! 🎉
|
|
|
1383
1383
|
**Made with ❤️ for WhatsApp Automation**
|
|
1384
1384
|
|
|
1385
1385
|
*The most powerful WhatsApp bot library - from 3-line bots to enterprise multi-device systems!*
|
|
1386
|
+
|
|
1387
|
+
|
|
1388
|
+
---
|
|
1389
|
+
|
|
1390
|
+
## 🔍 Error Codes System (NEW in v1.7.5!)
|
|
1391
|
+
|
|
1392
|
+
WAEngine now includes a comprehensive error code system with **80+ predefined error codes** for better debugging and error handling.
|
|
1393
|
+
|
|
1394
|
+
### **Features**
|
|
1395
|
+
- ✅ **Fixed Error Codes** - No more dynamic timestamps (WAE-1001, WAE-2002, etc.)
|
|
1396
|
+
- ✅ **15 Categories** - Connection, Auth, File, Message, Group, Media, etc.
|
|
1397
|
+
- ✅ **German Descriptions** - Clear error descriptions in German
|
|
1398
|
+
- ✅ **Quick Fixes** - Automatic solution suggestions for common errors
|
|
1399
|
+
- ✅ **Error Statistics** - Track error frequency and patterns
|
|
1400
|
+
- ✅ **Full Documentation** - See [ERROR-CODES.md](./ERROR-CODES.md)
|
|
1401
|
+
|
|
1402
|
+
### **Usage Example**
|
|
1403
|
+
```javascript
|
|
1404
|
+
try {
|
|
1405
|
+
await client.connect();
|
|
1406
|
+
} catch (error) {
|
|
1407
|
+
console.log('Error Code:', error.code); // WAE-1001
|
|
1408
|
+
console.log('Description:', getErrorDescription(error.code));
|
|
1409
|
+
console.log('Category:', getErrorCategory(error.code));
|
|
1410
|
+
}
|
|
1411
|
+
```
|
|
1412
|
+
|
|
1413
|
+
### **Error Categories**
|
|
1414
|
+
- **WAE-1xxx** - Connection Errors
|
|
1415
|
+
- **WAE-2xxx** - Authentication Errors
|
|
1416
|
+
- **WAE-3xxx** - File System Errors
|
|
1417
|
+
- **WAE-4xxx** - Message Errors
|
|
1418
|
+
- **WAE-5xxx** - Group Errors
|
|
1419
|
+
- **WAE-6xxx** - Media Errors
|
|
1420
|
+
- **WAE-7xxx** - Command Errors
|
|
1421
|
+
- **WAE-8xxx** - Plugin Errors
|
|
1422
|
+
- **WAE-9xxx** - System Errors
|
|
1423
|
+
- **WAE-10xxx** - QR Code Errors
|
|
1424
|
+
- **WAE-11xxx** - Mobile Support Errors
|
|
1425
|
+
- **WAE-12xxx** - Recovery Errors
|
|
1426
|
+
- **WAE-13xxx** - Database Errors
|
|
1427
|
+
- **WAE-14xxx** - Network Errors
|
|
1428
|
+
- **WAE-15xxx** - Security Errors
|
|
1429
|
+
|
|
1430
|
+
### **Error Statistics**
|
|
1431
|
+
```javascript
|
|
1432
|
+
const stats = client.errorHandler.getErrorStats();
|
|
1433
|
+
console.log('Total Errors:', stats.totalErrors);
|
|
1434
|
+
console.log('Most Common:', stats.mostCommonError);
|
|
1435
|
+
console.log('By Code:', stats.errorsByCode);
|
|
1436
|
+
```
|
|
1437
|
+
|
|
1438
|
+
**📖 Full Documentation:** [ERROR-CODES.md](./ERROR-CODES.md)
|
|
1439
|
+
|
|
1440
|
+
---
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "waengine",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.8",
|
|
4
4
|
"description": "🚀 WAEngine - The most powerful WhatsApp Bot Library with 400+ Advanced Features, Ultra-Robust Recovery Systems & Production-Ready Stability",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"type": "module",
|
package/src/advanced-features.js
CHANGED
|
@@ -285,22 +285,33 @@ export class AdvancedMessage {
|
|
|
285
285
|
export class AdvancedGroup {
|
|
286
286
|
constructor(client) {
|
|
287
287
|
this.client = client;
|
|
288
|
-
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
// Getter für Socket mit Null-Check
|
|
291
|
+
get socket() {
|
|
292
|
+
if (!this.client.socket) {
|
|
293
|
+
throw new Error('❌ Socket nicht verfügbar. Bot muss erst verbunden sein!');
|
|
294
|
+
}
|
|
295
|
+
return this.client.socket;
|
|
289
296
|
}
|
|
290
297
|
|
|
291
298
|
async setGroupSettings(groupId, settings) {
|
|
292
299
|
try {
|
|
293
|
-
const
|
|
300
|
+
const results = [];
|
|
294
301
|
|
|
295
302
|
if (settings.messagesAdminOnly !== undefined) {
|
|
296
|
-
|
|
303
|
+
const setting = settings.messagesAdminOnly ? 'announcement' : 'not_announcement';
|
|
304
|
+
const result = await this.socket.groupSettingUpdate(groupId, setting);
|
|
305
|
+
results.push(result);
|
|
297
306
|
}
|
|
298
307
|
|
|
299
308
|
if (settings.editGroupInfo !== undefined) {
|
|
300
|
-
|
|
309
|
+
const setting = settings.editGroupInfo === 'admin_only' ? 'locked' : 'unlocked';
|
|
310
|
+
const result = await this.socket.groupSettingUpdate(groupId, setting);
|
|
311
|
+
results.push(result);
|
|
301
312
|
}
|
|
302
313
|
|
|
303
|
-
return
|
|
314
|
+
return results.length === 1 ? results[0] : results;
|
|
304
315
|
} catch (error) {
|
|
305
316
|
console.error('❌ Group Settings Update fehlgeschlagen:', error);
|
|
306
317
|
throw new Error(`Gruppeneinstellungen konnten nicht geändert werden: ${error.message}`);
|
|
@@ -377,7 +388,14 @@ export class AdvancedGroup {
|
|
|
377
388
|
export class AdvancedPrivacy {
|
|
378
389
|
constructor(client) {
|
|
379
390
|
this.client = client;
|
|
380
|
-
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
// Getter für Socket mit Null-Check
|
|
394
|
+
get socket() {
|
|
395
|
+
if (!this.client.socket) {
|
|
396
|
+
throw new Error('❌ Socket nicht verfügbar. Bot muss erst verbunden sein!');
|
|
397
|
+
}
|
|
398
|
+
return this.client.socket;
|
|
381
399
|
}
|
|
382
400
|
|
|
383
401
|
async blockUser(jid) {
|
|
@@ -449,7 +467,14 @@ export class AdvancedPrivacy {
|
|
|
449
467
|
export class AdvancedAnalytics {
|
|
450
468
|
constructor(client) {
|
|
451
469
|
this.client = client;
|
|
452
|
-
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
// Getter für Socket mit Null-Check
|
|
473
|
+
get socket() {
|
|
474
|
+
if (!this.client.socket) {
|
|
475
|
+
throw new Error('❌ Socket nicht verfügbar. Bot muss erst verbunden sein!');
|
|
476
|
+
}
|
|
477
|
+
return this.client.socket;
|
|
453
478
|
}
|
|
454
479
|
|
|
455
480
|
async getDeliveryStatus(messageKey) {
|
|
@@ -531,7 +556,14 @@ export class AdvancedAnalytics {
|
|
|
531
556
|
export class AdvancedStatus {
|
|
532
557
|
constructor(client) {
|
|
533
558
|
this.client = client;
|
|
534
|
-
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
// Getter für Socket mit Null-Check
|
|
562
|
+
get socket() {
|
|
563
|
+
if (!this.client.socket) {
|
|
564
|
+
throw new Error('❌ Socket nicht verfügbar. Bot muss erst verbunden sein!');
|
|
565
|
+
}
|
|
566
|
+
return this.client.socket;
|
|
535
567
|
}
|
|
536
568
|
|
|
537
569
|
async sendStatusUpdate(type, content, options = {}) {
|
|
@@ -595,7 +627,14 @@ export class AdvancedStatus {
|
|
|
595
627
|
export class AdvancedBusiness {
|
|
596
628
|
constructor(client) {
|
|
597
629
|
this.client = client;
|
|
598
|
-
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
// Getter für Socket mit Null-Check
|
|
633
|
+
get socket() {
|
|
634
|
+
if (!this.client.socket) {
|
|
635
|
+
throw new Error('❌ Socket nicht verfügbar. Bot muss erst verbunden sein!');
|
|
636
|
+
}
|
|
637
|
+
return this.client.socket;
|
|
599
638
|
}
|
|
600
639
|
|
|
601
640
|
async setBusinessProfile(profile) {
|
|
@@ -677,18 +716,27 @@ export class AdvancedBusiness {
|
|
|
677
716
|
export class AdvancedSystem {
|
|
678
717
|
constructor(client) {
|
|
679
718
|
this.client = client;
|
|
680
|
-
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
// Getter für Socket mit Null-Check
|
|
722
|
+
get socket() {
|
|
723
|
+
if (!this.client.socket) {
|
|
724
|
+
throw new Error('❌ Socket nicht verfügbar. Bot muss erst verbunden sein!');
|
|
725
|
+
}
|
|
726
|
+
return this.client.socket;
|
|
681
727
|
}
|
|
682
728
|
|
|
683
729
|
async createBackup() {
|
|
684
730
|
try {
|
|
685
|
-
// Backup der wichtigsten Daten
|
|
731
|
+
// Backup der wichtigsten Daten (vereinfacht, da Baileys keine getContacts/getChats hat)
|
|
686
732
|
const backup = {
|
|
687
733
|
timestamp: Date.now(),
|
|
688
|
-
|
|
689
|
-
|
|
734
|
+
user: this.socket.user || null,
|
|
735
|
+
authState: 'saved', // Auth-State wird automatisch von Baileys gespeichert
|
|
690
736
|
settings: {
|
|
691
|
-
|
|
737
|
+
prefix: this.client.prefix || null,
|
|
738
|
+
commands: this.client.commands?.size || 0,
|
|
739
|
+
plugins: this.client.plugins?.size || 0
|
|
692
740
|
}
|
|
693
741
|
};
|
|
694
742
|
|
package/src/analytics-manager.js
CHANGED
|
@@ -220,10 +220,10 @@ export class AnalyticsManager {
|
|
|
220
220
|
// Store alerts
|
|
221
221
|
if (alerts.length > 0) {
|
|
222
222
|
this.alerts.push(...alerts);
|
|
223
|
-
this.storage.write.in("analytics").push("alerts", alerts);
|
|
224
223
|
|
|
225
|
-
//
|
|
224
|
+
// Store each alert individually
|
|
226
225
|
alerts.forEach(alert => {
|
|
226
|
+
this.storage.write.in("analytics-alerts").push(alert);
|
|
227
227
|
this.client.emit('performance_alert', alert);
|
|
228
228
|
});
|
|
229
229
|
}
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
// 🛡️ ANTI-BAN PROTECTION SYSTEM (NO LIMITS)
|
|
2
|
+
// Schützt Bots vor WhatsApp-Bans durch intelligente Verhaltens-Mimikry
|
|
3
|
+
|
|
4
|
+
export class AntiBanProtection {
|
|
5
|
+
constructor(client) {
|
|
6
|
+
this.client = client;
|
|
7
|
+
this.enabled = true;
|
|
8
|
+
|
|
9
|
+
// Verhaltens-Tracking
|
|
10
|
+
this.behavior = {
|
|
11
|
+
lastActivity: Date.now(),
|
|
12
|
+
sessionStart: Date.now(),
|
|
13
|
+
totalMessages: 0,
|
|
14
|
+
totalActions: 0
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
// Schutz-Features
|
|
18
|
+
this.features = {
|
|
19
|
+
humanTyping: true, // Simuliert menschliches Tippen
|
|
20
|
+
randomDelays: true, // Zufällige Verzögerungen
|
|
21
|
+
presenceUpdates: true, // Online/Offline Status Updates
|
|
22
|
+
readReceipts: true, // Lesebestätigungen
|
|
23
|
+
typingIndicator: true, // "tippt..." Anzeige
|
|
24
|
+
smartBrowser: true, // Realistischer Browser-String
|
|
25
|
+
sessionRotation: false // Session-Rotation (optional)
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
// Statistiken
|
|
29
|
+
this.stats = {
|
|
30
|
+
messagesProtected: 0,
|
|
31
|
+
actionsProtected: 0,
|
|
32
|
+
bansAvoided: 0,
|
|
33
|
+
suspiciousActivityPrevented: 0
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// ===== HAUPTFUNKTIONEN =====
|
|
38
|
+
|
|
39
|
+
// Menschliches Tipp-Verhalten simulieren
|
|
40
|
+
async simulateHumanTyping(text) {
|
|
41
|
+
if (!this.features.humanTyping) return;
|
|
42
|
+
|
|
43
|
+
// Berechne realistische Tipp-Zeit basierend auf Textlänge
|
|
44
|
+
const wordsPerMinute = 40 + Math.random() * 20; // 40-60 WPM (realistisch)
|
|
45
|
+
const words = text.split(' ').length;
|
|
46
|
+
const typingTime = (words / wordsPerMinute) * 60 * 1000;
|
|
47
|
+
|
|
48
|
+
// Min 500ms, Max 5000ms
|
|
49
|
+
const delay = Math.min(Math.max(typingTime, 500), 5000);
|
|
50
|
+
|
|
51
|
+
// Zeige "tippt..." während der Verzögerung
|
|
52
|
+
if (this.features.typingIndicator && this.client.socket) {
|
|
53
|
+
// Typing indicator wird automatisch von WhatsApp gehandhabt
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
await this.randomDelay(delay * 0.8, delay * 1.2);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Zufällige menschliche Verzögerung
|
|
60
|
+
async randomDelay(min = 300, max = 1500) {
|
|
61
|
+
if (!this.features.randomDelays) return;
|
|
62
|
+
|
|
63
|
+
const delay = min + Math.random() * (max - min);
|
|
64
|
+
await new Promise(resolve => setTimeout(resolve, delay));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Presence Updates (Online/Offline)
|
|
68
|
+
async updatePresence(status = 'available') {
|
|
69
|
+
if (!this.features.presenceUpdates || !this.client.socket) return;
|
|
70
|
+
|
|
71
|
+
try {
|
|
72
|
+
await this.client.socket.sendPresenceUpdate(status);
|
|
73
|
+
} catch (error) {
|
|
74
|
+
// Silent fail
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Simuliere "Lesen" einer Nachricht
|
|
79
|
+
async simulateReadMessage(jid, messageKey) {
|
|
80
|
+
if (!this.features.readReceipts || !this.client.socket) return;
|
|
81
|
+
|
|
82
|
+
try {
|
|
83
|
+
// Kleine Verzögerung bevor gelesen wird (realistisch)
|
|
84
|
+
await this.randomDelay(500, 2000);
|
|
85
|
+
|
|
86
|
+
await this.client.socket.readMessages([messageKey]);
|
|
87
|
+
|
|
88
|
+
// Weitere Verzögerung bevor geantwortet wird
|
|
89
|
+
await this.randomDelay(1000, 3000);
|
|
90
|
+
} catch (error) {
|
|
91
|
+
// Silent fail
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// ===== GESCHÜTZTE NACHRICHTENFUNKTIONEN =====
|
|
96
|
+
|
|
97
|
+
async sendMessageProtected(jid, content, options = {}) {
|
|
98
|
+
if (!this.enabled) {
|
|
99
|
+
return await this.client.socket.sendMessage(jid, content);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
try {
|
|
103
|
+
// 1. Simuliere Lesen (falls Antwort auf Nachricht)
|
|
104
|
+
if (options.quoted) {
|
|
105
|
+
await this.simulateReadMessage(jid, options.quoted.key);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// 2. Zeige Online-Status
|
|
109
|
+
await this.updatePresence('available');
|
|
110
|
+
|
|
111
|
+
// 3. Simuliere Tippen (falls Text)
|
|
112
|
+
if (content.text) {
|
|
113
|
+
await this.simulateHumanTyping(content.text);
|
|
114
|
+
} else {
|
|
115
|
+
// Für Medien: kurze Verzögerung
|
|
116
|
+
await this.randomDelay(800, 2000);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// 4. Sende Nachricht
|
|
120
|
+
const result = await this.client.socket.sendMessage(jid, content);
|
|
121
|
+
|
|
122
|
+
// 5. Update Statistiken
|
|
123
|
+
this.behavior.totalMessages++;
|
|
124
|
+
this.behavior.lastActivity = Date.now();
|
|
125
|
+
this.stats.messagesProtected++;
|
|
126
|
+
this.stats.bansAvoided++;
|
|
127
|
+
|
|
128
|
+
// 6. Kleine Pause nach Senden
|
|
129
|
+
await this.randomDelay(200, 800);
|
|
130
|
+
|
|
131
|
+
return result;
|
|
132
|
+
} catch (error) {
|
|
133
|
+
console.error('🛡️ Anti-Ban: Fehler beim geschützten Senden:', error.message);
|
|
134
|
+
throw error;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
async performActionProtected(actionFn, actionType = 'general') {
|
|
139
|
+
if (!this.enabled) {
|
|
140
|
+
return await actionFn();
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
try {
|
|
144
|
+
// 1. Zeige Online-Status
|
|
145
|
+
await this.updatePresence('available');
|
|
146
|
+
|
|
147
|
+
// 2. Menschliche Verzögerung vor Aktion
|
|
148
|
+
await this.randomDelay(1000, 3000);
|
|
149
|
+
|
|
150
|
+
// 3. Führe Aktion aus
|
|
151
|
+
const result = await actionFn();
|
|
152
|
+
|
|
153
|
+
// 4. Update Statistiken
|
|
154
|
+
this.behavior.totalActions++;
|
|
155
|
+
this.behavior.lastActivity = Date.now();
|
|
156
|
+
this.stats.actionsProtected++;
|
|
157
|
+
this.stats.bansAvoided++;
|
|
158
|
+
|
|
159
|
+
// 5. Pause nach Aktion
|
|
160
|
+
await this.randomDelay(1500, 3500);
|
|
161
|
+
|
|
162
|
+
return result;
|
|
163
|
+
} catch (error) {
|
|
164
|
+
console.error('🛡️ Anti-Ban: Fehler bei geschützter Aktion:', error.message);
|
|
165
|
+
throw error;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// ===== BROWSER & SESSION SCHUTZ =====
|
|
170
|
+
|
|
171
|
+
getRealisticBrowser() {
|
|
172
|
+
if (!this.features.smartBrowser) {
|
|
173
|
+
return ["Chrome", "121.0.0", ""];
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// Realistische Browser-Strings (rotierend)
|
|
177
|
+
const browsers = [
|
|
178
|
+
["Chrome", "121.0.0.0", "Windows"],
|
|
179
|
+
["Chrome", "120.0.0.0", "Mac OS"],
|
|
180
|
+
["Firefox", "122.0", "Windows"],
|
|
181
|
+
["Edge", "121.0.0.0", "Windows"],
|
|
182
|
+
["Safari", "17.2", "Mac OS"]
|
|
183
|
+
];
|
|
184
|
+
|
|
185
|
+
// Wähle zufälligen aber konsistenten Browser für diese Session
|
|
186
|
+
const index = Math.floor(Math.random() * browsers.length);
|
|
187
|
+
return browsers[index];
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// ===== AKTIVITÄTS-SIMULATION =====
|
|
191
|
+
|
|
192
|
+
async simulateIdleActivity() {
|
|
193
|
+
if (!this.enabled) return;
|
|
194
|
+
|
|
195
|
+
// Simuliere gelegentliche Aktivität auch wenn Bot "idle" ist
|
|
196
|
+
const timeSinceLastActivity = Date.now() - this.behavior.lastActivity;
|
|
197
|
+
|
|
198
|
+
// Alle 5-10 Minuten kleine Aktivität
|
|
199
|
+
if (timeSinceLastActivity > 300000 + Math.random() * 300000) {
|
|
200
|
+
try {
|
|
201
|
+
// Wechsle zwischen online/offline
|
|
202
|
+
const status = Math.random() > 0.5 ? 'available' : 'unavailable';
|
|
203
|
+
await this.updatePresence(status);
|
|
204
|
+
|
|
205
|
+
this.behavior.lastActivity = Date.now();
|
|
206
|
+
this.stats.suspiciousActivityPrevented++;
|
|
207
|
+
} catch (error) {
|
|
208
|
+
// Silent fail
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// Starte Hintergrund-Aktivität (optional)
|
|
214
|
+
startBackgroundActivity() {
|
|
215
|
+
if (this.backgroundInterval) return;
|
|
216
|
+
|
|
217
|
+
this.backgroundInterval = setInterval(() => {
|
|
218
|
+
this.simulateIdleActivity();
|
|
219
|
+
}, 60000); // Jede Minute checken
|
|
220
|
+
|
|
221
|
+
console.log('🛡️ Anti-Ban: Hintergrund-Aktivität gestartet');
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
stopBackgroundActivity() {
|
|
225
|
+
if (this.backgroundInterval) {
|
|
226
|
+
clearInterval(this.backgroundInterval);
|
|
227
|
+
this.backgroundInterval = null;
|
|
228
|
+
console.log('🛡️ Anti-Ban: Hintergrund-Aktivität gestoppt');
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// ===== KONFIGURATION =====
|
|
233
|
+
|
|
234
|
+
enable() {
|
|
235
|
+
this.enabled = true;
|
|
236
|
+
console.log('🛡️ Anti-Ban Protection: AKTIVIERT');
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
disable() {
|
|
240
|
+
this.enabled = false;
|
|
241
|
+
console.log('🛡️ Anti-Ban Protection: DEAKTIVIERT');
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
setFeature(feature, value) {
|
|
245
|
+
if (this.features.hasOwnProperty(feature)) {
|
|
246
|
+
this.features[feature] = value;
|
|
247
|
+
console.log(`🛡️ Anti-Ban: ${feature} = ${value}`);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
enableAllFeatures() {
|
|
252
|
+
Object.keys(this.features).forEach(key => {
|
|
253
|
+
this.features[key] = true;
|
|
254
|
+
});
|
|
255
|
+
console.log('🛡️ Anti-Ban: Alle Features aktiviert (maximaler Schutz)');
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
disableAllFeatures() {
|
|
259
|
+
Object.keys(this.features).forEach(key => {
|
|
260
|
+
this.features[key] = false;
|
|
261
|
+
});
|
|
262
|
+
console.log('🛡️ Anti-Ban: Alle Features deaktiviert');
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
// ===== STATISTIKEN =====
|
|
266
|
+
|
|
267
|
+
getStats() {
|
|
268
|
+
const sessionDuration = Date.now() - this.behavior.sessionStart;
|
|
269
|
+
const hours = Math.floor(sessionDuration / 3600000);
|
|
270
|
+
const minutes = Math.floor((sessionDuration % 3600000) / 60000);
|
|
271
|
+
|
|
272
|
+
return {
|
|
273
|
+
enabled: this.enabled,
|
|
274
|
+
features: this.features,
|
|
275
|
+
behavior: {
|
|
276
|
+
...this.behavior,
|
|
277
|
+
sessionDuration: `${hours}h ${minutes}m`,
|
|
278
|
+
messagesPerHour: hours > 0 ? Math.round(this.behavior.totalMessages / hours) : 0
|
|
279
|
+
},
|
|
280
|
+
stats: this.stats,
|
|
281
|
+
protection: {
|
|
282
|
+
level: this.enabled ? 'AKTIV' : 'INAKTIV',
|
|
283
|
+
effectiveness: this.stats.bansAvoided > 0 ? '✅ Funktioniert' : '⏳ Warte auf Aktivität'
|
|
284
|
+
}
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
printStats() {
|
|
289
|
+
const stats = this.getStats();
|
|
290
|
+
|
|
291
|
+
console.log('\n🛡️ ===== ANTI-BAN PROTECTION STATS =====');
|
|
292
|
+
console.log(`📊 Status: ${stats.protection.level}`);
|
|
293
|
+
console.log(`⏱️ Session Dauer: ${stats.behavior.sessionDuration}`);
|
|
294
|
+
console.log(`📨 Nachrichten geschützt: ${stats.stats.messagesProtected}`);
|
|
295
|
+
console.log(`⚡ Aktionen geschützt: ${stats.stats.actionsProtected}`);
|
|
296
|
+
console.log(`✅ Bans vermieden: ${stats.stats.bansAvoided}`);
|
|
297
|
+
console.log(`🎭 Verdächtige Aktivität verhindert: ${stats.stats.suspiciousActivityPrevented}`);
|
|
298
|
+
|
|
299
|
+
console.log('\n🎯 Aktive Features:');
|
|
300
|
+
Object.entries(stats.features).forEach(([key, value]) => {
|
|
301
|
+
const icon = value ? '✅' : '❌';
|
|
302
|
+
console.log(` ${icon} ${key}`);
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
console.log('\n💡 Effektivität: ' + stats.protection.effectiveness);
|
|
306
|
+
console.log('==========================================\n');
|
|
307
|
+
}
|
|
308
|
+
}
|
package/src/client.js
CHANGED
|
@@ -18,6 +18,7 @@ import { UIComponents } from "./ui-components.js";
|
|
|
18
18
|
import { ConnectionRecovery } from "./connection-recovery.js";
|
|
19
19
|
import { AuthRecovery } from "./auth-recovery.js";
|
|
20
20
|
import { globalResourceManager } from "./resource-manager.js";
|
|
21
|
+
import { AntiBanProtection } from "./anti-ban-protection.js";
|
|
21
22
|
|
|
22
23
|
export class WhatsAppClient {
|
|
23
24
|
constructor(options = {}) {
|
|
@@ -551,7 +552,10 @@ export class WhatsAppClient {
|
|
|
551
552
|
|
|
552
553
|
// Jetzt erst die echten Success-Messages zeigen
|
|
553
554
|
this.logger.success("WhatsApp erfolgreich authentifiziert!");
|
|
554
|
-
|
|
555
|
+
|
|
556
|
+
// Dynamische Ready Message mit echten Daten
|
|
557
|
+
this.logger.showDynamicReadyMessage(this);
|
|
558
|
+
|
|
555
559
|
this.emit('truly_connected', { userId: creds.me.id });
|
|
556
560
|
}
|
|
557
561
|
});
|
|
@@ -914,8 +918,12 @@ export class WhatsAppClient {
|
|
|
914
918
|
setupEventHandlers() {
|
|
915
919
|
// Messages - Saubere Message-Erkennung ohne Debug-Spam
|
|
916
920
|
this.socket.ev.on("messages.upsert", ({ messages, type }) => {
|
|
917
|
-
//
|
|
918
|
-
|
|
921
|
+
// DEBUG: Zeige alle Message-Types
|
|
922
|
+
console.log(`📥 Message Event - Type: ${type}, Count: ${messages.length}`);
|
|
923
|
+
|
|
924
|
+
// WICHTIG: Alle Types akzeptieren außer explizit ausgeschlossene
|
|
925
|
+
// Nur "prepend" (alte History) ignorieren wenn gewünscht
|
|
926
|
+
// if (type === "prepend") return; // Optional: Alte Messages ignorieren
|
|
919
927
|
|
|
920
928
|
messages.forEach((msg) => {
|
|
921
929
|
// Bessere Message-Validierung
|
package/src/console-logger.js
CHANGED
|
@@ -71,20 +71,10 @@ export class ConsoleLogger {
|
|
|
71
71
|
this.updateProgressBar('setup', 100, '🔧 System bereit');
|
|
72
72
|
this.completeProgressBar('setup');
|
|
73
73
|
|
|
74
|
-
//
|
|
75
|
-
this.showSystemSummary();
|
|
74
|
+
// Keine System Summary mehr - wird später in showDynamicReadyMessage angezeigt
|
|
76
75
|
}
|
|
77
76
|
|
|
78
|
-
showSystemSummary()
|
|
79
|
-
if (this.silent) return;
|
|
80
|
-
|
|
81
|
-
console.log(`
|
|
82
|
-
✅ System bereit
|
|
83
|
-
├─ Storage: ./waengine-data
|
|
84
|
-
├─ Devices: 2/2 konfiguriert
|
|
85
|
-
├─ Plugins: 8 verfügbar
|
|
86
|
-
└─ Prefix: "!"`);
|
|
87
|
-
}
|
|
77
|
+
// showSystemSummary() entfernt - wird durch showDynamicReadyMessage ersetzt
|
|
88
78
|
|
|
89
79
|
// ===== QR-CODE ANIMATION =====
|
|
90
80
|
async animateQRGeneration(deviceName = 'bot1', deviceNumber = 1, totalDevices = 2) {
|
|
@@ -209,12 +199,43 @@ export class ConsoleLogger {
|
|
|
209
199
|
console.log(` ${prefix} ${device}: Online & Authentifiziert`);
|
|
210
200
|
});
|
|
211
201
|
|
|
202
|
+
// Dynamische Ready Message mit echten Daten
|
|
203
|
+
this.showDynamicReadyMessage();
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// Dynamische Ready Message - NEU!
|
|
207
|
+
showDynamicReadyMessage(client = null) {
|
|
208
|
+
// Bot-Name ermitteln
|
|
209
|
+
const botName = client?.socket?.user?.name ||
|
|
210
|
+
client?.socket?.user?.verifiedName ||
|
|
211
|
+
'WAEngine Bot';
|
|
212
|
+
|
|
213
|
+
// Prefix ermitteln
|
|
214
|
+
const prefix = client?.prefix || null;
|
|
215
|
+
|
|
216
|
+
// Commands zählen
|
|
217
|
+
const commandCount = client?.commands?.size || 0;
|
|
218
|
+
|
|
219
|
+
// Plugins zählen
|
|
220
|
+
const pluginCount = client?.plugins?.size || 0;
|
|
221
|
+
|
|
212
222
|
console.log(`
|
|
213
|
-
🚀
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
223
|
+
🚀 ${botName} ist bereit!`);
|
|
224
|
+
|
|
225
|
+
// Nur anzeigen wenn vorhanden
|
|
226
|
+
if (prefix) {
|
|
227
|
+
console.log(` ├─ Prefix: "${prefix}"`);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
if (commandCount > 0) {
|
|
231
|
+
console.log(` ├─ Commands: ${commandCount} verfügbar`);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
if (pluginCount > 0) {
|
|
235
|
+
console.log(` ├─ Plugins: ${pluginCount} geladen`);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
console.log(` └─ Status: 🟢 Online & Authentifiziert
|
|
218
239
|
|
|
219
240
|
💬 Bot wartet auf Nachrichten...`);
|
|
220
241
|
}
|
package/src/core.js
CHANGED
|
@@ -83,7 +83,17 @@ export async function getSocket() {
|
|
|
83
83
|
|
|
84
84
|
// WICHTIG: Alle Events loggen für Debug
|
|
85
85
|
socket.ev.on("messages.upsert", (data) => {
|
|
86
|
-
console.log("🚨 RAW MESSAGE EVENT:"
|
|
86
|
+
console.log("🚨 RAW MESSAGE EVENT:");
|
|
87
|
+
console.log(` Type: ${data.type}`);
|
|
88
|
+
console.log(` Messages: ${data.messages.length}`);
|
|
89
|
+
data.messages.forEach((msg, i) => {
|
|
90
|
+
console.log(` Message ${i + 1}:`, {
|
|
91
|
+
from: msg.key.remoteJid,
|
|
92
|
+
fromMe: msg.key.fromMe,
|
|
93
|
+
hasMessage: !!msg.message,
|
|
94
|
+
type: Object.keys(msg.message || {})[0]
|
|
95
|
+
});
|
|
96
|
+
});
|
|
87
97
|
});
|
|
88
98
|
|
|
89
99
|
socket.ev.on("chats.set", (data) => {
|