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.
commands/_onVerifyResult.js
javascript ยท 165 lines
1/**#command2name: /onVerifyResult3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12// =========================================================13// ๐ COMMAND = /onVerifyResult14// STATUS: ERROR-FREE DATA VALIDATION PIPELINE15// =========================================================16 17try {18 if (!content) {19 Bot.sendMessage("โ ๏ธ Server response was blank. Please contact admin if payment was deducted.");20 return;21 }22 23 var res = (typeof content === "object") ? content : null;24 if (!res) {25 try { res = JSON.parse(content); } catch (e) { res = null; }26 }27 28 // Aapke response scheme ke mutabik status handle matrix29 var paymentVerified = (res && (res.status === "success" || res.status === "PAID" || res.success === true));30 var live_amount = res && res.data && res.data.amount ? res.data.amount : (User.getProperty("deposit_amount") || "0");31 var order_id = params ? params.trim() : "UNKNOWN";32 33 // โ
BUG FIX: pehle yaha QR message delete/clear karne ka koi code hi nahi tha,34 // isi wajah se balance add hone ke baad bhi purana QR code chat me pada reh35 // jaata tha. Ab /onCheck.js jaisa hi vanish + state-clear logic add kiya gaya36 // hai taaki verify hote hi QR turant hat jaaye.37 var verifyUserId = (typeof user !== "undefined" && user) ? user.telegramid : null;38 var verifyChatId = (typeof chat !== "undefined" && chat) ? chat.chatid : null;39 40 function vanishQrOnVerify(uid, fallbackChatId) {41 try {42 var qrMsgId = Bot.getProperty("qr_msg_id_" + uid) ||43 User.getProperty("qr_msg_id_" + uid) ||44 User.getProperty("last_qr_message_id_" + uid);45 if (qrMsgId && fallbackChatId) {46 try { Api.deleteMessage({ chat_id: fallbackChatId, message_id: qrMsgId }); } catch (e) {}47 }48 } catch (e) {}49 }50 51 function clearQrStateOnVerify(uid) {52 if (!uid) return;53 Bot.setProperty("qr_msg_id_" + uid, null, "string");54 User.setProperty("qr_msg_id_" + uid, null, "string");55 User.setProperty("last_qr_message_id_" + uid, null, "string");56 Bot.setProperty("qr_order_id_" + uid, null, "string");57 User.setProperty("qr_order_id_" + uid, null, "string");58 Bot.setProperty("qr_watch_order_" + uid, null, "string");59 User.setProperty("qr_watch_order_" + uid, null, "string");60 Bot.setProperty("verifying_lock_" + uid, false, "boolean");61 User.setProperty("verifying_lock_" + uid, false, "boolean");62 User.setProperty("pending_order_id", null);63 }64 65 if (paymentVerified == true) {66 67 // Payment verify hote hi sabse pehle QR ko vanish karo (product delivery ho68 // ya sirf wallet balance add โ dono cases me QR hatna chahiye)69 vanishQrOnVerify(verifyUserId, verifyChatId);70 clearQrStateOnVerify(verifyUserId);71 72 var prodIdx = User.getProperty("last_selected_prod_idx");73 var planIdx = User.getProperty("last_selected_plan_idx");74 var productList = Bot.getProperty("stored_products") || [];75 76 var product = (prodIdx !== undefined && prodIdx !== null) ? productList[Number(prodIdx)] : null;77 var plan = (product && planIdx !== undefined && planIdx !== null) ? product.plans[Number(planIdx)] : null;78 79 if (product && plan) {80 // ๐ข CASE A: DIRECT KEY EXTRACTION81 var stockList = Bot.getProperty("stock_" + product.name.trim() + "_" + plan.days.trim() + "_Day") || Bot.getProperty("stock_" + prodIdx + "_" + planIdx) || [];82 83 if (stockList.length > 0) {84 var deliveredKey = stockList.shift();85 86 Bot.setProperty("stock_" + product.name.trim() + "_" + plan.days.trim() + "_Day", stockList, "json");87 Bot.setProperty("stock_" + prodIdx + "_" + planIdx, stockList, "json");88 89 var userKeysHistory = User.getProperty("my_purchased_keys") || [];90 userKeysHistory.push({ product: product.name, days: plan.days, price: live_amount, key: deliveredKey, date: new Date().toLocaleDateString() });91 User.setProperty("my_purchased_keys", userKeysHistory, "json");92 93 var gatewaySuccessText = "โโโโโโโโโโโโโโโโโโโโโโโโโ Club โ\n" +94 "โ <tg-emoji emoji-id='5350447674971660988'>โ
</tg-emoji> <b>PAYMENT SUCCESSFUL</b> <tg-emoji emoji-id='5352825278672412291'>๐</tg-emoji> โ\n" +95 "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ\n\n" +96 "<blockquote>" +97 "<tg-emoji emoji-id='6147767796097884213'>๐ฆ</tg-emoji> <b>Product Name:</b> <code>" + product.name + "</code>\n" +98 "<tg-emoji emoji-id='6145391828779672333'>๐ฐ</tg-emoji> <b>Validity:</b> <code>" + plan.days + " Days</code>\n" +99 "<tg-emoji emoji-id='6284816251143331422'>๐</tg-emoji> <b>Your Key:</b> <code>" + deliveredKey + "</code>\n\n" +100 "โโโโโโโโโโโโโโโโโโโโโ\n" +101 "โจ <i>Payment auto-verified! Enjoy your premium product.</i>" +102 "</blockquote>";103 104 Bot.sendMessage(gatewaySuccessText, { parse_mode: "HTML" });105 106 // Admin Log107 var adminMsg = "<blockquote>" +108 "๐ <b>QR PAYMENT DIRECT DELIVERY</b> โ๏ธ\n\n" +109 "๐ค <b>Buyer:</b> " + user.first_name + " (<code>" + user.telegramid + "</code>)\n" +110 "๐ฆ <b>Product:</b> " + product.name + "\n" +111 "๐ <b>Key:</b> <code>" + deliveredKey + "</code>" +112 "</blockquote>";113 114 // โ
FIXED: pehle yaha ek hardcoded chat_id ("8154859186" โ kisi aur bot ka115 // reference ID) tha, jiski wajah se admin log tumhare admin ko kabhi milta116 // hi nahi tha. Ab yeh owner_id property se aata hai (same jo /start me set hai).117 var logAdminId = Bot.getProperty("owner_id") || "8154859186";118 Api.sendMessage({ chat_id: logAdminId, text: adminMsg, parse_mode: "HTML" });119 120 User.setProperty("last_selected_prod_idx", null);121 User.setProperty("last_selected_plan_idx", null);122 return;123 } else {124 Bot.sendMessage("โ ๏ธ Payment received, but item went Out of Stock! Contact Admin with Order ID: <code>" + order_id + "</code>");125 return;126 }127 } else {128 // ๐ก CASE B: RE-ALIGNED BALANCE FALLBACK129 Libs.ResourcesLib.userRes("balance").add(Number(live_amount));130 131 // ๐ Admin notification for wallet balance top-up132 var walletLogAdminId = Bot.getProperty("owner_id") || "8154859186";133 var walletAdminMsg = "<blockquote>" +134 "๐ <b>WALLET BALANCE ADDED</b> โ๏ธ\n\n" +135 "๐ค <b>User:</b> " + user.first_name + " (<code>" + user.telegramid + "</code>)\n" +136 "๐ฐ <b>Amount Added:</b> โน" + Number(live_amount).toFixed(2) + "\n" +137 "๐ <b>Order ID:</b> <code>" + order_id + "</code>" +138 "</blockquote>";139 try {140 Api.sendMessage({ chat_id: walletLogAdminId, text: walletAdminMsg, parse_mode: "HTML" });141 } catch (e) {}142 143 var walletSuccessText = "โโโโโโโโโโโโโโโโโโโโโโโโโ Club โ\n" +144 "โ <tg-emoji emoji-id='6194922667242429131'>๐</tg-emoji> <b>PAYMENT SUCCESSFUL</b> <tg-emoji emoji-id='6192822213486321961'>โจ</tg-emoji> โ\n" +145 "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ\n\n" +146 "<blockquote>" +147 "<tg-emoji emoji-id='6194911182499881916'>๐ฃ</tg-emoji> <b>Amount Added:</b> โน<code>" + Number(live_amount).toFixed(2) + "</code>\n\n" +148 "โน๏ธ <i>Click the button below to browse products.</i>" +149 "</blockquote>";150 151 var shopButtons = [[{ text: "๐ Shop Now", callback_data: "/back", style: "success", icon_custom_emoji_id: "6194922667242429131" }]];152 153 Api.sendMessage({154 chat_id: chat.chatid,155 text: walletSuccessText,156 parse_mode: "HTML",157 reply_markup: JSON.stringify({ inline_keyboard: shopButtons })158 });159 }160 } else {161 Bot.sendMessage("โ <b>Payment not found yet.</b> Please complete the transaction first and make sure you have paid the exact amount.", { parse_mode: "HTML" });162 }163} catch (err) {164 Bot.sendMessage("โ ๏ธ Process Error: " + err.message);165}