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 7h agoCreated Oct 30, 2026
Back to folder

commands/_manage_coadmin.js

javascript Β· 130 lines

Raw
1/**#command2name: /manage_coadmin3answer: 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// πŸ‘‘ OWNER-ONLY β€” Manage Co-Admins55// Usage: /manage_coadmin add USERID | /manage_coadmin remove USERID | /manage_coadmin list56// Co-Admins get full /admin panel access (product/plan/key/price/coupon/broadcast controls)57// but CANNOT manage other co-admins or transfer ownership β€” that stays Owner-only.58// =========================================================59 60try {61  var ownerId = Bot.getProperty("owner_id") || "7839151435";62  var currentChatId = String(chat.chatid);63 64  if (currentChatId !== ownerId) {65    Bot.sendMessage("❌ Sirf Owner hi co-admins manage kar sakta hai!");66    return;67  }68 69  if (!params || params.trim() === "") {70    var coAdminList = Bot.getProperty("co_admin_list") || [];71    Bot.sendMessage(72      "⚠️ <b>Format:</b>\n" +73      "<code>/manage_coadmin add USERID</code>\n" +74      "<code>/manage_coadmin remove USERID</code>\n" +75      "<code>/manage_coadmin list</code>\n\n" +76      "<b>Current Co-Admins:</b> " + (coAdminList.length ? coAdminList.join(", ") : "None"),77      { parse_mode: "HTML" }78    );79    return;80  }81 82  var parts = params.trim().split(" ");83  var action = parts[0].toLowerCase();84  var targetId = parts[1] ? parts[1].trim() : null;85 86  var coAdminList = Bot.getProperty("co_admin_list") || [];87 88  if (action === "list") {89    Bot.sendMessage(90      "<blockquote>πŸ‘‘ <b>CO-ADMIN LIST</b></blockquote>\n\n" + (coAdminList.length ? coAdminList.map(function (id) { return "β€’ <code>" + id + "</code>"; }).join("\n") : "<i>Koi co-admin nahi hai.</i>"),91      { parse_mode: "HTML" }92    );93    return;94  }95 96  if (!targetId || isNaN(Number(targetId))) {97    Bot.sendMessage("❌ Valid User ID chahiye! Example: <code>/manage_coadmin add 123456789</code>", { parse_mode: "HTML" });98    return;99  }100 101  if (action === "add") {102    if (targetId === ownerId) {103      Bot.sendMessage("❌ Owner khud apne aap ko co-admin nahi bana sakta!");104      return;105    }106    Bot.setProperty("co_admin_" + targetId, true, "boolean");107    if (coAdminList.indexOf(targetId) === -1) {108      coAdminList.push(targetId);109      Bot.setProperty("co_admin_list", coAdminList, "json");110    }111    Bot.sendMessage("βœ… <b>Co-Admin Added!</b> User <code>" + targetId + "</code> ab poora admin panel access kar sakta hai.", { parse_mode: "HTML" });112    try {113      Api.sendMessage({114        chat_id: targetId,115        text: "<blockquote>πŸ‘‘ <b>YOU ARE NOW A CO-ADMIN!</b></blockquote>\n\n<i>Aapko is store ke admin panel ka full access de diya gaya hai. /admin command use karke access karein.</i>",116        parse_mode: "HTML"117      });118    } catch (e) {}119  } else if (action === "remove") {120    Bot.setProperty("co_admin_" + targetId, null, "boolean");121    var idx = coAdminList.indexOf(targetId);122    if (idx > -1) { coAdminList.splice(idx, 1); Bot.setProperty("co_admin_list", coAdminList, "json"); }123    Bot.sendMessage("βœ… <b>Co-Admin Removed!</b> User <code>" + targetId + "</code> ka admin access hata diya gaya.", { parse_mode: "HTML" });124  } else {125    Bot.sendMessage("❌ Action 'add', 'remove', ya 'list' hona chahiye.");126  }127 128} catch (err) {129  Bot.sendMessage("⚠️ Error: " + err.message);130}