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/_buy_hack.js
javascript ยท 109 lines
1/**#command2name: /buy_hack3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12// =========================================================13// ๐ SHOP MENU โ Product listing (entry point of the whole buy flow)14// โ
BUG FIX: reply_markup pehle raw object bheja jaa raha tha (JSON.stringify15// missing) โ is wajah se product buttons kabhi kabhi properly render/work16// nahi karte the, jisse poora buy flow shuru hone se pehle hi tootta tha.17// โ
BUG FIX: photo-message (jaise Profile) se yahan aane par editMessageText18// fail ho jaata โ ab photo detect hoke delete + fresh send hota hai.19// โ
Premium redesign.20// =========================================================21 22try {23 var rawData = Bot.getProperty("stored_products");24 var productList = [];25 26 if (Array.isArray(rawData)) {27 productList = rawData;28 } else if (typeof rawData === "string") {29 try {30 productList = JSON.parse(rawData);31 if (!Array.isArray(productList)) { productList = []; }32 } catch (e) {33 productList = [];34 }35 }36 37 // Agar list bilkul khali hai toh ek default product dal do taaki store khali na dikhe38 if (productList.length === 0) {39 productList.push({40 name: "Drip Client (Non Root)",41 emoji: "5226656353744862682",42 id: "1",43 plans: []44 });45 Bot.setProperty("stored_products", productList, "json");46 }47 48 var chatId = chat.chatid;49 var firstName = user && user.first_name ? user.first_name : "User";50 var productButtons = [];51 52 for (var i = 0; i < productList.length; i++) {53 var item = productList[i];54 var itemName = (item && item.name) ? String(item.name) : "Product " + (i + 1);55 // FIX ONLY: product ka user-entered Emoji ID invalid hone par Telegram56 // poora Shop keyboard reject kar sakta hai. Product ka saved emoji data57 // unchanged rahega; Shop button ke liye known-good icon use hoga.58 productButtons.push([59 {60 text: itemName,61 callback_data: "/viewprod " + i,62 style: "primary",63 icon_custom_emoji_id: "5866053971960929280"64 }65 ]);66 }67 68 productButtons.push([69 {70 text: "Back to Menu",71 callback_data: "/back",72 style: "danger",73 icon_custom_emoji_id: "5893163582194978381"74 }75 ]);76 77 var storeText =78 "<blockquote>๐ <b>SELECT A PRODUCT</b> โจ</blockquote>\n" +79 "โโโโโโโโโโโโโโโโโโโโโ\n\n" +80 "<tg-emoji emoji-id='6091571559233755994'>๐</tg-emoji> <b>Yoo " + firstName + "!</b>\n" +81 "<i>Choose any product below to view its price and available duration plans.</i>\n" +82 "โโโโโโโโโโโโโโโโโโโโโ";83 84 var replyMarkupStr = JSON.stringify({ inline_keyboard: productButtons });85 86 if (request && request.message && request.message.message_id) {87 if (request.message.photo) {88 try { Api.deleteMessage({ chat_id: chatId, message_id: request.message.message_id }); } catch (e) {}89 Api.sendMessage({ chat_id: chatId, text: storeText, parse_mode: "HTML", reply_markup: replyMarkupStr });90 } else {91 Api.editMessageText({92 chat_id: chatId,93 message_id: request.message.message_id,94 text: storeText,95 parse_mode: "HTML",96 reply_markup: replyMarkupStr97 });98 }99 } else {100 Api.sendMessage({ chat_id: chatId, text: storeText, parse_mode: "HTML", reply_markup: replyMarkupStr });101 }102 103 if (request && request.id) {104 try { Api.answerCallbackQuery({ callback_query_id: request.id }); } catch (e) {}105 }106 107} catch (err) {108 Bot.sendMessage("โ ๏ธ Shop Menu Error: " + err.message, { parse_mode: "HTML" });109}