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/_deletekey_now.js
javascript · 96 lines
1/**#command2name: /deletekey_now3answer: 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) return;15 16 var callbackId = request ? request.id : null;17 18 // Data nikalna callback params se19 var dataStr = params ? params.trim() : "";20 if (!dataStr) return;21 22 var parts = dataStr.split("|");23 var keyIndex = Number(parts[0]);24 var prodName = parts[1];25 var cleanPlanDays = parts[2];26 27 var stockKeyText = "stock_" + prodName + "_" + cleanPlanDays;28 var keyStock = Bot.getProperty(stockKeyText) || [];29 30 if (keyStock.length === 0 || keyIndex >= keyStock.length) {31 if (callbackId) {32 Api.answerCallbackQuery({ callback_query_id: callbackId, text: "❌ Key already deleted or missing!", show_alert: true });33 }34 return;35 }36 37 // Key ko array se delete karna38 var removedKeyText = keyStock[keyIndex];39 keyStock.splice(keyIndex, 1);40 41 // Updated text stock ko save karna42 Bot.setProperty(stockKeyText, keyStock, "json");43 44 // 🔄 INDEX BACKUP PIPELINE SYNC (For /buyitem sync)45 var productList = Bot.getProperty("stored_products") || [];46 var prodIdx = -1;47 var planIdx = -1;48 var pDaysNumOnly = cleanPlanDays.replace("_Day", "").trim();49 50 for (var i = 0; i < productList.length; i++) {51 if (productList[i].name.trim().toLowerCase() === prodName.toLowerCase()) {52 prodIdx = i;53 break;54 }55 }56 if (prodIdx !== -1) {57 var plans = productList[prodIdx].plans || [];58 for (var j = 0; j < plans.length; j++) {59 if (String(plans[j].days).trim() === pDaysNumOnly) {60 planIdx = j;61 break;62 }63 }64 }65 if (prodIdx !== -1 && planIdx !== -1) {66 var stockKeyIndex = "stock_" + prodIdx + "_" + planIdx;67 Bot.setProperty(stockKeyIndex, keyStock, "json");68 }69 70 // Final Response & UI update71 var successText = "<blockquote><b>🗑️ KEY SUCCESSFULLY REMOVED</b>\n\n" +72 "• <b>Product:</b> <code>" + prodName + "</code>\n" +73 "• <b>Plan:</b> <code>" + cleanPlanDays + "</code>\n" +74 "• <b>Removed Key:</b> <code>" + removedKeyText + "</code>\n" +75 "• <b>Remaining Stock:</b> <code>" + keyStock.length + " Keys</code></blockquote>";76 77 // Message text edit karke confirm karna78 if (request && request.message) {79 HTTP.post({80 url: "https://api.telegram.org/bot" + bot.token + "/editMessageText",81 body: {82 chat_id: String(chat.chatid),83 message_id: Number(request.message.message_id),84 text: successText,85 parse_mode: "HTML"86 }87 });88 }89 90 if (callbackId) {91 Api.answerCallbackQuery({ callback_query_id: callbackId, text: "✅ Key Removed!" });92 }93 94} catch (err) {95 Bot.sendMessage("Error: " + err.message);96}