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.
commands/_addproduct.js
javascript ยท 96 lines
1/**#command2name: /addproduct3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12var adminId = String(Bot.getProperty("owner_id") || "8660373585");13var currentChatId = String(chat.chatid);14var isCoAdmin0 = !!Bot.getProperty("co_admin_" + currentChatId);15 16if (currentChatId === adminId || isCoAdmin0) {17 // Admin button se command bina params ke aaye to interactive flow start karo.18 // Isse /admin -> Add Product button ab reliably kaam karega.19 if (!params || params.trim() === "") {20 User.setProperty("add_product_step", "waiting_for_name", "string");21 User.setProperty("temp_product_name", null, "string");22 User.setProperty("temp_product_emoji", null, "string");23 Bot.sendMessage(24 "๐ฆ <b>ADD PRODUCT</b>\n\n" +25 "Product ka <b>Name</b> bhejiye:\n" +26 "<i>Example: Drip Proxy</i>\n\n" +27 "Ya direct format use kar sakte hain:\n" +28 "<code>/addproduct Name | EmojiID | PID</code>",29 { parse_mode: "HTML" }30 );31 return;32 }33 34 var parts = params.split("|");35 if (parts.length < 3) {36 Bot.sendMessage("โ ๏ธ Sabhi details (Name, Emoji ID, PID) '|' lagakar bhejein!", { parse_mode: "HTML" });37 return;38 }39 40 var prodName = parts[0].trim();41 var prodEmoji = parts[1].trim() || "5226656353744862682";42 var prodId = parts[2].trim();43 44 // Safe database fetch45 var productList = Bot.getProperty("stored_products");46 if (!Array.isArray(productList)) {47 productList = [];48 }49 50 // โ
BUG FIX: pehle har /addproduct call ek NAYA duplicate entry bana deta tha,51 // chahe wahi product naam se pehle se maujood ho โ isse shop me same product52 // do baar dikhta tha aur plans purani wali entry se hi attached rehte the.53 // Ab existing product (case-insensitive match) ho to usi ko UPDATE karta hai,54 // uske plans (agar honge) safe rehte hain.55 var existingIdx = -1;56 for (var pi = 0; pi < productList.length; pi++) {57 if (productList[pi].name && productList[pi].name.trim().toLowerCase() === prodName.toLowerCase()) {58 existingIdx = pi;59 break;60 }61 }62 63 var isUpdate = existingIdx > -1;64 65 if (isUpdate) {66 productList[existingIdx].name = prodName;67 productList[existingIdx].emoji = prodEmoji;68 productList[existingIdx].id = prodId;69 if (!Array.isArray(productList[existingIdx].plans)) { productList[existingIdx].plans = []; }70 } else {71 productList.push({72 name: prodName,73 emoji: prodEmoji,74 id: prodId,75 plans: []76 });77 }78 79 // Save karo80 Bot.setProperty("stored_products", productList, "json");81 82 Bot.sendMessage(83 "<blockquote>โ
<b>Product " + (isUpdate ? "Updated" : "Successfully Added") + "!</b></blockquote>\n\n" +84 "๐ฆ <b>Name:</b> " + prodName + "\n" +85 "๐ <b>Emoji:</b> <code>" + prodEmoji + "</code>\n" +86 "๐ <b>PID:</b> <code>" + prodId + "</code>\n\n" +87 "<i>" + (isUpdate ? "Existing plans safe rakhe gaye hain." : "Ab yeh product store me sabhi ko dikhega! Use /addplan to add pricing plans.") + "</i>",88 {89 parse_mode: "HTML",90 reply_markup: JSON.stringify({ inline_keyboard: [[{ text: "๐ Open Shop", callback_data: "/buy_hack", style: "success", icon_custom_emoji_id: "5866053971960929280" }]] })91 }92 );93 94} else {95 Bot.sendMessage("โ You are not the admin!");96}