Personal Telegram developer console for GitHub
feat: route owner pending workspace text
davoodmehraban89 committed
Oct 3, 2026 at 13:17 UTC
9df1b8c0fb504862608d2f8a3898109e1d4733de
1 file changed
+27
-1
src/bot.js
+27
-1
@@ -232,7 +232,8 @@ export class NexaDevBot {
232
233
async handleMessage(message) {
234
const chatId = message.chat?.id;
235
- const text = (message.text || '').trim();
235
+ const rawText = typeof message.text === 'string' ? message.text : '';
236
+ const text = rawText.trim();
237
if (!chatId) return { ok: false, error: 'Missing chat_id' };
238
239
if (text === '/start' || text === '/menu' || text.startsWith('/start')) {
@@ -260,6 +261,31 @@ export class NexaDevBot {
261
return { ok: true, command: 'status', res };
262
}
263
264
+ const ownerId = message.from?.id;
265
+ if (
266
+ typeof message.text === 'string' &&
267
+ ownerId !== undefined && ownerId !== null &&
268
+ this.workspaceStore.isConfigured()
269
+ ) {
270
+ const owner = String(ownerId);
271
+ const pending = await this.workspaceStore.getPendingInput({ ownerId: owner });
272
+ if (pending) {
273
+ const routed = await this.router.dispatchMessage(
274
+ { pending, text: rawText },
275
+ { isOwner: true, ownerId: owner }
276
+ );
277
+ if (routed?.requiresApproval || routed?.denied || !routed) {
278
+ return {
279
+ ok: false,
280
+ workspaceInput: true,
281
+ error: routed?.reason || 'Workspace input route unavailable'
282
+ };
283
+ }
284
+ const res = await this.telegram.sendMessage(chatId, routed.text, routed.reply_markup);
285
+ return { ok: true, workspaceInput: true, res };
286
+ }
287
+ }
288
+
289
const defaultText = `💡 برای دسترسی به منوهای پروژهها و ابزارهای Nexa Dev، دکمه زیر را لمس کنید:`;
290
const view = { text: defaultText, reply_markup: { inline_keyboard: [[{ text: '⚡ باز کردن منوی اصلی Nexa Dev', callback_data: 'menu:main' }]] } };
291
const res = await this.telegram.sendMessage(chatId, view.text, view.reply_markup);