kkapil9112/Aestheticmodes9_botPublic · Bot Template
AIA Telegram-based digital goods store bot with a full admin panel for managing products, plans, stock, keys, categories, resellers, balances, and coupons. It uses TeleBotHost APIs like Bot, Api, User, Libs.ResourcesLib, and HTTP to run a shop interface, handle admin-only commands, track users, and send inventory/balance summaries. The implementation appears focused on selling game-related accounts and keys such as FreeFire items, with customer-facing store, balance, coupon, and back-to-menu flows.
Commerceshopadmin-panelbalanceresellercouponsstock-management
102 commands1 envUpdated 29d agoCreated Aug 9, 2026
commands/_addproduct.js
javascript · 87 lines
1/**#command2name: /addproduct3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12var adminId = Bot.getProperty("owner_id") || "8812621370";13var isCoAdmin0 = Bot.getProperty("co_admin_" + String(chat.chatid));14 15if (chat.chatid == adminId || isCoAdmin0) {16 // Format: /addproduct Name | EmojiID | PID17 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</code>\n\n" +22 "<b>Example:</b>\n<code>/addproduct Drip Proxy | 61160843705 | 91</code>",23 { parse_mode: "HTML" }24 );25 return;26 }27 28 var parts = params.split("|");29 if (parts.length < 3) {30 Bot.sendMessage("⚠️ Sabhi details (Name, Emoji ID, PID) '|' lagakar bhejein!", { parse_mode: "HTML" });31 return;32 }33 34 var prodName = parts[0].trim();35 var prodEmoji = parts[1].trim();36 var prodId = parts[2].trim();37 38 // Safe database fetch39 var productList = Bot.getProperty("stored_products");40 if (!Array.isArray(productList)) {41 productList = [];42 }43 44 // ✅ BUG FIX: pehle har /addproduct call ek NAYA duplicate entry bana deta tha,45 // chahe wahi product naam se pehle se maujood ho — isse shop me same product46 // do baar dikhta tha aur plans purani wali entry se hi attached rehte the.47 // Ab existing product (case-insensitive match) ho to usi ko UPDATE karta hai,48 // uske plans (agar honge) safe rehte hain.49 var existingIdx = -1;50 for (var pi = 0; pi < productList.length; pi++) {51 if (productList[pi].name && productList[pi].name.trim().toLowerCase() === prodName.toLowerCase()) {52 existingIdx = pi;53 break;54 }55 }56 57 var isUpdate = existingIdx > -1;58 59 if (isUpdate) {60 productList[existingIdx].name = prodName;61 productList[existingIdx].emoji = prodEmoji;62 productList[existingIdx].id = prodId;63 if (!Array.isArray(productList[existingIdx].plans)) { productList[existingIdx].plans = []; }64 } else {65 productList.push({66 name: prodName,67 emoji: prodEmoji,68 id: prodId,69 plans: []70 });71 }72 73 // Save karo74 Bot.setProperty("stored_products", productList, "json");75 76 Bot.sendMessage(77 "<blockquote>✅ <b>Product " + (isUpdate ? "Updated" : "Successfully Added") + "!</b></blockquote>\n\n" +78 "📦 <b>Name:</b> " + prodName + "\n" +79 "💎 <b>Emoji:</b> <code>" + prodEmoji + "</code>\n" +80 "🔑 <b>PID:</b> <code>" + prodId + "</code>\n\n" +81 "<i>" + (isUpdate ? "Existing plans safe rakhe gaye hain." : "Ab yeh product store me sabhi ko dikhega! Use /addplan to add pricing plans.") + "</i>",82 { parse_mode: "HTML" }83 );84 85} else {86 Bot.sendMessage("❌ You are not the admin!");87}