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/_admin.js
javascript ยท 175 lines
1/**#command2name: /admin3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12try {13 var adminId = "8660373585"; // Aapki Admin ID14 15 var currentChatId = (typeof chat !== 'undefined' && chat && chat.chatid) ? String(chat.chatid) : null;16 var isCoAdmin = currentChatId && Bot.getProperty("co_admin_" + currentChatId);17 if (currentChatId !== adminId && !isCoAdmin) {18 Bot.sendMessage("โ Restricted command! Only accessible by Owner.");19 return;20 }21 22 // Live Database Metrics Extraction23 var userList = Bot.getProperty("all_users_list") || [];24 var totalUsers = userList.length;25 var currentResellerPrice = Bot.getProperty("reseller_upgrade_price") || "Not Set";26 27 // ๐ PREMIUM ADMINISTRATIVE MASTER INTERFACE28 var adminPanelText = 29 "<blockquote><b><tg-emoji emoji-id='6064138396228392033'>๐</tg-emoji> MASTER ADMINISTRATIVE PANEL</b>\n\n" +30 "<i>Welcome back Boss! Securely manage your store microservices, logs, databases, plans, and inventory control nodes below.</i></blockquote>\n" +31 "โโโโโโโโโโโโโโโโโโโโโโโโโโ\n" +32 "<blockquote><b><tg-emoji emoji-id='6039605143601680423'>๐</tg-emoji> BOT INFRASTRUCTURE SUMMARY</b>\n\n" +33 "โข <b>Total Registered Users:</b> <code>" + totalUsers + " Users</code>\n" +34 "โข <b>Reseller Upgrade Price:</b> <code>โน" + currentResellerPrice + "</code></blockquote>\n" +35 "โโโโโโโโโโโโโโโโโโโโโโโโโโ\n" +36 "<tg-emoji emoji-id='5346024644635804737'>๐ฐ</tg-emoji> <b>Select an operational control terminal module:</b>";37 38 // ๐จ ADVANCED SYSTEM CUSTOM-EMOJI INFRASTRUCTURE39 var adminKeyboard = [40 // Row 1: Product Structure (Success vs Danger Vector)41 [42 { text: "Add Product", callback_data: "/addproduct", style: "success", icon_custom_emoji_id: "5348392971207194994" },43 { text: "Remove Product", callback_data: "/removeproduct", style: "danger", icon_custom_emoji_id: "6143299028655280273" }44 ],45 // Row 2: Plan / Validity Variants46 [47 { text: "Add Plan", callback_data: "/addplan", style: "primary", icon_custom_emoji_id: "6194922667242429131" },48 { text: "Remove Plan", callback_data: "/removeplan", style: "danger", icon_custom_emoji_id: "6143299028655280273" }49 ],50 // Row 3: License Key Inventory System51 [52 { text: "Add Key", callback_data: "/addkey", style: "success", icon_custom_emoji_id: "6195196054795721892" },53 { text: "Remove Key", callback_data: "/removekey", style: "danger", icon_custom_emoji_id: "6143299028655280273" }54 ],55 // Row 4: FF ID Category Configurations56 [57 { text: "Add Cat for ID", callback_data: "/addcat_id", style: "success", icon_custom_emoji_id: "5334890573281114250" },58 { text: "Rem Cat for ID", callback_data: "/remcat_id", style: "danger", icon_custom_emoji_id: "6143299028655280273" }59 ],60 // Row 5: FF ID Stock Controls61 [62 { text: "Add Stock ID", callback_data: "/addstock_id", style: "success", icon_custom_emoji_id: "6195196054795721892" },63 { text: "Remove Stock ID", callback_data: "/remstock_id", style: "danger", icon_custom_emoji_id: "6143299028655280273" }64 ],65 // Row 5b: Stock Monitoring & Clear Control (UPDATED)66 [67 { text: "Check ID Stock", callback_data: "/allstocks", style: "primary", icon_custom_emoji_id: "6039605143601680423" },68 { text: "Clear All ID Stock", callback_data: "/clearstock", style: "danger", icon_custom_emoji_id: "6143299028655280273" }69 ],70 // Row 6: ID Pricing Controls71 [72 { text: "Set Normal Price ID", callback_data: "/normalprice_id", style: "primary", icon_custom_emoji_id: "5778145208411624388" },73 { text: "Set Reseller Price ID", callback_data: "/resellerprice_id", style: "success", icon_custom_emoji_id: "6267068789146260253" }74 ],75 // Row 7: Pricing Matrix Configurations (Global Keys)76 [77 { text: "Set All Products Normal Price", callback_data: "/normalprice", style: "primary", icon_custom_emoji_id: "5778145208411624388" },78 { text: "Set All Products Reseller Price", callback_data: "/setresellerprice", style: "success", icon_custom_emoji_id: "6267068789146260253" }79 ],80 // Row 8: Financial Wallet Controls81 [82 { text: "Add Bal", callback_data: "/addbal", style: "success", icon_custom_emoji_id: "5778145208411624388" },83 { text: "Remove Bal", callback_data: "/rembal", style: "danger", icon_custom_emoji_id: "6143299028655280273" },84 { text: "Check Bal", callback_data: "/checkbal", style: "primary", icon_custom_emoji_id: "6039605143601680423" }85 ],86 // Row 9: Reseller Authorization Cluster87 [88 { text: "Add Reseller", callback_data: "/addreseller", style: "success", icon_custom_emoji_id: "6195245116207143870" },89 { text: "Remove Reseller", callback_data: "/removereseller", style: "danger", icon_custom_emoji_id: "6143299028655280273" },90 { text: "View Role", callback_data: "/role", style: "primary", icon_custom_emoji_id: "6064138396228392033" }91 ],92 // Row 10: Global Parameters & Auditing Tools93 [94 { text: " Set Reseller Upgrade Fee", callback_data: "/setprice", style: "primary", icon_custom_emoji_id: "5463172695132745432" },95 { text: "All Keys", callback_data: "/allkey", style: "success", icon_custom_emoji_id: "6010210211334200822" },96 { text: "Total Users", callback_data: "/check_users", style: "primary", icon_custom_emoji_id: "6039605143601680423" }97 ],98 // Row 11: Core System Communications Hub99 [100 { text: "Broadcast System Terminal", callback_data: "/broadcast", style: "primary", icon_custom_emoji_id: "6041705726206808304" }101 ],102 // Row 12: ๐ Coupon System (NEW)103 [104 { text: "Generate Coupon", callback_data: "/gencoupon", style: "success", icon_custom_emoji_id: "6093677128295914531" },105 { text: "View Coupons", callback_data: "/coupons", style: "primary", icon_custom_emoji_id: "6102818532393750087" }106 ],107 // Row 13: ๐ Ownership / Co-Admin Controls (NEW โ Owner only, not Co-Admins)108 [109 { text: "Manage Co-Admins", callback_data: "/manage_coadmin", style: "primary", icon_custom_emoji_id: "6102856637343600044" },110 { text: "Transfer Ownership", callback_data: "/transfer_ownership", style: "danger", icon_custom_emoji_id: "6215386799133433653" }111 ],112 // Row 14: ๐ Maintenance Mode113 [114 { text: "Maintenance Mode", callback_data: "/toggle_maintenance", style: "danger", icon_custom_emoji_id: "6100657257605763582" }115 ],116 // Row 15: ๐ Reseller System (NEW)117 [118 { text: "Toggle Reseller System", callback_data: "/toggle_reseller_system", style: "success", icon_custom_emoji_id: "6102856637343600044" },119 { text: "Set Reseller Price", callback_data: "/set_reseller_price", style: "primary", icon_custom_emoji_id: "6312263493051489212" }120 ],121 // Row 16: ๐ Direct Reseller (NEW) โ admin types a User ID, no payment needed122 [123 { text: "Direct Reseller (by User ID)", callback_data: "/addreseller_info", style: "success", icon_custom_emoji_id: "6215386799133433653" }124 ],125 // Row 17: ๐ธ Auto-Discount System (NEW)126 [127 { text: "Set Product/Plan Discount", callback_data: "/set_discount", style: "primary", icon_custom_emoji_id: "6093677128295914531" }128 ]129 ];130 131 // ๐ค DISPATCH PIPELINE EXECUTION132 // Button click -> edit the existing admin screen (no duplicate message).133 // Direct /admin command -> send a new panel as before.134 var targetChatId = currentChatId || adminId;135 var adminMarkup = JSON.stringify({ inline_keyboard: adminKeyboard });136 137 // Stop Telegram's callback spinner immediately.138 var adminQueryId = null;139 if (request) {140 adminQueryId = request.id || (request.callback_query && request.callback_query.id);141 }142 if (adminQueryId) {143 try { Api.answerCallbackQuery({ callback_query_id: String(adminQueryId) }); } catch (e) {}144 }145 146 if (request && request.message && request.message.message_id) {147 try {148 Api.editMessageText({149 chat_id: targetChatId,150 message_id: Number(request.message.message_id),151 text: adminPanelText,152 parse_mode: "HTML",153 reply_markup: adminMarkup154 });155 } catch (editErr) {156 // Fallback only when Telegram cannot edit the current message.157 Api.sendMessage({158 chat_id: targetChatId,159 text: adminPanelText,160 parse_mode: "HTML",161 reply_markup: adminMarkup162 });163 }164 } else {165 Api.sendMessage({166 chat_id: targetChatId,167 text: adminPanelText,168 parse_mode: "HTML",169 reply_markup: adminMarkup170 });171 }172 173} catch (err) {174 Bot.sendMessage("Admin Panel Premium Cluster Error: " + err.message);175}