waengine 1.8.9 → 1.9.4
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/FEATURES.md +582 -1
- package/LICENSE +1 -1
- package/package.json +1 -1
- package/src/client.js +0 -7
- package/src/message.js +49 -0
package/FEATURES.md
CHANGED
|
@@ -458,6 +458,217 @@ msg.raw // Raw Baileys Object
|
|
|
458
458
|
|
|
459
459
|
---
|
|
460
460
|
|
|
461
|
+
## 📥 Media Download System **NEU in v1.7.9!**
|
|
462
|
+
|
|
463
|
+
### **Download Media von Nachrichten**
|
|
464
|
+
|
|
465
|
+
```javascript
|
|
466
|
+
// Media von Message herunterladen
|
|
467
|
+
const result = await msg.downloadMedia();
|
|
468
|
+
|
|
469
|
+
if (result.success) {
|
|
470
|
+
console.log(`Downloaded: ${result.info.type}`);
|
|
471
|
+
console.log(`Size: ${result.info.fileSize} bytes`);
|
|
472
|
+
console.log(`Mimetype: ${result.info.mimetype}`);
|
|
473
|
+
|
|
474
|
+
// Buffer verwenden
|
|
475
|
+
const buffer = result.buffer;
|
|
476
|
+
|
|
477
|
+
// Oder direkt speichern
|
|
478
|
+
const saved = await msg.downloadMedia({
|
|
479
|
+
savePath: './downloads',
|
|
480
|
+
fileName: 'custom_name.jpg'
|
|
481
|
+
});
|
|
482
|
+
|
|
483
|
+
console.log(`Saved to: ${saved.savedPath}`);
|
|
484
|
+
}
|
|
485
|
+
```
|
|
486
|
+
|
|
487
|
+
**Download Features:**
|
|
488
|
+
- ✅ **Alle Media-Typen** - Bilder, Videos, Audio, Dokumente, Sticker
|
|
489
|
+
- ✅ **Buffer Return** - Direkter Zugriff auf Media-Buffer
|
|
490
|
+
- ✅ **Auto-Save** - Optional direkt speichern
|
|
491
|
+
- ✅ **Media Info** - Typ, Größe, Mimetype, Dateiname
|
|
492
|
+
- ✅ **Caption Support** - Caption wird mit zurückgegeben
|
|
493
|
+
- ✅ **Error Handling** - Detaillierte Fehlerbehandlung
|
|
494
|
+
|
|
495
|
+
**Praktische Anwendungen:**
|
|
496
|
+
```javascript
|
|
497
|
+
// Auto-Sticker aus Bildern
|
|
498
|
+
client.on('message', async (msg) => {
|
|
499
|
+
if (msg.type === 'imageMessage' && msg.text?.toLowerCase() === 'sticker') {
|
|
500
|
+
const media = await msg.downloadMedia();
|
|
501
|
+
|
|
502
|
+
if (media.success) {
|
|
503
|
+
await msg.create.sticker.fromMedia(media.buffer, {
|
|
504
|
+
pack: 'Auto Stickers',
|
|
505
|
+
author: 'Bot'
|
|
506
|
+
});
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
});
|
|
510
|
+
|
|
511
|
+
// Media-Backup System
|
|
512
|
+
client.on('message', async (msg) => {
|
|
513
|
+
const mediaTypes = ['imageMessage', 'videoMessage', 'audioMessage'];
|
|
514
|
+
|
|
515
|
+
if (mediaTypes.includes(msg.type)) {
|
|
516
|
+
await msg.downloadMedia({
|
|
517
|
+
savePath: './media_backup',
|
|
518
|
+
fileName: `${msg.id}_${Date.now()}`
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
});
|
|
522
|
+
|
|
523
|
+
// Media-Weiterleitung
|
|
524
|
+
client.addCommand('forward-media', async (msg) => {
|
|
525
|
+
const media = await msg.downloadMedia();
|
|
526
|
+
|
|
527
|
+
if (media.success) {
|
|
528
|
+
// An anderen Chat senden
|
|
529
|
+
await client.socket.sendMessage(targetJid, {
|
|
530
|
+
[media.info.type]: media.buffer,
|
|
531
|
+
caption: media.info.caption
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
});
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
---
|
|
538
|
+
|
|
539
|
+
## 🎤 Enhanced Recording System
|
|
540
|
+
|
|
541
|
+
### **Erweiterte Recording-Funktionen**
|
|
542
|
+
|
|
543
|
+
```javascript
|
|
544
|
+
// Recording starten/stoppen
|
|
545
|
+
await msg.startRecording();
|
|
546
|
+
await msg.stopRecording();
|
|
547
|
+
|
|
548
|
+
// Recording für bestimmte Zeit
|
|
549
|
+
await msg.simulateRecording(3000); // 3 Sekunden
|
|
550
|
+
|
|
551
|
+
// Recording + Custom Function
|
|
552
|
+
await msg.recordAndSend(async () => {
|
|
553
|
+
await msg.sendImage('photo.jpg', 'Nach Recording!');
|
|
554
|
+
}, 3000);
|
|
555
|
+
|
|
556
|
+
// Recording + Reply
|
|
557
|
+
await msg.recordAndReply('Sprachnachricht!', 2500);
|
|
558
|
+
|
|
559
|
+
// Visual Record (unified)
|
|
560
|
+
await msg.visualRecord(true); // Start
|
|
561
|
+
await msg.visualRecord(false); // Stop
|
|
562
|
+
```
|
|
563
|
+
|
|
564
|
+
**Recording Features:**
|
|
565
|
+
- ✅ **Start/Stop Control** - Manuelles Recording-Control
|
|
566
|
+
- ✅ **Timed Recording** - Automatisches Stoppen nach Zeit
|
|
567
|
+
- ✅ **Record & Send** - Recording + Custom Function
|
|
568
|
+
- ✅ **Record & Reply** - Recording + Antwort
|
|
569
|
+
- ✅ **Realistic Timing** - Basierend auf Nachrichtenlänge
|
|
570
|
+
|
|
571
|
+
---
|
|
572
|
+
|
|
573
|
+
## ⌨️ Enhanced Typing System
|
|
574
|
+
|
|
575
|
+
### **Erweiterte Typing-Funktionen**
|
|
576
|
+
|
|
577
|
+
```javascript
|
|
578
|
+
// Typing starten/stoppen
|
|
579
|
+
await msg.startTyping();
|
|
580
|
+
await msg.stopTyping();
|
|
581
|
+
|
|
582
|
+
// Typing für bestimmte Zeit
|
|
583
|
+
await msg.typeFor(3000); // 3 Sekunden
|
|
584
|
+
|
|
585
|
+
// Typing mit Auto-Stop
|
|
586
|
+
await msg.visualWrite(true, 2000); // Stoppt automatisch nach 2s
|
|
587
|
+
|
|
588
|
+
// Typing + Custom Function
|
|
589
|
+
await msg.typeAndSend(async () => {
|
|
590
|
+
await msg.sendImage('photo.jpg');
|
|
591
|
+
}, 2000);
|
|
592
|
+
|
|
593
|
+
// Convenience Methods
|
|
594
|
+
await msg.quickType('Text'); // 1 Sekunde
|
|
595
|
+
await msg.normalType('Text'); // 2 Sekunden
|
|
596
|
+
await msg.slowType('Text'); // 4 Sekunden
|
|
597
|
+
await msg.realisticType('Text'); // Basierend auf Textlänge
|
|
598
|
+
|
|
599
|
+
// Typing mit Mentions
|
|
600
|
+
await msg.quickTypeWithMention('Hello @user!', userJid);
|
|
601
|
+
await msg.normalTypeWithMention('Hi @user!', userJid);
|
|
602
|
+
await msg.slowTypeWithMention('Hey @user!', userJid);
|
|
603
|
+
```
|
|
604
|
+
|
|
605
|
+
**Enhanced Typing Features:**
|
|
606
|
+
- ✅ **Start/Stop Control** - Manuelles Typing-Control
|
|
607
|
+
- ✅ **Timed Typing** - Automatisches Stoppen
|
|
608
|
+
- ✅ **Auto-Stop** - Mit Duration-Parameter
|
|
609
|
+
- ✅ **Type & Send** - Typing + Custom Function
|
|
610
|
+
- ✅ **Convenience Methods** - Quick/Normal/Slow/Realistic
|
|
611
|
+
- ✅ **Mention Support** - Typing mit Mentions kombiniert
|
|
612
|
+
|
|
613
|
+
---
|
|
614
|
+
|
|
615
|
+
## 📝 Enhanced Mention System
|
|
616
|
+
|
|
617
|
+
### **Erweiterte Mention-Funktionen**
|
|
618
|
+
|
|
619
|
+
```javascript
|
|
620
|
+
// Mention mit Typing
|
|
621
|
+
await msg.slowTypeWithMention('Hello @user!', userJid);
|
|
622
|
+
await msg.quickTypeWithMention('Hi @user!', userJid);
|
|
623
|
+
await msg.normalTypeWithMention('Hey @user!', userJid);
|
|
624
|
+
|
|
625
|
+
// Mention All
|
|
626
|
+
await msg.mentionAll('Important announcement!');
|
|
627
|
+
|
|
628
|
+
// Reply mit Mention
|
|
629
|
+
await msg.replyWithMention('Thanks @user!', userJid);
|
|
630
|
+
|
|
631
|
+
// Check if mentioned
|
|
632
|
+
const isMentioned = msg.isMentioned(userJid);
|
|
633
|
+
|
|
634
|
+
// Get all mentions
|
|
635
|
+
const mentions = msg.getMentions();
|
|
636
|
+
```
|
|
637
|
+
|
|
638
|
+
**Enhanced Mention Features:**
|
|
639
|
+
- ✅ **Typing + Mention** - Kombiniert Typing mit Mentions
|
|
640
|
+
- ✅ **Mention All** - Alle Gruppenmitglieder erwähnen
|
|
641
|
+
- ✅ **Reply with Mention** - Antwort mit Mention
|
|
642
|
+
- ✅ **Mention Check** - Prüfen ob User erwähnt wurde
|
|
643
|
+
- ✅ **Get Mentions** - Alle Mentions aus Message
|
|
644
|
+
|
|
645
|
+
---
|
|
646
|
+
|
|
647
|
+
## 🔧 Enhanced Message Editing
|
|
648
|
+
|
|
649
|
+
### **Erweiterte Edit-Funktionen**
|
|
650
|
+
|
|
651
|
+
```javascript
|
|
652
|
+
// Gesendete Nachricht bearbeiten
|
|
653
|
+
const sentMsg = await msg.reply('Original text');
|
|
654
|
+
await msg.editSent(sentMsg, 'Edited text');
|
|
655
|
+
|
|
656
|
+
// Mit Error Handling
|
|
657
|
+
try {
|
|
658
|
+
await msg.editSent(sentMsg, 'New text');
|
|
659
|
+
console.log('✅ Message edited');
|
|
660
|
+
} catch (error) {
|
|
661
|
+
console.log('❌ Edit failed:', error.message);
|
|
662
|
+
}
|
|
663
|
+
```
|
|
664
|
+
|
|
665
|
+
**Edit Features:**
|
|
666
|
+
- ✅ **Edit Sent Messages** - Gesendete Nachrichten bearbeiten
|
|
667
|
+
- ✅ **Error Handling** - Graceful Fehlerbehandlung
|
|
668
|
+
- ✅ **Validation** - Prüft ob Message editierbar ist
|
|
669
|
+
|
|
670
|
+
---
|
|
671
|
+
|
|
461
672
|
## 🎭 Typing Indicator
|
|
462
673
|
|
|
463
674
|
### **Manual Control**
|
|
@@ -3265,7 +3476,377 @@ const progress = ui.createProgress({
|
|
|
3265
3476
|
- 📢 **Advanced Status Features** - Status Updates, Views
|
|
3266
3477
|
- 💼 **Business Features** - Business Profile, Products, Payments
|
|
3267
3478
|
- ⚙️ **System Features** - Backup, Restore, Export, Sync
|
|
3268
|
-
- 🖼️ **Profile Picture Features** - Get/Send Profile
|
|
3479
|
+
- 🖼️ **Profile Picture Features** - Get/Send Profile Picture
|
|
3480
|
+
|
|
3481
|
+
---
|
|
3482
|
+
|
|
3483
|
+
## 🛡️ Ultra-Robust Recovery Systems **NEU in v2.0.0!**
|
|
3484
|
+
|
|
3485
|
+
### **Connection Recovery System**
|
|
3486
|
+
|
|
3487
|
+
Automatische Wiederherstellung bei allen Verbindungsproblemen mit intelligenten Recovery-Strategien.
|
|
3488
|
+
|
|
3489
|
+
```javascript
|
|
3490
|
+
// Connection Recovery aktivieren
|
|
3491
|
+
const recovery = client.connectionRecovery;
|
|
3492
|
+
|
|
3493
|
+
// Health Monitoring starten
|
|
3494
|
+
recovery.startHealthMonitoring();
|
|
3495
|
+
|
|
3496
|
+
// Recovery-Statistiken abrufen
|
|
3497
|
+
const stats = recovery.getStats();
|
|
3498
|
+
console.log(`Retry Count: ${stats.retryCount}`);
|
|
3499
|
+
console.log(`Last Error: ${stats.lastError}`);
|
|
3500
|
+
console.log(`Failure Count: ${stats.failureCount}`);
|
|
3501
|
+
|
|
3502
|
+
// Recovery manuell initiieren
|
|
3503
|
+
await recovery.initiateRecovery(error);
|
|
3504
|
+
|
|
3505
|
+
// Recovery-Status zurücksetzen
|
|
3506
|
+
recovery.reset();
|
|
3507
|
+
```
|
|
3508
|
+
|
|
3509
|
+
**Recovery-Strategien (automatisch):**
|
|
3510
|
+
1. **Quick Reconnect** - Schnelle Wiederverbindung
|
|
3511
|
+
2. **Socket Reset** - Socket neu initialisieren
|
|
3512
|
+
3. **Session Repair** - Session reparieren
|
|
3513
|
+
4. **Full Restart** - Kompletter Neustart
|
|
3514
|
+
|
|
3515
|
+
**Recovery Features:**
|
|
3516
|
+
- ✅ **Exponential Backoff** - Intelligente Wartezeiten
|
|
3517
|
+
- ✅ **Jitter Factor** - Verhindert Thundering Herd
|
|
3518
|
+
- ✅ **Health Checks** - Automatische Verbindungsprüfung
|
|
3519
|
+
- ✅ **Max Retries** - Konfigurierbare Retry-Limits
|
|
3520
|
+
- ✅ **Failure History** - Vollständige Fehlerhistorie
|
|
3521
|
+
- ✅ **Auto-Recovery** - Automatische Wiederherstellung
|
|
3522
|
+
|
|
3523
|
+
**Konfiguration:**
|
|
3524
|
+
```javascript
|
|
3525
|
+
const client = new WhatsAppClient({
|
|
3526
|
+
connectionRecovery: {
|
|
3527
|
+
maxRetries: 10,
|
|
3528
|
+
baseDelay: 2000,
|
|
3529
|
+
maxDelay: 60000,
|
|
3530
|
+
exponentialBackoff: true,
|
|
3531
|
+
jitterFactor: 0.1,
|
|
3532
|
+
healthCheckInterval: 30000
|
|
3533
|
+
}
|
|
3534
|
+
});
|
|
3535
|
+
```
|
|
3536
|
+
|
|
3537
|
+
---
|
|
3538
|
+
|
|
3539
|
+
### **Auth Recovery System**
|
|
3540
|
+
|
|
3541
|
+
Automatische Wiederherstellung bei Authentifizierungs-Problemen mit Smart Backup System.
|
|
3542
|
+
|
|
3543
|
+
```javascript
|
|
3544
|
+
// Auth Recovery verwenden
|
|
3545
|
+
const authRecovery = client.authRecovery;
|
|
3546
|
+
|
|
3547
|
+
// Auto-Backup starten (jede Stunde)
|
|
3548
|
+
authRecovery.startAutoBackup();
|
|
3549
|
+
|
|
3550
|
+
// Smart Backup erstellen (nur wenn Session valid)
|
|
3551
|
+
await authRecovery.createSmartBackup();
|
|
3552
|
+
|
|
3553
|
+
// Session-Korruption erkennen
|
|
3554
|
+
const issues = await authRecovery.detectCorruption();
|
|
3555
|
+
console.log(`Gefundene Probleme: ${issues.length}`);
|
|
3556
|
+
|
|
3557
|
+
// Auto-Repair durchführen
|
|
3558
|
+
const result = await authRecovery.autoRepair();
|
|
3559
|
+
if (result.repaired) {
|
|
3560
|
+
console.log(`✅ Repariert mit: ${result.method}`);
|
|
3561
|
+
}
|
|
3562
|
+
|
|
3563
|
+
// Von bestem Backup wiederherstellen
|
|
3564
|
+
const recovered = await authRecovery.recoverFromBestBackup();
|
|
3565
|
+
|
|
3566
|
+
// Recovery-Statistiken
|
|
3567
|
+
const stats = authRecovery.getStats();
|
|
3568
|
+
console.log(`Backups: ${stats.backupCount}`);
|
|
3569
|
+
console.log(`Auto-Backup: ${stats.autoBackupEnabled ? 'AN' : 'AUS'}`);
|
|
3570
|
+
```
|
|
3571
|
+
|
|
3572
|
+
**Auth Recovery Features:**
|
|
3573
|
+
- ✅ **Smart Backups** - Nur valide Sessions werden gesichert
|
|
3574
|
+
- ✅ **Auto-Backup** - Stündliche automatische Backups
|
|
3575
|
+
- ✅ **Corruption Detection** - Erkennt beschädigte Sessions
|
|
3576
|
+
- ✅ **Auto-Repair** - Automatische Reparatur
|
|
3577
|
+
- ✅ **Backup History** - Mehrere Backup-Versionen
|
|
3578
|
+
- ✅ **Best Backup Recovery** - Wählt bestes Backup automatisch
|
|
3579
|
+
- ✅ **Max Backups** - Automatisches Cleanup alter Backups
|
|
3580
|
+
|
|
3581
|
+
**Erkannte Probleme:**
|
|
3582
|
+
- Missing Auth Directory
|
|
3583
|
+
- Missing/Empty creds.json
|
|
3584
|
+
- Corrupted JSON
|
|
3585
|
+
- Invalid Structure
|
|
3586
|
+
- Temp Files
|
|
3587
|
+
- Permission Errors
|
|
3588
|
+
|
|
3589
|
+
---
|
|
3590
|
+
|
|
3591
|
+
### **Resource Manager**
|
|
3592
|
+
|
|
3593
|
+
Verhindert Memory Leaks und verwaltet alle Ressourcen automatisch.
|
|
3594
|
+
|
|
3595
|
+
```javascript
|
|
3596
|
+
// Resource Manager verwenden
|
|
3597
|
+
import { globalResourceManager } from 'waengine';
|
|
3598
|
+
|
|
3599
|
+
// Ressource registrieren
|
|
3600
|
+
const resourceId = globalResourceManager.register('connection', socket, {
|
|
3601
|
+
cleanup: async () => await socket.end(),
|
|
3602
|
+
type: 'socket'
|
|
3603
|
+
});
|
|
3604
|
+
|
|
3605
|
+
// Ressource freigeben
|
|
3606
|
+
await globalResourceManager.release(resourceId);
|
|
3607
|
+
|
|
3608
|
+
// Alle Ressourcen eines Typs freigeben
|
|
3609
|
+
await globalResourceManager.releaseByType('socket');
|
|
3610
|
+
|
|
3611
|
+
// Alle Ressourcen freigeben
|
|
3612
|
+
await globalResourceManager.releaseAll();
|
|
3613
|
+
|
|
3614
|
+
// Statistiken abrufen
|
|
3615
|
+
const stats = globalResourceManager.getStats();
|
|
3616
|
+
console.log(`Aktive Ressourcen: ${stats.active}`);
|
|
3617
|
+
console.log(`Memory Usage: ${stats.memoryUsage}MB`);
|
|
3618
|
+
|
|
3619
|
+
// Memory Leak Detection
|
|
3620
|
+
const leaks = globalResourceManager.detectLeaks();
|
|
3621
|
+
if (leaks.length > 0) {
|
|
3622
|
+
console.log(`⚠️ ${leaks.length} potenzielle Memory Leaks gefunden`);
|
|
3623
|
+
}
|
|
3624
|
+
```
|
|
3625
|
+
|
|
3626
|
+
**Resource Manager Features:**
|
|
3627
|
+
- ✅ **Automatic Cleanup** - Automatische Ressourcen-Freigabe
|
|
3628
|
+
- ✅ **Memory Leak Detection** - Erkennt Memory Leaks
|
|
3629
|
+
- ✅ **Resource Tracking** - Vollständiges Tracking
|
|
3630
|
+
- ✅ **Type-based Management** - Nach Typ verwalten
|
|
3631
|
+
- ✅ **Statistics** - Detaillierte Statistiken
|
|
3632
|
+
- ✅ **Health Monitoring** - Ressourcen-Gesundheit
|
|
3633
|
+
|
|
3634
|
+
---
|
|
3635
|
+
|
|
3636
|
+
## 🛡️ Anti-Ban Protection System
|
|
3637
|
+
|
|
3638
|
+
Schützt Bots vor WhatsApp-Bans durch intelligente Verhaltens-Mimikry.
|
|
3639
|
+
|
|
3640
|
+
```javascript
|
|
3641
|
+
// Anti-Ban Protection verwenden
|
|
3642
|
+
const antiBan = client.antiBan;
|
|
3643
|
+
|
|
3644
|
+
// Geschützte Nachricht senden
|
|
3645
|
+
await antiBan.sendMessageProtected(jid, { text: 'Hello!' });
|
|
3646
|
+
|
|
3647
|
+
// Geschützte Aktion ausführen
|
|
3648
|
+
await antiBan.performActionProtected(async () => {
|
|
3649
|
+
await client.socket.groupSettingUpdate(groupId, 'announcement');
|
|
3650
|
+
}, 'group_settings');
|
|
3651
|
+
|
|
3652
|
+
// Menschliches Tippen simulieren
|
|
3653
|
+
await antiBan.simulateHumanTyping('Lange Nachricht...');
|
|
3654
|
+
|
|
3655
|
+
// Presence Updates
|
|
3656
|
+
await antiBan.updatePresence('available'); // online
|
|
3657
|
+
await antiBan.updatePresence('unavailable'); // offline
|
|
3658
|
+
|
|
3659
|
+
// Nachricht "lesen" simulieren
|
|
3660
|
+
await antiBan.simulateReadMessage(jid, messageKey);
|
|
3661
|
+
|
|
3662
|
+
// Hintergrund-Aktivität starten
|
|
3663
|
+
antiBan.startBackgroundActivity();
|
|
3664
|
+
|
|
3665
|
+
// Features konfigurieren
|
|
3666
|
+
antiBan.setFeature('humanTyping', true);
|
|
3667
|
+
antiBan.setFeature('randomDelays', true);
|
|
3668
|
+
antiBan.setFeature('presenceUpdates', true);
|
|
3669
|
+
|
|
3670
|
+
// Alle Features aktivieren (maximaler Schutz)
|
|
3671
|
+
antiBan.enableAllFeatures();
|
|
3672
|
+
|
|
3673
|
+
// Statistiken anzeigen
|
|
3674
|
+
antiBan.printStats();
|
|
3675
|
+
const stats = antiBan.getStats();
|
|
3676
|
+
```
|
|
3677
|
+
|
|
3678
|
+
**Anti-Ban Features:**
|
|
3679
|
+
- ✅ **Human Typing** - Simuliert menschliches Tippen (40-60 WPM)
|
|
3680
|
+
- ✅ **Random Delays** - Zufällige menschliche Verzögerungen
|
|
3681
|
+
- ✅ **Presence Updates** - Realistische Online/Offline Status
|
|
3682
|
+
- ✅ **Read Receipts** - Simuliert Lesen von Nachrichten
|
|
3683
|
+
- ✅ **Typing Indicator** - "tippt..." Anzeige
|
|
3684
|
+
- ✅ **Smart Browser** - Realistische Browser-Strings
|
|
3685
|
+
- ✅ **Background Activity** - Gelegentliche Idle-Aktivität
|
|
3686
|
+
- ✅ **Session Rotation** - Optional: Session-Rotation
|
|
3687
|
+
|
|
3688
|
+
**Schutz-Level:**
|
|
3689
|
+
```javascript
|
|
3690
|
+
// Minimaler Schutz (schnell)
|
|
3691
|
+
antiBan.disable();
|
|
3692
|
+
|
|
3693
|
+
// Standard Schutz (empfohlen)
|
|
3694
|
+
antiBan.enable();
|
|
3695
|
+
|
|
3696
|
+
// Maximaler Schutz (sicher)
|
|
3697
|
+
antiBan.enableAllFeatures();
|
|
3698
|
+
antiBan.startBackgroundActivity();
|
|
3699
|
+
```
|
|
3700
|
+
|
|
3701
|
+
**Statistiken:**
|
|
3702
|
+
- Messages Protected
|
|
3703
|
+
- Actions Protected
|
|
3704
|
+
- Bans Avoided
|
|
3705
|
+
- Suspicious Activity Prevented
|
|
3706
|
+
- Session Duration
|
|
3707
|
+
- Messages per Hour
|
|
3708
|
+
|
|
3709
|
+
---
|
|
3710
|
+
|
|
3711
|
+
## 🎨 Console Logger System
|
|
3712
|
+
|
|
3713
|
+
Schöne animierte Console-Ausgabe ohne Spam.
|
|
3714
|
+
|
|
3715
|
+
```javascript
|
|
3716
|
+
// Console Logger verwenden
|
|
3717
|
+
import { logger } from 'waengine';
|
|
3718
|
+
|
|
3719
|
+
// Banner anzeigen
|
|
3720
|
+
logger.showBanner();
|
|
3721
|
+
|
|
3722
|
+
// Setup Animation
|
|
3723
|
+
await logger.animateSetup();
|
|
3724
|
+
|
|
3725
|
+
// QR-Code Animation
|
|
3726
|
+
await logger.animateQRGeneration('bot1', 1, 2);
|
|
3727
|
+
|
|
3728
|
+
// Connection Animation
|
|
3729
|
+
await logger.animateConnection('bot1', true);
|
|
3730
|
+
|
|
3731
|
+
// Device Pause
|
|
3732
|
+
await logger.showDevicePause(3);
|
|
3733
|
+
|
|
3734
|
+
// Finale Zusammenfassung
|
|
3735
|
+
logger.showFinalSummary(['bot1', 'bot2'], true);
|
|
3736
|
+
|
|
3737
|
+
// Dynamische Ready Message
|
|
3738
|
+
logger.showDynamicReadyMessage(client);
|
|
3739
|
+
|
|
3740
|
+
// Progress Bar erstellen
|
|
3741
|
+
const bar = logger.createProgressBar('download', 'Downloading', 100);
|
|
3742
|
+
logger.updateProgressBar('download', 50);
|
|
3743
|
+
logger.completeProgressBar('download', '✅ Done');
|
|
3744
|
+
|
|
3745
|
+
// Simple Logs
|
|
3746
|
+
logger.info('Information');
|
|
3747
|
+
logger.success('Erfolg!');
|
|
3748
|
+
logger.warning('Warnung!');
|
|
3749
|
+
logger.error('Fehler!');
|
|
3750
|
+
|
|
3751
|
+
// Console leeren
|
|
3752
|
+
logger.clear();
|
|
3753
|
+
```
|
|
3754
|
+
|
|
3755
|
+
**Console Logger Features:**
|
|
3756
|
+
- ✅ **Animated Banner** - Schöner Startup-Banner
|
|
3757
|
+
- ✅ **Progress Bars** - Animierte Fortschrittsbalken
|
|
3758
|
+
- ✅ **Setup Animation** - Schöne Setup-Sequenz
|
|
3759
|
+
- ✅ **QR Animation** - QR-Code Box mit Animation
|
|
3760
|
+
- ✅ **Connection Animation** - Verbindungs-Animation
|
|
3761
|
+
- ✅ **Device Status** - Schöne Device-Anzeige
|
|
3762
|
+
- ✅ **Dynamic Messages** - Dynamische Ready-Messages
|
|
3763
|
+
- ✅ **Color Support** - Farbige Ausgabe
|
|
3764
|
+
- ✅ **Silent Mode** - Komplett deaktivierbar
|
|
3765
|
+
|
|
3766
|
+
---
|
|
3767
|
+
|
|
3768
|
+
## 🔧 Device Manager
|
|
3769
|
+
|
|
3770
|
+
Professionelles Multi-Device Management mit Load Balancing.
|
|
3771
|
+
|
|
3772
|
+
```javascript
|
|
3773
|
+
// Device Manager verwenden
|
|
3774
|
+
import { DeviceManager } from 'waengine';
|
|
3775
|
+
|
|
3776
|
+
const deviceManager = new DeviceManager({
|
|
3777
|
+
maxDevices: 3,
|
|
3778
|
+
loadBalancing: 'round-robin', // round-robin, random, least-used
|
|
3779
|
+
syncEvents: true
|
|
3780
|
+
});
|
|
3781
|
+
|
|
3782
|
+
// Devices hinzufügen
|
|
3783
|
+
await deviceManager.addDevice('bot1');
|
|
3784
|
+
await deviceManager.addDevice('bot2');
|
|
3785
|
+
await deviceManager.addDevice('bot3');
|
|
3786
|
+
|
|
3787
|
+
// Einzelnes Device verbinden
|
|
3788
|
+
await deviceManager.connectDevice('bot1');
|
|
3789
|
+
|
|
3790
|
+
// Alle Devices verbinden (sequenziell)
|
|
3791
|
+
await deviceManager.connectAll();
|
|
3792
|
+
|
|
3793
|
+
// Device abrufen
|
|
3794
|
+
const client = deviceManager.getDevice('bot1');
|
|
3795
|
+
|
|
3796
|
+
// Nächstes Device (Load Balancing)
|
|
3797
|
+
const nextClient = deviceManager.getNextDevice();
|
|
3798
|
+
|
|
3799
|
+
// Smart Send (mit Load Balancing)
|
|
3800
|
+
await deviceManager.smartSend(chatId, { text: 'Hello!' }, {
|
|
3801
|
+
strategy: 'load-balance' // load-balance, broadcast, failover
|
|
3802
|
+
});
|
|
3803
|
+
|
|
3804
|
+
// Broadcast an alle Devices
|
|
3805
|
+
const results = await deviceManager.broadcast.sendMessage(chatId, {
|
|
3806
|
+
text: 'Broadcast Message!'
|
|
3807
|
+
});
|
|
3808
|
+
|
|
3809
|
+
// Send mit Failover
|
|
3810
|
+
await deviceManager.sendWithFailover(chatId, { text: 'Important!' });
|
|
3811
|
+
|
|
3812
|
+
// Device Status
|
|
3813
|
+
const status = deviceManager.getStatus();
|
|
3814
|
+
console.log(`Active: ${status.activeDevices}/${status.totalDevices}`);
|
|
3815
|
+
|
|
3816
|
+
// Health Check
|
|
3817
|
+
const health = deviceManager.getHealthCheck();
|
|
3818
|
+
console.log(`Health: ${health.healthPercentage}%`);
|
|
3819
|
+
|
|
3820
|
+
// Events
|
|
3821
|
+
deviceManager.on('message', (data) => {
|
|
3822
|
+
console.log(`Message from ${data.deviceId}`);
|
|
3823
|
+
});
|
|
3824
|
+
|
|
3825
|
+
deviceManager.on('device.connected', ({ deviceId }) => {
|
|
3826
|
+
console.log(`Device ${deviceId} connected`);
|
|
3827
|
+
});
|
|
3828
|
+
|
|
3829
|
+
// Cleanup
|
|
3830
|
+
await deviceManager.cleanup();
|
|
3831
|
+
```
|
|
3832
|
+
|
|
3833
|
+
**Device Manager Features:**
|
|
3834
|
+
- ✅ **Multi-Device Support** - Bis zu 3 Devices gleichzeitig
|
|
3835
|
+
- ✅ **Load Balancing** - Round-Robin, Random, Least-Used
|
|
3836
|
+
- ✅ **Smart Routing** - Intelligentes Message-Routing
|
|
3837
|
+
- ✅ **Broadcast System** - An alle Devices senden
|
|
3838
|
+
- ✅ **Failover** - Automatisches Failover bei Fehlern
|
|
3839
|
+
- ✅ **Event Sync** - Events von allen Devices
|
|
3840
|
+
- ✅ **Health Monitoring** - Device-Gesundheit überwachen
|
|
3841
|
+
- ✅ **Sequential Connect** - QR-Codes nacheinander
|
|
3842
|
+
- ✅ **Statistics** - Detaillierte Device-Statistiken
|
|
3843
|
+
|
|
3844
|
+
**Load Balancing Strategien:**
|
|
3845
|
+
- **round-robin**: Gleichmäßige Verteilung
|
|
3846
|
+
- **random**: Zufällige Auswahl
|
|
3847
|
+
- **least-used**: Am wenigsten genutztes Device
|
|
3848
|
+
|
|
3849
|
+
---s
|
|
3269
3850
|
- 🤖 **EasyBot Integration** - Alle Features in EasyBot verfügbar
|
|
3270
3851
|
|
|
3271
3852
|
### **🎵 Advanced Media Features**
|
package/LICENSE
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "waengine",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.4",
|
|
4
4
|
"description": "🚀 WAEngine - The most powerful WhatsApp Bot Library with 860+ Working Features, Complete Baileys Integration & Production-Ready Stability",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"type": "module",
|
package/src/client.js
CHANGED
|
@@ -937,13 +937,6 @@ export class WhatsAppClient {
|
|
|
937
937
|
if (messageTimestamp < this.connectionStartTime) {
|
|
938
938
|
this.ignoredMessagesCount++;
|
|
939
939
|
|
|
940
|
-
// Nur alle 10 Messages oder bei der ersten Message loggen
|
|
941
|
-
if (this.ignoredMessagesCount === 1) {
|
|
942
|
-
console.log(`📵 Offline Messages werden ignoriert...`);
|
|
943
|
-
} else if (this.ignoredMessagesCount % 10 === 0) {
|
|
944
|
-
console.log(`📵 ${this.ignoredMessagesCount} Offline Messages ignoriert...`);
|
|
945
|
-
}
|
|
946
|
-
|
|
947
940
|
// Timer für finale Zusammenfassung zurücksetzen
|
|
948
941
|
if (this.offlineMessageTimer) {
|
|
949
942
|
clearTimeout(this.offlineMessageTimer);
|
package/src/message.js
CHANGED
|
@@ -587,6 +587,55 @@ export class Message {
|
|
|
587
587
|
});
|
|
588
588
|
}
|
|
589
589
|
|
|
590
|
+
// ===== DELETE MESSAGE - Auto-Delete System =====
|
|
591
|
+
async deleteMessage() {
|
|
592
|
+
try {
|
|
593
|
+
// Lösche die aktuelle Message
|
|
594
|
+
// Erstelle den richtigen Key basierend auf dem Sender
|
|
595
|
+
const sender = this.getSender();
|
|
596
|
+
const botJid = this.client.socket.user?.id;
|
|
597
|
+
const botNumber = botJid?.split('@')[0]?.split(':')[0];
|
|
598
|
+
const senderNumber = sender?.split('@')[0]?.split(':')[0];
|
|
599
|
+
const isFromBot = botNumber === senderNumber;
|
|
600
|
+
|
|
601
|
+
const messageKey = {
|
|
602
|
+
remoteJid: this.from,
|
|
603
|
+
id: this.id,
|
|
604
|
+
fromMe: isFromBot
|
|
605
|
+
};
|
|
606
|
+
|
|
607
|
+
// In Gruppen: participant hinzufügen wenn nicht vom Bot
|
|
608
|
+
if (this.isGroup && !isFromBot) {
|
|
609
|
+
messageKey.participant = sender;
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
console.log('🗑️ Lösche Message:', {
|
|
613
|
+
id: this.id,
|
|
614
|
+
from: sender,
|
|
615
|
+
isFromBot: isFromBot,
|
|
616
|
+
isGroup: this.isGroup
|
|
617
|
+
});
|
|
618
|
+
|
|
619
|
+
const result = await this.client.socket.sendMessage(this.from, {
|
|
620
|
+
delete: messageKey
|
|
621
|
+
});
|
|
622
|
+
|
|
623
|
+
return {
|
|
624
|
+
success: true,
|
|
625
|
+
messageId: this.id,
|
|
626
|
+
sender: sender,
|
|
627
|
+
wasFromBot: isFromBot,
|
|
628
|
+
result: result
|
|
629
|
+
};
|
|
630
|
+
} catch (error) {
|
|
631
|
+
console.error('❌ Fehler beim Löschen der Message:', error.message);
|
|
632
|
+
return {
|
|
633
|
+
success: false,
|
|
634
|
+
error: error.message
|
|
635
|
+
};
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
|
|
590
639
|
async deleteFromReply() {
|
|
591
640
|
// Prüfe ob die Message eine Reply ist
|
|
592
641
|
const contextInfo = this.raw.message?.extendedTextMessage?.contextInfo;
|