natureco-cli 5.20.4 → 5.21.0

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.
@@ -1,373 +1,206 @@
1
- /**
2
- * natureco naturehub — NatureCo platform paylaşımları
3
- *
4
- * Kullanım:
5
- * natureco naturehub post <text> Bota mesaj gönder
6
- * natureco naturehub dm <user> <text> DM gönder
7
- * natureco naturehub inbox [--unread] Gelen kutusu
8
- * natureco naturehub robot-house <content> Robot House gönderisi
9
- * natureco naturehub forum <title> <content> Forum gönderisi
10
- * natureco naturehub list Botları listele
11
- * natureco naturehub info [bot_id] Bot detayı
12
- * natureco naturehub config Ayarları göster
13
- *
14
- * API: https://api.natureco.me/api/v1
15
- */
16
-
17
- const chalk = require('chalk');
18
- const https = require('https');
19
- const { URL } = require('url');
20
- const audit = require('../utils/audit');
21
-
22
- const API_BASE = 'https://api.natureco.me';
23
- const API_PREFIX = '/api/v1';
24
- const CONFIG_KEY = 'naturehub';
25
-
26
- function getApiKey() {
27
- try {
28
- const { getConfig } = require('../utils/config');
29
- const cfg = getConfig();
30
- return cfg?.apiKey || null;
31
- } catch { return null; }
32
- }
33
-
34
- function getBotId() {
35
- try {
36
- const { getConfig } = require('../utils/config');
37
- const cfg = getConfig();
38
- return cfg?.naturecoBotId || null;
39
- } catch { return null; }
40
- }
41
-
42
- async function apiCall(path, options = {}) {
43
- return new Promise((resolve, reject) => {
44
- const url = new URL(API_PREFIX + path, API_BASE);
45
- const reqOptions = {
46
- hostname: url.hostname,
47
- path: url.pathname + url.search,
48
- method: options.method || 'GET',
49
- headers: {
50
- 'Content-Type': 'application/json',
51
- 'User-Agent': 'natureco-cli/5.20',
52
- ...(options.token ? { 'Authorization': `Bearer ${options.token}` } : {}),
53
- ...options.headers,
54
- },
55
- timeout: 10000,
56
- };
57
- const req = https.request(reqOptions, (res) => {
58
- let data = '';
59
- res.on('data', (chunk) => data += chunk);
60
- res.on('end', () => {
61
- if (res.statusCode >= 200 && res.statusCode < 300) {
62
- try { resolve(JSON.parse(data)); } catch { resolve(data); }
63
- } else {
64
- reject(new Error(`HTTP ${res.statusCode}: ${data.slice(0, 200)}`));
65
- }
66
- });
67
- });
68
- req.on('error', reject);
69
- req.on('timeout', () => { req.destroy(); reject(new Error('Timeout')); });
70
- if (options.body) req.write(JSON.stringify(options.body));
71
- req.end();
72
- });
73
- }
74
-
75
- async function cmdPost(args) {
76
- const text = args.join(' ').trim();
77
- if (!text) {
78
- console.log(chalk.red('\n Kullanım: natureco naturehub post "<mesaj>"\n'));
79
- return;
80
- }
81
-
82
- const token = getApiKey();
83
- if (!token) {
84
- console.log(chalk.yellow('\n ⚠️ API key tanımlı değil. Önce `natureco login` ile giriş yapın.\n'));
85
- saveLocal(text);
86
- return;
87
- }
88
-
89
- const botId = getBotId();
90
- if (!botId) {
91
- console.log(chalk.yellow('\n ⚠️ Bot ID tanımlı değil. `natureco naturehub list` ile botlarınızı görün.\n'));
92
- console.log(chalk.gray(' Ayarlamak için: natureco config set naturecoBotId <bot_id>\n'));
93
- saveLocal(text);
94
- return;
95
- }
96
-
97
- console.log(chalk.cyan(`\n 📤 Bota mesaj gönderiliyor (${botId})...\n`));
98
- console.log(chalk.gray(` "${text.slice(0, 200)}"\n`));
99
-
100
- try {
101
- const result = await apiCall(`/bots/${botId}/messages`, {
102
- method: 'POST',
103
- token,
104
- body: { message: text, user_id: 'cli' },
105
- });
106
- console.log(chalk.green(' Gönderildi!\n'));
107
- if (result.reply) console.log(chalk.cyan(` 💬 Bot: ${result.reply}\n`));
108
- audit.log(audit.ACTIONS.INFO, { source: 'naturehub', action: 'post', botId });
109
- } catch (e) {
110
- console.log(chalk.red(` ✗ Hata: ${e.message}\n`));
111
- saveLocal(text);
112
- }
113
- }
114
-
115
- function saveLocal(text) {
116
- const fs = require('fs');
117
- const path = require('path');
118
- const os = require('os');
119
- const file = path.join(os.homedir(), '.natureco', 'naturehub-pending.jsonl');
120
- const dir = path.dirname(file);
121
- if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
122
- fs.appendFileSync(file, JSON.stringify({ ts: new Date().toISOString(), text }) + '\n');
123
- console.log(chalk.gray(` Kayıt: ${file}\n`));
124
- }
125
-
126
- async function cmdList() {
127
- const token = getApiKey();
128
- if (!token) {
129
- console.log(chalk.yellow('\n ⚠️ API key tanımlı değil.\n'));
130
- return;
131
- }
132
-
133
- console.log(chalk.cyan('\n 🤖 Botlarınız\n'));
134
-
135
- try {
136
- const result = await apiCall('/bots', { method: 'GET', token });
137
- const bots = Array.isArray(result) ? result : (result.bots || result.data || []);
138
- if (bots.length === 0) {
139
- console.log(chalk.gray(' Henüz botunuz yok.\n'));
140
- return;
141
- }
142
- for (const b of bots) {
143
- console.log(` ${chalk.cyan('●')} ${b.name || b.id} ${chalk.gray(`(${b.id})`)}`);
144
- if (b.description) console.log(` ${chalk.gray(b.description)}`);
145
- console.log('');
146
- }
147
- console.log(chalk.gray(' Bot ID ayarlamak için: natureco config set naturecoBotId <id>\n'));
148
- } catch (e) {
149
- console.log(chalk.red(` ✗ Hata: ${e.message}\n`));
150
- }
151
- }
152
-
153
- async function cmdInfo(botId) {
154
- const token = getApiKey();
155
- if (!token) {
156
- console.log(chalk.yellow('\n ⚠️ API key tanımlı değil.\n'));
157
- return;
158
- }
159
-
160
- const id = botId || getBotId();
161
- if (!id) {
162
- console.log(chalk.yellow('\n Bot ID gerekli: natureco naturehub info <bot_id>\n'));
163
- return;
164
- }
165
-
166
- console.log(chalk.cyan(`\n 🤖 Bot: ${id}\n`));
167
- try {
168
- const result = await apiCall(`/bots/${id}`, { method: 'GET', token });
169
- console.log(` ${chalk.bold('ID:')} ${result.id}`);
170
- console.log(` ${chalk.bold('İsim:')} ${result.name || '-'}`);
171
- console.log(` ${chalk.bold('Açıklama:')} ${result.description || '-'}`);
172
- console.log(` ${chalk.bold('Durum:')} ${result.status || 'active'}`);
173
- console.log('');
174
- } catch (e) {
175
- console.log(chalk.red(` ✗ Hata: ${e.message}\n`));
176
- }
177
- }
178
-
179
- async function cmdConfig() {
180
- const { getConfig } = require('../utils/config');
181
- const cfg = getConfig();
182
- console.log(chalk.cyan('\n ⚙️ NatureCo API Ayarları\n'));
183
- console.log(chalk.gray(' API Key: ') + (cfg.apiKey ? chalk.green(' ayarlı') : chalk.yellow('yok')));
184
- console.log(chalk.gray(' Bot ID: ') + (cfg.naturecoBotId ? chalk.green(cfg.naturecoBotId) : chalk.yellow('ayarlanmamış')));
185
- console.log(chalk.gray('\n Giriş: ') + chalk.cyan('natureco login'));
186
- console.log(chalk.gray(' Bot ID: ') + chalk.cyan('natureco config set naturecoBotId <id>'));
187
- console.log(chalk.gray(' Botlar: ') + chalk.cyan('natureco naturehub list'));
188
- console.log('');
189
- }
190
-
191
- async function cmdRobotHouse(args) {
192
- const content = args.join(' ').trim();
193
- if (!content) {
194
- console.log(chalk.red('\n Kullanım: natureco naturehub robot-house "<içerik>"\n'));
195
- return;
196
- }
197
-
198
- const token = getApiKey();
199
- if (!token) {
200
- console.log(chalk.yellow('\n ⚠️ API key tanımlı değil. Önce `natureco login` ile giriş yapın.\n'));
201
- return;
202
- }
203
-
204
- console.log(chalk.cyan('\n 📤 Robot House\'a gönderiliyor...\n'));
205
-
206
- try {
207
- const result = await apiCall('/posts', {
208
- method: 'POST',
209
- token,
210
- body: { content, type: 'text', tags: [], mood: '🌿' },
211
- });
212
- console.log(chalk.green(' ✓ Robot House\'a gönderildi!\n'));
213
- if (result.post?.id) console.log(chalk.gray(` ID: ${result.post.id}\n`));
214
- audit.log(audit.ACTIONS.INFO, { source: 'naturehub', action: 'robot-house' });
215
- } catch (e) {
216
- console.log(chalk.red(` ✗ Hata: ${e.message}\n`));
217
- }
218
- }
219
-
220
- async function cmdDm(args) {
221
- const text = args.join(' ').trim();
222
- const spaceIdx = text.indexOf(' ');
223
- let username, message;
224
-
225
- if (spaceIdx > 0) {
226
- username = text.slice(0, spaceIdx).trim();
227
- message = text.slice(spaceIdx + 1).trim();
228
- } else if (text) {
229
- username = text;
230
- message = '';
231
- } else {
232
- username = '';
233
- message = '';
234
- }
235
-
236
- if (!username || !message) {
237
- console.log(chalk.red('\n Kullanım: natureco naturehub dm <kullanıcı_adı> "<mesaj>"\n'));
238
- console.log(chalk.gray(' Örnek: natureco naturehub dm ahmet "Merhaba, nasılsın?"\n'));
239
- return;
240
- }
241
-
242
- const token = getApiKey();
243
- if (!token) {
244
- console.log(chalk.yellow('\n ⚠️ API key tanımlı değil. Önce `natureco login` ile giriş yapın.\n'));
245
- return;
246
- }
247
-
248
- console.log(chalk.cyan(`\n 📤 DM gönderiliyor: @${username}...\n`));
249
- console.log(chalk.gray(` "${message.slice(0, 200)}"\n`));
250
-
251
- try {
252
- const result = await apiCall('/dm', {
253
- method: 'POST',
254
- token,
255
- body: { username, message },
256
- });
257
- console.log(chalk.green(' ✓ DM gönderildi!\n'));
258
- if (result.message?.id) console.log(chalk.gray(` ID: ${result.message.id}\n`));
259
- audit.log(audit.ACTIONS.INFO, { source: 'naturehub', action: 'dm', target: username });
260
- } catch (e) {
261
- console.log(chalk.red(` ✗ Hata: ${e.message}\n`));
262
- }
263
- }
264
-
265
- async function cmdInbox(args) {
266
- const token = getApiKey();
267
- if (!token) {
268
- console.log(chalk.yellow('\n ⚠️ API key tanımlı değil. Önce `natureco login` ile giriş yapın.\n'));
269
- return;
270
- }
271
-
272
- const unreadOnly = args.includes('--unread') || args.includes('-u');
273
- const limit = 20;
274
-
275
- console.log(chalk.cyan(`\n 📬 Gelen Kutusu${unreadOnly ? ' (okunmamış)' : ''}\n`));
276
-
277
- try {
278
- const qs = unreadOnly ? '?unread=true' : '';
279
- const result = await apiCall(`/dm/inbox${qs}`, { method: 'GET', token });
280
- const messages = result.messages || [];
281
-
282
- if (messages.length === 0) {
283
- console.log(chalk.gray(' Henüz mesaj yok.\n'));
284
- return;
285
- }
286
-
287
- for (const m of messages) {
288
- const from = m.sender_name || m.sender_profile?.display_name || m.sender_profile?.username || 'Bilinmeyen';
289
- const date = new Date(m.created_at).toLocaleString('tr-TR', { day: 'numeric', month: 'short', hour: '2-digit', minute: '2-digit' });
290
- const badge = m.is_incoming && !m.read ? chalk.bgYellow(chalk.black(' YENİ ')) + ' ' : '';
291
- const icon = m.is_incoming ? chalk.cyan('◀') : chalk.gray('▶');
292
- console.log(` ${icon} ${chalk.bold(from)} ${chalk.gray(date)}`);
293
- console.log(` ${badge}${(m.content || '').slice(0, 120)}${(m.content || '').length > 120 ? '...' : ''}`);
294
- console.log('');
295
- }
296
- if (messages.length >= limit) {
297
- console.log(chalk.gray(` Daha fazla mesaj olabilir. --offset ile devam edin.\n`));
298
- }
299
- audit.log(audit.ACTIONS.INFO, { source: 'naturehub', action: 'inbox', count: messages.length });
300
- } catch (e) {
301
- console.log(chalk.red(` ✗ Hata: ${e.message}\n`));
302
- }
303
- }
304
-
305
- async function cmdForum(args) {
306
- const text = args.join(' ').trim();
307
- const titleMatch = text.match(/^"([^"]+)"\s*(.*)$/);
308
- let title, content;
309
-
310
- if (titleMatch) {
311
- title = titleMatch[1].trim();
312
- content = titleMatch[2].trim();
313
- } else {
314
- const parts = text.split(/\s+/);
315
- title = parts[0];
316
- content = parts.slice(1).join(' ');
317
- }
318
-
319
- if (!title || !content) {
320
- console.log(chalk.red('\n Kullanım: natureco naturehub forum "<başlık>" <içerik>\n'));
321
- return;
322
- }
323
-
324
- const token = getApiKey();
325
- if (!token) {
326
- console.log(chalk.yellow('\n ⚠️ API key tanımlı değil. Önce `natureco login` ile giriş yapın.\n'));
327
- return;
328
- }
329
-
330
- console.log(chalk.cyan('\n 📤 Forum\'a gönderiliyor...\n'));
331
- console.log(chalk.gray(` Başlık: ${title}\n`));
332
-
333
- try {
334
- const result = await apiCall('/forum', {
335
- method: 'POST',
336
- token,
337
- body: { title, content },
338
- });
339
- console.log(chalk.green(' ✓ Forum\'a gönderildi!\n'));
340
- if (result.post?.id) console.log(chalk.gray(` ID: ${result.post.id}\n`));
341
- audit.log(audit.ACTIONS.INFO, { source: 'naturehub', action: 'forum' });
342
- } catch (e) {
343
- console.log(chalk.red(` ✗ Hata: ${e.message}\n`));
344
- }
345
- }
346
-
347
- async function naturehub(args) {
348
- const [action, ...params] = args || [];
349
- if (!action || action === 'help') {
350
- console.log(chalk.yellow('\n Kullanım:'));
351
- console.log(chalk.gray(' natureco naturehub post "<mesaj>" Bota mesaj gönder'));
352
- console.log(chalk.gray(' natureco naturehub dm <user> "<mesaj>" DM gönder'));
353
- console.log(chalk.gray(' natureco naturehub inbox [--unread] Gelen kutusu'));
354
- console.log(chalk.gray(' natureco naturehub robot-house "<içerik>" Robot House gönderisi'));
355
- console.log(chalk.gray(' natureco naturehub forum "<başlık>" <içerik> Forum gönderisi'));
356
- console.log(chalk.gray(' natureco naturehub list Botları listele'));
357
- console.log(chalk.gray(' natureco naturehub info [bot_id] Bot detayı'));
358
- console.log(chalk.gray(' natureco naturehub config Ayarlar'));
359
- console.log('');
360
- return;
361
- }
362
- if (action === 'post') return cmdPost(params);
363
- if (action === 'robot-house' || action === 'robot_house' || action === 'robothouse') return cmdRobotHouse(params);
364
- if (action === 'forum') return cmdForum(params);
365
- if (action === 'list') return cmdList();
366
- if (action === 'info') return cmdInfo(params[0]);
367
- if (action === 'config') return cmdConfig();
368
- if (action === 'dm') return cmdDm(params);
369
- if (action === 'inbox') return cmdInbox(params);
370
- console.log(chalk.red(`\n Bilinmeyen action: ${action}\n`));
371
- }
372
-
373
- module.exports = naturehub;
1
+ /**
2
+ * natureco naturehub — NatureCo Bot API iletişimi
3
+ *
4
+ * natureco.me/api/v1/bots endpoint'lerini kullanır.
5
+ * Kullanım:
6
+ * natureco naturehub post <text> Bota mesaj gönder
7
+ * natureco naturehub list Botları listele
8
+ * natureco naturehub info [bot_id] Bot detayı
9
+ * natureco naturehub config Ayarları göster
10
+ *
11
+ * API: https://natureco.me/api/v1/bots
12
+ */
13
+
14
+ const chalk = require('chalk');
15
+ const https = require('https');
16
+ const { URL } = require('url');
17
+ const audit = require('../utils/audit');
18
+
19
+ const API_BASE = 'https://api.natureco.me';
20
+ const API_PREFIX = '/api/v1';
21
+ const CONFIG_KEY = 'naturehub';
22
+
23
+ function getApiKey() {
24
+ try {
25
+ const { getConfig } = require('../utils/config');
26
+ const cfg = getConfig();
27
+ return cfg?.apiKey || null;
28
+ } catch { return null; }
29
+ }
30
+
31
+ function getBotId() {
32
+ try {
33
+ const { getConfig } = require('../utils/config');
34
+ const cfg = getConfig();
35
+ return cfg?.naturecoBotId || null;
36
+ } catch { return null; }
37
+ }
38
+
39
+ async function apiCall(path, options = {}) {
40
+ return new Promise((resolve, reject) => {
41
+ const url = new URL(API_PREFIX + path, API_BASE);
42
+ const reqOptions = {
43
+ hostname: url.hostname,
44
+ path: url.pathname + url.search,
45
+ method: options.method || 'GET',
46
+ headers: {
47
+ 'Content-Type': 'application/json',
48
+ 'User-Agent': 'natureco-cli/5.20',
49
+ ...(options.token ? { 'Authorization': `Bearer ${options.token}` } : {}),
50
+ ...options.headers,
51
+ },
52
+ timeout: 10000,
53
+ };
54
+ const req = https.request(reqOptions, (res) => {
55
+ let data = '';
56
+ res.on('data', (chunk) => data += chunk);
57
+ res.on('end', () => {
58
+ if (res.statusCode >= 200 && res.statusCode < 300) {
59
+ try { resolve(JSON.parse(data)); } catch { resolve(data); }
60
+ } else {
61
+ reject(new Error(`HTTP ${res.statusCode}: ${data.slice(0, 200)}`));
62
+ }
63
+ });
64
+ });
65
+ req.on('error', reject);
66
+ req.on('timeout', () => { req.destroy(); reject(new Error('Timeout')); });
67
+ if (options.body) req.write(JSON.stringify(options.body));
68
+ req.end();
69
+ });
70
+ }
71
+
72
+ async function cmdPost(args) {
73
+ const text = args.join(' ').trim();
74
+ if (!text) {
75
+ console.log(chalk.red('\n Kullanım: natureco naturehub post "<mesaj>"\n'));
76
+ return;
77
+ }
78
+
79
+ const token = getApiKey();
80
+ if (!token) {
81
+ console.log(chalk.yellow('\n ⚠️ API key tanımlı değil. Önce `natureco login` ile giriş yapın.\n'));
82
+ saveLocal(text);
83
+ return;
84
+ }
85
+
86
+ const botId = getBotId();
87
+ if (!botId) {
88
+ console.log(chalk.yellow('\n ⚠️ Bot ID tanımlı değil. `natureco naturehub list` ile botlarınızı görün.\n'));
89
+ console.log(chalk.gray(' Ayarlamak için: natureco config set naturecoBotId <bot_id>\n'));
90
+ saveLocal(text);
91
+ return;
92
+ }
93
+
94
+ console.log(chalk.cyan(`\n 📤 Bota mesaj gönderiliyor (${botId})...\n`));
95
+ console.log(chalk.gray(` "${text.slice(0, 200)}"\n`));
96
+
97
+ try {
98
+ const result = await apiCall(`/bots/${botId}/messages`, {
99
+ method: 'POST',
100
+ token,
101
+ body: { message: text, user_id: 'cli' },
102
+ });
103
+ console.log(chalk.green(' ✓ Gönderildi!\n'));
104
+ if (result.reply) console.log(chalk.cyan(` 💬 Bot: ${result.reply}\n`));
105
+ audit.log(audit.ACTIONS.INFO, { source: 'naturehub', action: 'post', botId });
106
+ } catch (e) {
107
+ console.log(chalk.red(` Hata: ${e.message}\n`));
108
+ saveLocal(text);
109
+ }
110
+ }
111
+
112
+ function saveLocal(text) {
113
+ const fs = require('fs');
114
+ const path = require('path');
115
+ const os = require('os');
116
+ const file = path.join(os.homedir(), '.natureco', 'naturehub-pending.jsonl');
117
+ const dir = path.dirname(file);
118
+ if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
119
+ fs.appendFileSync(file, JSON.stringify({ ts: new Date().toISOString(), text }) + '\n');
120
+ console.log(chalk.gray(` Kayıt: ${file}\n`));
121
+ }
122
+
123
+ async function cmdList() {
124
+ const token = getApiKey();
125
+ if (!token) {
126
+ console.log(chalk.yellow('\n ⚠️ API key tanımlı değil.\n'));
127
+ return;
128
+ }
129
+
130
+ console.log(chalk.cyan('\n 🤖 Botlarınız\n'));
131
+
132
+ try {
133
+ const result = await apiCall('/bots', { method: 'GET', token });
134
+ const bots = Array.isArray(result) ? result : (result.bots || result.data || []);
135
+ if (bots.length === 0) {
136
+ console.log(chalk.gray(' Henüz botunuz yok.\n'));
137
+ return;
138
+ }
139
+ for (const b of bots) {
140
+ console.log(` ${chalk.cyan('●')} ${b.name || b.id} ${chalk.gray(`(${b.id})`)}`);
141
+ if (b.description) console.log(` ${chalk.gray(b.description)}`);
142
+ console.log('');
143
+ }
144
+ console.log(chalk.gray(' Bot ID ayarlamak için: natureco config set naturecoBotId <id>\n'));
145
+ } catch (e) {
146
+ console.log(chalk.red(` ✗ Hata: ${e.message}\n`));
147
+ }
148
+ }
149
+
150
+ async function cmdInfo(botId) {
151
+ const token = getApiKey();
152
+ if (!token) {
153
+ console.log(chalk.yellow('\n ⚠️ API key tanımlı değil.\n'));
154
+ return;
155
+ }
156
+
157
+ const id = botId || getBotId();
158
+ if (!id) {
159
+ console.log(chalk.yellow('\n Bot ID gerekli: natureco naturehub info <bot_id>\n'));
160
+ return;
161
+ }
162
+
163
+ console.log(chalk.cyan(`\n 🤖 Bot: ${id}\n`));
164
+ try {
165
+ const result = await apiCall(`/bots/${id}`, { method: 'GET', token });
166
+ console.log(` ${chalk.bold('ID:')} ${result.id}`);
167
+ console.log(` ${chalk.bold('İsim:')} ${result.name || '-'}`);
168
+ console.log(` ${chalk.bold('Açıklama:')} ${result.description || '-'}`);
169
+ console.log(` ${chalk.bold('Durum:')} ${result.status || 'active'}`);
170
+ console.log('');
171
+ } catch (e) {
172
+ console.log(chalk.red(` ✗ Hata: ${e.message}\n`));
173
+ }
174
+ }
175
+
176
+ async function cmdConfig() {
177
+ const { getConfig } = require('../utils/config');
178
+ const cfg = getConfig();
179
+ console.log(chalk.cyan('\n ⚙️ NatureCo API Ayarları\n'));
180
+ console.log(chalk.gray(' API Key: ') + (cfg.apiKey ? chalk.green('✓ ayarlı') : chalk.yellow('yok')));
181
+ console.log(chalk.gray(' Bot ID: ') + (cfg.naturecoBotId ? chalk.green(cfg.naturecoBotId) : chalk.yellow('ayarlanmamış')));
182
+ console.log(chalk.gray('\n Giriş: ') + chalk.cyan('natureco login'));
183
+ console.log(chalk.gray(' Bot ID: ') + chalk.cyan('natureco config set naturecoBotId <id>'));
184
+ console.log(chalk.gray(' Botlar: ') + chalk.cyan('natureco naturehub list'));
185
+ console.log('');
186
+ }
187
+
188
+ async function naturehub(args) {
189
+ const [action, ...params] = args || [];
190
+ if (!action || action === 'help') {
191
+ console.log(chalk.yellow('\n Kullanım:'));
192
+ console.log(chalk.gray(' natureco naturehub post "<mesaj>" Bota mesaj gönder'));
193
+ console.log(chalk.gray(' natureco naturehub list Botları listele'));
194
+ console.log(chalk.gray(' natureco naturehub info [bot_id] Bot detayı'));
195
+ console.log(chalk.gray(' natureco naturehub config Ayarlar'));
196
+ console.log('');
197
+ return;
198
+ }
199
+ if (action === 'post') return cmdPost(params);
200
+ if (action === 'list') return cmdList();
201
+ if (action === 'info') return cmdInfo(params[0]);
202
+ if (action === 'config') return cmdConfig();
203
+ console.log(chalk.red(`\n Bilinmeyen action: ${action}\n`));
204
+ }
205
+
206
+ module.exports = naturehub;