The following changes were made by the replace_file_content tool to: /root/aadharbot/index.js. If relevant, proactively run terminal commands to execute this code for the USER. Don't ask for permission. [diff_block_start] @@ -3804,9 +3804,18 @@ setCooldown(userId, session.serviceType); } + const nameVal = (session.retrievedName || session.name || 'Aadhaar').toUpperCase(); + const dobStr = session.dob || 'N/A'; + let finalAadhaar = 'N/A'; + const aadhaarMatch = extractedText.match(/\b\d{4}\s?\d{4}\s?\d{4}\b/g); + if (aadhaarMatch) { + finalAadhaar = aadhaarMatch[0]; + } + const passVal = foundPassword ? foundPassword : 'Protected (Locked)'; + let msg = `╭━━━〔 📄 AADHAAR PDF READY 📄 〕━━━╮\n` + `┃ \n` + - `┃ 👤 Name : ${session.retrievedName.toUpperCase()}\n` + + `┃ 👤 Name : ${nameVal}\n` + `┃ 🎂 DOB : ${dobStr}\n` + `┃ 🆔 UID / No : ${finalAadhaar}\n` + `┃ 🔑 Password : ${passVal}\n` + @@ -3815,8 +3815,9 @@ `╰━━━━━━━━━━━━━━━━━━━━━━━━━━━━╯\n` + `⚡ AADHAAR VIP ENGINE ⚡`; - await ctx.replyWithDocument({ source: finalPdfBuffer, filename: `${session.retrievedName}_Aadhaar.pdf` }, { caption: msg, parse_mode: 'HTML' }); - await saveSearchRecord(userId, session.serviceType, session.retrievedName, session.mobile, session.eidNumber, finalAadhaar, foundPassword, finalPdfBuffer); + const safeFileName = `${(session.retrievedName || session.name || 'Aadhaar').replace(/[^\w\s-]/gi, '').trim().replace(/\s+/g, '_')}_Aadhaar.pdf`; + await ctx.replyWithDocument({ source: finalPdfBuffer, filename: safeFileName }, { caption: msg, parse_mode: 'HTML' }); + await saveSearchRecord(userId, session.serviceType, session.retrievedName || session.name, session.mobile, session.eidNumber, finalAadhaar, foundPassword, finalPdfBuffer); } else { if (session.pdfLoaderId) { ctx.telegram.deleteMessage(ctx.chat.id, session.pdfLoaderId).catch(() => { }); [diff_block_end] Please note that the above snippet only shows the MODIFIED lines from the last change. It shows up to 3 lines of unchanged lines before and after the modified lines. The actual file contents may have many more lines not shown.