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] @@ -3730,11 +3730,16 @@ const access = await checkUserAccess(userId); let leftCredits = access.credits; - const cost = 1; - if (!access.isUnlimited) { - leftCredits = await deductUserCredit(userId, cost); - } else { - setCooldown(userId, session.serviceType); + let chargedDesc = ''; + if (access.isUnlimited) { + setCooldown(userId, session.serviceType); + chargedDesc = '0 (VIP Pass)'; + } else if (access.hasFreeSearch) { + await markDailyFreeSearchUsed(userId); + chargedDesc = '0 (Daily Free Search)'; + } else { + leftCredits = await deductUserCredit(userId, 1); + chargedDesc = `1 Credit ${CREDIT_EMOJI}`; } const nameVal = (session.retrievedName || session.name || 'Aadhaar').toUpperCase(); @@ -3752,7 +3752,7 @@ `🆔 UID / No: ${finalAadhaar}\n` + `🔑 Password: ${passVal}\n` + `━━━━━━━━━━━━━━━━━━━━━━━━━━\n` + - `💰 Charged: ${access.isUnlimited ? '0 (VIP Pass)' : '1 Credit'} ${access.isUnlimited ? '' : CREDIT_EMOJI}\n` + + `💰 Charged: ${chargedDesc}\n` + `🪙 Balance: ${access.isUnlimited ? 'Unlimited' : leftCredits + ' Credits'} ${access.isUnlimited ? '' : CREDIT_EMOJI}\n` + `━━━━━━━━━━━━━━━━━━━━━━━━━━\n` + `⚡ AADHAAR VIP ENGINE ⚡`; @@ -3777,15 +3777,20 @@ const pdfBuffer = Buffer.from(rawText, 'binary'); const access = await checkUserAccess(userId); let leftCredits = access.credits; - const cost = 1; - if (!access.isUnlimited) { - leftCredits = await deductUserCredit(userId, cost); - } else { - setCooldown(userId, session.serviceType); + let chargedDesc = ''; + if (access.isUnlimited) { + setCooldown(userId, session.serviceType); + chargedDesc = '0 (Unlimited Plan)'; + } else if (access.hasFreeSearch) { + await markDailyFreeSearchUsed(userId); + chargedDesc = '0 (Daily Free Search)'; + } else { + leftCredits = await deductUserCredit(userId, 1); + chargedDesc = `1 Credit ${CREDIT_EMOJI}`; } await ctx.replyWithDocument({ source: pdfBuffer, filename: `${session.retrievedName}_Aadhaar.pdf` }); ctx.reply(`
🎉 PDF Downloaded Successfully!
\n` + - `
🪙 Deducted: ${access.isUnlimited ? '0 (Unlimited Plan)' : `1 Credit ${CREDIT_EMOJI}`}\n` + + `
🪙 Deducted: ${chargedDesc}\n` + `🪙 Remaining Balance: ${access.isUnlimited ? 'Unlimited' : `${leftCredits} Credits ${CREDIT_EMOJI}`}
`, { parse_mode: 'HTML' }); await saveSearchRecord(userId, session.serviceType, session.retrievedName, session.mobile, session.eidNumber, null, null, pdfBuffer); } else { [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.