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_cat.js

javascript · 122 lines

Raw
1/**#command2name: /buy_hack_cat3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12// =========================================================13// 🛒 SHOP MENU — Product listing filtered by category (Step 1.5)14// Called after user selects "ANDROID ROOT" or "ANDROID NON ROOT" from15// /buy_hack. Shows only products matching that category. Products added16// with category "both" (or no category set at all — legacy products)17// show up under BOTH root and nonroot listings.18// =========================================================19 20try {21  var rawData = Bot.getProperty("stored_products");22  var productList = [];23 24  if (Array.isArray(rawData)) {25    productList = rawData;26  } else if (typeof rawData === "string") {27    try {28      productList = JSON.parse(rawData);29      if (!Array.isArray(productList)) { productList = []; }30    } catch (e) {31      productList = [];32    }33  }34 35  var chatId = chat.chatid;36  var firstName = user && user.first_name ? user.first_name : "User";37 38  // Category param — "root" or "nonroot"39  var category = params ? params.trim().toLowerCase() : "";40  if (category === "") {41    var cbData = request && request.callback_query ? request.callback_query.data : "";42    category = cbData.replace("/buy_hack_cat ", "").replace("buy_hack_cat ", "").trim().toLowerCase();43  }44  if (category !== "root" && category !== "nonroot" && category !== "iphone") { category = "nonroot"; }45 46  var categoryLabel = (category === "root") ? "ANDROID ROOT" : (category === "iphone") ? "iPHONE" : "ANDROID NON ROOT";47 48  var productButtons = [];49 50  for (var i = 0; i < productList.length; i++) {51    var item = productList[i];52    if (!item) { continue; }53 54    // Legacy products (no category field) ya "both" wale — dono categories me dikhte hain.55    var itemCategory = item.category ? String(item.category).toLowerCase() : "both";56    if (itemCategory !== "both" && itemCategory !== category) { continue; }57 58    var itemName = item.name ? String(item.name) : "Product " + (i + 1);59    var itemEmoji = item.emoji ? String(item.emoji) : "5226656353744862682";60 61    productButtons.push([62      {63        text: itemName,64        callback_data: "/viewprod " + i,65        style: "primary",66        icon_custom_emoji_id: itemEmoji67      }68    ]);69  }70 71  var storeText;72 73  if (productButtons.length === 0) {74    storeText =75      "<blockquote><b>" + categoryLabel + "</b></blockquote>\n" +76      "━━━━━━━━━━━━━━━━━━━━━\n\n" +77      "<tg-emoji emoji-id='6093854128193152827'>⚠️</tg-emoji> <i>Is category me abhi koi product available nahi hai. Jald hi add kiya jayega!</i>\n" +78      "━━━━━━━━━━━━━━━━━━━━━";79  } else {80    storeText =81      "<blockquote><b>" + categoryLabel + " — SELECT A PRODUCT</b></blockquote>\n" +82      "━━━━━━━━━━━━━━━━━━━━━\n\n" +83      "<tg-emoji emoji-id='6091571559233755994'>👋</tg-emoji> <b>Yoo " + firstName + "!</b>\n" +84      "<i>Choose any product below to view its price and available duration plans.</i>\n" +85      "━━━━━━━━━━━━━━━━━━━━━";86  }87 88  productButtons.push([89    {90      text: "Back",91      callback_data: "/buy_hack",92      style: "danger",93      icon_custom_emoji_id: "5893163582194978381"94    }95  ]);96 97  var replyMarkupStr = JSON.stringify({ inline_keyboard: productButtons });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}