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
ProfileTelegram
102 commands1 envUpdated 29d agoCreated Aug 9, 2026
Back to folder

commands/_addstock_id.js

javascript · 104 lines

Raw
1/**#command2name: /addstock_id3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12try {13  var adminId = "8812621370";14  if (String(chat.chatid) !== adminId) return;15 16  // Agar message khali hai17  if (!message) {18    Bot.sendMessage("❌ Format: <code>/addstock_id category_name email|password</code>", {parse_mode: "HTML"});19    return;20  }21 22  // Pura text line-by-line split karein (Bulk upload support ke liye)23  var lines = message.split("\n");24  var categories = Bot.getProperty("ff_categories") || {};25  26  var pendingStock = {}; 27  var totalAdded = 0;28  var reportMessage = "⚡ <b>Stock Loaded Successfully!</b>\n\n";29 30  for (var i = 0; i < lines.length; i++) {31    var currentLine = lines[i].trim();32    if (!currentLine) continue;33 34    // Command hatayein agar pehli line me ho35    if (currentLine.toLowerCase().indexOf("/addstock_id") === 0) {36      currentLine = currentLine.substring(12).trim(); // "/addstock_id" ki length 12 hai37    }38    39    if (!currentLine) continue;40 41    // Category aur account data ke beech ka space dhoondhein42    var spaceIndex = currentLine.indexOf(" ");43    if (spaceIndex === -1) continue;44 45    var alias = currentLine.substring(0, spaceIndex).toLowerCase().trim(); 46    var credential = currentLine.substring(spaceIndex + 1).trim(); // email|pass47 48    // Agar credential me "|" nahi hai toh line skip karein (Valid format check)49    if (credential.indexOf("|") === -1) continue;50 51    var finalSlug = "";52 53    // 1. Exact Category Slug Check54    if (categories[alias]) {55      finalSlug = alias;56    } else {57      // 2. Contains Slug Check or Name Match (Jaise 'lodu' ya 'fb')58      for (var key in categories) {59        var cleanKey = key.toLowerCase();60        var catName = categories[key].name ? categories[key].name.toLowerCase() : "";61        62        if (cleanKey.indexOf(alias) !== -1 || alias.indexOf(cleanKey) !== -1 ||63            catName.indexOf(alias) !== -1 || alias.indexOf(catName) !== -1) {64          finalSlug = key;65          break;66        }67      }68    }69 70    // Queue data if category found71    if (finalSlug !== "") {72      if (!pendingStock[finalSlug]) {73        pendingStock[finalSlug] = [];74      }75      pendingStock[finalSlug].push(credential);76      totalAdded++;77    }78  }79 80  // Database me save karein81  if (totalAdded > 0) {82    for (var slug in pendingStock) {83      var currentStock = Bot.getProperty("ff_stock_" + slug) || [];84      if (!Array.isArray(currentStock)) currentStock = [];85 86      var newAccounts = pendingStock[slug];87      for (var j = 0; j < newAccounts.length; j++) {88        currentStock.push(newAccounts[j]);89      }90 91      Bot.setProperty("ff_stock_" + slug, currentStock, "json");92 93      var catName = categories[slug] && categories[slug].name ? categories[slug].name : slug.toUpperCase();94      reportMessage += "• <code>" + newAccounts.length + " accounts</code> ➔ <b>" + catName + "</b>\n";95    }96 97    Bot.sendMessage(reportMessage, {parse_mode: "HTML"});98  } else {99    Bot.sendMessage("❌ <b>Stock Add Nahi Hua!</b>\n\nKyu nahi hua?\n1. <code>LODU</code> naam ki category system me nahi bani hai.\n2. Aapne account ke beech me <code>|</code> nahi lagaya.\n\n<b>Sahi Format:</b>\n<code>/addstock_id lodu jajaj@gmail.com|Sam72@</code>", {parse_mode: "HTML"});100  }101 102} catch(e) {103  Bot.sendMessage("Error: " + e.message);104}