ashoksarande3/ASHOK_HACK_STORE_BOTPublic ยท Bot Template

AIThis bot operates as a commercial storefront for selling Free Fire game hacks and cheats via UPI QR code payments. It features a dynamic pricing system with separate normal and reseller prices, product plans with flexible durations (days, hours, minutes), and a reseller program requiring a one-time upgrade fee. The bot handles payment verification through QR code generation and expiry tracking, user verification via Telegram contact sharing, and admin tools for stock management, plan creation, and ownership transfer. It includes a balance system, maintenance mode, and Telegram Stars payment fallback. The codebase uses TeleBotHost's TBL JavaScript APIs (Bot, Api, HTTP, db properties, Libs) for all logic.

Commercefreefiregame-hacksupi-paymentsqr-codesreseller-systemdynamic-pricing
ProfileTelegram
102 commands0 envUpdated 16d agoCreated Aug 22, 2026
Back to folder

commands/_onCheck.js

javascript ยท 280 lines

Raw
1/**#command2name: /onCheck3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12try {13  var opts = (typeof options !== "undefined" && options) ? options : {};14  let isBackground = opts.is_background || false;15  let orderId = opts.order_id;16  let amount = opts.amount;17  let chatId = chat ? chat.chatid : null;18  let attempt = opts.attempt || 1;19 20  if (typeof params !== "undefined" && params && params.trim() !== "") {21    let splitParams = params.trim().split(" ");22    if (splitParams.length >= 1 && splitParams[0].length > 5) {23      orderId = splitParams[0];24    }25    if (splitParams.length >= 2) amount = splitParams[1];26  }27 28  let targetUserId = (typeof user !== "undefined" && user) ? user.telegramid : null;29 30  // ๐Ÿ› ๏ธ ULTIMATE FALLBACK: Agar button ya params se orderId na mile, toh active pending order ID utha lo!31  if ((!orderId || orderId.trim() === "") && targetUserId) {32    orderId = User.getProperty("pending_order_id") || 33              Bot.getProperty("qr_order_id_" + targetUserId) || 34              User.getProperty("qr_order_id_" + targetUserId) ||35              User.getProperty("buy_pending_order_id");36  }37 38  let queryId = null;39  if (typeof request !== "undefined" && request) {40    if (request.callback_query && request.callback_query.id) {41      queryId = request.callback_query.id;42    } else if (request.id) {43      queryId = request.id;44    }45  }46 47  // ๐ŸŽจ Premium emojis48  let e_chart = "<tg-emoji emoji-id='5992430854909989581'>๐Ÿ“Š</tg-emoji>";49  let e_plus = "<tg-emoji emoji-id='5346004239246183111'>โž•</tg-emoji>";50  let e_arrow = "<tg-emoji emoji-id='5875506366050734240'>โžก๏ธ</tg-emoji>";51  let e_coin = "<tg-emoji emoji-id='5778335621491723621'>๐Ÿช™</tg-emoji>";52  let e_money = "<tg-emoji emoji-id='5348392971207194994'>๐Ÿ’ฐ</tg-emoji>";53  let e_time = "<tg-emoji emoji-id='5776213190387961618'>๐Ÿ•“</tg-emoji>";54  let e_check = "<tg-emoji emoji-id='5330237710655306682'>โœ…</tg-emoji>";55 56  function vanishQrMessage(uid, fallbackChatId) {57    try {58      let qrMsgId = Bot.getProperty("qr_msg_id_" + uid) ||59                    User.getProperty("qr_msg_id_" + uid) ||60                    User.getProperty("last_qr_message_id_" + uid);61      if (qrMsgId) {62        try { Api.deleteMessage({ chat_id: fallbackChatId, message_id: qrMsgId }); } catch (e) {}63      }64    } catch (e) {}65  }66 67  function clearQrState(uid) {68    Bot.setProperty("qr_msg_id_" + uid, null, "string");69    User.setProperty("qr_msg_id_" + uid, null, "string");70    User.setProperty("last_qr_message_id_" + uid, null, "string");71    Bot.setProperty("qr_order_id_" + uid, null, "string");72    User.setProperty("qr_order_id_" + uid, null, "string");73    Bot.setProperty("qr_watch_order_" + uid, null, "string");74    User.setProperty("qr_watch_order_" + uid, null, "string");75    Bot.setProperty("verifying_lock_" + uid, false, "boolean");76    User.setProperty("verifying_lock_" + uid, false, "boolean");77    User.setProperty("topup_verifying_lock_" + uid, false, "boolean");78    User.setProperty("pending_order_id", null);79  }80 81  function getUnifiedBalance(uid) {82    let resBal = 0;83    try { resBal = Number(Libs.ResourcesLib.userRes("balance").value()) || 0; } catch (e) {}84    let bonusBal = Number(Bot.getProperty("balance" + uid) || 0);85    return resBal + bonusBal;86  }87 88  // โœ… STEP 1: Strict Order ID validation check89  if (!orderId || orderId.trim() === "") {90    if (queryId) {91      try {92        Api.answerCallbackQuery({93          callback_query_id: queryId,94          text: "โš ๏ธ Active order nahi mila. Kripya pehle naya QR generate karein.",95          show_alert: true96        });97      } catch (e) {}98    }99    return;100  }101 102  // โœ… STEP 2: Duplicate Claim Check103  if (Bot.getProperty("claimed_topup_" + orderId)) {104    vanishQrMessage(targetUserId, chatId);105    if (targetUserId) clearQrState(targetUserId);106 107    if (queryId) {108      try {109        Api.answerCallbackQuery({110          callback_query_id: queryId,111          text: "โœ… ALREADY CLAIMED โœ…\nYe payment pehle hi verify hokar balance me add ho chuki hai.",112          show_alert: true113        });114      } catch (e) {}115    }116    return;117  }118 119  if (targetUserId && !isBackground) {120    let isChecking = User.getProperty("topup_verifying_lock_" + targetUserId);121    if (isChecking) {122      if (queryId) {123        try {124          Api.answerCallbackQuery({125            callback_query_id: queryId,126            text: "โณ VERIFYING... PLEASE WAIT...",127            show_alert: true128          });129        } catch (e) {}130      }131      return;132    }133    User.setProperty("topup_verifying_lock_" + targetUserId, true, "boolean");134  }135 136  let responseData = (typeof content !== "undefined" && content) ? (typeof content === "object" ? content : JSON.parse(content)) : null;137 138  if (responseData && (responseData.status === "success" || responseData.status === "SUCCESS") && responseData.data) {139 140    // โœ… STEP 3: Mark claimed only NOW that payment is confirmed successful141    // (avoids race conditions on concurrent success calls, without falsely142    // locking out an order that hasn't actually been paid yet)143    if (Bot.getProperty("claimed_topup_" + orderId)) {144      // Someone else already processed this exact order in parallel โ€” bail out145      if (targetUserId) User.setProperty("topup_verifying_lock_" + targetUserId, false, "boolean");146      return;147    }148    Bot.setProperty("claimed_topup_" + orderId, true, "boolean");149 150    let txData = responseData.data;151    let txAmount = txData.amount || amount;152    let utr = txData.utr || txData.transaction_id || "N/A";153    let senderName = txData.sender_name || (typeof user !== "undefined" && user ? user.first_name : "Valued User");154    let payTime = txData.payment_time_ist || "N/A";155    let addedAmount = parseFloat(txAmount) || 0;156 157    try {158      Libs.ResourcesLib.userRes("balance").add(addedAmount);159    } catch (e) {}160    let newBalance = getUnifiedBalance(targetUserId);161 162    // ๐Ÿ”” Admin notification for wallet balance top-up163    try {164      let walletLogAdminId = Bot.getProperty("owner_id") || "8660373585";165      let walletAdminMsg = "<blockquote>" +166        "๐Ÿ”” <b>WALLET BALANCE ADDED</b> โœ”๏ธ\n\n" +167        "๐Ÿ‘ค <b>User:</b> " + senderName + " (<code>" + targetUserId + "</code>)\n" +168        "๐Ÿ’ฐ <b>Amount Added:</b> โ‚น" + addedAmount.toFixed(2) + "\n" +169        "๐Ÿงพ <b>UTR:</b> <code>" + utr + "</code>\n" +170        "๐Ÿ†” <b>Order ID:</b> <code>" + orderId + "</code>" +171        "</blockquote>";172      Api.sendMessage({ chat_id: walletLogAdminId, text: walletAdminMsg, parse_mode: "HTML" });173    } catch (e) {}174 175    if (queryId) {176      try {177        Api.answerCallbackQuery({178          callback_query_id: queryId,179          text: "โœ… PAYMENT VERIFIED SUCCESSFULLY!",180          show_alert: false181        });182      } catch (e) {}183    }184 185    if (targetUserId) {186      vanishQrMessage(targetUserId, chatId);187      clearQrState(targetUserId);188    }189 190    if (User.getProperty("buy_reseller_upgrade")) {191      let resellerPrice = Number(User.getProperty("buy_reseller_price") || 0);192      User.setProperty("buy_reseller_upgrade", null, "boolean");193      User.setProperty("buy_reseller_price", null, "number");194 195      Bot.setProperty("is_reseller_" + targetUserId, true, "boolean");196 197      Api.sendMessage({198        chat_id: chatId,199        text: "<blockquote><tg-emoji emoji-id='6102856637343600044'>๐ŸŽ‰</tg-emoji> <b>CONGRATULATIONS!</b></blockquote>\n\n" +200              "<tg-emoji emoji-id='6215386799133433653'>๐Ÿ‘‘</tg-emoji> <b>You are now a Reseller!</b>\n\n" +201              "<i>Payment verified aur permanent reseller status activate ho gaya!</i>",202        parse_mode: "HTML",203        reply_markup: JSON.stringify({ inline_keyboard: [[{ text: "Explore Shop", callback_data: "/buy_hack", style: "success" }]] })204      });205 206      if (targetUserId) User.setProperty("topup_verifying_lock_" + targetUserId, false, "boolean");207      return;208    }209 210    let pendingProdIdx = User.getProperty("buy_prod_idx");211    let pendingPlanIdx = User.getProperty("buy_plan_idx");212 213    if (pendingProdIdx !== null && pendingProdIdx !== undefined && pendingProdIdx !== "" &&214        pendingPlanIdx !== null && pendingPlanIdx !== undefined && pendingPlanIdx !== "") {215 216      Api.sendMessage({ 217        chat_id: chatId, 218        text: e_check + " <b>Payment verified! Generating your key now...</b>", 219        parse_mode: "HTML" 220      });221 222      Bot.run({223        command: "/confirm_buyitem",224        options: { params: pendingProdIdx + " " + pendingPlanIdx }225      });226 227      User.setProperty("buy_prod_idx", null);228      User.setProperty("buy_plan_idx", null);229      User.setProperty("buy_price", null);230      User.setProperty("buy_needpay", null);231 232      if (targetUserId) User.setProperty("topup_verifying_lock_" + targetUserId, false, "boolean");233      return;234    }235 236    let successText = "โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”\n" +237                      e_plus + " <b>PAYMENT SUCCESSFUL</b> " + e_plus + "\n" +238                      "โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”\n\n" +239                      e_money + " <b>Added Amount:</b> โ‚น<b>" + addedAmount.toFixed(2) + "</b>\n" +240                      e_chart + " <b>New Balance:</b> โ‚น<b>" + newBalance.toFixed(2) + "</b>\n" +241                      e_arrow + " <b>UTR / Ref ID:</b> <code>" + utr + "</code>\n" +242                      e_time + " <b>Time:</b> " + payTime + "\n\n" +243                      "โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”\n" +244                      e_coin + " <i>Your funds have been successfully credited! ๐ŸŽ‰</i>";245 246    Api.sendMessage({247      chat_id: chatId,248      text: successText,249      parse_mode: "HTML",250      reply_markup: JSON.stringify({251        inline_keyboard: [[252          { text: "๐Ÿ›’ Shop Now", callback_data: "/buy_hack", style: "success" },253          { text: "๐Ÿ”ฐ Profile", callback_data: "/profile", style: "primary" }254        ]]255      })256    });257 258    if (targetUserId) User.setProperty("topup_verifying_lock_" + targetUserId, false, "boolean");259    return;260  }261 262  if (queryId && !isBackground) {263    try {264      Api.answerCallbackQuery({265        callback_query_id: queryId,266        text: "โš ๏ธ PAYMENT NOT RECEIVED YET\nPlease complete the payment first.",267        show_alert: true268      });269    } catch (e) {}270  }271 272  if (targetUserId) User.setProperty("topup_verifying_lock_" + targetUserId, false, "boolean");273 274} catch (err) {275  try {276    let uid = (typeof user !== "undefined" && user) ? user.telegramid : null;277    if (uid) User.setProperty("topup_verifying_lock_" + uid, false, "boolean");278  } catch (e) {}279  Bot.sendMessage("โš ๏ธ Error in verification check: " + err.message);280}