natureco-cli 1.0.28 → 1.0.30

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": "natureco-cli",
3
- "version": "1.0.28",
3
+ "version": "1.0.30",
4
4
  "description": "NatureCo AI Bot Terminal Interface",
5
5
  "main": "bin/natureco.js",
6
6
  "bin": {
@@ -193,7 +193,7 @@ async function startWhatsAppConnection(sessionDir, botId, selectedBot, config, a
193
193
  console.log(chalk.gray('\nSession kaydedildi: ~/.natureco/whatsapp-sessions/'));
194
194
 
195
195
  // Prepare allowed numbers list (add own number)
196
- const ownNumber = sock.user?.id?.replace('@s.whatsapp.net', '');
196
+ const ownNumber = sock.user?.id?.split(':')[0].replace('@s.whatsapp.net', '');
197
197
  const finalAllowedNumbers = ownNumber ? [ownNumber, ...allowedNumbersList] : allowedNumbersList;
198
198
 
199
199
  // Save to config
@@ -223,7 +223,7 @@ async function startWhatsAppConnection(sessionDir, botId, selectedBot, config, a
223
223
  for (const msg of messages) {
224
224
  if (msg.key.fromMe) continue; // kendi mesajları yoksay
225
225
 
226
- const sender = msg.key.remoteJid?.replace('@s.whatsapp.net', '');
226
+ const sender = msg.key.remoteJid?.split('@')[0].split(':')[0];
227
227
  const allowedNumbers = config.whatsappAllowedNumbers || [];
228
228
 
229
229
  // İzin listesi doluysa kontrol et
@@ -238,13 +238,18 @@ async function startWhatsAppConnection(sessionDir, botId, selectedBot, config, a
238
238
  '';
239
239
 
240
240
  if (messageText) {
241
+ console.log('📨 Mesaj alındı:', sender, messageText);
241
242
  console.log(chalk.cyan(`\n📱 ${sender}:`), chalk.white(messageText));
242
243
 
243
244
  try {
245
+ console.log('📡 API isteği gönderiliyor...');
244
246
  const response = await sendMessage(config.apiKey, config.defaultBotId, messageText, null, '');
247
+ console.log('📩 API yanıtı:', JSON.stringify(response));
248
+
245
249
  const reply = response?.reply || response?.message || '';
246
250
 
247
251
  if (reply) {
252
+ console.log('📤 WhatsApp yanıtı gönderiliyor:', reply);
248
253
  await sock.sendMessage(msg.key.remoteJid, { text: reply });
249
254
  console.log(chalk.green(`✅ Cevap gönderildi: ${reply.substring(0, 50)}...`));
250
255
  }