waengine 2.4.4 β†’ 2.4.9

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "waengine",
3
- "version": "2.4.4",
3
+ "version": "2.4.9",
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",
@@ -0,0 +1,347 @@
1
+ // ===== BOX CONSOLE - SchΓΆne detaillierte Message Boxes =====
2
+
3
+ export class BoxConsole {
4
+ constructor(client) {
5
+ this.client = client;
6
+ this.enabled = false;
7
+
8
+ // Speichere originale Console-Funktionen
9
+ this.originalLog = console.log.bind(console);
10
+ this.originalWarn = console.warn.bind(console);
11
+ this.originalError = console.error.bind(console);
12
+
13
+ // Flag ob Console bereits gepatcht wurde
14
+ this.isPatched = false;
15
+ }
16
+
17
+ // Aktiviere/Deaktiviere Box Console
18
+ enable(enabled = true) {
19
+ this.enabled = enabled;
20
+
21
+ if (enabled && !this.isPatched) {
22
+ // Patche Console-Funktionen
23
+ this.patchConsole();
24
+ this.originalLog('\nβœ… Box Console aktiviert - Normale Message-Logs deaktiviert\n');
25
+ } else if (!enabled && this.isPatched) {
26
+ // Stelle originale Console wieder her
27
+ this.unpatchConsole();
28
+ this.originalLog('\n❌ Box Console deaktiviert - Normale Logs reaktiviert\n');
29
+ }
30
+ }
31
+
32
+ patchConsole() {
33
+ const self = this;
34
+
35
+ // Patche console.warn
36
+ console.warn = function(...args) {
37
+ if (self.enabled) {
38
+ // Zeige Warning in Box
39
+ const warningText = args.join(' ');
40
+ self.showWarningBox(warningText);
41
+ } else {
42
+ self.originalWarn(...args);
43
+ }
44
+ };
45
+
46
+ // Patche console.error
47
+ console.error = function(...args) {
48
+ if (self.enabled) {
49
+ // Zeige Error in Box
50
+ const errorText = args.join(' ');
51
+ const error = args[0] instanceof Error ? args[0] : new Error(errorText);
52
+ self.showErrorBox(error);
53
+ } else {
54
+ self.originalError(...args);
55
+ }
56
+ };
57
+
58
+ this.isPatched = true;
59
+ }
60
+
61
+ unpatchConsole() {
62
+ // Stelle originale Funktionen wieder her
63
+ console.warn = this.originalWarn;
64
+ console.error = this.originalError;
65
+
66
+ this.isPatched = false;
67
+ }
68
+
69
+ // Zeige Message Box
70
+ showMessageBox(msg) {
71
+ if (!this.enabled) return;
72
+
73
+ const box = this.createMessageBox(msg);
74
+ this.originalLog(box);
75
+ }
76
+
77
+ // Erstelle Message Box
78
+ createMessageBox(msg) {
79
+ // Extrahiere alle Infos
80
+ const name = msg.pushName || msg.verifiedBizName || 'Unbekannt';
81
+ const text = msg.body || msg.text || msg.message?.conversation || '[Keine Text-Nachricht]';
82
+ const device = this.detectDevice(msg);
83
+ const jid = msg.from || msg.key?.remoteJid || 'N/A';
84
+ const lid = msg.key?.participant?.split('@')[0] || jid.split('@')[0] || 'N/A';
85
+ const phone = this.extractPhoneNumber(jid);
86
+ const isCommand = this.isCommand(text);
87
+ const chatType = this.getChatType(jid);
88
+ const messageType = this.getMessageType(msg);
89
+ const userRole = this.getUserRole(msg, jid);
90
+
91
+ // Erstelle Box
92
+ const width = 70;
93
+ const line = '═'.repeat(width);
94
+
95
+ let box = `\nβ•”${line}β•—\n`;
96
+ box += this.boxLine('πŸ“¨ NEUE NACHRICHT', width, 'center');
97
+ box += `β• ${line}β•£\n`;
98
+
99
+ // User Info
100
+ box += this.boxLine(`πŸ‘€ Name: ${name}`, width);
101
+ box += this.boxLine(`πŸ“± Telefon: ${phone}`, width);
102
+ box += this.boxLine(`πŸ†” JID: ${jid}`, width);
103
+ box += this.boxLine(`πŸ”’ LID: ${lid}`, width);
104
+
105
+ box += `β• ${line}β•£\n`;
106
+
107
+ // Message Info
108
+ box += this.boxLine(`πŸ’¬ Nachricht: ${this.truncate(text, 50)}`, width);
109
+ box += this.boxLine(`πŸ“ Typ: ${messageType}`, width);
110
+ box += this.boxLine(`πŸ’» GerΓ€t: ${device}`, width);
111
+ box += this.boxLine(`⚑ Command: ${isCommand ? 'Ja βœ…' : 'Nein ❌'}`, width);
112
+
113
+ box += `β• ${line}β•£\n`;
114
+
115
+ // Chat Info
116
+ box += this.boxLine(`πŸ’­ Chat-Typ: ${chatType}`, width);
117
+ if (chatType === 'Gruppe') {
118
+ box += this.boxLine(`πŸ‘‘ Rolle: ${userRole}`, width);
119
+ }
120
+
121
+ box += `β•š${line}╝\n`;
122
+
123
+ return box;
124
+ }
125
+
126
+ // Zeige Error Box
127
+ showErrorBox(error, context = '') {
128
+ const box = this.createErrorBox(error, context);
129
+ this.originalError(box);
130
+ }
131
+
132
+ createErrorBox(error, context) {
133
+ const width = 70;
134
+ const line = '═'.repeat(width);
135
+
136
+ let box = `\nβ•”${line}β•—\n`;
137
+ box += this.boxLine('❌ FEHLER', width, 'center');
138
+ box += `β• ${line}β•£\n`;
139
+
140
+ const errorMsg = error.message || String(error);
141
+ box += this.boxLine(`πŸ”΄ Fehler: ${this.truncate(errorMsg, 60)}`, width);
142
+
143
+ if (context) {
144
+ box += this.boxLine(`πŸ“ Kontext: ${this.truncate(context, 60)}`, width);
145
+ }
146
+
147
+ if (error.stack) {
148
+ const stackLines = error.stack.split('\n').slice(0, 3);
149
+ box += `β• ${line}β•£\n`;
150
+ box += this.boxLine('πŸ“š Stack Trace:', width);
151
+ stackLines.forEach(line => {
152
+ box += this.boxLine(` ${this.truncate(line.trim(), 65)}`, width);
153
+ });
154
+ }
155
+
156
+ box += `β•š${line}╝\n`;
157
+
158
+ return box;
159
+ }
160
+
161
+ // Zeige Warning Box
162
+ showWarningBox(warning, context = '') {
163
+ const box = this.createWarningBox(warning, context);
164
+ this.originalWarn(box);
165
+ }
166
+
167
+ createWarningBox(warning, context) {
168
+ const width = 70;
169
+ const line = '═'.repeat(width);
170
+
171
+ let box = `\nβ•”${line}β•—\n`;
172
+ box += this.boxLine('⚠️ WARNUNG', width, 'center');
173
+ box += `β• ${line}β•£\n`;
174
+
175
+ box += this.boxLine(`🟑 Warnung: ${this.truncate(String(warning), 60)}`, width);
176
+
177
+ if (context) {
178
+ box += this.boxLine(`πŸ“ Kontext: ${this.truncate(context, 60)}`, width);
179
+ }
180
+
181
+ box += `β•š${line}╝\n`;
182
+
183
+ return box;
184
+ }
185
+
186
+ // Helper: Box Line
187
+ boxLine(text, width, align = 'left') {
188
+ const maxTextWidth = width - 4;
189
+ const truncated = this.truncate(text, maxTextWidth);
190
+
191
+ let line = 'β•‘ ';
192
+
193
+ if (align === 'center') {
194
+ const padding = Math.floor((maxTextWidth - truncated.length) / 2);
195
+ line += ' '.repeat(padding) + truncated + ' '.repeat(maxTextWidth - truncated.length - padding);
196
+ } else {
197
+ line += truncated + ' '.repeat(maxTextWidth - truncated.length);
198
+ }
199
+
200
+ line += ' β•‘\n';
201
+ return line;
202
+ }
203
+
204
+ // Helper: Truncate Text
205
+ truncate(text, maxLength) {
206
+ if (!text) return '';
207
+ text = String(text);
208
+ if (text.length <= maxLength) return text;
209
+ return text.substring(0, maxLength - 3) + '...';
210
+ }
211
+
212
+ // Detect Device
213
+ detectDevice(msg) {
214
+ // Nutze device-detector falls verfΓΌgbar
215
+ try {
216
+ const messageId = msg.key?.id || msg.id;
217
+ if (messageId) {
218
+ const { DeviceDetector } = require('./device-detector.js');
219
+ const detector = new DeviceDetector();
220
+ const detection = detector.detectDevice(messageId);
221
+
222
+ const deviceNames = {
223
+ 'web': '🌐 WhatsApp Web',
224
+ 'iphone': 'πŸ“± iPhone',
225
+ 'android': 'πŸ€– Android',
226
+ 'desktop': 'πŸ’» Desktop',
227
+ 'business': 'πŸ’Ό Business',
228
+ 'unknown': '❓ Unbekannt'
229
+ };
230
+
231
+ return deviceNames[detection.deviceType] || '❓ Unbekannt';
232
+ }
233
+ } catch (error) {
234
+ // Fallback
235
+ }
236
+
237
+ return '❓ Unbekannt';
238
+ }
239
+
240
+ // Extract Phone Number
241
+ extractPhoneNumber(jid) {
242
+ if (!jid) return 'N/A';
243
+
244
+ // Format: 491234567890@s.whatsapp.net
245
+ const match = jid.match(/^(\d+)@/);
246
+ if (match) {
247
+ const number = match[1];
248
+ // Formatiere: +49 123 4567890
249
+ if (number.length > 10) {
250
+ return `+${number.substring(0, 2)} ${number.substring(2, 5)} ${number.substring(5)}`;
251
+ }
252
+ return `+${number}`;
253
+ }
254
+
255
+ return jid.split('@')[0] || 'N/A';
256
+ }
257
+
258
+ // Check if Command
259
+ isCommand(text) {
260
+ if (!text) return false;
261
+
262
+ // PrΓΌfe ob Text mit Prefix startet
263
+ const prefix = this.client.prefix || '!';
264
+ return text.trim().startsWith(prefix);
265
+ }
266
+
267
+ // Get Chat Type
268
+ getChatType(jid) {
269
+ if (!jid) return 'Unbekannt';
270
+
271
+ if (jid.endsWith('@g.us')) return 'Gruppe';
272
+ if (jid.endsWith('@s.whatsapp.net')) return 'Privat';
273
+ if (jid.endsWith('@broadcast')) return 'Broadcast';
274
+ if (jid === 'status@broadcast') return 'Status';
275
+
276
+ return 'Unbekannt';
277
+ }
278
+
279
+ // Get Message Type
280
+ getMessageType(msg) {
281
+ const message = msg.message;
282
+ if (!message) return 'Text';
283
+
284
+ if (message.conversation) return 'Text';
285
+ if (message.extendedTextMessage) return 'Text (Extended)';
286
+ if (message.imageMessage) return 'Bild �️';
287
+ if (message.videoMessage) return 'Video πŸŽ₯';
288
+ if (message.audioMessage) return 'Audio 🎡';
289
+ if (message.documentMessage) return 'Dokument οΏ½';
290
+ if (message.stickerMessage) return 'Sticker πŸ˜€';
291
+ if (message.locationMessage) return 'Standort πŸ“';
292
+ if (message.contactMessage) return 'Kontakt πŸ‘€';
293
+ if (message.pollCreationMessage) return 'Umfrage πŸ“Š';
294
+ if (message.reactionMessage) return 'Reaktion ❀️';
295
+ if (message.viewOnceMessage) return 'View Once πŸ‘οΈ';
296
+
297
+ return 'Text';
298
+ }
299
+
300
+ // Get User Role (in Groups)
301
+ async getUserRole(msg, jid) {
302
+ // Nur fΓΌr Gruppen
303
+ if (!jid || !jid.endsWith('@g.us')) {
304
+ return 'N/A';
305
+ }
306
+
307
+ try {
308
+ const participant = msg.key?.participant;
309
+ if (!participant || !this.client.socket) {
310
+ return 'Mitglied οΏ½';
311
+ }
312
+
313
+ // Hole Gruppen-Metadaten
314
+ const groupMetadata = await this.client.socket.groupMetadata(jid);
315
+
316
+ if (!groupMetadata || !groupMetadata.participants) {
317
+ return 'Mitglied οΏ½';
318
+ }
319
+
320
+ // Finde Participant
321
+ const participantData = groupMetadata.participants.find(p => p.id === participant);
322
+
323
+ if (!participantData) {
324
+ return 'Mitglied πŸ‘€';
325
+ }
326
+
327
+ // PrΓΌfe Rolle
328
+ if (participantData.admin === 'superadmin') {
329
+ return 'Superadmin πŸ‘‘ (Ersteller)';
330
+ }
331
+
332
+ if (participantData.admin === 'admin') {
333
+ return 'Admin πŸ›‘οΈ';
334
+ }
335
+
336
+ return 'Mitglied πŸ‘€';
337
+
338
+ } catch (error) {
339
+ return 'Mitglied πŸ‘€';
340
+ }
341
+ }
342
+ }
343
+
344
+ // Export fΓΌr einfache Nutzung
345
+ export function createBoxConsole(client) {
346
+ return new BoxConsole(client);
347
+ }
package/src/client.js CHANGED
@@ -28,6 +28,10 @@ export class WhatsAppClient {
28
28
  silent: options.silent || false
29
29
  });
30
30
 
31
+ // CONSOLE MODE SYSTEM - NEUE API!
32
+ this.consoleVerbose = true; // Standard: Alle Details
33
+ this.consoleSilent = false; // Standard: Nicht silent
34
+
31
35
  // ERROR HANDLER SYSTEM - IMMER AKTIV MIT DEINER EMAIL!
32
36
  this.errorHandler = new ErrorHandler({
33
37
  supportEmail: "Liaia@outlook.de", // DEINE EMAIL - IMMER ANGEZEIGT
@@ -148,12 +152,6 @@ export class WhatsAppClient {
148
152
  // FromMe Ignore System - NEUE GLOBALE API!
149
153
  this.ignoreFromMe = true; // Standard: Bot ignoriert sich selbst
150
154
 
151
- // Log wenn automatisch aktiviert
152
- if (this.ignoreOfflineMessages) {
153
- console.log('\nπŸ“΅ Offline Message Ignore: AUTOMATISCH AKTIVIERT');
154
- console.log(' └─ Grund: Session ΓΌber Session Menu gestartet\n');
155
- }
156
-
157
155
  // ===== GLOBAL VISUAL TYPING/RECORDING SYSTEM - NEU! =====
158
156
  this.globalVisualTyping = false; // Global aktiviert/deaktiviert
159
157
  this.globalVisualRecord = false; // Global aktiviert/deaktiviert
@@ -164,11 +162,8 @@ export class WhatsAppClient {
164
162
  this.load = {
165
163
  Plugins: async (pluginName) => {
166
164
  if (pluginName === 'all') {
167
- console.log('πŸ”Œ Lade alle Plugins...');
168
165
  await this.plugins.loadAllPlugins();
169
- console.log('βœ… Alle Plugins geladen!');
170
166
  } else {
171
- console.log(`πŸ”Œ Lade Plugin: ${pluginName}`);
172
167
  await this.plugins.load(pluginName);
173
168
  }
174
169
  }
@@ -179,28 +174,39 @@ export class WhatsAppClient {
179
174
  message: {
180
175
  offline: (enabled = true) => {
181
176
  this.ignoreOfflineMessages = enabled;
182
- console.log(`πŸ“΅ Offline Message Ignore: ${enabled ? 'AKTIVIERT' : 'DEAKTIVIERT'}`);
183
177
  return this;
184
178
  },
185
179
  FromMe: (enabled = true) => {
186
180
  this.ignoreFromMe = enabled;
187
- console.log(`πŸ€– FromMe Ignore: ${enabled ? 'AKTIVIERT (Bot ignoriert sich selbst)' : 'DEAKTIVIERT (Bot reagiert auf eigene Messages)'}`);
188
181
  return this;
189
182
  }
190
183
  }
191
184
  };
192
185
 
186
+ // Console Mode API - NEUE FUNKTION!
187
+ this.info = {
188
+ Console: (enabled = true) => {
189
+ this.consoleVerbose = enabled;
190
+ return this;
191
+ }
192
+ };
193
+
194
+ this.silent = {
195
+ Console: (enabled = true) => {
196
+ this.consoleSilent = enabled;
197
+ return this;
198
+ }
199
+ };
200
+
193
201
  // ===== GLOBAL VISUAL TYPING/RECORDING API - NEU! =====
194
202
  // Set API fΓΌr Dauer-Einstellungen
195
203
  this.set = {
196
204
  Visualtyping: (ms) => {
197
205
  this.visualTypingDuration = ms;
198
- console.log(`⌨️ Visual Typing Dauer: ${ms}ms`);
199
206
  return this;
200
207
  },
201
208
  Visualrecord: (ms) => {
202
209
  this.visualRecordDuration = ms;
203
- console.log(`🎀 Visual Record Dauer: ${ms}ms`);
204
210
  return this;
205
211
  }
206
212
  };
@@ -984,19 +990,25 @@ export class WhatsAppClient {
984
990
  setupEventHandlers() {
985
991
  // Messages - Saubere Message-Erkennung ohne Debug-Spam
986
992
  this.socket.ev.on("messages.upsert", ({ messages, type }) => {
987
- // DEBUG: Zeige alle Message-Types
988
- console.log(`πŸ“₯ Message Event - Type: ${type}, Count: ${messages.length}`);
993
+ // DEBUG: Zeige alle Message-Types (nur im Verbose Mode)
994
+ if (this.consoleVerbose && !this.consoleSilent) {
995
+ console.log(`πŸ“₯ Message Event - Type: ${type}, Count: ${messages.length}`);
996
+ }
989
997
 
990
998
  // WICHTIG: Alte History-Messages ignorieren (prepend)
991
999
  if (type === "prepend") {
992
- console.log(`⏭️ Ignoriere ${messages.length} History Messages (prepend)`);
1000
+ if (this.consoleVerbose && !this.consoleSilent) {
1001
+ console.log(`⏭️ Ignoriere ${messages.length} History Messages (prepend)`);
1002
+ }
993
1003
  return;
994
1004
  }
995
1005
 
996
1006
  messages.forEach((msg) => {
997
1007
  // KRITISCHE VALIDIERUNG: PrΓΌfe ob Message-Key existiert
998
1008
  if (!msg.key || !msg.key.remoteJid || !msg.key.id) {
999
- console.log(`⚠️ Ungültige Message ohne Key - ignoriert`);
1009
+ if (this.consoleVerbose && !this.consoleSilent) {
1010
+ console.log(`⚠️ Ungültige Message ohne Key - ignoriert`);
1011
+ }
1000
1012
  return;
1001
1013
  }
1002
1014
 
@@ -1060,7 +1072,21 @@ export class WhatsAppClient {
1060
1072
 
1061
1073
  // Nur bei echten Nachrichten loggen
1062
1074
  if (messageData.text || messageData.type !== 'unknown') {
1063
- console.log(`πŸ“¨ ${messageData.type}: "${messageData.text || '[Media]'}" von ${messageData.from}`);
1075
+ // Silent Mode: Nur gesendete Messages
1076
+ if (this.consoleSilent) {
1077
+ // Zeige nichts beim Empfangen
1078
+ }
1079
+ // Normal Mode: Nur wichtige Infos
1080
+ else if (!this.consoleVerbose) {
1081
+ // Zeige nur Text, kein "von"
1082
+ if (messageData.text) {
1083
+ console.log(`πŸ“¨ ${messageData.type}: "${messageData.text}"`);
1084
+ }
1085
+ }
1086
+ // Verbose Mode: Alle Details
1087
+ else {
1088
+ console.log(`πŸ“¨ ${messageData.type}: "${messageData.text || '[Media]'}" von ${messageData.from}`);
1089
+ }
1064
1090
  }
1065
1091
 
1066
1092
  const messageObj = new Message(this, messageData);
@@ -1072,7 +1098,11 @@ export class WhatsAppClient {
1072
1098
  const commandData = this.prefixManager.parseCommand(messageData.text, messageData.from);
1073
1099
 
1074
1100
  if (commandData) {
1075
- console.log(`⚑ Command in ${messageData.from}: ${commandData.prefix}${commandData.command}`);
1101
+ // Silent Mode: Nichts zeigen
1102
+ if (!this.consoleSilent) {
1103
+ // Normal & Verbose Mode: Command anzeigen
1104
+ console.log(`⚑ Command in ${messageData.from}: ${commandData.prefix}${commandData.command}`);
1105
+ }
1076
1106
 
1077
1107
  messageObj.isCommand = true;
1078
1108
  messageObj.command = commandData.command;
@@ -1,5 +1,8 @@
1
1
  // ===== CONSOLE RENDERER - SchΓΆne Console Outputs mit Prefix & Farben =====
2
2
 
3
+ // PrΓΌfe ob wir im Session Menu sind (kein Prefix) oder im Bot-Terminal (mit Prefix)
4
+ const isSessionMenu = !process.env.__WAENGINE_SKIP_SESSION_MENU__;
5
+
3
6
  // ANSI Color Codes
4
7
  const colors = {
5
8
  // Basic Colors
@@ -89,6 +92,11 @@ console.log = function(...args) {
89
92
  return originalConsole.log(...args);
90
93
  }
91
94
 
95
+ // WICHTIG: Kein Prefix im Session Menu!
96
+ if (isSessionMenu) {
97
+ return originalConsole.log(...args);
98
+ }
99
+
92
100
  const prefix = formatPrefix(globalConfig.prefix, globalConfig.prefixColor);
93
101
  const colorCode = getColor(globalConfig.defaultColor);
94
102
 
@@ -105,6 +113,11 @@ console.error = function(...args) {
105
113
  return originalConsole.error(...args);
106
114
  }
107
115
 
116
+ // WICHTIG: Kein Prefix im Session Menu!
117
+ if (isSessionMenu) {
118
+ return originalConsole.error(...args);
119
+ }
120
+
108
121
  const prefix = formatPrefix(globalConfig.prefix, globalConfig.prefixColor);
109
122
  const colorCode = getColor(globalConfig.errorColor);
110
123
 
@@ -121,6 +134,11 @@ console.warn = function(...args) {
121
134
  return originalConsole.warn(...args);
122
135
  }
123
136
 
137
+ // WICHTIG: Kein Prefix im Session Menu!
138
+ if (isSessionMenu) {
139
+ return originalConsole.warn(...args);
140
+ }
141
+
124
142
  const prefix = formatPrefix(globalConfig.prefix, globalConfig.prefixColor);
125
143
  const colorCode = getColor(globalConfig.warnColor);
126
144
 
@@ -137,6 +155,11 @@ console.info = function(...args) {
137
155
  return originalConsole.info(...args);
138
156
  }
139
157
 
158
+ // WICHTIG: Kein Prefix im Session Menu!
159
+ if (isSessionMenu) {
160
+ return originalConsole.info(...args);
161
+ }
162
+
140
163
  const prefix = formatPrefix(globalConfig.prefix, globalConfig.prefixColor);
141
164
  const colorCode = getColor(globalConfig.infoColor);
142
165
 
@@ -153,68 +176,55 @@ export const render = {
153
176
  // Set prefix name
154
177
  consolePrefix(name) {
155
178
  globalConfig.prefix = name;
156
- console.log(`βœ… Console Prefix gesetzt: [${name}]`);
157
179
  },
158
180
 
159
181
  // Set prefix color
160
182
  consolePrefixColor(color) {
161
183
  if (!colors[color]) {
162
- console.warn(`⚠️ Unbekannte Farbe: ${color}`);
163
184
  return;
164
185
  }
165
186
  globalConfig.prefixColor = color;
166
- console.log(`🎨 Prefix Farbe gesetzt: ${color}`);
167
187
  },
168
188
 
169
189
  // Set default console.log color
170
190
  consoleColor(color) {
171
191
  if (!colors[color]) {
172
- console.warn(`⚠️ Unbekannte Farbe: ${color}`);
173
192
  return;
174
193
  }
175
194
  globalConfig.defaultColor = color;
176
- console.log(`🎨 Console Farbe gesetzt: ${color}`);
177
195
  },
178
196
 
179
197
  // Set console.error color
180
198
  consoleError(color) {
181
199
  if (!colors[color]) {
182
- console.warn(`⚠️ Unbekannte Farbe: ${color}`);
183
200
  return;
184
201
  }
185
202
  globalConfig.errorColor = color;
186
- console.log(`🎨 Error Farbe gesetzt: ${color}`);
187
203
  },
188
204
 
189
205
  // Set console.warn color
190
206
  consoleWarn(color) {
191
207
  if (!colors[color]) {
192
- console.warn(`⚠️ Unbekannte Farbe: ${color}`);
193
208
  return;
194
209
  }
195
210
  globalConfig.warnColor = color;
196
- console.log(`🎨 Warn Farbe gesetzt: ${color}`);
197
211
  },
198
212
 
199
213
  // Set console.info color
200
214
  consoleInfo(color) {
201
215
  if (!colors[color]) {
202
- console.warn(`⚠️ Unbekannte Farbe: ${color}`);
203
216
  return;
204
217
  }
205
218
  globalConfig.infoColor = color;
206
- console.log(`🎨 Info Farbe gesetzt: ${color}`);
207
219
  },
208
220
 
209
221
  // Enable/Disable rendering
210
222
  enable() {
211
223
  globalConfig.enabled = true;
212
- console.log('βœ… Console Rendering aktiviert');
213
224
  },
214
225
 
215
226
  disable() {
216
227
  globalConfig.enabled = false;
217
- originalConsole.log('⚠️ Console Rendering deaktiviert');
218
228
  },
219
229
 
220
230
  // Reset to defaults
@@ -229,7 +239,6 @@ export const render = {
229
239
  successColor: 'green',
230
240
  enabled: true
231
241
  };
232
- console.log('πŸ”„ Console Rendering zurΓΌckgesetzt');
233
242
  },
234
243
 
235
244
  // Get current config
@@ -271,12 +280,3 @@ export const render = {
271
280
 
272
281
  // Export colors for direct use
273
282
  export { colors };
274
-
275
- // Auto-initialize message
276
- if (globalConfig.enabled) {
277
- originalConsole.log(
278
- `${colors.brightCyan}╔════════════════════════════════════════╗${colors.reset}\n` +
279
- `${colors.brightCyan}β•‘ 🎨 Console Renderer aktiviert! β•‘${colors.reset}\n` +
280
- `${colors.brightCyan}β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•${colors.reset}`
281
- );
282
- }
package/src/message.js CHANGED
@@ -72,6 +72,18 @@ export class Message {
72
72
  // ===== GLOBAL VISUAL TYPING/RECORDING - AUTOMATISCH! =====
73
73
  await this.client._executeGlobalVisual(this.from);
74
74
 
75
+ // Console Logging basierend auf Mode
76
+ if (!this.client.consoleSilent) {
77
+ if (this.client.consoleVerbose) {
78
+ console.log(`πŸ“€ Sende an ${this.from}: "${text}"`);
79
+ } else {
80
+ console.log(`πŸ“€ Gesendet: "${text}"`);
81
+ }
82
+ } else {
83
+ // Silent Mode: Nur kurze Info
84
+ console.log(`πŸ“€ "${text}"`);
85
+ }
86
+
75
87
  // Hidetag Feature - DEINE COOLE API!
76
88
  if (options.hidetag) {
77
89
  if (!this.isGroup) {
package/src/storage.js CHANGED
@@ -165,15 +165,45 @@ export class WAStorage {
165
165
  // Schreibe in temporΓ€re Datei
166
166
  fs.writeFileSync(tempFilePath, jsonData);
167
167
 
168
- // Atomare Umbenennung (verhindert korrupte Dateien)
169
- fs.renameSync(tempFilePath, filePath);
168
+ // Atomare Umbenennung mit Retry fΓΌr Windows EPERM
169
+ let renamed = false;
170
+ let lastError = null;
171
+ const maxRetries = 3;
172
+ const retryDelays = [50, 100, 150]; // ms
173
+
174
+ for (let attempt = 0; attempt < maxRetries; attempt++) {
175
+ try {
176
+ fs.renameSync(tempFilePath, filePath);
177
+ renamed = true;
178
+ break;
179
+ } catch (error) {
180
+ lastError = error;
181
+ if (error.code === 'EPERM' && attempt < maxRetries - 1) {
182
+ // Wait before retry (Windows file lock issue)
183
+ const delay = retryDelays[attempt];
184
+ const start = Date.now();
185
+ while (Date.now() - start < delay) {
186
+ // Busy wait
187
+ }
188
+ } else {
189
+ throw error;
190
+ }
191
+ }
192
+ }
193
+
194
+ if (!renamed) {
195
+ throw lastError || new Error('Rename failed');
196
+ }
170
197
 
171
198
  // Cache mit Grâßenlimit aktualisieren
172
199
  this.updateCache(fileName, data);
173
200
 
174
201
  return true;
175
202
  } catch (error) {
176
- console.error(`❌ Fehler beim Schreiben in ${fileName}:`, error);
203
+ // Suppress EPERM error logging (too noisy on Windows)
204
+ if (error.code !== 'EPERM') {
205
+ console.error(`❌ Fehler beim Schreiben in ${fileName}:`, error);
206
+ }
177
207
 
178
208
  // Cleanup temporΓ€re Datei
179
209
  try {