The command exited with code 0. Output: 1 2 const fs = require('fs'); 3 4 let bot, sessions, userCache, pool, PaymentService, helpers; 5 6 function init(b, s, u, p, ps, h) { 7 bot = b; 8 sessions = s; 9 userCache = u; 10 pool = p; 11 PaymentService = ps; 12 helpers = h; 13 14 bot.action(/^BUY_PLAN_(\w+)_(\d+)$/, async (ctx) => { 15 ctx.answerCbQuery().catch(() => { }); 16 17 bot.action(/verify_(.+)/, async (ctx) => { 18 try { 19 await ctx.answerCbQuery('šŸ”„ Verifying your payment...', true); 20 const orderId = ctx.match[1]; 21 22 // Let the user know the daemon is checking 23 await ctx.reply(`We are checking the payment status with the bank for Order ID: ${orderId}. Your balance will update automatically within 1-2 minutes!`); 24 } catch (e) { 25 console.error("Error:", e); 26 console.error(e); 27 } 28 }); 29 30 bot.on('photo', async (ctx) => { 31 const userId = ctx.chat.id; 32 const session = sessions[userId]; 33 if (!session || session.step !== 'WAITING_FOR_SCREENSHOT') return; 34 35 const photo = ctx.message.photo; 36 if (!photo || photo.length === 0) return; 37 38 // Get the largest image size 39 const fileId = photo[photo.length - 1].file_id; 40 const logGroupId = process.env.LOG_GROUP_ID; 41 42 try { 43 const threadId = await helpers.getOrCreateUserThread(ctx, userId, ctx.from.first_name || 'User', ctx.from.username); 44 45 if (logGroupId) { 46 const sendOptions = { 47 caption: `šŸ“Š Payment Proof Submitted / ą¤Ŗą„‡ą¤®ą„‡ą¤‚ą¤Ÿ ą¤Ŗą„ą¤°ą„‚ą¤«\n` + 48 `šŸ‘¤ User: ${ctx.from.first_name || 'User'}\n` + 49 `šŸ†” ID: ${userId}\n` + 50 `šŸ’µ Expected Amount: ₹${session.expectedAmount}\n` + 51 `šŸ”¢ Submitted UTR: ${session.utr}\n` + 52 `🧾 Order ID: ${session.orderId}\n` + 53 `šŸ”¢ Serial No: ${session.serialNumber || 'N/A'}`, 54 parse_mode: 'HTML' 55 }; 56 if (threadId && threadId !== -1) { 57 sendOptions.message_thread_id = threadId; 58 } 59 // Forward screenshot to the log group 60 await ctx.telegram.sendPhoto(logGroupId, fileId, sendOptions); 61 } 62 63 // Release/clean up the session step so they can continue bot usage 64 delete sessions[userId]; 65 66 const successMsg = `šŸ“ø Screenshot Submitted Successfully! / ą¤øą„ą¤•ą„ą¤°ą„€ą¤Øą¤¶ą„‰ą¤Ÿ सबमिट ą¤¹ą„‹ गया!\n` + 67 `━━━━━━━━━━━━━━━━━━━━━━━━━━\n` + 68 `
šŸ’° Status: Verification is in progress. Once confirmed by the gateway, your credits will be updated automatically.\n\n` + 69 `šŸ¤– Note: You can now use other bot features normally.
`; 70 await ctx.reply(successMsg, { parse_mode: 'HTML' }); 71 72 } catch (err) { 73 console.error("[SCREENSHOT FORWARD ERROR]:", err.message); 74 ctx.reply("āŒ Submission failed: Could not upload screenshot. Please try again.", { parse_mode: 'HTML' }); 75 } 76 }); 77 78 setInterval(async () => { 79 try { 80 await PaymentService.checkPendingPayments(); 81 } catch (e) { 82 console.error("[DAEMON INTERVAL ERROR]", e.message); 83 } 84 }, 60000); 85 } 86 87 async function handleText(ctx, userId, session) { 88 const text = ctx.message.text; 89 90 if (session.step === 'WAITING_FOR_UTR') { 91 const utr = text.trim(); 92 if (!/^\d{12}$/.test(utr)) { 93 return ctx.reply("āŒ Invalid UTR Format: Please enter a valid 12-digit numeric UTR/Ref No.", { parse_mode: 'HTML' }); 94 } 95 await PaymentService.processUtrPayment(ctx, userId, utr); 96 return; 97 } 98 99 return true; 100 if (session.step === 'WAITING_FOR_BUY_AMOUNT') { 101 const amount = parseInt(text.trim()); 102 if (isNaN(amount) || amount < 100 || amount > 100000) { 103 return ctx.reply("āŒ Invalid Amount: Please enter a valid number between ₹100 and ₹1,00,000.", { parse_mode: 'HTML' }); 104 } 105 if (amount > 20000) { 106 return ctx.reply(`šŸ’Ž Custom Amount\n\nFor amounts above ₹20,000, please directly DM our admin @EverythingBypass to arrange the payment and credits.\n\nšŸ‘‰ Click here to contact @EverythingBypass`, { 107 parse_mode: 'HTML', 108 disable_web_page_preview: true 109 }); 110 } 111 await PaymentService.generatePaymentRequest(ctx, userId, amount, session.planType || 'credits'); 112 return; 113 } 114 115 return true; 116 117 return false; 118 } 119 120 module.exports = { init, handleText };