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

javascript Β· 131 lines

Raw
1/**#command2name: /removeplan3answer: 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  // Apni Admin Telegram ID yahan dalein55  var adminId = "7839151435";56 57  if (String(chat.chatid) !== adminId) {58    Bot.sendMessage("❌ You are not the admin!");59    return;60  }61 62  // Format validation verification63  if (!params) {64    Bot.sendMessage("⚠️ Format: `/removeplan PRODUCT NAME | DAYS`\n\n*Example:* `/removeplan FreeFire Hack | 1`", { parse_mode: "Markdown" });65    return;66  }67 68  var data = params.split("|");69  if (data.length < 2) {70    Bot.sendMessage("⚠️ Galat Format! Product Name aur Days '|' se alag honi chahiye.");71    return;72  }73 74  var pName = data[0].trim().toLowerCase();75  var pDays = data[1].trim();76 77  // Database se existing products list nikalna78  var productList = Bot.getProperty("stored_products") || [];79  var productIndex = -1;80 81  // 1. Pehle product find karein82  for (var i = 0; i < productList.length; i++) {83    if (productList[i].name.toLowerCase() === pName) {84      productIndex = i;85      break;86    }87  }88 89  if (productIndex === -1) {90    Bot.sendMessage("❌ Product **" + data[0].trim() + "** database me nahi mila!", { parse_mode: "Markdown" });91    return;92  }93 94  var product = productList[productIndex];95  var plans = product.plans || [];96  var planIndex = -1;97 98  // 2. Us product ke andar targeted plan find karein99  for (var j = 0; j < plans.length; j++) {100    if (String(plans[j].days) === pDays) {101      planIndex = j;102      break;103    }104  }105 106  if (planIndex === -1) {107    Bot.sendMessage("❌ Product me **" + pDays + " Days** wala koi plan nahi mila!", { parse_mode: "Markdown" });108    return;109  }110 111  // 3. Plan ko array se remove (delete) karna112  plans.splice(planIndex, 1);113 114  var feedbackMsg = "";115  116  // 4. Verification Check: Agar saare plans delete ho chuke hain, toh product hi remove kar do117  if (plans.length === 0) {118    productList.splice(productIndex, 1);119    feedbackMsg = "πŸ—‘οΈ Product **" + product.name + "** ka aakhri plan thha, isliye poora product list se remove ho gaya!";120  } else {121    productList[productIndex].plans = plans;122    feedbackMsg = "βœ… Product **" + product.name + "** se **" + pDays + " Days** wala plan successfully remove ho gaya!";123  }124 125  // 5. Updated list database me save karna126  Bot.setProperty("stored_products", productList, "json");127  Bot.sendMessage(feedbackMsg, { parse_mode: "Markdown" });128 129} catch (err) {130  Bot.sendMessage("⚠️ Error: " + err.message);131}