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

javascript ยท 102 lines

Raw
1/**#command2name: /mykey3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12// =========================================================13// ๐Ÿ”‘ MY KEYS โ€” shows all purchased keys14// โœ… BUG FIXES:15// 1. Pehle photo message (Profile se aane par) editMessageText try karta tha16//    jo Telegram me fail hota hai โ€” isi wajah se "My Keys" click karne par17//    kuch dikhta hi nahi tha.18// 2. catch(err) block errors ko SILENTLY hide kar raha tha โ€” koi feedback19//    hi nahi milta tha jab kuch fail hota.20// 3. Raw HTTP.post use ho raha tha bina success/error handling ke โ€” ab21//    consistent Api.* wrapper functions use hote hain (poore bot jaisa).22// =========================================================23 24try {25    let userKeys = User.getProperty("my_purchased_keys");26    let chatId = chat.chatid;27 28    let text = "";29    let keyboard = { inline_keyboard: [] };30 31    if (!userKeys || userKeys.length === 0) {32        text = "<blockquote>" +33            "<tg-emoji emoji-id='6192822213486321961'>๐Ÿ—ฃ</tg-emoji> <b>No keys found!</b>\n" +34            "<tg-emoji emoji-id='5866053971960929280'>๐Ÿ’Ž</tg-emoji> You haven't purchased anything yet." +35            "</blockquote>";36 37        keyboard.inline_keyboard = [38            [39                { text: "Shop Now", callback_data: "/buy_hack", style: "success", icon_custom_emoji_id: "5866053971960929280" },40                { text: "Back", callback_data: "/back", style: "danger", icon_custom_emoji_id: "5893163582194978381" }41            ]42        ];43    } else {44        text = "<b>๐Ÿ“‹ Your Active Keys:</b>\n\n";45 46        for (let i = 0; i < userKeys.length; i++) {47            let keyData = userKeys[i];48            let pName = keyData.productName || keyData.product || "N/A";49            let pPrice = keyData.cost || keyData.price || "0";50            let pKey = keyData.key || "No Key Found";51            let pDays = keyData.days || "N/A";52            let pDate = keyData.date || "N/A";53 54            text += "<blockquote>" +55                "<tg-emoji emoji-id='6192822213486321961'>๐Ÿ—ฃ</tg-emoji> <b>Product Name:</b> " + pName + "\n" +56                "<tg-emoji emoji-id='6266967801580231067'>โณ</tg-emoji> <b>Days:</b> " + pDays + "\n" +57                "<tg-emoji emoji-id='6176966310920983412'>โžก๏ธ</tg-emoji> <b>Key:</b> <code>" + pKey + "</code>\n" +58                "<tg-emoji emoji-id='6267068789146260253'>๐Ÿ›’</tg-emoji> <b>Price:</b> โ‚น" + pPrice + "\n" +59                "<tg-emoji emoji-id='5866053971960929280'>๐Ÿ“…</tg-emoji> <b>Date:</b> " + pDate +60                "</blockquote>\n";61        }62 63        // Telegram caption/message length limits ke against safety trim (very large history)64        if (text.length > 3800) {65            text = text.substring(0, 3800) + "\n\n<i>... (list truncated โ€” download full receipt from History)</i>";66        }67 68        keyboard.inline_keyboard = [69            [70                { text: "๐Ÿงพ Download Receipt", callback_data: "/history_receipt", style: "primary", icon_custom_emoji_id: "6100170496077204999" }71            ],72            [73                { text: "Back To Menu", callback_data: "/back", style: "danger", icon_custom_emoji_id: "5893163582194978381" }74            ]75        ];76    }77 78    // โœ… FIX: photo-message ho to delete + fresh send, warna edit; Api.* wrapper use hota hai79    if (request && request.message && request.message.message_id) {80        if (request.message.photo) {81            try { Api.deleteMessage({ chat_id: chatId, message_id: request.message.message_id }); } catch (delErr) {}82            Api.sendMessage({ chat_id: chatId, text: text, parse_mode: "HTML", reply_markup: JSON.stringify(keyboard) });83        } else {84            Api.editMessageText({85                chat_id: chatId,86                message_id: request.message.message_id,87                text: text,88                parse_mode: "HTML",89                reply_markup: JSON.stringify(keyboard)90            });91        }92    } else {93        Api.sendMessage({ chat_id: chatId, text: text, parse_mode: "HTML", reply_markup: JSON.stringify(keyboard) });94    }95 96    var queryId = request ? (request.id || (request.callback_query && request.callback_query.id)) : null;97    if (queryId) { try { Api.answerCallbackQuery({ callback_query_id: String(queryId) }); } catch (e) {} }98 99} catch (err) {100    // โœ… FIX: ab error silently hide nahi hoti โ€” user ko dikhti hai101    try { Bot.sendMessage("โš ๏ธ My Keys Error: " + err.message, { parse_mode: "HTML" }); } catch (e) {}102}