indrajitghosh20006/HgfhhuybotPublic · Bot Template

ProfileTelegram

AIThis bot provides a command‑based admin interface for managing user balances, products, and resellers. It supports adding balances via UPI or Binance Pay, approving payments, and configuring product details and categories. The bot also handles user role changes, stock uploads, and offers a simple calculator UI for entering amounts. All interactions are handled through short commands and inline keyboards, with no long‑running listeners or external frameworks.

Utilityadminbalanceproductresellerpaymentupi
138 commands0 envUpdated 15h agoCreated Sep 27, 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 = "7839151435";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}