ashoksarande3/ASHOK_HACK_STORE_BOTPublic · Bot Template

AIThis bot operates as a commercial storefront for selling Free Fire game hacks and cheats via UPI QR code payments. It features a dynamic pricing system with separate normal and reseller prices, product plans with flexible durations (days, hours, minutes), and a reseller program requiring a one-time upgrade fee. The bot handles payment verification through QR code generation and expiry tracking, user verification via Telegram contact sharing, and admin tools for stock management, plan creation, and ownership transfer. It includes a balance system, maintenance mode, and Telegram Stars payment fallback. The codebase uses TeleBotHost's TBL JavaScript APIs (Bot, Api, HTTP, db properties, Libs) for all logic.

Commercefreefiregame-hacksupi-paymentsqr-codesreseller-systemdynamic-pricing
ProfileTelegram
102 commands0 envUpdated 16d agoCreated Aug 22, 2026
Back to folder

commands/_addkey.js

javascript · 102 lines

Raw
1/**#command2name: /addkey3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12try {13  var adminId = "8660373585";14  if (String(chat.chatid) !== adminId) {15    Bot.sendMessage("❌ You are not the admin!");16    return;17  }18 19  if (!params) {20    Bot.sendMessage("⚠️ *Format:* `/addkey PRODUCT NAME | DAYS | KEY1`\n`KEY2`\n`KEY3` (Line-by-line)", { parse_mode: "Markdown" });21    return;22  }23 24  var lines = params.split("\n");25  var firstLineParts = lines[0].split("|");26 27  if (firstLineParts.length < 3) {28    Bot.sendMessage("⚠️ *Galat Format!*\nPehli line me `Product Name | Days | Key` hona chahiye.", { parse_mode: "Markdown" });29    return;30  }31 32  // 1. Inputs ko clean aur trim karna33  var pName = firstLineParts[0].trim().toLowerCase();34  var pDays = firstLineParts[1].trim(); 35  36  var pDaysClean = pDays.includes("_Day") ? pDays : pDays + "_Day";37  var pDaysNumOnly = pDays.replace("_Day", "").trim(); 38 39  var keysToAdd = [];40  keysToAdd.push(firstLineParts[2].trim());41 42  for (var l = 1; l < lines.length; l++) {43    var currentLineKey = lines[l].trim();44    if (currentLineKey !== "") {45      keysToAdd.push(currentLineKey);46    }47  }48 49  // 2. Products fetching50  var productList = Bot.getProperty("stored_products") || [];51  var prodIdx = -1;52  var planIdx = -1;53  var exactProdName = firstLineParts[0].trim(); // Fallback name54 55  // Soft loop matching (Case insensitive)56  for (var i = 0; i < productList.length; i++) {57    if (productList[i].name.trim().toLowerCase() === pName) {58      prodIdx = i;59      exactProdName = productList[i].name.trim();60      break;61    }62  }63 64  // FORCE CORRECTION: Agar index loop se na mile to handle anyway65  if (prodIdx === -1) {66    Bot.sendMessage("⚠️ Product *" + exactProdName + "* lists me nahi mila, par system dynamic key store bypass generate kar raha hai...", { parse_mode: "Markdown" });67  } else {68    var plans = productList[prodIdx].plans || [];69    for (var j = 0; j < plans.length; j++) {70      if (String(plans[j].days).trim() === pDaysNumOnly) {71        planIdx = j;72        break;73      }74    }75  }76 77  // 3. Dual-pipeline saving mechanics78  var stockKeyText = "stock_" + exactProdName + "_" + pDaysClean;79  var currentStock = Bot.getProperty(stockKeyText) || [];80  81  // Array merging82  var updatedStock = currentStock.concat(keysToAdd);83  Bot.setProperty(stockKeyText, updatedStock, "json");84 85  // Agar structured index match hua hai to us pipeline ko bhi update karein86  if (prodIdx !== -1 && planIdx !== -1) {87    var stockKeyIndex = "stock_" + prodIdx + "_" + planIdx;88    Bot.setProperty(stockKeyIndex, updatedStock, "json");89  }90 91  // 4. GUARANTEED SUCCESS CONFIRMATION MESSAGE92  var successMsg = "<blockquote><b>📦 STOCK UPDATED SUCCESSFULLY</b>\n\n" +93                   "• <b>Product:</b> <code>" + exactProdName + "</code>\n" +94                   "• <b>Plan:</b> <code>" + pDaysClean + "</code>\n" +95                   "• <b>Added Keys:</b> <code>" + keysToAdd.length + " Keys</code>\n" +96                   "• <b>Total Stock Now:</b> <code>" + updatedStock.length + " Keys available</code></blockquote>";97 98  Bot.sendMessage(successMsg, { parse_mode: "HTML" });99 100} catch (err) {101  Bot.sendMessage("⚠️ System Error: " + err.message);102}