indrajitghosh20006/Testseller_01botPublic · Bot Template

ProfileTelegram

AIThis bot provides an admin‑controlled system for managing user balances, products, and reseller roles. It includes commands to add balances (via manual input, Binance Pay, or UPI), approve and credit payments, and set up product listings with categories and pricing. Admins can also add resellers, view reseller info, and manage stock entries. The bot uses built‑in TeleBotHost APIs such as Bot, Api, HTTP, and Libs for database operations and message handling.

Commerceadminbalanceproductresellerpaymentsbinance
138 commands0 envUpdated 17h agoCreated Sep 27, 2026
Back to folder

commands/_removekey.js

javascript · 69 lines

Raw
1/**#command2name: /removekey3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12try {13  var adminId = "7839151435"; // Aapki Admin ID14  if (String(chat.chatid) !== adminId) return;15 16  if (!params) {17    Bot.sendMessage("❌ <b>Usage:</b>\n<code>/removekey PRODUCT NAME | DAYS</code>\n\n<i>Example: DRIP CLIENT | 1_Day</i>", { parse_mode: "HTML" });18    return;19  }20 21  var args = params.split("|");22  if (args.length < 2) {23    Bot.sendMessage("❌ <b>Format Error!</b> Use Pipe symbol:\n<code>/removekey PRODUCT NAME | DAYS</code>", { parse_mode: "HTML" });24    return;25  }26 27  var prodName = args[0].trim();28  var planDays = args[1].trim();29  var cleanPlanDays = planDays.includes("_Day") ? planDays : planDays + "_Day";30 31  var stockKeyText = "stock_" + prodName + "_" + cleanPlanDays;32  var keyStock = Bot.getProperty(stockKeyText) || [];33 34  if (keyStock.length === 0) {35    Bot.sendMessage("❌ Product: <b>" + prodName + " (" + cleanPlanDays + ")</b> ka stock already empty hai!", { parse_mode: "HTML" });36    return;37  }38 39  var inlineButtons = [];40  41  // Har ek key ke liye ek individual delete button banana42  for (var i = 0; i < keyStock.length; i++) {43    var fullKey = keyStock[i];44    // Display ke liye key ka chota part dikhana taaki button bada na ho45    var shortKey = fullKey.length > 15 ? fullKey.substring(0, 12) + "..." : fullKey; 46    47    inlineButtons.push([48      {49        text: "🗑️ Key " + (i + 1) + " [" + shortKey + "]",50        // Callback me parameters pass karna: index_number | prodName | planDays51        callback_data: "/deletekey_now " + i + "|" + prodName + "|" + cleanPlanDays52      }53    ]);54  }55 56  var menuText = "<blockquote><b>🗑️ SELECT KEY TO REMOVE</b>\n\n" +57                 "• <b>Product:</b> <code>" + prodName + "</code>\n" +58                 "• <b>Plan:</b> <code>" + cleanPlanDays + "</code>\n" +59                 "• <b>Total Keys:</b> <code>" + keyStock.length + "</code>\n\n" +60                 "<i>Niche diye gaye buttons me se jis key ko remove karna hai, uspar click karein:</i></blockquote>";61 62  Bot.sendMessage(menuText, {63    parse_mode: "HTML",64    reply_markup: JSON.stringify({ inline_keyboard: inlineButtons })65  });66 67} catch (err) {68  Bot.sendMessage("⚠️ Error: " + err.message);69}