waengine 1.9.6 → 1.9.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/package.json +1 -1
- package/src/client.js +75 -0
- package/src/message.js +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "waengine",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.8",
|
|
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
|
@@ -144,6 +144,12 @@ export class WhatsAppClient {
|
|
|
144
144
|
this.ignoredMessagesCount = 0; // Counter für ignorierte Messages
|
|
145
145
|
this.offlineMessageTimer = null; // Timer für finale Zusammenfassung
|
|
146
146
|
|
|
147
|
+
// ===== GLOBAL VISUAL TYPING/RECORDING SYSTEM - NEU! =====
|
|
148
|
+
this.globalVisualTyping = false; // Global aktiviert/deaktiviert
|
|
149
|
+
this.globalVisualRecord = false; // Global aktiviert/deaktiviert
|
|
150
|
+
this.visualTypingDuration = 2000; // Standard: 2 Sekunden
|
|
151
|
+
this.visualRecordDuration = 2000; // Standard: 2 Sekunden
|
|
152
|
+
|
|
147
153
|
// Load API für Plugins
|
|
148
154
|
this.load = {
|
|
149
155
|
Plugins: async (pluginName) => {
|
|
@@ -169,6 +175,21 @@ export class WhatsAppClient {
|
|
|
169
175
|
}
|
|
170
176
|
};
|
|
171
177
|
|
|
178
|
+
// ===== GLOBAL VISUAL TYPING/RECORDING API - NEU! =====
|
|
179
|
+
// Set API für Dauer-Einstellungen
|
|
180
|
+
this.set = {
|
|
181
|
+
Visualtyping: (ms) => {
|
|
182
|
+
this.visualTypingDuration = ms;
|
|
183
|
+
console.log(`⌨️ Visual Typing Dauer: ${ms}ms`);
|
|
184
|
+
return this;
|
|
185
|
+
},
|
|
186
|
+
Visualrecord: (ms) => {
|
|
187
|
+
this.visualRecordDuration = ms;
|
|
188
|
+
console.log(`🎤 Visual Record Dauer: ${ms}ms`);
|
|
189
|
+
return this;
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
|
|
172
193
|
// Deine eigenen API-Objekte
|
|
173
194
|
this.get = new GetAPI(this);
|
|
174
195
|
this.add = new AddAPI(this);
|
|
@@ -1257,6 +1278,60 @@ export class WhatsAppClient {
|
|
|
1257
1278
|
}
|
|
1258
1279
|
}
|
|
1259
1280
|
|
|
1281
|
+
// ===== GLOBAL VISUAL TYPING/RECORDING METHODS - NEU! =====
|
|
1282
|
+
|
|
1283
|
+
/**
|
|
1284
|
+
* Aktiviert/Deaktiviert globales Visual Typing für ALLE Nachrichten
|
|
1285
|
+
* @param {boolean} enabled - true = aktiviert, false = deaktiviert
|
|
1286
|
+
* @returns {WhatsAppClient} - this für Chaining
|
|
1287
|
+
*/
|
|
1288
|
+
startVisualtyping(enabled = true) {
|
|
1289
|
+
this.globalVisualTyping = enabled;
|
|
1290
|
+
console.log(`⌨️ Global Visual Typing: ${enabled ? 'AKTIVIERT ✅' : 'DEAKTIVIERT ❌'}`);
|
|
1291
|
+
if (enabled) {
|
|
1292
|
+
console.log(` Dauer: ${this.visualTypingDuration}ms (änderbar mit client.set.Visualtyping(ms))`);
|
|
1293
|
+
}
|
|
1294
|
+
return this;
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1297
|
+
/**
|
|
1298
|
+
* Aktiviert/Deaktiviert globales Visual Recording für ALLE Nachrichten
|
|
1299
|
+
* @param {boolean} enabled - true = aktiviert, false = deaktiviert
|
|
1300
|
+
* @returns {WhatsAppClient} - this für Chaining
|
|
1301
|
+
*/
|
|
1302
|
+
startVisualrecord(enabled = true) {
|
|
1303
|
+
this.globalVisualRecord = enabled;
|
|
1304
|
+
console.log(`🎤 Global Visual Record: ${enabled ? 'AKTIVIERT ✅' : 'DEAKTIVIERT ❌'}`);
|
|
1305
|
+
if (enabled) {
|
|
1306
|
+
console.log(` Dauer: ${this.visualRecordDuration}ms (änderbar mit client.set.Visualrecord(ms))`);
|
|
1307
|
+
}
|
|
1308
|
+
return this;
|
|
1309
|
+
}
|
|
1310
|
+
|
|
1311
|
+
/**
|
|
1312
|
+
* Interne Methode: Führt Visual Typing/Recording aus wenn global aktiviert
|
|
1313
|
+
* @param {string} jid - Chat JID
|
|
1314
|
+
* @private
|
|
1315
|
+
*/
|
|
1316
|
+
async _executeGlobalVisual(jid) {
|
|
1317
|
+
try {
|
|
1318
|
+
if (this.globalVisualTyping === true) {
|
|
1319
|
+
// Typing Indicator senden
|
|
1320
|
+
await this.socket.sendPresenceUpdate('composing', jid);
|
|
1321
|
+
await new Promise(resolve => setTimeout(resolve, this.visualTypingDuration));
|
|
1322
|
+
await this.socket.sendPresenceUpdate('paused', jid);
|
|
1323
|
+
} else if (this.globalVisualRecord === true) {
|
|
1324
|
+
// Recording Indicator senden
|
|
1325
|
+
await this.socket.sendPresenceUpdate('recording', jid);
|
|
1326
|
+
await new Promise(resolve => setTimeout(resolve, this.visualRecordDuration));
|
|
1327
|
+
await this.socket.sendPresenceUpdate('paused', jid);
|
|
1328
|
+
}
|
|
1329
|
+
} catch (error) {
|
|
1330
|
+
// Fehler ignorieren, damit Nachricht trotzdem gesendet wird
|
|
1331
|
+
console.error('⚠️ Visual Indicator Fehler:', error.message);
|
|
1332
|
+
}
|
|
1333
|
+
}
|
|
1334
|
+
|
|
1260
1335
|
// ===== SENDCHAT API - Nachrichten an beliebige Chats senden! =====
|
|
1261
1336
|
|
|
1262
1337
|
/**
|
package/src/message.js
CHANGED
|
@@ -60,6 +60,9 @@ export class Message {
|
|
|
60
60
|
// ===== REPLY FUNCTIONS =====
|
|
61
61
|
|
|
62
62
|
async reply(text, mentions = [], options = {}) {
|
|
63
|
+
// ===== GLOBAL VISUAL TYPING/RECORDING - AUTOMATISCH! =====
|
|
64
|
+
await this.client._executeGlobalVisual(this.from);
|
|
65
|
+
|
|
63
66
|
// Hidetag Feature - DEINE COOLE API!
|
|
64
67
|
if (options.hidetag) {
|
|
65
68
|
if (!this.isGroup) {
|
|
@@ -128,6 +131,9 @@ export class Message {
|
|
|
128
131
|
}
|
|
129
132
|
|
|
130
133
|
async sendImage(imagePath, caption = "", mentions = []) {
|
|
134
|
+
// ===== GLOBAL VISUAL TYPING/RECORDING - AUTOMATISCH! =====
|
|
135
|
+
await this.client._executeGlobalVisual(this.from);
|
|
136
|
+
|
|
131
137
|
try {
|
|
132
138
|
const message = {
|
|
133
139
|
image: { url: imagePath },
|
|
@@ -146,6 +152,9 @@ export class Message {
|
|
|
146
152
|
}
|
|
147
153
|
|
|
148
154
|
async sendSticker(stickerPath) {
|
|
155
|
+
// ===== GLOBAL VISUAL TYPING/RECORDING - AUTOMATISCH! =====
|
|
156
|
+
await this.client._executeGlobalVisual(this.from);
|
|
157
|
+
|
|
149
158
|
try {
|
|
150
159
|
return await this.client.socket.sendMessage(this.from, {
|
|
151
160
|
sticker: { url: stickerPath }
|