amanjha18v/AMAN_SHOPS_BOTPublic · Bot Template

AIAMAN SHOP STORE appears to be a Telegram automation bot. Commands include /*, /addbal, /addbal_all, /addbal_binance, /addbal_binance_approve, /addbal_binance_paid, /addbal_upi, /addcat_id. Observed in code: messaging, http, libs, keyboards, payments.

Utilityutility
ProfileTelegram
132 commands0 envUpdated 7h agoCreated Sep 4, 2026
Back to folder

commands/_buy_hack_cat.js

javascript · 134 lines

Raw
1/**#command2name: /buy_hack_cat3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12/**#command13name: /buy_hack_cat14answer: 15keyboard: 16parse_mode: markdown17aliases: 18allow_only_group: false19need_reply: false20case_insensitive: false21is_web: 022#command**/23 24// =========================================================25// 🛒 SHOP MENU — Product listing filtered by category (Step 1.5)26// Called after user selects "ANDROID ROOT" or "ANDROID NON ROOT" from27// /buy_hack. Shows only products matching that category. Products added28// with category "both" (or no category set at all — legacy products)29// show up under BOTH root and nonroot listings.30// =========================================================31 32try {33  var rawData = Bot.getProperty("stored_products");34  var productList = [];35 36  if (Array.isArray(rawData)) {37    productList = rawData;38  } else if (typeof rawData === "string") {39    try {40      productList = JSON.parse(rawData);41      if (!Array.isArray(productList)) { productList = []; }42    } catch (e) {43      productList = [];44    }45  }46 47  var chatId = chat.chatid;48  var firstName = user && user.first_name ? user.first_name : "User";49 50  // Category param — "root" or "nonroot"51  var category = params ? params.trim().toLowerCase() : "";52  if (category === "") {53    var cbData = request && request.callback_query ? request.callback_query.data : "";54    category = cbData.replace("/buy_hack_cat ", "").replace("buy_hack_cat ", "").trim().toLowerCase();55  }56  if (category !== "root" && category !== "nonroot" && category !== "iphone") { category = "nonroot"; }57 58  var categoryLabel = (category === "root") ? "ANDROID ROOT" : (category === "iphone") ? "iPHONE" : "ANDROID NON ROOT";59 60  var productButtons = [];61 62  for (var i = 0; i < productList.length; i++) {63    var item = productList[i];64    if (!item) { continue; }65 66    // Legacy products (no category field) ya "both" wale — dono categories me dikhte hain.67    var itemCategory = item.category ? String(item.category).toLowerCase() : "both";68    if (itemCategory !== "both" && itemCategory !== category) { continue; }69 70    var itemName = item.name ? String(item.name) : "Product " + (i + 1);71    var itemEmoji = item.emoji ? String(item.emoji) : "5226656353744862682";72 73    productButtons.push([74      {75        text: itemName,76        callback_data: "/viewprod " + i,77        style: "primary",78        icon_custom_emoji_id: itemEmoji79      }80    ]);81  }82 83  var storeText;84 85  if (productButtons.length === 0) {86    storeText =87      "<blockquote><b>" + categoryLabel + "</b></blockquote>\n" +88      "━━━━━━━━━━━━━━━━━━━━━\n\n" +89      "<tg-emoji emoji-id='6093854128193152827'>⚠️</tg-emoji> <i>Is category me abhi koi product available nahi hai. Jald hi add kiya jayega!</i>\n" +90      "━━━━━━━━━━━━━━━━━━━━━";91  } else {92    storeText =93      "<blockquote><b>" + categoryLabel + " — SELECT A PRODUCT</b></blockquote>\n" +94      "━━━━━━━━━━━━━━━━━━━━━\n\n" +95      "<tg-emoji emoji-id='6091571559233755994'>👋</tg-emoji> <b>Yoo " + firstName + "!</b>\n" +96      "<i>Choose any product below to view its price and available duration plans.</i>\n" +97      "━━━━━━━━━━━━━━━━━━━━━";98  }99 100  productButtons.push([101    {102      text: "Back",103      callback_data: "/buy_hack",104      style: "danger",105      icon_custom_emoji_id: "5893163582194978381"106    }107  ]);108 109  var replyMarkupStr = JSON.stringify({ inline_keyboard: productButtons });110 111  if (request && request.message && request.message.message_id) {112    if (request.message.photo) {113      try { Api.deleteMessage({ chat_id: chatId, message_id: request.message.message_id }); } catch (e) {}114      Api.sendMessage({ chat_id: chatId, text: storeText, parse_mode: "HTML", reply_markup: replyMarkupStr });115    } else {116      Api.editMessageText({117        chat_id: chatId,118        message_id: request.message.message_id,119        text: storeText,120        parse_mode: "HTML",121        reply_markup: replyMarkupStr122      });123    }124  } else {125    Api.sendMessage({ chat_id: chatId, text: storeText, parse_mode: "HTML", reply_markup: replyMarkupStr });126  }127 128  if (request && request.id) {129    try { Api.answerCallbackQuery({ callback_query_id: request.id }); } catch (e) {}130  }131 132} catch (err) {133  Bot.sendMessage("⚠️ Shop Menu Error: " + err.message, { parse_mode: "HTML" });134}