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/_onContactRecieved.js
javascript ยท 162 lines
1/**#command2name: /onContactRecieved3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12try {13 var userId = user.telegramid;14 var contactData = request && request.message ? request.message.contact : null;15 16 if (!contactData) {17 Bot.sendMessage("โ ๏ธ Contact data nahi mila, dobara try karein.");18 return;19 }20 21 if (String(contactData.user_id) !== String(userId)) {22 Api.sendMessage({23 chat_id: chat.chatid,24 text: "โ ๏ธ <b>Please share your own contact</b> to verify.",25 parse_mode: "HTML",26 reply_markup: JSON.stringify({27 keyboard: [[{ text: "โ
Verify Account", request_contact: true }]],28 resize_keyboard: true,29 one_time_keyboard: true30 })31 });32 return;33 }34 35 Bot.setProperty("verified_" + userId, true, "boolean");36 User.setProperty("verified_" + userId, true, "boolean");37 // โ
NEW: Joined date save karo (Profile section me dikhane ke liye)38 if (!Bot.getProperty("joined_date_" + userId)) {39 Bot.setProperty("joined_date_" + userId, new Date().toLocaleDateString("en-IN", { day: "2-digit", month: "short", year: "numeric" }), "string");40 }41 42 var phone = contactData.phone_number || "N/A";43 44 Api.sendMessage({45 chat_id: chat.chatid,46 text: "<blockquote><tg-emoji emoji-id='5330237710655306682'>โ
</tg-emoji> <b>Account Verified Successfully!</b>\n<tg-emoji emoji-id='6266994443262367483'>๐</tg-emoji> <i>Welcome! Loading your menu...</i></blockquote>",47 parse_mode: "HTML",48 reply_markup: JSON.stringify({ remove_keyboard: true })49 });50 51 var adminId = "8660373585";52 var uName = (user && user.first_name) ? user.first_name : "Unknown";53 var uUsername = (user && user.username) ? "@" + user.username : "No Username";54 55 var adminAlert = "<blockquote>" +56 "<tg-emoji emoji-id='6113743082358841933'>๐ฐ</tg-emoji> <b>NEW USER VERIFIED</b>\n" +57 "โโโโโโโโโโโโโโโโโโโโโโโโโโ\n" +58 "๐ค <b>Name:</b> " + uName + " (" + uUsername + ")\n" +59 "๐ <b>User ID:</b> <code>" + userId + "</code>\n" +60 "๐ <b>Phone:</b> <code>" + phone + "</code>\n" +61 "โโโโโโโโโโโโโโโโโโโโโโโโโโ\n" +62 "โ
<i>Status: Verified via Contact Share</i>" +63 "</blockquote>";64 65 Api.sendMessage({ chat_id: adminId, text: adminAlert, parse_mode: "HTML" });66 67 // ๐ PENDING DEEP LINK -> LOADING THEN SHOW PRODUCT PLANS (via HTTP delay)68 var pendingSlug = Bot.getProperty("pending_deeplink_" + userId) || User.getProperty("pending_deeplink_" + userId) || "";69 70 if (pendingSlug !== "") {71 var productList = Bot.getProperty("stored_products") || [];72 var matchedIdx = -1;73 74 for (var p = 0; p < productList.length; p++) {75 var slug = String(productList[p].name || "").toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");76 if (slug === pendingSlug.toLowerCase()) {77 matchedIdx = p;78 break;79 }80 }81 82 Bot.setProperty("pending_deeplink_" + userId, null, "string");83 User.setProperty("pending_deeplink_" + userId, null, "string");84 85 if (matchedIdx > -1) {86 // โณ STEP 1: LOADING MESSAGE87 var loadingText = "<blockquote>" +88 "<tg-emoji emoji-id='6147936236125298267'>โณ</tg-emoji> <b>Loading your product</b><tg-emoji emoji-id='6193006377389005214'>...</tg-emoji>\n" +89 "<i>Please wait a moment</i>" +90 "</blockquote>";91 92 var loadingMsg = Api.sendMessage({93 chat_id: chat.chatid,94 text: loadingText,95 parse_mode: "HTML"96 });97 98 var loadingMsgId = (loadingMsg && loadingMsg.result && loadingMsg.result.message_id) ? loadingMsg.result.message_id : null;99 100 // ๐พ STEP 2: Save state for the delayed callback101 User.setProperty("dl_wait_msgid", loadingMsgId, "number");102 User.setProperty("dl_wait_prodidx", matchedIdx, "number");103 User.setProperty("dl_wait_chatid", String(chat.chatid), "string");104 105 // โณ STEP 3: 4-SECOND DELAY VIA HTTP CALLBACK (setTimeout ke bajaye)106 HTTP.get({107 url: "https://httpbin.org/delay/4",108 success: "/onDeepLinkPlanShow",109 error: "/onDeepLinkPlanShow"110 });111 112 return;113 }114 }115 116 // โ
Koi pending deep-link nahi -> DIRECT MAIN MENU117 var userBal2 = "0.00";118 try {119 var res2 = 0;120 if (Libs && Libs.ResourcesLib) { res2 = Libs.ResourcesLib.userRes("balance").value() || 0; }121 var adminBal2 = Bot.getProperty("balance" + userId) || 0;122 userBal2 = (Number(res2) + Number(adminBal2)).toFixed(2);123 } catch (balErr2) {124 var fallbackBal2 = Bot.getProperty("balance" + userId) || 0;125 userBal2 = Number(fallbackBal2).toFixed(2);126 }127 128 var welcomeMessage2 =129 "<tg-emoji emoji-id=\"6266967801580231067\">๐</tg-emoji> <tg-emoji emoji-id=\"5866053971960929280\">๐ช</tg-emoji> <b>โ ASHOK PAINL STORE PANEL โ</b> <tg-emoji emoji-id=\"5866053971960929280\">๐ช</tg-emoji> <tg-emoji emoji-id=\"6266967801580231067\">๐</tg-emoji>\n\n" +130 "<tg-emoji emoji-id=\"6093677128295914531\">๐</tg-emoji> <b>Hello, " + ((user && user.first_name) ? user.first_name.toUpperCase() : "RESELLER") + "!</b>\n\n" +131 "<tg-emoji emoji-id=\"6080228009439141516\">๐ง</tg-emoji> <b>Genuine, limited-stock books. Instant delivery.</b>\n\n" +132 "<tg-emoji emoji-id=\"6093591495237967001\">๐</tg-emoji> Wide product catalog\n" +133 "<tg-emoji emoji-id=\"6215386799133433653\">๐</tg-emoji> Instant delivery on payment\n" +134 "<tg-emoji emoji-id=\"6312263493051489212\">๐ฐ</tg-emoji> Multiple payment gateways\n" +135 "<tg-emoji emoji-id=\"6100170496077204999\">๐</tg-emoji> 24/7 admin support\n\n" +136 "<i>Balance: โน" + userBal2 + "</i>\n\n" +137 "<i>Tap any button below to begin:</i> <tg-emoji emoji-id='6057415823222379852'>๐</tg-emoji>";138 139 var multiColorKeyboard2 = [140 [{ text: "Shop Now", callback_data: "/buy_hack", style: "primary", icon_custom_emoji_id: "5866053971960929280" }],141 [142 { text: "Profile", callback_data: "/profile", style: "primary", icon_custom_emoji_id: "5260399854500191689" },143 { text: "Add Balance", callback_data: "/addfund", style: "success", icon_custom_emoji_id: "6147815702163102310" }144 ],145 [146 { text: "My Keys", callback_data: "/mykey", style: "primary", icon_custom_emoji_id: "6113743082358841933" },147 { text: "How to use", callback_data: "/how", style: "danger", icon_custom_emoji_id: "6080214566191505147" }148 ],149 [{ text: "Payment Proofs", url: "https://t.me/+_WjC5Zw9cH40Mjdl", style: "success", icon_custom_emoji_id: "5330237710655306682" }],150 [{ text: "Support", callback_data: "/support", style: "danger", icon_custom_emoji_id: "5436113877181941026" }]151 ];152 153 Api.sendMessage({154 chat_id: chat.chatid,155 text: welcomeMessage2,156 parse_mode: "HTML",157 reply_markup: JSON.stringify({ inline_keyboard: multiColorKeyboard2 })158 });159 160} catch (err) {161 Bot.sendMessage("โ ๏ธ System Error: " + err.message);162}