devbro468/Dev_x_store_botPublic · Bot Template

AIThis bot operates a digital storefront (DEV X STORE) selling subscription-based products — likely game hacks, accounts, or access keys — categorized by platform (Android Root, Non-Root, iPhone). It features a reseller program with discounted pricing, a dual-currency wallet (INR balance + Telegram Stars/XTR), and a full admin/co-admin panel for managing products, plans, per-plan pricing, stock (keys/accounts), coupons, and API endpoints. Purchases flow through a plan selection screen offering wallet payment, Stars invoices (sendInvoice with XTR currency), and coupon application. Successful Stars payments are handled via successful_payment webhook, crediting wallet or delivering keys directly. Admin tools include user listing with chunked messaging, stock viewing/deletion with inline keyboards, co-admin management, and API registry updates. The bot registers users on first interaction and

Commercecommercedigital-goodsstars-paymentreseller-systemadmin-panelstock-management
ProfileTelegram
119 commands0 envUpdated 15d agoCreated Aug 23, 2026
Back to folder

commands/_buy_hack.js

javascript · 122 lines

Raw
1/**#command2name: /buy_hack3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12// =========================================================13// 🛒 SHOP MENU — Category selection (entry point of the whole buy flow)14// ✅ NEW: Shop Now ab seedha product list nahi, pehle "ANDROID ROOT" /15// "ANDROID NON ROOT" category selection dikhata hai. Product asli list16// /buy_hack_cat me dikhti hai (category ke hisaab se filter hokar).17// ✅ BUG FIX: reply_markup pehle raw object bheja jaa raha tha (JSON.stringify18// missing) — is wajah se product buttons kabhi kabhi properly render/work19// nahi karte the, jisse poora buy flow shuru hone se pehle hi tootta tha.20// ✅ BUG FIX: photo-message (jaise Profile) se yahan aane par editMessageText21// fail ho jaata — ab photo detect hoke delete + fresh send hota hai.22// ✅ Premium redesign.23// =========================================================24 25try {26  var rawData = Bot.getProperty("stored_products");27  var productList = [];28 29  if (Array.isArray(rawData)) {30    productList = rawData;31  } else if (typeof rawData === "string") {32    try {33      productList = JSON.parse(rawData);34      if (!Array.isArray(productList)) { productList = []; }35    } catch (e) {36      productList = [];37    }38  }39 40  // Agar list bilkul khali hai toh ek default product dal do taaki store khali na dikhe41  if (productList.length === 0) {42    productList.push({43      name: "Drip Client (Non Root)",44      emoji: "5226656353744862682",45      id: "1",46      category: "nonroot",47      plans: []48    });49    Bot.setProperty("stored_products", productList, "json");50  }51 52  var chatId = chat.chatid;53  var firstName = user && user.first_name ? user.first_name : "User";54 55  var categoryButtons = [56    [57      {58        text: "ANDROID NON ROOT",59        callback_data: "/buy_hack_cat nonroot",60        style: "primary",61        icon_custom_emoji_id: "6181418358055900195"62      }63    ],64    [65      {66        text: "ANDROID ROOT",67        callback_data: "/buy_hack_cat root",68        style: "primary",69        icon_custom_emoji_id: "5931415565955503486"70      }71    ],72    [73      {74        text: "iPHONE",75        callback_data: "/buy_hack_cat iphone",76        style: "primary",77        icon_custom_emoji_id: "6145197004768157529"78      }79    ],80    [81      {82        text: "Back to Menu",83        callback_data: "/back",84        style: "danger",85        icon_custom_emoji_id: "5893163582194978381"86      }87    ]88  ];89 90  var storeText =91    "<blockquote>🛒 <b>SELECT YOUR DEVICE TYPE</b> ✨</blockquote>\n" +92    "━━━━━━━━━━━━━━━━━━━━━\n\n" +93    "<tg-emoji emoji-id='6091571559233755994'>👋</tg-emoji> <b>Yoo " + firstName + "!</b>\n" +94    "<i>Pehle apna device type chunein, uske baad products dikhenge.</i>\n" +95    "━━━━━━━━━━━━━━━━━━━━━";96 97  var replyMarkupStr = JSON.stringify({ inline_keyboard: categoryButtons });98 99  if (request && request.message && request.message.message_id) {100    if (request.message.photo) {101      try { Api.deleteMessage({ chat_id: chatId, message_id: request.message.message_id }); } catch (e) {}102      Api.sendMessage({ chat_id: chatId, text: storeText, parse_mode: "HTML", reply_markup: replyMarkupStr });103    } else {104      Api.editMessageText({105        chat_id: chatId,106        message_id: request.message.message_id,107        text: storeText,108        parse_mode: "HTML",109        reply_markup: replyMarkupStr110      });111    }112  } else {113    Api.sendMessage({ chat_id: chatId, text: storeText, parse_mode: "HTML", reply_markup: replyMarkupStr });114  }115 116  if (request && request.id) {117    try { Api.answerCallbackQuery({ callback_query_id: request.id }); } catch (e) {}118  }119 120} catch (err) {121  Bot.sendMessage("⚠️ Shop Menu Error: " + err.message, { parse_mode: "HTML" });122}