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

javascript Β· 166 lines

Raw
1/**#command2name: /maintenance_toggle3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12/**#command13name: /maintenance_toggle14answer:15keyboard:16parse_mode: html17aliases:18allow_only_group: false19need_reply: false20case_insensitive: false21is_web: 022#command**/23 24try {25 26  var adminId = String(Bot.getProperty("owner_id") || "7839151435");27  var currentChatId = String(chat.chatid);28  var isCoAdmin = Bot.getProperty("co_admin_" + currentChatId);29 30  if (currentChatId !== adminId && !isCoAdmin) {31    if (request && request.id) {32      try {33        Api.answerCallbackQuery({34          callback_query_id: String(request.id),35          text: "❌ Admin/Co-Admin only",36          show_alert: true37        });38      } catch (e) {}39    }40    return;41  }42 43  var param = String(params || "").trim();44 45  // =====================================================46  // GLOBAL MAINTENANCE MODE47  // /maintenance_toggle48  // =====================================================49 50  if (param === "") {51 52    var oldState = Bot.getProperty("maintenance_mode") === true;53    var newState = !oldState;54 55    Bot.setProperty("maintenance_mode", newState, "boolean");56 57    if (newState) {58      Bot.setProperty("maintenance_removed_at", 0, "number");59    } else {60      Bot.setProperty("maintenance_removed_at", Date.now(), "number");61    }62 63    if (request && request.id) {64      try {65        Api.answerCallbackQuery({66          callback_query_id: String(request.id),67          text: newState68            ? "πŸ›  Maintenance Mode ON"69            : "🟒 Maintenance Mode OFF",70          show_alert: false71        });72      } catch (e) {}73    }74 75    Bot.sendMessage(76      newState77        ? "πŸ›  <b>MAINTENANCE MODE ON</b>\n\nBot ab maintenance mode me hai."78        : "🟒 <b>MAINTENANCE MODE OFF</b>\n\nBot ab LIVE hai.",79      { parse_mode: "HTML" }80    );81 82    return;83  }84 85  // =====================================================86  // PANEL-WISE MAINTENANCE87  // /maintenance_toggle 088  // /maintenance_toggle 189  // /maintenance_toggle 290  // =====================================================91 92  var index = Number(param);93 94  if (isNaN(index) || index < 0) {95    Bot.sendMessage("❌ Invalid panel selection.");96    return;97  }98 99  var products = Bot.getProperty("stored_products") || [];100 101  if (!Array.isArray(products) || !products[index]) {102 103    if (request && request.id) {104      try {105        Api.answerCallbackQuery({106          callback_query_id: String(request.id),107          text: "❌ Panel not found!",108          show_alert: true109        });110      } catch (e) {}111    }112 113    return;114  }115 116  var product = products[index];117 118  var productName = String(119    product.name || ("Panel " + (index + 1))120  );121 122  var key =123    "panel_maintenance_" +124    String(product.id || product.name || index)125      .toUpperCase()126      .replace(/[^A-Z0-9_-]/g, "_");127 128  var oldPanelState = Bot.getProperty(key) === true;129  var newPanelState = !oldPanelState;130 131  Bot.setProperty(key, newPanelState, "boolean");132 133  if (request && request.id) {134    try {135      Api.answerCallbackQuery({136        callback_query_id: String(request.id),137        text: newPanelState138          ? "πŸ›  " + productName + " β†’ Maintenance ON"139          : "🟒 " + productName + " β†’ Maintenance OFF",140        show_alert: false141      });142    } catch (e) {}143  }144 145  // Panel Maintenance screen refresh146  try {147    Bot.runCommand("/panel_maintenance");148  } catch (e) {149 150    Bot.sendMessage(151      newPanelState152        ? "πŸ›  <b>" + productName + "</b> β†’ Maintenance ON"153        : "🟒 <b>" + productName + "</b> β†’ Maintenance OFF",154      { parse_mode: "HTML" }155    );156 157  }158 159} catch (err) {160 161  Bot.sendMessage(162    "⚠️ Maintenance Error:\n" +163    (err && err.message ? err.message : String(err))164  );165 166}