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/_api_record.js

javascript Β· 113 lines

Raw
1/**#command2name: /api_record3answer: 4keyboard: 5parse_mode: markdown6aliases: /apirecord,/api_record_check7allow_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// Admin-only live connection check for the configured reseller API.54// The actual API URL/keys must be supplied by the admin; this command never invents them.55try {56  var ownerId = String(Bot.getProperty("owner_id") || "7839151435");57  var uid = String(chat.chatid);58  var co = Bot.getProperty("co_admin_" + uid);59  if (uid !== ownerId && !co) return;60 61  var reg = Bot.getProperty("api_registry") || {};62  var activeId = String(Bot.getProperty("active_reseller_api") || "");63  var api = activeId ? reg[activeId] : null;64  if (!api) {65    Bot.sendMessage("⚠️ <b>API Record Check</b>\n\nNo active online API configured. Use <code>/apiadd</code> first.", {parse_mode:"HTML"});66    return;67  }68  if (api.enabled === false) {69    Bot.sendMessage("❌ <b>API Record Check</b>\n\nActive API is disabled: <code>" + activeId + "</code>", {parse_mode:"HTML"});70    return;71  }72  if (!api.url) {73    Bot.sendMessage("❌ <b>API Record Check</b>\n\nAPI URL is missing for <code>" + activeId + "</code>.", {parse_mode:"HTML"});74    return;75  }76 77  Bot.setProperty("api_record_target_chat", uid, "string");78  Bot.setProperty("api_record_api_id", activeId, "string");79  Bot.setProperty("api_record_started_at", new Date().toISOString(), "string");80  Bot.setProperty("api_record_status", "checking", "string");81 82  var headers = {"Accept":"application/json,text/plain,*/*"};83  if (api.api_key) headers["x-api-key"] = String(api.api_key);84  if (api.master_key) headers["x-master-key"] = String(api.master_key);85  if (api.user_number) headers["x-user-number"] = String(api.user_number);86  if (api.side) headers["x-side"] = String(api.side);87  if (api.policy) headers["x-policy"] = String(api.policy);88 89  Bot.sendMessage(90    "πŸ”Ž <b>Live API Record Check Started</b>\n\n" +91    "β€’ API: <b>" + String(api.name || activeId) + "</b>\n" +92    "β€’ URL: <code>" + String(api.url) + "</code>\n" +93    "β€’ User Number: <code>" + String(api.user_number || "Not set") + "</code>\n" +94    "β€’ Side: <code>" + String(api.side || "Not set") + "</code>\n" +95    "β€’ Policy: <code>" + String(api.policy || "Not set") + "</code>\n\n" +96    "⏳ Connecting...",97    {parse_mode:"HTML"}98  );99 100  var body = "api_key=" + encodeURIComponent(String(api.api_key || "")) +101             "&action=" + encodeURIComponent(String(Bot.getProperty("bunty_validate_action") || "balance"));102  ["user_number","side","policy"].forEach(function(k){ if (api[k]) body += "&" + k + "=" + encodeURIComponent(String(api[k])); });103  headers["Content-Type"] = "application/x-www-form-urlencoded";104  HTTP.post({105    url: String(api.url),106    body: body,107    headers: headers,108    success: "/api_record_result",109    error: "/api_record_error"110  });111} catch (e) {112  Bot.sendMessage("⚠️ <b>API Record Error:</b> <code>" + String(e.message || e) + "</code>", {parse_mode:"HTML"});113}