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/_admin.js
javascript Β· 221 lines
1/**#command2name: /admin3answer: 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 // One-time migration of legacy owner IDs to the current admin/owner.55 var storedOwnerId = String(Bot.getProperty("owner_id") || "");56 if (!storedOwnerId || ["7839151435"].indexOf(storedOwnerId) !== -1) {57 Bot.setProperty("owner_id", "7839151435", "string");58 }59 var currentStoreName = String(Bot.getProperty("store_name") || "");60 if (!currentStoreName || currentStoreName === "ππ πππππ" || currentStoreName === "ππ πππππ") {61 Bot.setProperty("store_name", "ππ πππππ", "string");62 }63 // β
FIXED (v3): dynamic owner_id (same fix as /addbal) so this stays correct64 // even after ownership transfer, instead of a frozen hardcoded ID.65 var adminId = Bot.getProperty("owner_id") || "7839151435";66 67 var currentChatId = (typeof chat !== 'undefined' && chat && chat.chatid) ? String(chat.chatid) : null;68 var isCoAdmin = currentChatId && Bot.getProperty("co_admin_" + currentChatId);69 if (currentChatId !== adminId && !isCoAdmin) {70 Bot.sendMessage("β Restricted command! Only accessible by Owner.");71 return;72 }73 74 // Live Database Metrics Extraction75 var userList = Bot.getProperty("all_users_list") || [];76 var totalUsers = userList.length;77 var currentResellerPrice = Bot.getProperty("reseller_upgrade_price") || "Not Set";78 79 // π PREMIUM ADMINISTRATIVE MASTER INTERFACE80 var adminPanelText = 81 "<blockquote><b><tg-emoji emoji-id='6064138396228392033'>π</tg-emoji> MASTER ADMINISTRATIVE PANEL</b>\n\n" +82 "<i>Welcome back Boss! Securely manage your store microservices, logs, databases, plans, and inventory control nodes below.</i></blockquote>\n" +83 "ββββββββββββββββββββββββββ\n" +84 "<blockquote><b><tg-emoji emoji-id='6039605143601680423'>π</tg-emoji> BOT INFRASTRUCTURE SUMMARY</b>\n\n" +85 "β’ <b>Total Registered Users:</b> <code>" + totalUsers + " Users</code>\n" +86 "β’ <b>Reseller Upgrade Price:</b> <code>βΉ" + currentResellerPrice + "</code></blockquote>\n" +87 "ββββββββββββββββββββββββββ\n" +88 "<tg-emoji emoji-id='5346024644635804737'>π°</tg-emoji> <b>Select an operational control terminal module:</b>";89 90 // π¨ CONSOLIDATED ADMIN CONTROLS β screenshot controls are surfaced directly.91 // Existing handlers are reused; no nested "Seller Panel β Full Controls" menu.92 var adminKeyboard = [93 [94 { text: "Bot Statistics", callback_data: "/check_users", style: "success", icon_custom_emoji_id: "6039605143601680423" },95 { text: "Add Product", callback_data: "/addproduct", style: "success", icon_custom_emoji_id: "5348392971207194994" }96 ],97 [98 { text: "Manage Products", callback_data: "/manage_products", style: "primary", icon_custom_emoji_id: "5258077307985207053" },99 { text: "Add Stock", callback_data: "/addstock", style: "success", icon_custom_emoji_id: "6195196054795721892" }100 ],101 [102 { text: "Quick Add Key", callback_data: "/addkey", style: "success", icon_custom_emoji_id: "6195196054795721892" },103 { text: "Product Maintenance", callback_data: "/panel_maintenance", style: "danger", icon_custom_emoji_id: "6100657257605763582" }104 ],105 [106 { text: "Reseller Mgmt", callback_data: "/addreseller_info", style: "success", icon_custom_emoji_id: "6195245116207143870" },107 { text: "Create Coupon", callback_data: "/gencoupon", style: "success", icon_custom_emoji_id: "6093677128295914531" }108 ],109 [110 { text: "Broadcast", callback_data: "/broadcast", style: "primary", icon_custom_emoji_id: "6041705726206808304" },111 { text: "All Files Link", callback_data: "/set_download_link_btn", style: "primary", icon_custom_emoji_id: "6091571559233755994" }112 ],113 [114 { text: "Tutorial Video", callback_data: "/set_how_link_btn", style: "primary", icon_custom_emoji_id: "5258077307985207053" },115 { text: "Set Payment ( UPI + Gram UPI Gateway )", callback_data: "/set_payment_upi_btn", style: "primary", icon_custom_emoji_id: "6312263493051489212" }116 ],117 [118 { text: "Set Payment (Binance Pay)", callback_data: "/set_payment_binance_btn", style: "primary", icon_custom_emoji_id: "6312263493051489212" },119 ],120 [121 { text: "Set Support Link", callback_data: "/set_support_link_btn", style: "danger", icon_custom_emoji_id: "6267129592998270736" },122 { text: "API Record / Connection Check", callback_data: "/api_record", style: "success", icon_custom_emoji_id: "6039605143601680423" }123 ],124 [125 { text: "Bunty API", callback_data: "/bunty_api", style: "primary", icon_custom_emoji_id: "6039605143601680423" }126 ],127 [128 { text: "API ON/OFF Control", callback_data: "/api_control", style: "success", icon_custom_emoji_id: "6039605143601680423" }129 ],130 [131 { text: "Add Plan", callback_data: "/addplan", style: "primary", icon_custom_emoji_id: "6194922667242429131" },132 { text: "Remove Product", callback_data: "/removeproduct", style: "danger", icon_custom_emoji_id: "6143299028655280273" }133 ],134 [135 { text: "Remove Plan", callback_data: "/removeplan", style: "danger", icon_custom_emoji_id: "6143299028655280273" },136 ],137 [138 { text: "Remove Key", callback_data: "/removekey", style: "danger", icon_custom_emoji_id: "6143299028655280273" },139 { text: "Add Cat for ID", callback_data: "/addcat_id", style: "success", icon_custom_emoji_id: "5334890573281114250" }140 ],141 [142 { text: "Rem Cat for ID", callback_data: "/remcat_id", style: "danger", icon_custom_emoji_id: "6143299028655280273" },143 { text: "Add Stock ID", callback_data: "/addstock_id", style: "success", icon_custom_emoji_id: "6195196054795721892" }144 ],145 [146 { text: "Remove Stock ID", callback_data: "/remstock_id", style: "danger", icon_custom_emoji_id: "6143299028655280273" },147 { text: "Check ID Stock", callback_data: "/allstocks", style: "primary", icon_custom_emoji_id: "6039605143601680423" }148 ],149 [150 { text: "Clear All ID Stock", callback_data: "/clearstock", style: "danger", icon_custom_emoji_id: "6143299028655280273" },151 { text: "Set Normal Price ID", callback_data: "/normalprice_id", style: "primary", icon_custom_emoji_id: "5778145208411624388" }152 ],153 [154 { text: "Set Reseller Price ID", callback_data: "/resellerprice_id", style: "success", icon_custom_emoji_id: "6267068789146260253" },155 { text: "Set All Products Normal Price", callback_data: "/normalprice", style: "primary", icon_custom_emoji_id: "5778145208411624388" }156 ],157 [158 { text: "Set All Products Reseller Price", callback_data: "/setresellerprice", style: "success", icon_custom_emoji_id: "6267068789146260253" },159 { text: "Add Bal", callback_data: "/addbal", style: "success", icon_custom_emoji_id: "5778145208411624388" }160 ],161 [162 { text: "Remove Bal", callback_data: "/rembal", style: "danger", icon_custom_emoji_id: "6143299028655280273" },163 { text: "Check Bal", callback_data: "/checkbal", style: "primary", icon_custom_emoji_id: "6039605143601680423" }164 ],165 [166 { text: "Add Bal To All Users", callback_data: "/addbal_all", style: "success", icon_custom_emoji_id: "5778145208411624388" }167 ],168 [169 { text: "Add Reseller", callback_data: "/addreseller", style: "success", icon_custom_emoji_id: "6195245116207143870" },170 { text: "Remove Reseller", callback_data: "/removereseller", style: "danger", icon_custom_emoji_id: "6143299028655280273" },171 { text: "View Role", callback_data: "/role", style: "primary", icon_custom_emoji_id: "6064138396228392033" }172 ],173 [174 { text: "Set Reseller Upgrade Fee", callback_data: "/setprice", style: "primary", icon_custom_emoji_id: "5463172695132745432" },175 { text: "Set Reseller Price", callback_data: "/set_reseller_price", style: "primary", icon_custom_emoji_id: "6312263493051489212" }176 ],177 [178 { text: "Toggle Reseller System", callback_data: "/toggle_reseller_system", style: "success", icon_custom_emoji_id: "6102856637343600044" },179 ],180 [181 { text: "Set Product/Plan Discount", callback_data: "/set_discount", style: "primary", icon_custom_emoji_id: "6093677128295914531" },182 { text: "Member Custom Price", callback_data: "/setmemberprice", style: "success", icon_custom_emoji_id: "6312263493051489212" }183 ],184 [185 { text: "Remove Member Price", callback_data: "/removememberprice", style: "danger", icon_custom_emoji_id: "6143299028655280273" },186 { text: "All Keys", callback_data: "/allkey", style: "success", icon_custom_emoji_id: "6010210211334200822" }187 ],188 [189 { text: "View Coupons", callback_data: "/coupons", style: "primary", icon_custom_emoji_id: "6102818532393750087" }190 ],191 [192 { text: "Manage Co-Admins", callback_data: "/manage_coadmin", style: "primary", icon_custom_emoji_id: "6102856637343600044" },193 { text: "Transfer Ownership", callback_data: "/transfer_ownership", style: "danger", icon_custom_emoji_id: "6215386799133433653" }194 ],195 [196 { text: "Maintenance Mode", callback_data: "/maintenance_toggle", style: "danger", icon_custom_emoji_id: "6100657257605763582" },197 ],198 [199 { text: "Demo Video Manager", callback_data: "/demo_manager", style: "primary", icon_custom_emoji_id: "5258077307985207053" },200 ],201 [202 { text: "Manage Button", callback_data: "/manage_button", style: "success", icon_custom_emoji_id: "6039605143601680423" }203 ]204 ];205 206 // π€ DISPATCH PIPELINE EXECUTION207 // β
FIXED: pehle ye hamesha hardcoded adminId ko panel bhejta tha β agar208 // koi co-admin /admin kholta, to panel unko na milkar owner ke chat me209 // chala jaata tha. Ab panel usi chat me jaata hai jisne /admin request kiya.210 Api.sendMessage({211 chat_id: currentChatId,212 text: adminPanelText,213 parse_mode: "HTML",214 reply_markup: JSON.stringify({215 inline_keyboard: adminKeyboard216 })217 });218 219} catch (err) {220 Bot.sendMessage("Admin Panel Premium Cluster Error: " + err.message);221}