tarunpoonia905/OfcDevShopBotPublic · Bot Template

ProfileTelegram

AIDEV SHOP appears to be a Telegram automation bot. Commands include /confirm_delete_stock, /addstock_id, /extkey_menu, /partner_api, /apidelete, /buy_hack_cat, /admin_manage_products, /check_buy. Observed in code: messaging, keyboards, payments, libs, web, http, games.

Utilityutility
228 commands0 envUpdated 12d agoCreated Oct 18, 2026
Back to folder

commands/_onCheck.js

javascript · 480 lines

Raw
1/**#command2name: /onCheck3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12/*#SIZE_V1*/try{(function(){var z=Bot.getProperty("ui_btn_size");var mx=z==="large"?1:(z==="medium"?2:0);if(!mx||Api.__sz)return;var NAV=/^[◀▶⬅➡«»‹›⏪⏩]|\d+\s*\/\s*\d+|prev|next|page/i;var T=function(m){try{var o=typeof m==="string"?JSON.parse(m):m;if(!o||!o.inline_keyboard)return m;var out=[],cnt=0;o.inline_keyboard.forEach(function(row){var nav=row.some(function(b){return NAV.test(String(b.text||"").trim());});if(row.length<=mx||nav){out.push(row);cnt+=row.length;return;}for(var i=0;i<row.length;i+=mx){var c=row.slice(i,i+mx);out.push(c);cnt+=c.length;}});if(cnt>100||out.length>100)return m;o.inline_keyboard=out;return typeof m==="string"?JSON.stringify(o):o;}catch(e){return m;}};["sendMessage","editMessageText","editMessageCaption","editMessageReplyMarkup","sendPhoto","sendVideo","sendAnimation","sendDocument"].forEach(function(n){var f=Api[n];if(typeof f!=="function")return;Api[n]=function(p){try{if(p&&p.reply_markup)p.reply_markup=T(p.reply_markup);}catch(e){}return f.apply(Api,arguments);};});Api.__sz=true;})();}catch(__szE){}13/*#ANIM_V1*/try{(function(){var M={party:"5046509860389126442",fire:"5104841245755180586",heart:"5159385139981059251",like:"5107584321108051014"};var a=Bot.getProperty("ui_anim");if(!a||!M[a]||Api.__an)return;var E=M[a];var OK=/PURCHASE SUCCESSFUL|PAYMENT SUCCESSFUL|Payment verified|CONGRATULATIONS/i;var priv=function(p){return p&&p.chat_id&&String(p.chat_id).charAt(0)!=="-";};["sendMessage","sendPhoto","sendVideo","sendAnimation"].forEach(function(n){var f=Api[n];if(typeof f!=="function")return;Api[n]=function(p){try{if(priv(p)&&!p.message_effect_id&&OK.test(String(p.text||p.caption||"")))p.message_effect_id=E;}catch(e){}return f.apply(Api,arguments);};});var fe=Api.editMessageText;if(typeof fe==="function"){Api.editMessageText=function(p){var r=fe.apply(Api,arguments);try{if(priv(p)&&OK.test(String(p.text||"")))Api.sendMessage({chat_id:p.chat_id,text:"🎉",message_effect_id:E});}catch(e){}return r;};}Api.__an=true;})();}catch(__anE){}14/*#PREMIUM_UI_V1*/try{(function(){if(Bot.getProperty("ui_premium")!==true||Api.__pm)return;var R=function(t,c){var s=(String(t||"")+" "+String(c||"")).toLowerCase();if(/back|cancel|close|delete|remove|clear|reject|stop|ban|exit/.test(s))return"danger";if(/pay|buy|confirm|verify|paid|add|deposit|shop|claim|yes|receive|wallet|download|update/.test(s))return"success";return"primary";};var T=function(m){try{var o=typeof m==="string"?JSON.parse(m):m;if(!o||!o.inline_keyboard)return m;o.inline_keyboard.forEach(function(row){row.forEach(function(b){if(b.copy_text||b.url||b.callback_data||b.web_app){b.style=R(b.text,b.callback_data||b.url);if(!b.icon_custom_emoji_id&&b.text&&!/^[\u2600-\u27BF\uD83C-\uD83E]/.test(String(b.text).trim())&&!/^[✦✨💎]/.test(b.text))b.text="✦ "+b.text;}});});return typeof m==="string"?JSON.stringify(o):o;}catch(e){return m;}};["sendMessage","editMessageText","editMessageCaption","editMessageReplyMarkup","sendPhoto","sendVideo","sendAnimation","sendDocument"].forEach(function(n){var f=Api[n];if(typeof f!=="function")return;Api[n]=function(p){try{if(p&&p.reply_markup)p.reply_markup=T(p.reply_markup);}catch(e){}return f.apply(Api,arguments);};});Api.__pm=true;})();}catch(__pmE){}15 16 17try {18  function __paytmNorm(r, lockedAmt, orderIdX) {19    if (!r || typeof r !== "object") return r;20    if (String(r.status).toLowerCase() === "success" && r.data) return r;21    var d = (r.data && typeof r.data === "object") ? r.data : r;22    var st = String(d.status || d.txn_status || d.STATUS || d.payment_status || r.status || r.txn_status || "").toUpperCase();23    var paidSt = ["TXN_SUCCESS", "SUCCESS", "PAID", "COMPLETED", "CAPTURED", "CREDITED"];24    var failSt = ["PENDING", "FAILURE", "FAILED", "EXPIRED", "CANCELLED", "CREATED", "NOT_FOUND", "TXN_FAILURE", "ERROR"];25    var paid = (paidSt.indexOf(st) !== -1 && failSt.indexOf(st) === -1) || d.paid === true || d.is_paid === true || r.paid === true || r.is_paid === true;26    if (!paid) return r;27    var amt = parseFloat(d.amount || d.txn_amount || d.TXNAMOUNT || d.paid_amount || r.amount || r.txn_amount || 0) || 0;28    if (!(amt > 0)) amt = Number(lockedAmt || 0);29    return { status: "success", data: {30      amount: amt,31      utr: d.utr || d.rrn || d.bank_txn_id || d.transaction_id || d.txn_id || d.txnid || r.utr || r.transaction_id || r.txn_id || orderIdX,32      sender_name: d.sender_name || d.payer_name || r.sender_name || "Valued User",33      payment_time_ist: d.payment_time_ist || d.txn_date || d.payment_time || r.payment_time_ist || "N/A"34    }};35  }36  var opts = (typeof options !== "undefined" && options) ? options : {};37  let isBackground = opts.is_background || false;38  let orderId = opts.order_id;39  let amount = opts.amount;40  // 🔧 FIX: background (auto-verify) calls always pass options.userId explicitly —41  // that must win over any ambient user/chat context, which is unreliable in a42  // scheduled/background invocation (no real incoming update). Only fall back to43  // the live user/chat when options.userId isn't provided (manual button click).44  let chatId = opts.userId || ((typeof chat !== "undefined" && chat) ? chat.chatid : null);45  let attempt = opts.attempt || 1;46 47  if (typeof params !== "undefined" && params && params.trim() !== "") {48    let splitParams = params.trim().split(" ");49    if (splitParams.length >= 1 && splitParams[0].length > 5) {50      orderId = splitParams[0];51    }52    if (splitParams.length >= 2) amount = splitParams[1];53  }54 55  let targetUserId = opts.userId || ((typeof user !== "undefined" && user) ? user.telegramid : null);56 57  // 🛠️ ULTIMATE FALLBACK: Agar button ya params se orderId na mile, toh active pending order ID utha lo!58  if ((!orderId || orderId.trim() === "") && targetUserId) {59    orderId = User.getProperty("pending_order_id") || 60              Bot.getProperty("qr_order_id_" + targetUserId) || 61              User.getProperty("qr_order_id_" + targetUserId) ||62              User.getProperty("buy_pending_order_id");63  }64 65  let queryId = null;66  if (typeof request !== "undefined" && request) {67    if (request.callback_query && request.callback_query.id) {68      queryId = request.callback_query.id;69    } else if (request.id) {70      queryId = request.id;71    }72  }73 74  // 🎨 Premium emojis75  let e_chart = "<tg-emoji emoji-id='5992430854909989581'>📊</tg-emoji>";76  let e_plus = "<tg-emoji emoji-id='5346004239246183111'>➕</tg-emoji>";77  let e_arrow = "<tg-emoji emoji-id='5875506366050734240'>➡️</tg-emoji>";78  let e_coin = "<tg-emoji emoji-id='5778335621491723621'>🪙</tg-emoji>";79  let e_money = "<tg-emoji emoji-id='5348392971207194994'>💰</tg-emoji>";80  let e_time = "<tg-emoji emoji-id='5776213190387961618'>🕓</tg-emoji>";81  let e_check = "<tg-emoji emoji-id='5330237710655306682'>✅</tg-emoji>";82 83  function vanishQrMessage(uid, fallbackChatId) {84    try {85      let qrMsgId = Bot.getProperty("qr_msg_id_" + uid) ||86                    User.getProperty("qr_msg_id_" + uid) ||87                    User.getProperty("last_qr_message_id_" + uid);88      if (qrMsgId) {89        try { Api.deleteMessage({ chat_id: fallbackChatId, message_id: qrMsgId }); } catch (e) {}90      }91    } catch (e) {}92  }93 94  function clearQrState(uid) {95    Bot.setProperty("qr_msg_id_" + uid, null, "string");96    User.setProperty("qr_msg_id_" + uid, null, "string");97    User.setProperty("last_qr_message_id_" + uid, null, "string");98    Bot.setProperty("qr_order_id_" + uid, null, "string");99    User.setProperty("qr_order_id_" + uid, null, "string");100    Bot.setProperty("qr_watch_order_" + uid, null, "string");101    User.setProperty("qr_watch_order_" + uid, null, "string");102    Bot.setProperty("verifying_lock_" + uid, false, "boolean");103    User.setProperty("verifying_lock_" + uid, false, "boolean");104    User.setProperty("topup_verifying_lock_" + uid, false, "boolean");105    User.setProperty("pending_order_id", null);106  }107 108  function balRes(uid) {109    // normal (user context) me pehle jaisa userRes; background run me anotherUserRes fallback110    try {111      if (typeof user !== "undefined" && user && String(user.telegramid) === String(uid)) return Libs.ResourcesLib.userRes("balance");112    } catch (e) {}113    return Libs.ResourcesLib.anotherUserRes("balance", uid);114  }115 116  function getUnifiedBalance(uid) {117    let resBal = 0;118    try { resBal = Number(balRes(uid).value()) || 0; } catch (e) {}119    let bonusBal = Number(Bot.getProperty("balance" + uid) || 0);120    return resBal + bonusBal;121  }122 123  // ✅ STEP 1: Strict Order ID validation check124  if (!orderId || orderId.trim() === "") {125    if (queryId) {126      try {127        Api.answerCallbackQuery({128          callback_query_id: queryId,129          text: "⚠️ Active order nahi mila. Kripya pehle naya QR generate karein.",130          show_alert: true131        });132      } catch (e) {}133    }134    return;135  }136 137  // ✅ STEP 2: Duplicate Claim Check138  if (Bot.getProperty("claimed_topup_" + orderId)) {139    vanishQrMessage(targetUserId, chatId);140    if (targetUserId) clearQrState(targetUserId);141 142    if (queryId) {143      try {144        Api.answerCallbackQuery({145          callback_query_id: queryId,146          text: "✅ ALREADY CLAIMED ✅\nYe payment pehle hi verify hokar balance me add ho chuki hai.",147          show_alert: true148        });149      } catch (e) {}150    }151    return;152  }153 154  if (targetUserId && !isBackground) {155    let isChecking = User.getProperty("topup_verifying_lock_" + targetUserId);156    if (isChecking) {157      if (queryId) {158        try {159          Api.answerCallbackQuery({160            callback_query_id: queryId,161            text: "⏳ VERIFYING... PLEASE WAIT...",162            show_alert: true163          });164        } catch (e) {}165      }166      return;167    }168    User.setProperty("topup_verifying_lock_" + targetUserId, true, "boolean");169  }170 171  // ✅ Auto-verify hand-over: /auto_verify_result already fetched the gateway reply -> use it.172  let responseData = (opts.response && typeof opts.response === "object") ? opts.response :173                     ((typeof content !== "undefined" && content) ? (typeof content === "object" ? content : JSON.parse(content)) : null);174 175  // Paytm Business verify API returns {success:true,status:"TXN_SUCCESS",amount:...}.176  // Normalize it to the existing internal {status:"success",data:{...}} shape.177  if (responseData && String(orderId).indexOf("fg_") !== 0 && Bot.getProperty("pay_gw_" + orderId) !== "famgateway") {178    responseData = __paytmNorm(responseData,179      Number(Bot.getProperty("pay_order_amount_" + orderId) || User.getProperty("pay_order_amount_" + orderId) || 0), orderId);180  }181 182  // FamGateway response normalization — handles BOTH:183  // 1. /api/verify-order.php  -> { status:"success", data:{ utr, transaction_id, ... } }184  // 2. /api/checkout-status.php -> { status:"paid"|"success"|"pending"|"expired", order_id, utr, amount, ... }185  var isFamOrder = (String(orderId).indexOf("fg_") === 0) || (Bot.getProperty("pay_gw_" + orderId) === "famgateway");186  if (responseData && isFamOrder && !responseData.__normalized) {187    (function () {188      var top   = String(responseData.status || "").toLowerCase();189      var d     = responseData.data || responseData;  // checkout-status puts fields at top level190      var inner = String(d.status || d.payment_status || d.order_status || "").toLowerCase();191      var paidStates = ["success", "paid", "completed", "captured"];192      var hasRef = !!(d.utr || d.transaction_id || d.txn_id || responseData.utr || responseData.transaction_id);193      var notPaid = ["pending","expired","created","failed","cancelled"].indexOf(top) !== -1 ||194                    ["pending","expired","created","failed","cancelled"].indexOf(inner) !== -1;195      var paid = (paidStates.indexOf(top) !== -1) && !notPaid &&196                 (hasRef || paidStates.indexOf(inner) !== -1 || d.is_paid === true || d.paid === true ||197                  responseData.is_paid === true || responseData.paid === true);198 199      if (!paid) { responseData = { status: "pending" }; return; }200 201      var base = Number(Bot.getProperty("pay_order_amount_" + orderId) || User.getProperty("pay_order_amount_" + orderId) || 0);202      var pay  = Number(Bot.getProperty("pay_order_payable_" + orderId) || 0);203      // checkout-status puts amount at top level; verify-order puts it in data204      var got  = parseFloat(205        d.amount_received || d.paid_amount || d.received_amount || d.payable_amount || d.amount ||206        responseData.amount || responseData.paid_amount || 0207      ) || 0;208      if (base > 0 && (got <= 0 || Math.abs(got - base) <= 0.01 || (pay > 0 && Math.abs(got - pay) <= 0.01))) got = base;209 210      responseData = { __normalized: true, status: "success", data: {211        amount: got,212        utr:          d.utr || d.transaction_id || d.txn_id || responseData.utr || responseData.transaction_id || orderId,213        sender_name:  d.sender_name || d.payer_name || responseData.sender_name || "Valued User",214        payment_time_ist: d.payment_time_ist || d.payment_time || responseData.payment_time || "N/A"215      }};216    })();217  }218 219  if (responseData && (responseData.status === "success" || responseData.status === "SUCCESS") && responseData.data) {220 221    // Keep duplicate protection, but DO NOT mark an order claimed until its222    // gateway-reported amount has passed the strict order-amount check.223    if (Bot.getProperty("claimed_topup_" + orderId)) {224      if (targetUserId) User.setProperty("topup_verifying_lock_" + targetUserId, false, "boolean");225      return;226    }227 228    let txData = responseData.data;229    let txAmount = txData.amount || amount;230    let utr = txData.utr || txData.transaction_id || "N/A";231    let senderName = txData.sender_name || (typeof user !== "undefined" && user ? user.first_name : "Valued User");232    let payTime = txData.payment_time_ist || "N/A";233    let addedAmount = parseFloat(txAmount) || 0;234 235    // The gateway order is the source of truth for the amount lock. Fall back236    // to the user's pending amount only for older orders created before this237    // per-order property was introduced.238    let expectedAmount = Number(239      Bot.getProperty("pay_order_amount_" + orderId) ||240      User.getProperty("pay_order_amount_" + orderId) ||241      User.getProperty("buy_needpay") ||242      User.getProperty("buy_expected_amount") ||243      User.getProperty("deposit_amount") ||244      User.getProperty("pending_pay_amount_" + targetUserId) || 0245    );246 247    if (!(expectedAmount > 0) || !(addedAmount > 0) || Math.abs(addedAmount - expectedAmount) > 0.01) {248      if (targetUserId) User.setProperty("topup_verifying_lock_" + targetUserId, false, "boolean");249      let mismatchText = expectedAmount > 0250        ? "❌ Amount mismatch! Expected ₹" + expectedAmount.toFixed(2) + ", received ₹" + addedAmount.toFixed(2) + "."251        : "❌ This order has no valid locked amount, so it cannot be credited.";252      if (queryId) {253        try { Api.answerCallbackQuery({ callback_query_id: queryId, text: mismatchText, show_alert: true }); } catch (e) {}254      } else {255        Bot.sendMessage(mismatchText);256      }257      return;258    }259 260    // ─────────────────────────────────────────────────────────────261    // 📒 LIVE ALL-DEPOSIT HISTORY262    // Record only wallet deposits. Product purchases and reseller263    // upgrades are intentionally excluded from "deposit" history.264    // ─────────────────────────────────────────────────────────────265    var __isProductPayment = (User.getProperty("buy_prod_idx") !== null &&266                              User.getProperty("buy_prod_idx") !== undefined &&267                              User.getProperty("buy_prod_idx") !== "");268    var __isResellerPayment = !!(User.getProperty("buy_reseller_upgrade") ||269                                 Number(Bot.getProperty("reseller_upg_" + targetUserId) || 0) > 0);270 271    if (!__isProductPayment && !__isResellerPayment) {272      try {273        var __hist = Bot.getProperty("deposit_history_records");274        if (!Array.isArray(__hist)) __hist = [];275 276        var __gw = String(Bot.getProperty("pay_gw_" + orderId) || "").toLowerCase();277        if (__gw === "famgateway" || isFamOrder || __gw.indexOf("fam") === 0) __gw = "FamPay";278        else if (__gw.indexOf("paytm") === 0) __gw = "Paytm";279        else if (__gw.indexOf("jdp") === 0) __gw = "JDP";280        else if (__gw.indexOf("zap") === 0) __gw = "JDP/UPI";281        else if (String(orderId).toLowerCase().indexOf("paytm") !== -1 ||282                 String(responseData.gateway || "").toLowerCase().indexOf("paytm") !== -1) __gw = "Paytm";283        else if (String(orderId).toLowerCase().indexOf("jdp") !== -1 ||284                 String(responseData.gateway || "").toLowerCase().indexOf("jdp") !== -1) __gw = "JDP";285        else if (String(responseData.gateway || "").toLowerCase().indexOf("fampay") !== -1) __gw = "FamPay";286        else __gw = "UPI";287 288        var __uFirst = (typeof user !== "undefined" && user) ? (user.first_name || "") : "";289        var __uLast  = (typeof user !== "undefined" && user) ? (user.last_name || "") : "";290        var __uName  = (String(__uFirst) + " " + String(__uLast)).trim();291        if (!__uName && senderName) __uName = senderName;292 293        var __email = "";294        try {295          __email = User.getProperty("email") || User.getProperty("user_email") ||296                    User.getProperty("email_address") || "";297        } catch(e0) {}298 299        __hist.push({300          ts: Date.now(),301          user_id: String(targetUserId || ""),302          name: String(__uName || senderName || "Valued User"),303          username: (typeof user !== "undefined" && user) ? String(user.username || "") : "",304          email: String(__email || "Not provided"),305          amount: Number(addedAmount),306          utr: String(utr || "N/A"),307          order_id: String(orderId || "N/A"),308          gateway: __gw309        });310 311        // Keep the database bounded while retaining a large audit window.312        if (__hist.length > 5000) __hist = __hist.slice(__hist.length - 5000);313        Bot.setProperty("deposit_history_records", __hist, "json");314      } catch(__histErr) {315        try {316          Api.sendMessage({317            chat_id: String(Bot.getProperty("owner_id") || "7127818616"),318            parse_mode:"HTML",319            text:"⚠️ <b>Deposit history save failed</b>\n<code>"+String(__histErr.message||__histErr).replace(/</g,"&lt;")+"</code>"320          });321        } catch(e1) {}322      }323    }324 325    // Claim only after the payment is successful AND the amount matches.326    Bot.setProperty("claimed_topup_" + orderId, true, "boolean");327 328    try {329      balRes(targetUserId).add(addedAmount);330    } catch (e) {331      // pehle silent tha — user ko "success" dikhta tha par balance add nahi hota tha332      try {333        Api.sendMessage({ chat_id: String(Bot.getProperty("owner_id") || "7127818616"), parse_mode: "HTML",334          text: "❗ <b>Balance credit FAILED</b>\nUser: <code>" + targetUserId + "</code>\nAmount: ₹" + addedAmount.toFixed(2) +335                "\nOrder: <code>" + orderId + "</code>\nError: <code>" + String(e.message) + "</code>" });336      } catch (e2) {}337    }338    let newBalance = getUnifiedBalance(targetUserId);339 340 341    // 🔔 Admin notification for wallet balance top-up342    try {343      let walletLogAdminId = Bot.getProperty("owner_id") || "7127818616";344      let walletAdminMsg = "<blockquote>" +345        "🔔 <b>WALLET BALANCE ADDED</b> ✔️\n\n" +346        "👤 <b>User:</b> " + senderName + " (<code>" + targetUserId + "</code>)\n" +347        "💰 <b>Amount Added:</b> ₹" + addedAmount.toFixed(2) + "\n" +348        "🧾 <b>UTR:</b> <code>" + utr + "</code>\n" +349        "🆔 <b>Order ID:</b> <code>" + orderId + "</code>" +350        "</blockquote>";351      Api.sendMessage({ chat_id: walletLogAdminId, text: walletAdminMsg, parse_mode: "HTML" });352    } catch (e) {}353 354    if (queryId) {355      try {356        Api.answerCallbackQuery({357          callback_query_id: queryId,358          text: "✅ PAYMENT VERIFIED SUCCESSFULLY!",359          show_alert: false360        });361      } catch (e) {}362    }363 364    if (targetUserId) {365      vanishQrMessage(targetUserId, chatId);366      clearQrState(targetUserId);367    }368 369    let __resUpBot = Number(Bot.getProperty("reseller_upg_" + targetUserId) || 0);370    if (User.getProperty("buy_reseller_upgrade") || __resUpBot > 0) {371      let resellerPrice = Number(User.getProperty("buy_reseller_price") || __resUpBot || 0);372 373      // 💰 Top-up ke baad wallet me full price aa chuka hai -> reseller price ab kaat lo374      // (pehle kabhi deduct nahi hota tha, isse reseller status wallet balance bachakar free mil jata tha).375      // Pehle bonus balance, phir main wallet se — same order jo product purchase me hota hai.376      if (resellerPrice > 0) {377        let bonusNow = Number(Bot.getProperty("balance" + targetUserId) || 0);378        let takeBonus = Math.min(bonusNow, resellerPrice);379        if (takeBonus > 0) Bot.setProperty("balance" + targetUserId, bonusNow - takeBonus, "number");380        let takeWallet = resellerPrice - takeBonus;381        if (takeWallet > 0) {382          try { balRes(targetUserId).add(-takeWallet); } catch (dedErr) {383            try {384              Api.sendMessage({ chat_id: String(Bot.getProperty("owner_id") || "7127818616"), parse_mode: "HTML",385                text: "❗ <b>Reseller price deduct FAILED</b>\nUser: <code>" + targetUserId + "</code>\nAmount: ₹" + takeWallet.toFixed(2) + "\nError: <code>" + String(dedErr.message) + "</code>" });386            } catch (e2) {}387          }388        }389      }390      User.setProperty("buy_reseller_upgrade", null, "boolean");391      User.setProperty("buy_reseller_price", null, "number");392      Bot.setProperty("reseller_upg_" + targetUserId, null, "number");393 394      Bot.setProperty("is_reseller_" + targetUserId, true, "boolean");395 396      Api.sendMessage({397        chat_id: chatId,398        text: "<blockquote><tg-emoji emoji-id='6102856637343600044'>🎉</tg-emoji> <b>CONGRATULATIONS!</b></blockquote>\n\n" +399              "<tg-emoji emoji-id='6215386799133433653'>👑</tg-emoji> <b>You are now a Reseller!</b>\n\n" +400              "<i>Payment verified aur permanent reseller status activate ho gaya!</i>",401        parse_mode: "HTML",402        reply_markup: JSON.stringify({ inline_keyboard: [[{ text: "Explore Shop", callback_data: "/buy_hack", style: "success" }]] })403      });404 405      if (targetUserId) User.setProperty("topup_verifying_lock_" + targetUserId, false, "boolean");406      return;407    }408 409    let pendingProdIdx = User.getProperty("buy_prod_idx");410    let pendingPlanIdx = User.getProperty("buy_plan_idx");411 412    if (pendingProdIdx !== null && pendingProdIdx !== undefined && pendingProdIdx !== "" &&413        pendingPlanIdx !== null && pendingPlanIdx !== undefined && pendingPlanIdx !== "") {414 415      Api.sendMessage({ 416        chat_id: chatId, 417        text: e_check + " <b>Payment verified! Generating your key now...</b>", 418        parse_mode: "HTML" 419      });420 421      Bot.run({422        command: "/confirm_buyitem",423        options: { params: pendingProdIdx + " " + pendingPlanIdx }424      });425 426      User.setProperty("buy_prod_idx", null);427      User.setProperty("buy_plan_idx", null);428      User.setProperty("buy_price", null);429      User.setProperty("buy_needpay", null);430 431      if (targetUserId) User.setProperty("topup_verifying_lock_" + targetUserId, false, "boolean");432      return;433    }434 435    let successText = "━━━━━━━━━━━━━━━━━━━━\n" +436                      e_plus + " <b>PAYMENT SUCCESSFUL</b> " + e_plus + "\n" +437                      "━━━━━━━━━━━━━━━━━━━━\n\n" +438                      (opts.auto_verified ? "🤖 <i>Auto-verified - Verify dabane ki zaroorat nahi padi</i>\n\n" : "") +439                      e_money + " <b>Added Amount:</b> ₹<b>" + addedAmount.toFixed(2) + "</b>\n" +440                      e_chart + " <b>New Balance:</b> ₹<b>" + newBalance.toFixed(2) + "</b>\n" +441                      e_arrow + " <b>UTR / Ref ID:</b> <code>" + utr + "</code>\n" +442                      e_time + " <b>Time:</b> " + payTime + "\n\n" +443                      "━━━━━━━━━━━━━━━━━━━━\n" +444                      e_coin + " <i>Your funds have been successfully credited! 🎉</i>";445 446    Api.sendMessage({447      chat_id: chatId,448      text: successText,449      parse_mode: "HTML",450      reply_markup: JSON.stringify({451        inline_keyboard: [[452          { text: "🛒 Shop Now", callback_data: "/buy_hack", style: "success" },453          { text: "🔰 Profile", callback_data: "/profile", style: "primary" }454        ]]455      })456    });457 458    if (targetUserId) User.setProperty("topup_verifying_lock_" + targetUserId, false, "boolean");459    return;460  }461 462  if (queryId && !isBackground) {463    try {464      Api.answerCallbackQuery({465        callback_query_id: queryId,466        text: "⚠️ PAYMENT NOT RECEIVED YET\nPlease complete the payment first.",467        show_alert: true468      });469    } catch (e) {}470  }471 472  if (targetUserId) User.setProperty("topup_verifying_lock_" + targetUserId, false, "boolean");473 474} catch (err) {475  try {476    let uid = (typeof user !== "undefined" && user) ? user.telegramid : null;477    if (uid) User.setProperty("topup_verifying_lock_" + uid, false, "boolean");478  } catch (e) {}479  Bot.sendMessage("⚠️ Error in verification check: " + err.message);480}
commands/_onCheck.js · tarunpoonia905/OfcDevShopBot · TeleDevs