indrajitghosh20006/Igstore_01botPublic Β· Bot Template
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 7h agoCreated Oct 30, 2026
commands/_addstock_id.js
javascript Β· 145 lines
1/**#command2name: /addstock_id3answer: 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 53try {54 var adminId = "7839151435";55 if (String(chat.chatid) !== adminId) return;56 57 // Agar message khali hai58 if (!message) {59 Bot.sendMessage("β Format: <code>/addstock_id category_name email|password</code>", {parse_mode: "HTML"});60 return;61 }62 63 // Pura text line-by-line split karein (Bulk upload support ke liye)64 var lines = message.split("\n");65 var categories = Bot.getProperty("ff_categories") || {};66 67 var pendingStock = {}; 68 var totalAdded = 0;69 var reportMessage = "β‘ <b>Stock Loaded Successfully!</b>\n\n";70 71 for (var i = 0; i < lines.length; i++) {72 var currentLine = lines[i].trim();73 if (!currentLine) continue;74 75 // Command hatayein agar pehli line me ho76 if (currentLine.toLowerCase().indexOf("/addstock_id") === 0) {77 currentLine = currentLine.substring(12).trim(); // "/addstock_id" ki length 12 hai78 }79 80 if (!currentLine) continue;81 82 // Category aur account data ke beech ka space dhoondhein83 var spaceIndex = currentLine.indexOf(" ");84 if (spaceIndex === -1) continue;85 86 var alias = currentLine.substring(0, spaceIndex).toLowerCase().trim(); 87 var credential = currentLine.substring(spaceIndex + 1).trim(); // email|pass88 89 // Agar credential me "|" nahi hai toh line skip karein (Valid format check)90 if (credential.indexOf("|") === -1) continue;91 92 var finalSlug = "";93 94 // 1. Exact Category Slug Check95 if (categories[alias]) {96 finalSlug = alias;97 } else {98 // 2. Contains Slug Check or Name Match (Jaise 'lodu' ya 'fb')99 for (var key in categories) {100 var cleanKey = key.toLowerCase();101 var catName = categories[key].name ? categories[key].name.toLowerCase() : "";102 103 if (cleanKey.indexOf(alias) !== -1 || alias.indexOf(cleanKey) !== -1 ||104 catName.indexOf(alias) !== -1 || alias.indexOf(catName) !== -1) {105 finalSlug = key;106 break;107 }108 }109 }110 111 // Queue data if category found112 if (finalSlug !== "") {113 if (!pendingStock[finalSlug]) {114 pendingStock[finalSlug] = [];115 }116 pendingStock[finalSlug].push(credential);117 totalAdded++;118 }119 }120 121 // Database me save karein122 if (totalAdded > 0) {123 for (var slug in pendingStock) {124 var currentStock = Bot.getProperty("ff_stock_" + slug) || [];125 if (!Array.isArray(currentStock)) currentStock = [];126 127 var newAccounts = pendingStock[slug];128 for (var j = 0; j < newAccounts.length; j++) {129 currentStock.push(newAccounts[j]);130 }131 132 Bot.setProperty("ff_stock_" + slug, currentStock, "json");133 134 var catName = categories[slug] && categories[slug].name ? categories[slug].name : slug.toUpperCase();135 reportMessage += "β’ <code>" + newAccounts.length + " accounts</code> β <b>" + catName + "</b>\n";136 }137 138 Bot.sendMessage(reportMessage, {parse_mode: "HTML"});139 } else {140 Bot.sendMessage("β <b>Stock Add Nahi Hua!</b>\n\nKyu nahi hua?\n1. <code>LODU</code> naam ki category system me nahi bani hai.\n2. Aapne account ke beech me <code>|</code> nahi lagaya.\n\n<b>Sahi Format:</b>\n<code>/addstock_id lodu jajaj@gmail.com|Sam72@</code>", {parse_mode: "HTML"});141 }142 143} catch(e) {144 Bot.sendMessage("Error: " + e.message);145}