indrajitghosh20006/Igstore_01botPublic Β· Bot Template

ProfileTelegram

AIThe bot provides an admin interface for a digital store, allowing the owner or co‑admins to add balances, products, plans, and categories. It supports payment workflows via UPI and Binance Pay, automatically generating QR codes and handling manual approval of deposits. The code patches inline keyboards to use premium emoji icons and includes helper functions for user and bot properties. Overall, it serves as a commerce management tool for a Telegram-based storefront.

Commercestoreadminbalanceproductplancategory
170 commands0 envUpdated 8h agoCreated Oct 30, 2026
Back to folder

commands/_buy_hack.js

javascript Β· 165 lines

Raw
1/**#command2name: /buy_hack3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12// PREMIUM BUTTON ICONS13(function(){14  try {15    if (!JSON.__premiumPatched) {16      var __origStringify = JSON.stringify;17      JSON.stringify = function(value, replacer, space) {18        try {19          if (value && value.inline_keyboard && Array.isArray(value.inline_keyboard)) {20            var premiumIds = [21              "6143444134125379822",22              "6091379307907652768",23              "6147534454819661264",24              "6147817325660741985",25              "6235683689292897318",26              "6102856637343600044"27            ];28            var rows = value.inline_keyboard.map(function(row, ri) {29              if (!Array.isArray(row)) return row;30              return row.map(function(btn, bi) {31                if (!btn || typeof btn !== "object") return btn;32                var copy = {};33                for (var k in btn) copy[k] = btn[k];34                if (!copy.icon_custom_emoji_id) copy.icon_custom_emoji_id = premiumIds[(ri + bi) % premiumIds.length];35                return copy;36              });37            });38            var cloned = {};39            for (var key in value) cloned[key] = value[key];40            cloned.inline_keyboard = rows;41            return __origStringify.call(JSON, cloned, replacer, space);42          }43        } catch (e) {}44        return __origStringify.call(JSON, value, replacer, space);45      };46      JSON.__premiumPatched = true;47    }48  } catch (e) {}49})();50 51 52 53// =========================================================54// πŸ›’ SHOP MENU β€” Category selection (entry point of the whole buy flow)55// βœ… NEW: Shop / Store Product ab seedha product list nahi, pehle "ANDROID ROOT" /56// "ANDROID NON ROOT" category selection dikhata hai. Product asli list57// /buy_hack_cat me dikhti hai (category ke hisaab se filter hokar).58// βœ… BUG FIX: reply_markup pehle raw object bheja jaa raha tha (JSON.stringify59// missing) β€” is wajah se product buttons kabhi kabhi properly render/work60// nahi karte the, jisse poora buy flow shuru hone se pehle hi tootta tha.61// βœ… BUG FIX: photo-message (jaise Profile) se yahan aane par editMessageText62// fail ho jaata β€” ab photo detect hoke delete + fresh send hota hai.63// βœ… Premium redesign.64// =========================================================65 66try {67  var rawData = Bot.getProperty("stored_products");68  var productList = [];69 70  if (Array.isArray(rawData)) {71    productList = rawData;72  } else if (typeof rawData === "string") {73    try {74      productList = JSON.parse(rawData);75      if (!Array.isArray(productList)) { productList = []; }76    } catch (e) {77      productList = [];78    }79  }80 81  // Agar list bilkul khali hai toh ek default product dal do taaki store khali na dikhe82  if (productList.length === 0) {83    productList.push({84      name: "Drip Client (Non Root)",85      emoji: "5226656353744862682",86      id: "1",87      category: "nonroot",88      plans: []89    });90    Bot.setProperty("stored_products", productList, "json");91  }92 93  var chatId = chat.chatid;94  var firstName = user && user.first_name ? user.first_name : "User";95 96  var categoryButtons = [97    [98      {99        text: " π™‰π™Šπ™‰ π™π™Šπ™Šπ™",100        callback_data: "/buy_hack_cat nonroot",101        style: "primary",102        icon_custom_emoji_id: "5467752521839690487"103      }104    ],105    [106      {107        text: "π˜Όπ™‰π˜Ώπ™π™Šπ™„π˜Ώ π™π™Šπ™Šπ™",108        callback_data: "/buy_hack_cat root",109        style: "primary",110        icon_custom_emoji_id: "6287397479243585292"111      }112    ],113    [114      {115        text: "π™Šπ™„π™Ž/π™„π™‹π™ƒπ™Šπ™‰π™€",116        callback_data: "/buy_hack_cat iphone",117        style: "primary",118        icon_custom_emoji_id: "5332823031859389246"119      }120    ],121    [122      {123        text: "π˜½π™–π™˜π™  𝙩𝙀 π™ˆπ™šπ™£π™ͺ",124        callback_data: "/back",125        style: "danger",126        icon_custom_emoji_id: "6100379527840538820"127      }128    ]129  ];130 131  var storeName = String(Bot.getProperty("store_name") || "𝙄𝙂 π™Žπ™π™Šπ™π™€");132  storeName = storeName.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");133 134  var storeText =135    "<blockquote><b>πŸ›’ " + storeName + " πŸ›’</b></blockquote>\n" +136    "━━━━━━━━━━━━━━━━━━━━━\n\n" +137    "<tg-emoji emoji-id='5467752521839690487'>πŸ“±</tg-emoji> <b>Select your device type</b>\n" +138    "━━━━━━━━━━━━━━━━━━━━━";139 140  var replyMarkupStr = JSON.stringify({ inline_keyboard: categoryButtons });141 142  if (request && request.message && request.message.message_id) {143    if (request.message.photo) {144      try { Api.deleteMessage({ chat_id: chatId, message_id: request.message.message_id }); } catch (e) {}145      Api.sendMessage({ chat_id: chatId, text: storeText, parse_mode: "HTML", reply_markup: replyMarkupStr });146    } else {147      Api.editMessageText({148        chat_id: chatId,149        message_id: request.message.message_id,150        text: storeText,151        parse_mode: "HTML",152        reply_markup: replyMarkupStr153      });154    }155  } else {156    Api.sendMessage({ chat_id: chatId, text: storeText, parse_mode: "HTML", reply_markup: replyMarkupStr });157  }158 159  if (request && request.id) {160    try { Api.answerCallbackQuery({ callback_query_id: request.id }); } catch (e) {}161  }162 163} catch (err) {164  Bot.sendMessage("⚠️ Shop Menu Error: " + err.message, { parse_mode: "HTML" });165}