waengine 1.8.3 β 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 +8 -1
- package/src/client.js +81 -7
- package/src/console-logger.js +1 -1
- package/src/message.js +113 -8
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",
|
|
@@ -12,6 +12,13 @@
|
|
|
12
12
|
"example:easy": "node examples/easy-bot-examples.js vollstΓ€ndig"
|
|
13
13
|
},
|
|
14
14
|
"keywords": [
|
|
15
|
+
"best-libary",
|
|
16
|
+
"Library",
|
|
17
|
+
"whatsapp-bot-libary",
|
|
18
|
+
"Whatsapp-libary",
|
|
19
|
+
"npm",
|
|
20
|
+
"npm-install-waengine",
|
|
21
|
+
"api",
|
|
15
22
|
"mention",
|
|
16
23
|
"waengine",
|
|
17
24
|
"hidetag",
|
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);
|
|
@@ -1317,6 +1310,87 @@ export class WhatsAppClient {
|
|
|
1317
1310
|
|
|
1318
1311
|
return results;
|
|
1319
1312
|
}
|
|
1313
|
+
|
|
1314
|
+
// ===== CONTACT INFO API =====
|
|
1315
|
+
|
|
1316
|
+
/**
|
|
1317
|
+
* Holt erweiterte Kontakt-Informationen
|
|
1318
|
+
* @param {string} jid - Die JID des Kontakts
|
|
1319
|
+
* @returns {Promise<object>} Kontakt-Informationen
|
|
1320
|
+
*/
|
|
1321
|
+
async getContactInfo(jid) {
|
|
1322
|
+
try {
|
|
1323
|
+
// Normalisiere JID
|
|
1324
|
+
let normalizedJid = jid;
|
|
1325
|
+
if (!jid.includes('@')) {
|
|
1326
|
+
normalizedJid = `${jid}@s.whatsapp.net`;
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1329
|
+
// Basis-Info: PrΓΌfe ob Nummer auf WhatsApp ist
|
|
1330
|
+
const onWhatsAppCheck = await this.socket.onWhatsApp(normalizedJid);
|
|
1331
|
+
|
|
1332
|
+
if (!onWhatsAppCheck || onWhatsAppCheck.length === 0) {
|
|
1333
|
+
return {
|
|
1334
|
+
exists: false,
|
|
1335
|
+
jid: normalizedJid,
|
|
1336
|
+
number: jid.split('@')[0]
|
|
1337
|
+
};
|
|
1338
|
+
}
|
|
1339
|
+
|
|
1340
|
+
const baseInfo = onWhatsAppCheck[0];
|
|
1341
|
+
|
|
1342
|
+
// Erweiterte Kontakt-Informationen sammeln
|
|
1343
|
+
const contactInfo = {
|
|
1344
|
+
exists: baseInfo.exists,
|
|
1345
|
+
jid: baseInfo.jid,
|
|
1346
|
+
number: baseInfo.jid.split('@')[0],
|
|
1347
|
+
isBusiness: baseInfo.isBusiness || false,
|
|
1348
|
+
name: null,
|
|
1349
|
+
notify: null,
|
|
1350
|
+
verifiedName: null,
|
|
1351
|
+
status: null,
|
|
1352
|
+
profilePicture: null
|
|
1353
|
+
};
|
|
1354
|
+
|
|
1355
|
+
try {
|
|
1356
|
+
// Versuche Profilbild abzurufen
|
|
1357
|
+
const profilePicUrl = await this.socket.profilePictureUrl(normalizedJid, 'image');
|
|
1358
|
+
contactInfo.profilePicture = profilePicUrl;
|
|
1359
|
+
} catch (error) {
|
|
1360
|
+
// Kein Profilbild verfΓΌgbar
|
|
1361
|
+
contactInfo.profilePicture = null;
|
|
1362
|
+
}
|
|
1363
|
+
|
|
1364
|
+
try {
|
|
1365
|
+
// Versuche Status abzurufen
|
|
1366
|
+
const status = await this.socket.fetchStatus(normalizedJid);
|
|
1367
|
+
contactInfo.status = status?.status || null;
|
|
1368
|
+
contactInfo.statusTimestamp = status?.setAt || null;
|
|
1369
|
+
} catch (error) {
|
|
1370
|
+
// Status nicht verfΓΌgbar
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1373
|
+
// Versuche Name aus dem Store zu holen (wenn verfΓΌgbar)
|
|
1374
|
+
try {
|
|
1375
|
+
if (this.socket.store && this.socket.store.contacts) {
|
|
1376
|
+
const storeContact = this.socket.store.contacts[normalizedJid];
|
|
1377
|
+
if (storeContact) {
|
|
1378
|
+
contactInfo.name = storeContact.name || storeContact.notify || null;
|
|
1379
|
+
contactInfo.notify = storeContact.notify || null;
|
|
1380
|
+
contactInfo.verifiedName = storeContact.verifiedName || null;
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
1383
|
+
} catch (error) {
|
|
1384
|
+
// Store nicht verfΓΌgbar
|
|
1385
|
+
}
|
|
1386
|
+
|
|
1387
|
+
return contactInfo;
|
|
1388
|
+
|
|
1389
|
+
} catch (error) {
|
|
1390
|
+
console.error('β Fehler beim Abrufen der Kontakt-Info:', error);
|
|
1391
|
+
return null;
|
|
1392
|
+
}
|
|
1393
|
+
}
|
|
1320
1394
|
}
|
|
1321
1395
|
|
|
1322
1396
|
// ===== DEINE API-KLASSEN =====
|
package/src/console-logger.js
CHANGED
|
@@ -13,7 +13,7 @@ export class ConsoleLogger {
|
|
|
13
13
|
|
|
14
14
|
console.log(`
|
|
15
15
|
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
16
|
-
β π WAEngine v1.8.
|
|
16
|
+
β π WAEngine v1.8.9 β
|
|
17
17
|
β Advanced WhatsApp Bot Framework β
|
|
18
18
|
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ`);
|
|
19
19
|
}
|
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;
|
|
@@ -1558,16 +1607,72 @@ export class Message {
|
|
|
1558
1607
|
|
|
1559
1608
|
async getContactInfo(jid) {
|
|
1560
1609
|
try {
|
|
1561
|
-
//
|
|
1562
|
-
|
|
1563
|
-
if (
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1610
|
+
// Normalisiere JID
|
|
1611
|
+
let normalizedJid = jid;
|
|
1612
|
+
if (!jid.includes('@')) {
|
|
1613
|
+
normalizedJid = `${jid}@s.whatsapp.net`;
|
|
1614
|
+
}
|
|
1615
|
+
|
|
1616
|
+
// Basis-Info: PrΓΌfe ob Nummer auf WhatsApp ist
|
|
1617
|
+
const onWhatsAppCheck = await this.client.socket.onWhatsApp(normalizedJid);
|
|
1618
|
+
|
|
1619
|
+
if (!onWhatsAppCheck || onWhatsAppCheck.length === 0) {
|
|
1620
|
+
return {
|
|
1621
|
+
exists: false,
|
|
1622
|
+
jid: normalizedJid,
|
|
1623
|
+
number: jid.split('@')[0]
|
|
1568
1624
|
};
|
|
1569
1625
|
}
|
|
1570
|
-
|
|
1626
|
+
|
|
1627
|
+
const baseInfo = onWhatsAppCheck[0];
|
|
1628
|
+
|
|
1629
|
+
// Erweiterte Kontakt-Informationen sammeln
|
|
1630
|
+
const contactInfo = {
|
|
1631
|
+
exists: baseInfo.exists,
|
|
1632
|
+
jid: baseInfo.jid,
|
|
1633
|
+
number: baseInfo.jid.split('@')[0],
|
|
1634
|
+
isBusiness: baseInfo.isBusiness || false,
|
|
1635
|
+
name: null,
|
|
1636
|
+
notify: null,
|
|
1637
|
+
verifiedName: null,
|
|
1638
|
+
status: null,
|
|
1639
|
+
profilePicture: null
|
|
1640
|
+
};
|
|
1641
|
+
|
|
1642
|
+
try {
|
|
1643
|
+
// Versuche Profilbild abzurufen
|
|
1644
|
+
const profilePicUrl = await this.client.socket.profilePictureUrl(normalizedJid, 'image');
|
|
1645
|
+
contactInfo.profilePicture = profilePicUrl;
|
|
1646
|
+
} catch (error) {
|
|
1647
|
+
// Kein Profilbild verfΓΌgbar
|
|
1648
|
+
contactInfo.profilePicture = null;
|
|
1649
|
+
}
|
|
1650
|
+
|
|
1651
|
+
try {
|
|
1652
|
+
// Versuche Status abzurufen
|
|
1653
|
+
const status = await this.client.socket.fetchStatus(normalizedJid);
|
|
1654
|
+
contactInfo.status = status?.status || null;
|
|
1655
|
+
contactInfo.statusTimestamp = status?.setAt || null;
|
|
1656
|
+
} catch (error) {
|
|
1657
|
+
// Status nicht verfΓΌgbar
|
|
1658
|
+
}
|
|
1659
|
+
|
|
1660
|
+
// Versuche Name aus dem Store zu holen (wenn verfΓΌgbar)
|
|
1661
|
+
try {
|
|
1662
|
+
if (this.client.socket.store && this.client.socket.store.contacts) {
|
|
1663
|
+
const storeContact = this.client.socket.store.contacts[normalizedJid];
|
|
1664
|
+
if (storeContact) {
|
|
1665
|
+
contactInfo.name = storeContact.name || storeContact.notify || null;
|
|
1666
|
+
contactInfo.notify = storeContact.notify || null;
|
|
1667
|
+
contactInfo.verifiedName = storeContact.verifiedName || null;
|
|
1668
|
+
}
|
|
1669
|
+
}
|
|
1670
|
+
} catch (error) {
|
|
1671
|
+
// Store nicht verfΓΌgbar
|
|
1672
|
+
}
|
|
1673
|
+
|
|
1674
|
+
return contactInfo;
|
|
1675
|
+
|
|
1571
1676
|
} catch (error) {
|
|
1572
1677
|
console.error('β Fehler beim Abrufen der Kontakt-Info:', error);
|
|
1573
1678
|
return null;
|