ayushyadav7970824760/goldensellingstore_botPublic · Bot Template

AIThis Telegram store bot lets customers browse digital products and plans, apply coupons, add funds via UPI, and receive purchased keys. It includes a full admin panel for managing products, reordering items, setting reseller prices, viewing and removing key stock, configuring UPI payment details and update links, and checking user balances. Co-admins and resellers are supported, and support tickets are forwarded to the admin.

Commercedigital_storeadmin_panelupi_paymentsresellercouponskey_stock
ProfileTelegram
146 commands0 envUpdated 2d agoCreated Sep 5, 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 = "8477746023"; // 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}