waengine 1.5.0 → 1.7.3
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 +618 -2
- package/README.md +365 -6
- package/package.json +2 -2
- package/src/advanced-features.js +776 -0
- package/src/client.js +82 -2
- package/src/easy-advanced.js +673 -0
- package/src/easy-bot.js +347 -4
- package/src/index.js +13 -0
- package/src/message.js +193 -0
- package/src/multi-client.js +1 -0
package/src/easy-bot.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { WhatsAppClient } from "./client.js";
|
|
2
2
|
import { MultiWhatsAppClient } from "./multi-client.js";
|
|
3
|
+
import { EasyAdvanced, EasyAdvancedRule } from "./easy-advanced.js";
|
|
3
4
|
|
|
4
5
|
export class EasyBot {
|
|
5
6
|
constructor() {
|
|
@@ -19,6 +20,9 @@ export class EasyBot {
|
|
|
19
20
|
typingEnabled: true,
|
|
20
21
|
reactionsEnabled: true
|
|
21
22
|
};
|
|
23
|
+
|
|
24
|
+
// ===== ADVANCED FEATURES INTEGRATION - NEU! =====
|
|
25
|
+
this.advanced = null; // Wird nach Client-Erstellung initialisiert
|
|
22
26
|
}
|
|
23
27
|
|
|
24
28
|
// ===== FACTORY METHODS =====
|
|
@@ -44,8 +48,13 @@ export class EasyBot {
|
|
|
44
48
|
heartbeatInterval: 20000, // 20 Sekunden Heartbeat
|
|
45
49
|
connectionTimeout: 180000, // 3 Minuten Timeout
|
|
46
50
|
keepAlive: true,
|
|
51
|
+
quietHeartbeat: true, // Heartbeat-Spam deaktivieren
|
|
47
52
|
...options
|
|
48
53
|
});
|
|
54
|
+
|
|
55
|
+
// Advanced Features nach Client-Erstellung initialisieren
|
|
56
|
+
bot.advanced = new EasyAdvanced(bot);
|
|
57
|
+
|
|
49
58
|
return bot;
|
|
50
59
|
}
|
|
51
60
|
|
|
@@ -63,6 +72,7 @@ export class EasyBot {
|
|
|
63
72
|
heartbeatInterval: 20000,
|
|
64
73
|
connectionTimeout: 180000,
|
|
65
74
|
keepAlive: true,
|
|
75
|
+
quietHeartbeat: true, // Heartbeat-Spam deaktivieren
|
|
66
76
|
...options
|
|
67
77
|
});
|
|
68
78
|
return bot;
|
|
@@ -79,6 +89,7 @@ export class EasyBot {
|
|
|
79
89
|
reconnectInterval: 1000, // Sehr schnelle Wiederverbindung
|
|
80
90
|
heartbeatInterval: 15000, // 15 Sekunden Heartbeat
|
|
81
91
|
connectionTimeout: 300000, // 5 Minuten Timeout
|
|
92
|
+
quietHeartbeat: true, // Heartbeat-Spam deaktivieren
|
|
82
93
|
...options
|
|
83
94
|
});
|
|
84
95
|
}
|
|
@@ -740,6 +751,112 @@ class EasyRule {
|
|
|
740
751
|
return this;
|
|
741
752
|
}
|
|
742
753
|
|
|
754
|
+
// ===== ADVANCED MEDIA ACTIONS - NEU! =====
|
|
755
|
+
|
|
756
|
+
voice(audioPath) {
|
|
757
|
+
this.actions.push({ type: 'voice', value: audioPath });
|
|
758
|
+
return this;
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
videoMessage(videoPath) {
|
|
762
|
+
this.actions.push({ type: 'videoMessage', value: videoPath });
|
|
763
|
+
return this;
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
gif(gifPath, caption = "") {
|
|
767
|
+
this.actions.push({ type: 'gif', value: { path: gifPath, caption } });
|
|
768
|
+
return this;
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
// ===== ADVANCED MESSAGE ACTIONS - NEU! =====
|
|
772
|
+
|
|
773
|
+
forward(targetChat = null) {
|
|
774
|
+
this.actions.push({ type: 'forward', value: targetChat });
|
|
775
|
+
return this;
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
pin() {
|
|
779
|
+
this.actions.push({ type: 'pin', value: true });
|
|
780
|
+
return this;
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
star() {
|
|
784
|
+
this.actions.push({ type: 'star', value: true });
|
|
785
|
+
return this;
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
quote(text) {
|
|
789
|
+
this.actions.push({ type: 'quote', value: text });
|
|
790
|
+
return this;
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
// ===== RICH CONTENT ACTIONS - NEU! =====
|
|
794
|
+
|
|
795
|
+
buttons(text, buttonList, footer = "") {
|
|
796
|
+
this.actions.push({ type: 'buttons', value: { text, buttons: buttonList, footer } });
|
|
797
|
+
return this;
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
list(title, description, buttonText, sections) {
|
|
801
|
+
this.actions.push({ type: 'list', value: { title, description, buttonText, sections } });
|
|
802
|
+
return this;
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
// ===== GROUP ACTIONS - NEU! =====
|
|
806
|
+
|
|
807
|
+
groupInfo() {
|
|
808
|
+
this.actions.push({ type: 'groupInfo', value: true });
|
|
809
|
+
return this;
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
inviteLink() {
|
|
813
|
+
this.actions.push({ type: 'inviteLink', value: true });
|
|
814
|
+
return this;
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
// ===== PRIVACY ACTIONS - NEU! =====
|
|
818
|
+
|
|
819
|
+
block() {
|
|
820
|
+
this.actions.push({ type: 'block', value: true });
|
|
821
|
+
return this;
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
unblock() {
|
|
825
|
+
this.actions.push({ type: 'unblock', value: true });
|
|
826
|
+
return this;
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
// ===== ANALYTICS ACTIONS - NEU! =====
|
|
830
|
+
|
|
831
|
+
checkOnline() {
|
|
832
|
+
this.actions.push({ type: 'checkOnline', value: true });
|
|
833
|
+
return this;
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
archive() {
|
|
837
|
+
this.actions.push({ type: 'archive', value: true });
|
|
838
|
+
return this;
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
mute(duration = 8 * 60 * 60 * 1000) {
|
|
842
|
+
this.actions.push({ type: 'mute', value: duration });
|
|
843
|
+
return this;
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
// ===== STATUS ACTIONS - NEU! =====
|
|
847
|
+
|
|
848
|
+
sendStatus(text, options = {}) {
|
|
849
|
+
this.actions.push({ type: 'sendStatus', value: { text, options } });
|
|
850
|
+
return this;
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
// ===== SYSTEM ACTIONS - NEU! =====
|
|
854
|
+
|
|
855
|
+
backup() {
|
|
856
|
+
this.actions.push({ type: 'backup', value: true });
|
|
857
|
+
return this;
|
|
858
|
+
}
|
|
859
|
+
|
|
743
860
|
sendAudio(path) {
|
|
744
861
|
this.actions.push({ type: 'audio', value: path });
|
|
745
862
|
return this;
|
|
@@ -1084,6 +1201,235 @@ class EasyRule {
|
|
|
1084
1201
|
console.error('❌ Fehler bei News:', error.message);
|
|
1085
1202
|
}
|
|
1086
1203
|
break;
|
|
1204
|
+
|
|
1205
|
+
// ===== ADVANCED FEATURES CASES - NEU! =====
|
|
1206
|
+
|
|
1207
|
+
case 'voice':
|
|
1208
|
+
try {
|
|
1209
|
+
const mentions = msg.getMentions();
|
|
1210
|
+
if (mentions.length > 0) {
|
|
1211
|
+
await msg.sendVoiceToMentioned(action.value);
|
|
1212
|
+
} else {
|
|
1213
|
+
await msg.sendVoiceMessage(action.value);
|
|
1214
|
+
}
|
|
1215
|
+
} catch (error) {
|
|
1216
|
+
console.error('❌ Voice Message Fehler:', error.message);
|
|
1217
|
+
await this.bot.sendReply(msg, '❌ Voice Message nicht verfügbar');
|
|
1218
|
+
}
|
|
1219
|
+
break;
|
|
1220
|
+
|
|
1221
|
+
case 'videoMessage':
|
|
1222
|
+
try {
|
|
1223
|
+
const mentions = msg.getMentions();
|
|
1224
|
+
if (mentions.length > 0) {
|
|
1225
|
+
await msg.sendVideoMessageToMentioned(action.value);
|
|
1226
|
+
} else {
|
|
1227
|
+
await msg.sendVideoMessage(action.value);
|
|
1228
|
+
}
|
|
1229
|
+
} catch (error) {
|
|
1230
|
+
console.error('❌ Video Message Fehler:', error.message);
|
|
1231
|
+
await this.bot.sendReply(msg, '❌ Video Message nicht verfügbar');
|
|
1232
|
+
}
|
|
1233
|
+
break;
|
|
1234
|
+
|
|
1235
|
+
case 'gif':
|
|
1236
|
+
try {
|
|
1237
|
+
const mentions = msg.getMentions();
|
|
1238
|
+
if (mentions.length > 0) {
|
|
1239
|
+
await msg.sendGifToMentioned(action.value.path, action.value.caption);
|
|
1240
|
+
} else {
|
|
1241
|
+
await msg.sendGif(action.value.path, action.value.caption);
|
|
1242
|
+
}
|
|
1243
|
+
} catch (error) {
|
|
1244
|
+
console.error('❌ GIF Fehler:', error.message);
|
|
1245
|
+
await this.bot.sendReply(msg, '❌ GIF nicht verfügbar');
|
|
1246
|
+
}
|
|
1247
|
+
break;
|
|
1248
|
+
|
|
1249
|
+
case 'forward':
|
|
1250
|
+
try {
|
|
1251
|
+
if (action.value) {
|
|
1252
|
+
await msg.forward(action.value);
|
|
1253
|
+
} else {
|
|
1254
|
+
const mentions = msg.getMentions();
|
|
1255
|
+
if (mentions.length > 0) {
|
|
1256
|
+
await msg.forwardToMentioned();
|
|
1257
|
+
} else {
|
|
1258
|
+
await msg.forwardToSender();
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
} catch (error) {
|
|
1262
|
+
console.error('❌ Forward Fehler:', error.message);
|
|
1263
|
+
await this.bot.sendReply(msg, '❌ Forward nicht verfügbar');
|
|
1264
|
+
}
|
|
1265
|
+
break;
|
|
1266
|
+
|
|
1267
|
+
case 'pin':
|
|
1268
|
+
try {
|
|
1269
|
+
if (!msg.isGroup) {
|
|
1270
|
+
await this.bot.sendReply(msg, '❌ Pin funktioniert nur in Gruppen!');
|
|
1271
|
+
} else if (!(await msg.isAdmin())) {
|
|
1272
|
+
await this.bot.sendReply(msg, '❌ Nur Admins können pinnen!');
|
|
1273
|
+
} else {
|
|
1274
|
+
await msg.pin();
|
|
1275
|
+
await this.bot.sendReply(msg, '📌 Nachricht gepinnt!');
|
|
1276
|
+
}
|
|
1277
|
+
} catch (error) {
|
|
1278
|
+
console.error('❌ Pin Fehler:', error.message);
|
|
1279
|
+
await this.bot.sendReply(msg, '❌ Pin nicht verfügbar');
|
|
1280
|
+
}
|
|
1281
|
+
break;
|
|
1282
|
+
|
|
1283
|
+
case 'star':
|
|
1284
|
+
try {
|
|
1285
|
+
await msg.star();
|
|
1286
|
+
await this.bot.sendReply(msg, '⭐ Nachricht markiert!');
|
|
1287
|
+
} catch (error) {
|
|
1288
|
+
console.error('❌ Star Fehler:', error.message);
|
|
1289
|
+
await this.bot.sendReply(msg, '❌ Star nicht verfügbar');
|
|
1290
|
+
}
|
|
1291
|
+
break;
|
|
1292
|
+
|
|
1293
|
+
case 'quote':
|
|
1294
|
+
try {
|
|
1295
|
+
await msg.quote(action.value);
|
|
1296
|
+
} catch (error) {
|
|
1297
|
+
console.error('❌ Quote Fehler:', error.message);
|
|
1298
|
+
await this.bot.sendReply(msg, '❌ Quote nicht verfügbar');
|
|
1299
|
+
}
|
|
1300
|
+
break;
|
|
1301
|
+
|
|
1302
|
+
case 'buttons':
|
|
1303
|
+
try {
|
|
1304
|
+
await msg.sendButtons(action.value.text, action.value.buttons, action.value.footer);
|
|
1305
|
+
} catch (error) {
|
|
1306
|
+
console.error('❌ Buttons Fehler:', error.message);
|
|
1307
|
+
await this.bot.sendReply(msg, '❌ Buttons nicht verfügbar');
|
|
1308
|
+
}
|
|
1309
|
+
break;
|
|
1310
|
+
|
|
1311
|
+
case 'list':
|
|
1312
|
+
try {
|
|
1313
|
+
await msg.sendList(action.value.title, action.value.description, action.value.buttonText, action.value.sections);
|
|
1314
|
+
} catch (error) {
|
|
1315
|
+
console.error('❌ List Fehler:', error.message);
|
|
1316
|
+
await this.bot.sendReply(msg, '❌ List nicht verfügbar');
|
|
1317
|
+
}
|
|
1318
|
+
break;
|
|
1319
|
+
|
|
1320
|
+
case 'groupInfo':
|
|
1321
|
+
try {
|
|
1322
|
+
if (!msg.isGroup) {
|
|
1323
|
+
await this.bot.sendReply(msg, '❌ Nur in Gruppen verfügbar!');
|
|
1324
|
+
} else {
|
|
1325
|
+
const metadata = await this.bot.client.get.GroupMetadata(msg.from);
|
|
1326
|
+
let info = `🏢 **Gruppeninfo**\n\n`;
|
|
1327
|
+
info += `📝 Name: ${metadata.subject}\n`;
|
|
1328
|
+
info += `👥 Mitglieder: ${metadata.participants.length}\n`;
|
|
1329
|
+
info += `👑 Admins: ${metadata.participants.filter(p => p.admin).length}\n`;
|
|
1330
|
+
info += `📅 Erstellt: ${new Date(metadata.creation * 1000).toLocaleDateString()}\n`;
|
|
1331
|
+
if (metadata.desc) info += `📄 Beschreibung: ${metadata.desc}\n`;
|
|
1332
|
+
await this.bot.sendReply(msg, info);
|
|
1333
|
+
}
|
|
1334
|
+
} catch (error) {
|
|
1335
|
+
console.error('❌ Group Info Fehler:', error.message);
|
|
1336
|
+
await this.bot.sendReply(msg, '❌ Group Info nicht verfügbar');
|
|
1337
|
+
}
|
|
1338
|
+
break;
|
|
1339
|
+
|
|
1340
|
+
case 'inviteLink':
|
|
1341
|
+
try {
|
|
1342
|
+
if (!msg.isGroup) {
|
|
1343
|
+
await this.bot.sendReply(msg, '❌ Nur in Gruppen verfügbar!');
|
|
1344
|
+
} else if (!(await msg.isAdmin())) {
|
|
1345
|
+
await this.bot.sendReply(msg, '❌ Nur Admins können Einladungslinks erstellen!');
|
|
1346
|
+
} else {
|
|
1347
|
+
const inviteLink = await this.bot.client.group.getInviteLink(msg.from);
|
|
1348
|
+
await this.bot.sendReply(msg, `🔗 **Einladungslink:**\n${inviteLink}`);
|
|
1349
|
+
}
|
|
1350
|
+
} catch (error) {
|
|
1351
|
+
console.error('❌ Invite Link Fehler:', error.message);
|
|
1352
|
+
await this.bot.sendReply(msg, '❌ Invite Link nicht verfügbar');
|
|
1353
|
+
}
|
|
1354
|
+
break;
|
|
1355
|
+
|
|
1356
|
+
case 'block':
|
|
1357
|
+
try {
|
|
1358
|
+
const mentions = msg.getMentions();
|
|
1359
|
+
const targetJid = mentions.length > 0 ? mentions[0] : msg.getSender();
|
|
1360
|
+
await this.bot.client.privacy.block(targetJid);
|
|
1361
|
+
await this.bot.sendReply(msg, '🚫 User blockiert!');
|
|
1362
|
+
} catch (error) {
|
|
1363
|
+
console.error('❌ Block Fehler:', error.message);
|
|
1364
|
+
await this.bot.sendReply(msg, '❌ Block nicht verfügbar');
|
|
1365
|
+
}
|
|
1366
|
+
break;
|
|
1367
|
+
|
|
1368
|
+
case 'unblock':
|
|
1369
|
+
try {
|
|
1370
|
+
const mentions = msg.getMentions();
|
|
1371
|
+
const targetJid = mentions.length > 0 ? mentions[0] : msg.getSender();
|
|
1372
|
+
await this.bot.client.privacy.unblock(targetJid);
|
|
1373
|
+
await this.bot.sendReply(msg, '✅ User entblockiert!');
|
|
1374
|
+
} catch (error) {
|
|
1375
|
+
console.error('❌ Unblock Fehler:', error.message);
|
|
1376
|
+
await this.bot.sendReply(msg, '❌ Unblock nicht verfügbar');
|
|
1377
|
+
}
|
|
1378
|
+
break;
|
|
1379
|
+
|
|
1380
|
+
case 'checkOnline':
|
|
1381
|
+
try {
|
|
1382
|
+
const mentions = msg.getMentions();
|
|
1383
|
+
const targetJid = mentions.length > 0 ? mentions[0] : msg.getSender();
|
|
1384
|
+
const isOnline = await this.bot.client.analytics.isOnline(targetJid);
|
|
1385
|
+
const userNumber = targetJid.split('@')[0].split(':')[0];
|
|
1386
|
+
await this.bot.sendReply(msg, `📱 +${userNumber} ist ${isOnline ? 'ONLINE 🟢' : 'OFFLINE 🔴'}`);
|
|
1387
|
+
} catch (error) {
|
|
1388
|
+
console.error('❌ Online Check Fehler:', error.message);
|
|
1389
|
+
await this.bot.sendReply(msg, '❌ Online Check nicht verfügbar');
|
|
1390
|
+
}
|
|
1391
|
+
break;
|
|
1392
|
+
|
|
1393
|
+
case 'archive':
|
|
1394
|
+
try {
|
|
1395
|
+
await this.bot.client.analytics.archiveChat(msg.from);
|
|
1396
|
+
await this.bot.sendReply(msg, '📦 Chat archiviert!');
|
|
1397
|
+
} catch (error) {
|
|
1398
|
+
console.error('❌ Archive Fehler:', error.message);
|
|
1399
|
+
await this.bot.sendReply(msg, '❌ Archive nicht verfügbar');
|
|
1400
|
+
}
|
|
1401
|
+
break;
|
|
1402
|
+
|
|
1403
|
+
case 'mute':
|
|
1404
|
+
try {
|
|
1405
|
+
await this.bot.client.analytics.muteChat(msg.from, action.value);
|
|
1406
|
+
await this.bot.sendReply(msg, `🔇 Chat für ${Math.round(action.value / 60000)} Minuten stummgeschaltet!`);
|
|
1407
|
+
} catch (error) {
|
|
1408
|
+
console.error('❌ Mute Fehler:', error.message);
|
|
1409
|
+
await this.bot.sendReply(msg, '❌ Mute nicht verfügbar');
|
|
1410
|
+
}
|
|
1411
|
+
break;
|
|
1412
|
+
|
|
1413
|
+
case 'sendStatus':
|
|
1414
|
+
try {
|
|
1415
|
+
await this.bot.client.status.send('text', action.value.text, action.value.options);
|
|
1416
|
+
await this.bot.sendReply(msg, `📢 Status gesendet: "${action.value.text}"`);
|
|
1417
|
+
} catch (error) {
|
|
1418
|
+
console.error('❌ Status Fehler:', error.message);
|
|
1419
|
+
await this.bot.sendReply(msg, '❌ Status nicht verfügbar');
|
|
1420
|
+
}
|
|
1421
|
+
break;
|
|
1422
|
+
|
|
1423
|
+
case 'backup':
|
|
1424
|
+
try {
|
|
1425
|
+
await this.bot.sendReply(msg, '💾 Erstelle Backup...');
|
|
1426
|
+
const backup = await this.bot.client.system.backup();
|
|
1427
|
+
await this.bot.sendReply(msg, `✅ Backup erstellt! Timestamp: ${backup.timestamp}`);
|
|
1428
|
+
} catch (error) {
|
|
1429
|
+
console.error('❌ Backup Fehler:', error.message);
|
|
1430
|
+
await this.bot.sendReply(msg, '❌ Backup nicht verfügbar');
|
|
1431
|
+
}
|
|
1432
|
+
break;
|
|
1087
1433
|
|
|
1088
1434
|
case 'crypto':
|
|
1089
1435
|
try {
|
|
@@ -1252,10 +1598,7 @@ class EasyRule {
|
|
|
1252
1598
|
}
|
|
1253
1599
|
break;
|
|
1254
1600
|
|
|
1255
|
-
|
|
1256
|
-
// Implementierung für mentionUser
|
|
1257
|
-
await this.bot.sendReply(msg, action.value.text);
|
|
1258
|
-
break;
|
|
1601
|
+
|
|
1259
1602
|
|
|
1260
1603
|
case 'delete':
|
|
1261
1604
|
// Implementierung für delete
|
package/src/index.js
CHANGED
|
@@ -12,6 +12,19 @@ export { EasyBot, createBot, createMultiBot, quickBot, bot, multiBot } from "./e
|
|
|
12
12
|
export { generateQRCode } from "./qr.js";
|
|
13
13
|
export { Message } from "./message.js";
|
|
14
14
|
|
|
15
|
+
// ===== ADVANCED FEATURES EXPORTS - NEU! =====
|
|
16
|
+
export {
|
|
17
|
+
AdvancedMessage,
|
|
18
|
+
AdvancedGroup,
|
|
19
|
+
AdvancedPrivacy,
|
|
20
|
+
AdvancedAnalytics,
|
|
21
|
+
AdvancedStatus,
|
|
22
|
+
AdvancedBusiness,
|
|
23
|
+
AdvancedSystem
|
|
24
|
+
} from "./advanced-features.js";
|
|
25
|
+
|
|
26
|
+
export { EasyAdvanced, EasyAdvancedRule } from "./easy-advanced.js";
|
|
27
|
+
|
|
15
28
|
// NEUE ROBUSTE FACTORY METHODS - NEU!
|
|
16
29
|
export const createRobustBot = () => EasyBot.createRobust();
|
|
17
30
|
export const createUltraRobustBot = () => EasyBot.createRobust().enableUltraRobust();
|
package/src/message.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Message-Klasse mit deinen eigenen Funktionen
|
|
2
2
|
import { getStorage } from "./storage.js";
|
|
3
3
|
import { StickerCreator } from "./sticker-creator.js";
|
|
4
|
+
import { AdvancedMessage, AdvancedGroup, AdvancedPrivacy, AdvancedAnalytics, AdvancedStatus, AdvancedBusiness, AdvancedSystem } from "./advanced-features.js";
|
|
4
5
|
|
|
5
6
|
export class Message {
|
|
6
7
|
constructor(client, data) {
|
|
@@ -36,6 +37,24 @@ export class Message {
|
|
|
36
37
|
}
|
|
37
38
|
}
|
|
38
39
|
};
|
|
40
|
+
|
|
41
|
+
// ===== ADVANCED FEATURES INTEGRATION - NEU! =====
|
|
42
|
+
this.advanced = new AdvancedMessage(this);
|
|
43
|
+
this.forward = this.advanced.forwardMessage.bind(this.advanced);
|
|
44
|
+
this.forwardToMentioned = this.advanced.forwardToMentioned.bind(this.advanced);
|
|
45
|
+
this.forwardToSender = this.advanced.forwardToSender.bind(this.advanced);
|
|
46
|
+
this.edit = this.advanced.editMessage.bind(this.advanced);
|
|
47
|
+
this.pin = this.advanced.pinMessage.bind(this.advanced);
|
|
48
|
+
this.unpin = this.advanced.unpinMessage.bind(this.advanced);
|
|
49
|
+
this.star = this.advanced.starMessage.bind(this.advanced);
|
|
50
|
+
this.unstar = this.advanced.unstarMessage.bind(this.advanced);
|
|
51
|
+
this.replyTo = this.advanced.replyToMessage.bind(this.advanced);
|
|
52
|
+
this.replyToSender = this.advanced.replyToSender.bind(this.advanced);
|
|
53
|
+
this.quote = this.advanced.quoteMessage.bind(this.advanced);
|
|
54
|
+
this.sendButtons = this.advanced.sendButtonMessage.bind(this.advanced);
|
|
55
|
+
this.sendList = this.advanced.sendListMessage.bind(this.advanced);
|
|
56
|
+
this.sendTemplate = this.advanced.sendTemplateMessage.bind(this.advanced);
|
|
57
|
+
this.sendCarousel = this.advanced.sendCarouselMessage.bind(this.advanced);
|
|
39
58
|
}
|
|
40
59
|
|
|
41
60
|
// ===== REPLY FUNCTIONS =====
|
|
@@ -99,6 +118,39 @@ export class Message {
|
|
|
99
118
|
});
|
|
100
119
|
}
|
|
101
120
|
|
|
121
|
+
// ===== PROFILE PICTURE FUNCTIONS - NEU! =====
|
|
122
|
+
|
|
123
|
+
async getProfilePicture(jid) {
|
|
124
|
+
try {
|
|
125
|
+
// Baileys Funktion für Profilbild-URL
|
|
126
|
+
const profilePicUrl = await this.client.socket.profilePictureUrl(jid, 'image');
|
|
127
|
+
return profilePicUrl;
|
|
128
|
+
} catch (error) {
|
|
129
|
+
// Fallback: Kein Profilbild verfügbar
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
async sendProfilePicture(jid, caption = "") {
|
|
135
|
+
try {
|
|
136
|
+
const profilePicUrl = await this.getProfilePicture(jid);
|
|
137
|
+
|
|
138
|
+
if (!profilePicUrl) {
|
|
139
|
+
await this.reply(`❌ Kein Profilbild für diesen User verfügbar.`);
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// Profilbild als Bild senden
|
|
144
|
+
await this.sendImage(profilePicUrl, caption);
|
|
145
|
+
return true;
|
|
146
|
+
|
|
147
|
+
} catch (error) {
|
|
148
|
+
console.error('❌ Fehler beim Senden des Profilbilds:', error);
|
|
149
|
+
await this.reply(`❌ Fehler beim Laden des Profilbilds: ${error.message}`);
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
102
154
|
async sendAudio(audioPath) {
|
|
103
155
|
return await this.client.socket.sendMessage(this.from, {
|
|
104
156
|
audio: { url: audioPath },
|
|
@@ -133,6 +185,147 @@ export class Message {
|
|
|
133
185
|
return await this.client.socket.sendMessage(this.from, message);
|
|
134
186
|
}
|
|
135
187
|
|
|
188
|
+
// ===== ADVANCED MEDIA FEATURES - NEU! =====
|
|
189
|
+
|
|
190
|
+
async sendVoiceMessage(audioPath, mentions = []) {
|
|
191
|
+
const message = {
|
|
192
|
+
audio: { url: audioPath },
|
|
193
|
+
mimetype: 'audio/ogg; codecs=opus',
|
|
194
|
+
ptt: true // Push-to-talk (Voice Message)
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
if (mentions.length > 0) {
|
|
198
|
+
message.mentions = mentions;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
return await this.client.socket.sendMessage(this.from, message);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
async sendVoiceToMentioned(audioPath) {
|
|
205
|
+
const mentions = this.getMentions();
|
|
206
|
+
if (mentions.length === 0) {
|
|
207
|
+
return await this.sendVoiceMessage(audioPath);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
const results = [];
|
|
211
|
+
for (const jid of mentions) {
|
|
212
|
+
try {
|
|
213
|
+
const result = await this.client.socket.sendMessage(jid, {
|
|
214
|
+
audio: { url: audioPath },
|
|
215
|
+
mimetype: 'audio/ogg; codecs=opus',
|
|
216
|
+
ptt: true
|
|
217
|
+
});
|
|
218
|
+
results.push({ jid, success: true, result });
|
|
219
|
+
} catch (error) {
|
|
220
|
+
results.push({ jid, success: false, error: error.message });
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
return results;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
async sendVideoMessage(videoPath, mentions = []) {
|
|
227
|
+
const message = {
|
|
228
|
+
video: { url: videoPath },
|
|
229
|
+
ptv: true, // Push-to-view (Video Message)
|
|
230
|
+
mimetype: 'video/mp4'
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
if (mentions.length > 0) {
|
|
234
|
+
message.mentions = mentions;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
return await this.client.socket.sendMessage(this.from, message);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
async sendVideoMessageToMentioned(videoPath) {
|
|
241
|
+
const mentions = this.getMentions();
|
|
242
|
+
if (mentions.length === 0) {
|
|
243
|
+
return await this.sendVideoMessage(videoPath);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
const results = [];
|
|
247
|
+
for (const jid of mentions) {
|
|
248
|
+
try {
|
|
249
|
+
const result = await this.client.socket.sendMessage(jid, {
|
|
250
|
+
video: { url: videoPath },
|
|
251
|
+
ptv: true,
|
|
252
|
+
mimetype: 'video/mp4'
|
|
253
|
+
});
|
|
254
|
+
results.push({ jid, success: true, result });
|
|
255
|
+
} catch (error) {
|
|
256
|
+
results.push({ jid, success: false, error: error.message });
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
return results;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
async sendGif(gifPath, caption = "", mentions = []) {
|
|
263
|
+
const message = {
|
|
264
|
+
video: { url: gifPath },
|
|
265
|
+
caption: caption,
|
|
266
|
+
gifPlayback: true,
|
|
267
|
+
mimetype: 'video/mp4'
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
if (mentions.length > 0) {
|
|
271
|
+
message.mentions = mentions;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
return await this.client.socket.sendMessage(this.from, message);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
async sendGifToMentioned(gifPath, caption = "") {
|
|
278
|
+
const mentions = this.getMentions();
|
|
279
|
+
if (mentions.length === 0) {
|
|
280
|
+
return await this.sendGif(gifPath, caption);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
const results = [];
|
|
284
|
+
for (const jid of mentions) {
|
|
285
|
+
try {
|
|
286
|
+
const result = await this.client.socket.sendMessage(jid, {
|
|
287
|
+
video: { url: gifPath },
|
|
288
|
+
caption: caption,
|
|
289
|
+
gifPlayback: true,
|
|
290
|
+
mimetype: 'video/mp4'
|
|
291
|
+
});
|
|
292
|
+
results.push({ jid, success: true, result });
|
|
293
|
+
} catch (error) {
|
|
294
|
+
results.push({ jid, success: false, error: error.message });
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
return results;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
async sendVideoWithThumbnail(videoPath, thumbnailPath, caption = "", mentions = []) {
|
|
301
|
+
const message = {
|
|
302
|
+
video: { url: videoPath },
|
|
303
|
+
caption: caption,
|
|
304
|
+
jpegThumbnail: thumbnailPath,
|
|
305
|
+
mimetype: 'video/mp4'
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
if (mentions.length > 0) {
|
|
309
|
+
message.mentions = mentions;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
return await this.client.socket.sendMessage(this.from, message);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
async sendImageWithThumbnail(imagePath, thumbnailPath, caption = "", mentions = []) {
|
|
316
|
+
const message = {
|
|
317
|
+
image: { url: imagePath },
|
|
318
|
+
caption: caption,
|
|
319
|
+
jpegThumbnail: thumbnailPath
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
if (mentions.length > 0) {
|
|
323
|
+
message.mentions = mentions;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
return await this.client.socket.sendMessage(this.from, message);
|
|
327
|
+
}
|
|
328
|
+
|
|
136
329
|
async sendLocation(latitude, longitude) {
|
|
137
330
|
return await this.client.socket.sendMessage(this.from, {
|
|
138
331
|
location: {
|
package/src/multi-client.js
CHANGED
|
@@ -16,6 +16,7 @@ export class MultiWhatsAppClient {
|
|
|
16
16
|
heartbeatInterval: options.heartbeatInterval || 20000,
|
|
17
17
|
connectionTimeout: options.connectionTimeout || 180000,
|
|
18
18
|
keepAlive: options.keepAlive !== false,
|
|
19
|
+
quietHeartbeat: options.quietHeartbeat !== false, // Heartbeat-Spam deaktivieren
|
|
19
20
|
...options
|
|
20
21
|
});
|
|
21
22
|
|