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/_addplan.js

javascript ยท 152 lines

Raw
1/**#command2name: /addplan3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12// Apni Admin Telegram ID yahan dalein13var adminId = Bot.getProperty("owner_id") || "8660373585";14var isCoAdmin0 = Bot.getProperty("co_admin_" + String(chat.chatid));15 16if (chat.chatid != adminId && !isCoAdmin0) {17  Bot.sendMessage("โŒ You are not the admin!");18  return;19}20 21// โœ… FIXED: Ab sirf "Days" nahi โ€” Hour / Minute bhi support karta hai!22// Format: /addplan PRODUCT NAME | DURATION | NORMAL PRICE | RESELLER PRICE23// DURATION examples: "7" ya "7d" ya "7days" = 7 Days | "1h" ya "1hour" = 1 Hour | "30m" ya "30min" = 30 Minutes24if (!params) {25  Bot.sendMessage(26    "โš ๏ธ Format: `/addplan PRODUCT NAME | DURATION | NORMAL PRICE | RESELLER PRICE`\n\n" +27    "*Examples:*\n" +28    "`/addplan FreeFire Hack | 7d | 91 | 64`  (7 Days)\n" +29    "`/addplan FreeFire Hack | 1h | 10 | 8`  (1 Hour)\n" +30    "`/addplan FreeFire Hack | 30m | 5 | 4`  (30 Minutes)",31    { parse_mode: "Markdown" }32  );33  return;34}35 36var data = params.split("|");37if (data.length < 4) {38  Bot.sendMessage("โš ๏ธ Galat Format! Charo cheezein '|' se alag honi chahiye.");39  return;40}41 42var pName = data[0].trim();43var rawDuration = data[1].trim();44var pNormal = parseFloat(data[2].trim());45var pReseller = parseFloat(data[3].trim());46 47if (isNaN(pNormal) || isNaN(pReseller)) {48  Bot.sendMessage("โŒ Price numeric (number) honi chahiye!");49  return;50}51 52// ๐Ÿ•’ DURATION PARSER โ€” value + unit (day / hour / minute) nikalta hai53var durMatch = rawDuration.toLowerCase().match(/^([0-9]+(?:\.[0-9]+)?)\s*(h|hr|hrs|hour|hours|m|min|mins|minute|minutes|d|day|days)?$/);54var pValue = durMatch ? durMatch[1] : rawDuration.replace(/[^0-9.]/g, "");55var unitRaw = durMatch ? (durMatch[2] || "d") : "d";56var pUnit = "day";57if (/^h/.test(unitRaw)) { pUnit = "hour"; }58else if (/^m/.test(unitRaw)) { pUnit = "minute"; }59else { pUnit = "day"; }60 61if (!pValue || isNaN(Number(pValue))) {62  Bot.sendMessage("โŒ Duration samajh nahi aayi! Example: 7d, 1h, 30m");63  return;64}65 66var pDays = String(pValue); // (naam legacy rakha hai backward-compat ke liye, ab ye "value" hai)67 68// ๐ŸŸข Dynamic Global Price Keys โ€” unit-aware (Day plans purane format me hi rehte hain,69// taaki pehle se set kiye hue Day-prices na tootein; Hour/Minute plans naye suffix format me)70var cleanProdName = pName.toUpperCase();71var priceKeySuffix = (pUnit === "day") ? pDays : (pDays + "_" + pUnit);72var normalKey = "price_normal_" + cleanProdName + "_" + priceKeySuffix;73var resellerKey = "price_reseller_" + cleanProdName + "_" + priceKeySuffix;74 75Bot.setProperty(normalKey, pNormal, "number");76Bot.setProperty(resellerKey, pReseller, "number");77 78// Database se existing products list nikalna79var productList = Bot.getProperty("stored_products") || [];80 81// Check karna ki kya yeh product pehle se list me hai?82var productIndex = -1;83for (var i = 0; i < productList.length; i++) {84  if (productList[i].name.toLowerCase() === pName.toLowerCase()) {85    productIndex = i;86    break;87  }88}89 90// ๐Ÿ•’ Human-readable duration label91var unitLabelWord = (pUnit === "hour") ? (Number(pDays) === 1 ? "Hour" : "Hours") :92                     (pUnit === "minute") ? (Number(pDays) === 1 ? "Minute" : "Minutes") :93                     (Number(pDays) === 1 ? "Day" : "Days");94var durationDisplay = pDays + " " + unitLabelWord;95 96// ๐Ÿช„ AUTOMATIC WEBSITE PLAN NAME PREDICTOR ENGINE (sirf Day-unit plans ke liye โ€” 97// external API generally sirf Day-based duration hi samajhta hai)98var lowerName = pName.toLowerCase();99var autoWebsiteName = durationDisplay; // Default fallback โ€” Hour/Minute plans literal label use karte hain100 101if (pUnit === "day") {102  autoWebsiteName = pDays + " Days"; // Default Fallback103  if (lowerName.indexOf("pato") > -1) {104    autoWebsiteName = pDays + " DaYs All Colours Mix";105  } else if (lowerName.indexOf("prime") > -1 || lowerName.indexOf("hook") > -1) {106    autoWebsiteName = (pDays === "7") ? "7 Days NonRoot" : pDays + " Days Nonroot";107  } else if (lowerName.indexOf("nonroot") > -1 || lowerName.indexOf("non root") > -1) {108    autoWebsiteName = pDays + " DaYs NONROOT";109  } else if (lowerName.indexOf("all android") > -1 || lowerName.indexOf("mix") > -1) {110    autoWebsiteName = pDays + " DaYs All Colours Mix";111  }112}113 114// Setup complete plan object with dynamic fallback name + unit info115var newPlan = {116  days: pDays,                 // ab ye numeric "value" hai (backward-compat naam)117  unit: pUnit,                 // "day" | "hour" | "minute"  โœ… NEW118  durationDisplay: durationDisplay, // โœ… NEW โ€” human readable, jaise "1 Hour", "30 Minutes", "7 Days"119  normal_price: pNormal,120  reseller_price: pReseller,121  name_on_website: autoWebsiteName122};123 124if (productIndex !== -1) {125  if (!productList[productIndex].plans) { productList[productIndex].plans = []; }126  127  var planUpdated = false;128  for (var p = 0; p < productList[productIndex].plans.length; p++) {129    var existingUnit = productList[productIndex].plans[p].unit || "day";130    if (String(productList[productIndex].plans[p].days) === pDays && existingUnit === pUnit) {131      productList[productIndex].plans[p] = newPlan;132      planUpdated = true;133      break;134    }135  }136  137  if (!planUpdated) {138    productList[productIndex].plans.push(newPlan);139  }140  Bot.sendMessage("โœ… Product <b>" + pName + "</b> me <code>" + durationDisplay + "</code> ka plan โ‚น" + pNormal + " (Reseller: โ‚น" + pReseller + ") par set ho gaya!\nโ„น๏ธ <i>API Target Format: " + autoWebsiteName + "</i>", { parse_mode: "HTML" });141} else {142  var defaultEmoji = "5226656353744862682"; 143  productList.push({144    name: pName,145    emoji: defaultEmoji,146    plans: [newPlan]147  });148  Bot.sendMessage("โœ… Naya Product <b>" + pName + "</b> successfully register ho gaya!\nโ„น๏ธ <i>API Target Format: " + autoWebsiteName + "</i>", { parse_mode: "HTML" });149}150 151// Database array update execution152Bot.setProperty("stored_products", productList, "json");