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 };