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 8h agoCreated Oct 30, 2026
commands/_checkbal.js
javascript Β· 121 lines
1/**#command2name: /checkbal3answer: 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 = Bot.getProperty("owner_id") || "7839151435";55 var requesterId = String(user.telegramid);56 var isCoAdmin = Bot.getProperty("co_admin_" + requesterId);57 58 if (requesterId !== String(adminId) && !isCoAdmin) {59 Bot.sendMessage("β Access Denied.");60 return;61 }62 63 if (request && request.id) {64 try {65 HTTP.post({66 url: "https://api.telegram.org/bot" + bot.token + "/answerCallbackQuery",67 body: { callback_query_id: request.id }68 });69 } catch (e) {}70 }71 72 // Supports both button prompt and direct /checkbal USER_ID.73 var raw = "";74 if (typeof params !== "undefined" && params) raw = String(params).trim();75 if (!raw && typeof message !== "undefined" && message) {76 var parts = String(message).trim().split(/\s+/);77 if (parts.length > 1) raw = parts.slice(1).join(" ").trim();78 }79 80 if (!raw || !/^\d+$/.test(raw)) {81 User.setProperty("checkbal_step", "waiting_input", "string");82 Bot.sendMessage(83 "π <b>Check Member Balance</b>\n\n" +84 "Member/User ID bhejein:\n<code>123456789</code>",85 { parse_mode: "HTML" }86 );87 return;88 }89 90 var targetId = raw;91 92 // Profile details are stored by /start when available.93 var profile = Bot.getProperty("user_profile_" + targetId) || {};94 var name = profile.first_name || profile.name || "N/A";95 var username = profile.username ? (String(profile.username).charAt(0) === "@" ? profile.username : "@" + profile.username) : "N/A";96 97 // One consistent wallet source: ResourcesLib balance.98 var balance = 0;99 try {100 balance = Number(Libs.ResourcesLib.anotherUserRes("balance", targetId).value()) || 0;101 } catch (e1) {}102 103 // Keep compatibility with older admin balance storage.104 var legacyBalance = Number(Bot.getProperty("balance" + targetId) || 0);105 var totalBalance = (balance + legacyBalance).toFixed(2);106 107 var totalSpent = Number(Bot.getProperty("total_spent_by_" + targetId) || 0).toFixed(2);108 109 Bot.sendMessage(110 "<blockquote><b>π€ MEMBER BALANCE DETAILS</b>\n\n" +111 "β’ <b>Name:</b> " + name + "\n" +112 "β’ <b>Username:</b> " + username + "\n" +113 "β’ <b>User ID:</b> <code>" + targetId + "</code>\n" +114 "β’ <b>Balance:</b> <code>βΉ" + totalBalance + "</code>\n" +115 "β’ <b>Total Spent:</b> <code>βΉ" + totalSpent + "</code></blockquote>",116 { parse_mode: "HTML" }117 );118 119} catch (err) {120 Bot.sendMessage("β οΈ <b>Check Balance Error:</b> <code>" + err.message + "</code>", { parse_mode: "HTML" });121}