The command exited with code 0. Output: Created At: 2026-09-01T06:37:36Z Completed At: 2026-09-01T06:37:36Z File Path: `file:///root/aadharbot/index.js` Total Lines: 5458 Total Bytes: 252861 Showing lines 3410 to 3510 The following code has been modified to include a line number before every line, in the format: : . Please note that any changes targeting the original code should remove the line number, colon, and leading space. 3410: }; 3411: 3412: console.time(tLabel('Backend Request')); 3413: otpResponse = await callApi('/eid-to-adhar/send-otp', { 3414: method: 'POST', 3415: body: JSON.stringify(otpReqBody), 3416: signal: AbortSignal.timeout(12000) 3417: }); 3418: otpData = await otpResponse.json(); 3419: console.timeEnd(tLabel('Backend Request')); 3420: } 3421: 3422: console.log(`[Attempt ${attempt}] Backend Response Status:`, otpResponse.status, otpData); 3423: 3424: if (otpResponse.ok && otpData.status === "success") { 3425: if (statusMessageId) ctx.telegram.deleteMessage(ctx.chat.id, statusMessageId).catch(() => { }); 3426: if (session.startLoaderId) { 3427: ctx.telegram.deleteMessage(ctx.chat.id, session.startLoaderId).catch(() => { }); 3428: session.startLoaderId = null; 3429: } 3430: 3431: session.otpTxnId = otpData.otpTxnId || otpData.txnId; 3432: ctx.reply(`šŸ“© *OTP Sent Successfully!*\n\nPlease enter the 6-digit OTP sent to your registered mobile number:\n\nšŸ’” _Send /cancel to cancel this process._`, { parse_mode: 'Markdown' }); 3433: session.step = session.pdfPhase ? 'WAITING_FOR_PDF_OTP' : 'WAITING_FOR_OTP'; 3434: console.timeEnd(tLabel('Total Loop')); 3435: } else { 3436: let errMsg = otpData ? (otpData.message || (otpData.data && otpData.data.data && otpData.data.data.message) || (otpData.data && otpData.data.message)) : null; 3437: if (errMsg && typeof errMsg === 'string' && !errMsg.toLowerCase().includes('captcha')) { 3438: console.log(`[Attempt ${attempt}] Validation error:`, errMsg); 3439: if (statusMessageId) ctx.telegram.deleteMessage(ctx.chat.id, statusMessageId).catch(() => { }); 3440: ctx.reply(`āš ļø *Error:* ${errMsg}\n\nPlease check your details and try again.`, { parse_mode: 'Markdown' }); 3441: delete sessions[ctx.chat.id]; 3442: return; 3443: } 3444: console.log(`[Attempt ${attempt}] Backend returned non-success status or HTTP error. Retrying...`); 3445: 3446: // If we reached max attempts and it's still failing, don't fall back to manual captcha if it's not explicitly a captcha error. 3447: if (attempt >= 3 && errMsg && !errMsg.toLowerCase().includes('captcha')) { 3448: if (statusMessageId) ctx.telegram.deleteMessage(ctx.chat.id, statusMessageId).catch(() => { }); 3449: ctx.reply(`āš ļø *Error:* ${errMsg || 'Connection failed'}\n\nPlease try again later.`, { parse_mode: 'Markdown' }); 3450: delete sessions[ctx.chat.id]; 3451: return; 3452: } 3453: 3454: await new Promise(r => setTimeout(r, 500)); 3455: try { console.timeEnd(tLabel('Total Loop')); } catch (err) {} 3456: await autoSolveAndRequestOtp(ctx, session, attempt + 1, statusMessageId); 3457: } 3458: } catch (error) { 3459: console.error("Network Error (Retry):", error.code || error.message); 3460: try { console.timeEnd(tLabel('Total Loop')); } catch (e) { 3461: console.error("Error:", e); 3462: } 3463: await new Promise(r => setTimeout(r, 500)); 3464: await autoSolveAndRequestOtp(ctx, session, attempt + 1, statusMessageId); 3465: } 3466: } 3467: 3468: // Action Handlers for Buttons 3469: bot.action('CAPTCHA_AUTO', async (ctx) => { 3470: const userId = ctx.chat.id; 3471: const session = sessions[userId]; 3472: if (!session) return; 3473: 3474: ctx.answerCbQuery().catch(() => { }); 3475: ctx.editMessageText('ā³ Loading... Please wait.', { parse_mode: 'HTML' }); 3476: session.step = session.pdfPhase ? 'SOLVING_CAPTCHA_PDF' : 'SOLVING_CAPTCHA'; 3477: await autoSolveAndRequestOtp(ctx, session, 1); 3478: }); 3479: 3480: bot.action('CAPTCHA_MANUAL', async (ctx) => { 3481: const userId = ctx.chat.id; 3482: const session = sessions[userId]; 3483: if (!session) return; 3484: 3485: ctx.answerCbQuery().catch(() => { }); 3486: ctx.editMessageText('āœļø *Switching to manual verification...*', { parse_mode: 'Markdown' }); 3487: await fetchManualCaptcha(ctx, session); 3488: }); 3489: 3490: bot.action('CHOOSE_WITH_DOB', async (ctx) => { 3491: const userId = ctx.chat.id; 3492: const session = sessions[userId]; 3493: if (!session) return; 3494: ctx.answerCbQuery().catch(() => { }); 3495: ctx.editMessageText('šŸ“… *Please enter your Date of Birth (in DD/MM/YYYY format):*', { parse_mode: 'Markdown' }); 3496: session.step = 'WAITING_FOR_DOB_VAL'; 3497: }); 3498: 3499: bot.action('CHOOSE_WITHOUT_DOB', async (ctx) => { 3500: const userId = ctx.chat.id; 3501: const session = sessions[userId]; 3502: if (!session) return; 3503: ctx.answerCbQuery().catch(() => { }); 3504: 3505: // Instantly delete the prompt to avoid chat clutter 3506: ctx.deleteMessage().catch(() => { }); 3507: session.dob = null; 3508: session.step = 'SOLVING_CAPTCHA'; 3509: await autoSolveAndRequestOtp(ctx, session, 1); 3510: }); The above content does NOT show the entire file contents. If you need to view any lines of the file which were not shown to complete your task, call this tool again to view those lines.