natureco-cli 1.0.50 → 1.0.52

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/README.md CHANGED
@@ -4,80 +4,86 @@
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
5
5
  [![Platform](https://img.shields.io/badge/platform-macOS%20%7C%20Windows%20%7C%20Linux-blue)]()
6
6
 
7
- Terminal-native AI agent CLI — chat with your bots, automate workflows, and connect Telegram, Discord, Slack & more. A powerful alternative to Claude Code & OpenClaw.
7
+ Terminal-native AI agent CLI — chat with your bots, automate workflows, and connect Telegram, Discord, Slack & WhatsApp. A powerful alternative to Claude Code & OpenClaw.
8
8
 
9
- ## Features
9
+ ## Features
10
10
 
11
- - **Terminal-Native Chat** — Interactive conversations with your AI bots directly from the command line with full context awareness
12
- - **Multi-Platform Integration** — Connect Telegram, Discord, Slack, and WhatsApp bots with simple commands and QR code authentication
13
- - **Skill System** — Extend bot capabilities with NatureHub and ClawHub skills (thousands of pre-built skills available)
14
- - **MCP Support** — Integrate Model Context Protocol servers for filesystem, GitHub, databases, and custom tools
15
- - **AI-Powered Git** — Automated code review, intelligent commit messages, and PR generation with context-aware analysis
16
- - **Web Dashboard** — Beautiful glassmorphism UI at localhost:3848 for browser-based chat and bot management
17
- - **WebSocket Gateway** — Real-time bidirectional communication server for custom integrations and live updates
18
- - **Automation Tools** — Schedule cron jobs, create hooks, and build custom commands for workflow automation
19
- - **Code Analysis** — Deep code review with security, performance, and quality scoring via ultrareview command
20
- - **System Health** — Built-in doctor command checks Node.js, API keys, integrations, and auto-fixes common issues
11
+ - **🤖 Multi-Bot Chat** — Interactive conversations with AI bots, support for multi-word bot names, auto-selection when no default
12
+ - **🔌 Multi-Platform Integration** — Telegram, Discord, Slack, WhatsApp (QR code auth with Baileys)
13
+ - **🎯 Skill System** — Extend capabilities with NatureHub and ClawHub skills
14
+ - **🔧 MCP Support** — Model Context Protocol servers for filesystem, GitHub, databases
15
+ - **🌐 Web Dashboard** — Beautiful glassmorphism UI at localhost:3848 with animated gradients
16
+ - **⚡ Gateway Server** — Background process with WhatsApp auto-start, OpenClaw-style logging
17
+ - **🎨 Custom AI Providers** — OpenAI, Anthropic, Groq, Gemini with model selection
18
+ - **📝 Code Analysis** — Deep code review with security, performance, quality scoring
19
+ - **🔄 Automation** — Cron jobs, hooks, custom commands, background tasks
20
+ - **💾 Memory System** — Persistent conversation memory per bot
21
+ - **📊 System Health** — Built-in doctor command with auto-fix
21
22
 
22
- ## Quick Start
23
+ ## 🚀 Quick Start
23
24
 
24
25
  ```bash
25
26
  # Install globally
26
27
  npm install -g natureco-cli
27
28
 
28
- # Login with your API key
29
- natureco login
29
+ # Run setup wizard
30
+ natureco setup
30
31
 
31
32
  # Start chatting
32
33
  natureco chat
33
34
  ```
34
35
 
35
- ## Commands
36
+ ## 📋 Commands
36
37
 
37
38
  ### Temel Komutlar
38
39
 
39
40
  | Komut | Açıklama |
40
41
  |-------|----------|
41
42
  | `natureco` | Gateway ekranını açar — sistem durumu, aktif bot, skill sayısı |
42
- | `natureco setup` | Kurulum sihirbazını başlatır — API key, bot seç, Telegram/Discord bağla |
43
- | `natureco login` | API key ile giriş yapar, config'e kaydeder |
43
+ | `natureco setup` | Kurulum sihirbazı — API key, bot seç, AI provider, model seç, entegrasyonlar |
44
+ | `natureco login` | API key ile giriş yapar |
44
45
  | `natureco logout` | Çıkış yapar, config'i temizler |
45
46
  | `natureco help` | Tüm komutları ve örnekleri listeler |
46
- | `natureco doctor` | Sistem sağlık kontrolü — Node, API key, bot, skill, entegrasyon durumu |
47
- | `natureco doctor --fix` | Sorunları otomatik onarır — güncellemeleri yükler, config'i yeniler |
48
- | `natureco update` | Yeni versiyon var mı kontrol eder |
47
+ | `natureco doctor` | Sistem sağlık kontrolü — Node, API, bot, skill, entegrasyon |
48
+ | `natureco doctor --fix` | Sorunları otomatik onarır |
49
+ | `natureco update` | Yeni versiyon kontrolü |
49
50
 
50
51
  ### Sohbet
51
52
 
52
53
  | Komut | Açıklama |
53
54
  |-------|----------|
54
- | `natureco chat` | Varsayılan botla interaktif sohbet başlatır |
55
- | `natureco chat "Bot Adı"` | Belirli bir botla sohbet başlatır |
55
+ | `natureco chat` | Varsayılan botla sohbet (yoksa interaktif seçim) |
56
+ | `natureco chat Bot Adı` | Belirli botla sohbet (boşluklu isimler desteklenir) |
57
+ | `natureco chat Nature Bot V3` | Çok kelimeli bot adları otomatik birleştirilir |
56
58
  | `natureco chat --resume` | En son oturuma devam eder |
57
- | `natureco ask "soru"` | Tek seferlik soru sorar, cevap alır, çıkar |
58
- | `natureco run script.md` | Markdown dosyasını bota prompt olarak gönderir |
59
- | `natureco bots` | Tüm botlarınızı listeler (ID, provider, durum) |
59
+ | `natureco ask "soru"` | Tek seferlik soru sorar |
60
+ | `natureco run script.md` | Markdown dosyasını prompt olarak gönderir |
61
+ | `natureco bots` | Tüm botları listeler |
60
62
 
61
63
  **Chat İçi Komutlar:**
62
64
 
63
65
  | Komut | Açıklama |
64
66
  |-------|----------|
65
67
  | `/clear` | Ekranı temizler |
66
- | `/bot` | Bot listesini gösterir veya bot değiştirir |
68
+ | `/bot` | Bot listesi gösterir veya bot değiştirir |
69
+ | `/bot Bot Adı` | Belirli bota geçer |
67
70
  | `/skills` | Aktif skill'leri gösterir |
68
71
  | `/memory` | Hafıza durumunu gösterir |
72
+ | `/memory clear` | Hafızayı temizler |
69
73
  | `/commands` | Özel komutları listeler |
74
+ | `/ultrareview` | Son kod bloğunu detaylı inceler |
70
75
  | `/help` | Chat yardımını gösterir |
71
- | `exit` veya `quit` | Sohbetten çıkar |
76
+ | `exit` / `quit` | Sohbetten çıkar |
77
+ | `Ctrl+B` | Görevi arka plana al |
72
78
 
73
79
  ### Skill Sistemi
74
80
 
75
81
  | Komut | Açıklama |
76
82
  |-------|----------|
77
- | `natureco skills` | Yüklü skill'leri listeler (kaynak, açıklama) |
83
+ | `natureco skills` | Yüklü skill'leri listeler |
78
84
  | `natureco skills install slug` | NatureHub'dan skill yükler |
79
- | `natureco skills install clawhub:slug` | ClawHub'dan skill yükler (binlerce skill) |
80
- | `natureco skills browse` | Popüler skill listesini gösterir, interaktif seçim |
85
+ | `natureco skills install clawhub:slug` | ClawHub'dan skill yükler |
86
+ | `natureco skills browse` | Popüler skill listesi, interaktif seçim |
81
87
  | `natureco skills search "sorgu"` | Skill arar |
82
88
  | `natureco skills remove slug` | Skill'i kaldırır |
83
89
  | `natureco skills create ad` | Yeni skill şablonu oluşturur |
@@ -86,10 +92,13 @@ natureco chat
86
92
 
87
93
  | Komut | Açıklama |
88
94
  |-------|----------|
89
- | `natureco telegram connect` | Telegram botunu bağlar (token + kullanıcı ID) |
95
+ | `natureco telegram connect` | Telegram botunu bağlar (token + user ID) |
90
96
  | `natureco discord connect` | Discord botunu bağlar |
91
97
  | `natureco slack connect` | Slack workspace'ine bağlanır |
92
- | `natureco whatsapp connect` | WhatsApp QR kod ile bağlar |
98
+ | `natureco whatsapp connect` | WhatsApp QR kod ile bağlanır (Baileys) |
99
+ | `natureco whatsapp status` | WhatsApp bağlantı durumu ve izin listesi |
100
+ | `natureco whatsapp allow <numara>` | İzin listesine numara ekler |
101
+ | `natureco whatsapp disconnect` | WhatsApp bağlantısını keser |
93
102
 
94
103
  ### MCP Sunucuları
95
104
 
@@ -98,40 +107,48 @@ natureco chat
98
107
  | `natureco mcp list` | Bağlı MCP sunucularını listeler |
99
108
  | `natureco mcp add` | MCP sunucu ekler (filesystem, github, postgres...) |
100
109
  | `natureco mcp templates` | Hazır MCP şablonlarını listeler |
110
+ | `natureco mcp enable <name>` | MCP sunucusunu aktif eder |
111
+ | `natureco mcp disable <name>` | MCP sunucusunu devre dışı bırakır |
101
112
 
102
113
  ### Otomasyon
103
114
 
104
115
  | Komut | Açıklama |
105
116
  |-------|----------|
106
- | `natureco ultrareview dosya.js` | Kodu derinlemesine inceler — güvenlik, performans, kalite puanlar |
107
- | `natureco git review` | Staged değişiklikleri bota inceletir |
108
- | `natureco git commit` | AI ile commit mesajı üretir ve commit atar |
109
- | `natureco cron add` | Zamanlanmış görev oluşturur (her gün, her X saatte) |
117
+ | `natureco ultrareview dosya.js` | Kod inceleme — güvenlik, performans, kalite puanlar |
118
+ | `natureco git review` | Staged değişiklikleri inceletir |
119
+ | `natureco git commit` | AI ile commit mesajı üretir |
120
+ | `natureco cron add` | Zamanlanmış görev oluşturur |
110
121
  | `natureco cron list` | Cron görevlerini listeler |
111
122
  | `natureco cron start` | Cron daemon'unu başlatır |
112
- | `natureco cron stop` | Cron daemon'unu durdurur |
113
- | `natureco hooks create tip` | Hook oluşturur (pre-message, post-message, on-start...) |
114
- | `natureco commands create ad` | Özel /komut oluşturur (chat'te /ad ile kullan) |
123
+ | `natureco hooks create tip` | Hook oluşturur (pre-message, post-message...) |
124
+ | `natureco commands create ad` | Özel /komut oluşturur |
115
125
 
116
- ### Arayüz & Sunucular
126
+ ### Gateway & Dashboard
117
127
 
118
128
  | Komut | Açıklama |
119
129
  |-------|----------|
120
- | `natureco dashboard` | Web arayüzünü açar (localhost:3848) — tarayıcıda chat |
130
+ | `natureco gateway start` | Gateway'i arka planda başlatır (WhatsApp otomatik) |
131
+ | `natureco gateway stop` | Gateway'i durdurur |
132
+ | `natureco gateway status` | Gateway durumu (son 10 log) |
133
+ | `natureco gateway logs` | Tüm logları gösterir (~/.natureco/gateway.log) |
134
+ | `natureco dashboard` | Web arayüzü açar (localhost:3848) |
121
135
  | `natureco dashboard stop` | Dashboard'u durdurur |
122
136
  | `natureco dashboard status` | Dashboard durumunu kontrol eder |
123
- | `natureco gateway start` | WebSocket sunucusunu başlatır (ws://localhost:3847) |
124
- | `natureco gateway stop` | Gateway'i durdurur |
125
- | `natureco gateway status` | Gateway durumunu kontrol eder |
137
+
138
+ ### Yapılandırma
139
+
140
+ | Komut | Açıklama |
141
+ |-------|----------|
126
142
  | `natureco config list` | Tüm ayarları gösterir |
127
- | `natureco config set key val` | Ayar değiştirir (örn: defaultBot, theme) |
128
- | `natureco init` | Mevcut klasörde .natureco/ proje klasörü oluşturur |
143
+ | `natureco config get key` | Belirli ayarı gösterir |
144
+ | `natureco config set key val` | Ayar değiştirir |
145
+ | `natureco init` | Proje klasörü oluşturur (.natureco/) |
129
146
 
130
- ## Integrations
147
+ ## 🔌 Integrations
131
148
 
132
149
  ### Telegram
133
150
 
134
- Connect your Telegram bot to receive and respond to messages directly through NatureCo. Supports both bot token and user ID authentication.
151
+ Telegram botunuzu bağlayın, mesajları alın ve yanıtlayın. Bot token ve kullanıcı ID ile kimlik doğrulama.
135
152
 
136
153
  ```bash
137
154
  natureco telegram connect
@@ -139,7 +156,7 @@ natureco telegram connect
139
156
 
140
157
  ### Discord
141
158
 
142
- Integrate Discord bots with full support for server channels, DMs, and slash commands. Seamless setup with OAuth2 flow.
159
+ Discord botlarını entegre edin. Sunucu kanalları, DM'ler ve slash komutları desteklenir.
143
160
 
144
161
  ```bash
145
162
  natureco discord connect
@@ -147,7 +164,7 @@ natureco discord connect
147
164
 
148
165
  ### Slack
149
166
 
150
- Connect to Slack workspaces and enable bot interactions in channels and direct messages. Supports Slack App authentication.
167
+ Slack workspace'lerine bağlanın. Kanal ve DM mesajlarını yönetin.
151
168
 
152
169
  ```bash
153
170
  natureco slack connect
@@ -155,40 +172,145 @@ natureco slack connect
155
172
 
156
173
  ### WhatsApp
157
174
 
158
- Link WhatsApp accounts using QR code authentication. Send and receive messages through your AI bot with full media support.
175
+ WhatsApp hesaplarını QR kod ile bağlayın. Baileys kütüphanesi ile tam medya desteği.
159
176
 
160
177
  ```bash
178
+ # İlk bağlantı (QR kod)
161
179
  natureco whatsapp connect
180
+
181
+ # Gateway ile otomatik başlat
182
+ natureco gateway start
183
+
184
+ # İzin listesine numara ekle
185
+ natureco whatsapp allow 905551234567
186
+
187
+ # Durum kontrolü
188
+ natureco whatsapp status
189
+ ```
190
+
191
+ **WhatsApp Özellikleri:**
192
+ - QR kod ile terminal'de bağlantı
193
+ - Session persistence (~/.natureco/whatsapp-sessions/)
194
+ - İzin listesi kontrolü (son 10 hane karşılaştırma)
195
+ - Gateway ile otomatik başlatma
196
+ - OpenClaw-style logging
197
+ - Auto-reconnect (515, 408 hata kodları)
198
+ - Çoklu mesaj formatı desteği (text, caption, buttons, list...)
199
+
200
+ ## 🌐 Gateway Server
201
+
202
+ Arka planda çalışan gateway sunucusu. WhatsApp otomatik başlatma, OpenClaw-style logging, health check.
203
+
204
+ ```bash
205
+ # Gateway'i başlat (arka planda)
206
+ natureco gateway start
207
+
208
+ # Logları canlı izle
209
+ tail -f ~/.natureco/gateway.log
210
+
211
+ # Durum kontrolü
212
+ natureco gateway status
213
+
214
+ # Durdur
215
+ natureco gateway stop
162
216
  ```
163
217
 
164
- ## Dashboard
218
+ **Gateway Özellikleri:**
219
+ - Detached process (terminal kapatılsa bile çalışır)
220
+ - WhatsApp otomatik başlatma (config'de kayıtlıysa)
221
+ - OpenClaw-style log formatı: `[timestamp] [module] message`
222
+ - Health check her 60 saniyede
223
+ - Auto-restart on connection loss (10s delay)
224
+ - Platform-aware stop (SIGTERM → SIGKILL / taskkill)
225
+ - Tüm loglar ~/.natureco/gateway.log dosyasında
165
226
 
166
- Launch a beautiful web interface at `localhost:3848` with glassmorphism design and dark mode. Features include:
227
+ ## 🎨 Dashboard
167
228
 
168
- - Real-time chat with all your bots
169
- - Bot switching and configuration
170
- - Skill and MCP management
171
- - Live system stats and health monitoring
172
- - Responsive design for desktop and mobile
229
+ Localhost:3848'de çalışan web arayüzü. Glassmorphism tasarım, animated gradient arka plan.
173
230
 
174
231
  ```bash
175
232
  natureco dashboard
176
233
  ```
177
234
 
178
- ![Dashboard Preview](https://natureco.me/assets/cli-dashboard.png)
235
+ **Dashboard Özellikleri:**
236
+ - Modern glassmorphism UI
237
+ - Animated gradient background (natureco.me/landing ile aynı)
238
+ - Sol sidebar: Aktif bot, diğer botlar, kanallar, skill'ler, hafıza, sessions, sistem, cron jobs
239
+ - Sağ chat alanı: Bot avatar, model bilgisi, version badge
240
+ - Typing indicator (üç nokta animasyonu)
241
+ - Türkçe karakter desteği
242
+ - Responsive tasarım
243
+
244
+ ## 🤖 Custom AI Providers
245
+
246
+ NatureCo dışında kendi AI provider'ınızı kullanın. Setup sırasında veya config ile ayarlayın.
247
+
248
+ **Desteklenen Provider'lar:**
249
+ - **OpenAI:** GPT-5.5, GPT-5.4, GPT-5, GPT-4.1, GPT-4o, o3, o4 Mini
250
+ - **Anthropic:** Claude Opus 4.7/4.6/4.5, Sonnet 4.6/4.5, Haiku 4.5/3.5
251
+ - **Groq:** Llama 3.3 70B, Llama 3.1 8B/70B, Mixtral 8x7B, Gemma 2 9B
252
+ - **Gemini:** 2.5 Pro/Flash, 2.0 Flash, 1.5 Pro/Flash
253
+
254
+ ```bash
255
+ # Setup sırasında provider ve model seç
256
+ natureco setup
257
+
258
+ # Config ile değiştir
259
+ natureco config set aiProvider openai
260
+ natureco config set aiModel gpt-4o
261
+ ```
262
+
263
+ ## 📁 File Structure
264
+
265
+ ```
266
+ ~/.natureco/
267
+ ├── config.json # Ana yapılandırma
268
+ ├── gateway.pid # Gateway process ID
269
+ ├── gateway.log # Gateway logları
270
+ ├── dashboard.pid # Dashboard process ID
271
+ ├── skills/ # Yüklü skill'ler
272
+ ├── memory/ # Bot hafızaları
273
+ ├── history/ # Chat geçmişi
274
+ ├── sessions/ # Chat oturumları
275
+ ├── whatsapp-sessions/ # WhatsApp session'ları
276
+ │ └── {bot_id}/ # Bot bazında session
277
+ └── cron.json # Cron görevleri
278
+ ```
279
+
280
+ ## 🔧 Configuration
281
+
282
+ Config dosyası: `~/.natureco/config.json`
283
+
284
+ **Örnek Config:**
285
+ ```json
286
+ {
287
+ "apiKey": "nc_...",
288
+ "defaultBot": "Nature Bot",
289
+ "defaultBotId": "bot_123",
290
+ "aiProvider": "openai",
291
+ "aiModel": "gpt-4o",
292
+ "telegramToken": "...",
293
+ "discordToken": "...",
294
+ "whatsappConnected": true,
295
+ "whatsappBotId": "bot_123",
296
+ "whatsappPhone": "905551234567@s.whatsapp.net",
297
+ "whatsappAllowedNumbers": ["905551234567", "905422842631"]
298
+ }
299
+ ```
179
300
 
180
- ## Support
301
+ ## 📚 Support
181
302
 
182
303
  - **Documentation:** [natureco.me/docs](https://natureco.me/docs)
183
304
  - **CLI Docs:** [natureco.me/cli](https://natureco.me/cli)
184
305
  - **npm Package:** [npmjs.com/package/natureco-cli](https://www.npmjs.com/package/natureco-cli)
185
- - **GitHub Issues:** [github.com/natureco/cli/issues](https://github.com/natureco/cli/issues)
186
306
  - **API Reference:** [natureco.me/api](https://natureco.me/api)
307
+ - **GitHub:** [github.com/natureco/cli](https://github.com/natureco/cli)
187
308
 
188
- ## License
309
+ ## 📝 License
189
310
 
190
311
  MIT © NatureCo
191
312
 
192
313
  ---
193
314
 
194
- **Version:** 1.0.21 | **Node.js:** >=18.0.0 | **Platform:** macOS, Windows, Linux
315
+ **Version:** 1.0.51 | **Node.js:** >=16.0.0 | **Platform:** macOS, Windows, Linux
316
+
package/bin/natureco.js CHANGED
@@ -45,10 +45,11 @@ program
45
45
  .action(bots);
46
46
 
47
47
  program
48
- .command('chat [bot-name]')
48
+ .command('chat [bot-name...]')
49
49
  .description('Start interactive chat with a bot (uses default bot if not specified)')
50
50
  .option('--resume [session-id]', 'Resume a previous session')
51
- .action((botName, options) => {
51
+ .action((botNameParts, options) => {
52
+ const botName = Array.isArray(botNameParts) ? botNameParts.join(' ') : botNameParts;
52
53
  chat(botName, options);
53
54
  });
54
55
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "natureco-cli",
3
- "version": "1.0.50",
3
+ "version": "1.0.52",
4
4
  "description": "NatureCo AI Bot Terminal Interface",
5
5
  "main": "bin/natureco.js",
6
6
  "bin": {
@@ -35,7 +35,7 @@ async function chat(botName, options = {}) {
35
35
  process.exit(1);
36
36
  }
37
37
 
38
- // Bot adı verilmediyse config'den defaultBot'u kullan
38
+ // Bot adı verilmediyse config'den defaultBot'u kullan veya interaktif seçim sun
39
39
  let bot;
40
40
  if (!botName) {
41
41
  const { getConfig } = require('../utils/config');
@@ -49,12 +49,24 @@ async function chat(botName, options = {}) {
49
49
  }
50
50
 
51
51
  if (!bot) {
52
- console.log(chalk.red('\n❌ No default bot configured.\n'));
53
- console.log(chalk.gray('Available bots:'));
54
- botList.bots.forEach(b => console.log(chalk.cyan(` - ${b.name}`)));
52
+ // Interaktif bot seçimi
53
+ console.log(chalk.yellow('Varsayılan bot bulunamadı. Lütfen bir bot seçin:\n'));
54
+ botList.bots.forEach((b, i) => {
55
+ console.log(chalk.cyan(` ${i + 1}. ${b.name}`));
56
+ });
55
57
  console.log('');
56
- console.log(chalk.yellow('Usage: natureco chat <bot-name>\n'));
57
- process.exit(1);
58
+
59
+ process.stdin.resume();
60
+ const { selectedBot } = await inquirer.prompt([
61
+ {
62
+ type: 'list',
63
+ name: 'selectedBot',
64
+ message: 'Bot seçin:',
65
+ choices: botList.bots.map((b, i) => ({ name: b.name, value: b.id })),
66
+ },
67
+ ]);
68
+
69
+ bot = botList.bots.find(b => b.id === selectedBot);
58
70
  }
59
71
  } else {
60
72
  // Bot adı ile eşleşen botu bul
@@ -211,7 +211,7 @@ body::before{
211
211
  <div class="header-bot-name" id="header-bot-name">Nature Bot</div>
212
212
  <div class="header-bot-model" id="header-bot-model">NatureCo</div>
213
213
  </div>
214
- <div class="version-badge" id="version-badge">v1.0.50</div>
214
+ <div class="version-badge" id="version-badge">v1.0.52</div>
215
215
  </div>
216
216
  <div class="messages" id="messages"></div>
217
217
  <div class="input-area">
@@ -341,7 +341,7 @@ function dashboard(action) {
341
341
  apiKey: cfg.apiKey,
342
342
  defaultBot: cfg.defaultBot,
343
343
  defaultBotId: cfg.defaultBotId,
344
- version: 'v1.0.50',
344
+ version: 'v1.0.52',
345
345
  bots: cfg.bots || [],
346
346
  telegramToken: cfg.telegramToken || null,
347
347
  whatsappConnected: cfg.whatsappConnected || false,
package/src/utils/api.js CHANGED
@@ -24,7 +24,7 @@ async function getBots(apiKey) {
24
24
  });
25
25
  }
26
26
 
27
- async function sendMessage(apiKey, botId, message, conversationId = null, skillPrompts = '') {
27
+ async function _sendMessage(apiKey, botId, message, conversationId = null, skillPrompts = '') {
28
28
  const { getConfig } = require('./config');
29
29
  const config = getConfig();
30
30
 
@@ -62,6 +62,22 @@ async function sendMessage(apiKey, botId, message, conversationId = null, skillP
62
62
  });
63
63
  }
64
64
 
65
+ async function sendMessage(...args) {
66
+ let result;
67
+ for (let i = 0; i < 3; i++) {
68
+ result = await _sendMessage(...args);
69
+ const reply = result?.reply || result?.message || '';
70
+ if (reply && !reply.includes('Şu an yanıt veremiyorum')) {
71
+ return result;
72
+ }
73
+ // Son denemede bekleme
74
+ if (i < 2) {
75
+ await new Promise(r => setTimeout(r, 2000));
76
+ }
77
+ }
78
+ return result;
79
+ }
80
+
65
81
  async function validateApiKey(apiKey) {
66
82
  try {
67
83
  const result = await getBots(apiKey);