amanjha18v/AMAN_SHOPS_BOTPublic · Bot Template

AIAMAN SHOP STORE appears to be a Telegram automation bot. Commands include /*, /addbal, /addbal_all, /addbal_binance, /addbal_binance_approve, /addbal_binance_paid, /addbal_upi, /addcat_id. Observed in code: messaging, http, libs, keyboards, payments.

Utilityutility
ProfileTelegram
132 commands0 envUpdated 6h agoCreated Sep 4, 2026
Back to folder

commands/_addproduct.js

javascript · 107 lines

Raw
1/**#command2name: /addproduct3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12var adminId = Bot.getProperty("owner_id") || "5191323229";13var isCoAdmin0 = Bot.getProperty("co_admin_" + String(chat.chatid));14 15if (chat.chatid == adminId || isCoAdmin0) {16  // Format: /addproduct Name | EmojiID | PID | Category(root/nonroot/both)17  if (!params || params.trim() === "") {18    Bot.sendMessage(19      "⚠️ <b>Galat Format!</b>\n\n" +20      "Kripya is tarah bhejien:\n" +21      "<code>/addproduct Name | EmojiID | PID | Category</code>\n\n" +22      "<b>Category</b> me likhein: <code>root</code>, <code>nonroot</code>, <code>iphone</code> ya <code>both</code>\n\n" +23      "<b>Example:</b>\n<code>/addproduct Drip Client | 61160843705 | 91 | root</code>\n" +24      "<code>/addproduct Drip Client | 61160843705 | 92 | nonroot</code>\n" +25      "<code>/addproduct Panther Spoofer | 61160843705 | 93 | iphone</code>",26      { parse_mode: "HTML" }27    );28    return;29  }30 31  var parts = params.split("|");32  if (parts.length < 3) {33    Bot.sendMessage("⚠️ Sabhi details (Name, Emoji ID, PID) '|' lagakar bhejein!", { parse_mode: "HTML" });34    return;35  }36 37  var prodName = parts[0].trim();38  var prodEmoji = parts[1].trim();39  var prodId = parts[2].trim();40 41  // ✅ NEW: 4th field = category (root / nonroot / iphone / both). Agar admin nahi bhejta42  // toh default "both" — taaki purana /addproduct format (3 fields) bhi chalta rahe.43  var rawCategory = parts.length >= 4 ? parts[3].trim().toLowerCase() : "both";44  var prodCategory = "both";45  if (rawCategory === "root" || rawCategory === "android root" || rawCategory === "androidroot") {46    prodCategory = "root";47  } else if (rawCategory === "nonroot" || rawCategory === "non root" || rawCategory === "android non root" || rawCategory === "androidnonroot") {48    prodCategory = "nonroot";49  } else if (rawCategory === "iphone" || rawCategory === "ios" || rawCategory === "i phone" || rawCategory === "apple") {50    prodCategory = "iphone";51  } else {52    prodCategory = "both";53  }54 55  // Safe database fetch56  var productList = Bot.getProperty("stored_products");57  if (!Array.isArray(productList)) {58    productList = [];59  }60 61  // ✅ BUG FIX: pehle har /addproduct call ek NAYA duplicate entry bana deta tha,62  // chahe wahi product naam se pehle se maujood ho — isse shop me same product63  // do baar dikhta tha aur plans purani wali entry se hi attached rehte the.64  // Ab existing product (case-insensitive match) ho to usi ko UPDATE karta hai,65  // uske plans (agar honge) safe rehte hain.66  var existingIdx = -1;67  for (var pi = 0; pi < productList.length; pi++) {68    if (productList[pi].name && productList[pi].name.trim().toLowerCase() === prodName.toLowerCase()) {69      existingIdx = pi;70      break;71    }72  }73 74  var isUpdate = existingIdx > -1;75 76  if (isUpdate) {77    productList[existingIdx].name = prodName;78    productList[existingIdx].emoji = prodEmoji;79    productList[existingIdx].id = prodId;80    productList[existingIdx].category = prodCategory;81    if (!Array.isArray(productList[existingIdx].plans)) { productList[existingIdx].plans = []; }82  } else {83    productList.push({84      name: prodName,85      emoji: prodEmoji,86      id: prodId,87      category: prodCategory,88      plans: []89    });90  }91 92  // Save karo93  Bot.setProperty("stored_products", productList, "json");94 95  Bot.sendMessage(96    "<blockquote>✅ <b>Product " + (isUpdate ? "Updated" : "Successfully Added") + "!</b></blockquote>\n\n" +97    "📦 <b>Name:</b> " + prodName + "\n" +98    "💎 <b>Emoji:</b> <code>" + prodEmoji + "</code>\n" +99    "🔑 <b>PID:</b> <code>" + prodId + "</code>\n" +100    "📂 <b>Category:</b> <code>" + (prodCategory === "root" ? "ANDROID ROOT" : prodCategory === "nonroot" ? "ANDROID NON ROOT" : prodCategory === "iphone" ? "iPHONE" : "BOTH") + "</code>\n\n" +101    "<i>" + (isUpdate ? "Existing plans safe rakhe gaye hain." : "Ab yeh product store me sabhi ko dikhega! Use /addplan to add pricing plans.") + "</i>",102    { parse_mode: "HTML" }103  );104 105} else {106  Bot.sendMessage("❌ You are not the admin!");107}