devbro468/Dev_x_store_botPublic · Bot Template

AIThis bot operates a digital storefront (DEV X STORE) selling subscription-based products — likely game hacks, accounts, or access keys — categorized by platform (Android Root, Non-Root, iPhone). It features a reseller program with discounted pricing, a dual-currency wallet (INR balance + Telegram Stars/XTR), and a full admin/co-admin panel for managing products, plans, per-plan pricing, stock (keys/accounts), coupons, and API endpoints. Purchases flow through a plan selection screen offering wallet payment, Stars invoices (sendInvoice with XTR currency), and coupon application. Successful Stars payments are handled via successful_payment webhook, crediting wallet or delivering keys directly. Admin tools include user listing with chunked messaging, stock viewing/deletion with inline keyboards, co-admin management, and API registry updates. The bot registers users on first interaction and

Commercecommercedigital-goodsstars-paymentreseller-systemadmin-panelstock-management
ProfileTelegram
119 commands0 envUpdated 15d agoCreated Aug 23, 2026
Back to folder

commands/_admin.js

javascript · 169 lines

Raw
1/**#command2name: /admin3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12try {13  // ✅ FIXED (v3): dynamic owner_id (same fix as /addbal) so this stays correct14  // even after ownership transfer, instead of a frozen hardcoded ID.15  var adminId = Bot.getProperty("owner_id") || "8875810358";16 17  var currentChatId = (typeof chat !== 'undefined' && chat && chat.chatid) ? String(chat.chatid) : null;18  var isCoAdmin = currentChatId && Bot.getProperty("co_admin_" + currentChatId);19  if (currentChatId !== adminId && !isCoAdmin) {20    Bot.sendMessage("❌ Restricted command! Only accessible by Owner.");21    return;22  }23 24  // Live Database Metrics Extraction25  var userList = Bot.getProperty("all_users_list") || [];26  var totalUsers = userList.length;27  var currentResellerPrice = Bot.getProperty("reseller_upgrade_price") || "Not Set";28 29  // 📝 PREMIUM ADMINISTRATIVE MASTER INTERFACE30  var adminPanelText = 31    "<blockquote><b><tg-emoji emoji-id='6064138396228392033'>👑</tg-emoji> MASTER ADMINISTRATIVE PANEL</b>\n\n" +32    "<i>Welcome back Boss! Securely manage your store microservices, logs, databases, plans, and inventory control nodes below.</i></blockquote>\n" +33    "━━━━━━━━━━━━━━━━━━━━━━━━━━\n" +34    "<blockquote><b><tg-emoji emoji-id='6039605143601680423'>📊</tg-emoji> BOT INFRASTRUCTURE SUMMARY</b>\n\n" +35    "• <b>Total Registered Users:</b> <code>" + totalUsers + " Users</code>\n" +36    "• <b>Reseller Upgrade Price:</b> <code>₹" + currentResellerPrice + "</code></blockquote>\n" +37    "━━━━━━━━━━━━━━━━━━━━━━━━━━\n" +38    "<tg-emoji emoji-id='5346024644635804737'>🔰</tg-emoji> <b>Select an operational control terminal module:</b>";39 40  // 🎨 ADVANCED SYSTEM CUSTOM-EMOJI INFRASTRUCTURE41  var adminKeyboard = [42    // Row 1: Product Structure (Success vs Danger Vector)43    [44      { text: "Add Product", callback_data: "/addproduct", style: "success", icon_custom_emoji_id: "5348392971207194994" },45      { text: "Change Product Emoji", callback_data: "/setproductemoji", style: "primary", icon_custom_emoji_id: "5348392971207194994" },46      { text: "Remove Product", callback_data: "/removeproduct", style: "danger", icon_custom_emoji_id: "6143299028655280273" }47    ],48    // Row 2: Plan / Validity Variants49    [50      { text: "Add Plan", callback_data: "/addplan", style: "primary", icon_custom_emoji_id: "6194922667242429131" },51      { text: "Remove Plan", callback_data: "/removeplan", style: "danger", icon_custom_emoji_id: "6143299028655280273" }52    ],53    // Row 3: License Key Inventory System54    [55      { text: "Add Key", callback_data: "/addkey", style: "success", icon_custom_emoji_id: "6195196054795721892" },56      { text: "Remove Key", callback_data: "/removekey", style: "danger", icon_custom_emoji_id: "6143299028655280273" }57    ],58    // Row 4: FF ID Category Configurations59    [60      { text: "Add Cat for ID", callback_data: "/addcat_id", style: "success", icon_custom_emoji_id: "5334890573281114250" },61      { text: "Rem Cat for ID", callback_data: "/remcat_id", style: "danger", icon_custom_emoji_id: "6143299028655280273" }62    ],63    // Row 5: FF ID Stock Controls64    [65      { text: "Add Stock ID", callback_data: "/addstock_id", style: "success", icon_custom_emoji_id: "6195196054795721892" },66      { text: "Remove Stock ID", callback_data: "/remstock_id", style: "danger", icon_custom_emoji_id: "6143299028655280273" }67    ],68    // Row 5b: Stock Monitoring & Clear Control (UPDATED)69    [70      { text: "Check ID Stock", callback_data: "/allstocks", style: "primary", icon_custom_emoji_id: "6039605143601680423" },71      { text: "Clear All ID Stock", callback_data: "/clearstock", style: "danger", icon_custom_emoji_id: "6143299028655280273" }72    ],73    // Row 6: ID Pricing Controls74    [75      { text: "Set Normal Price ID", callback_data: "/normalprice_id", style: "primary", icon_custom_emoji_id: "5778145208411624388" },76      { text: "Set Reseller Price ID", callback_data: "/resellerprice_id", style: "success", icon_custom_emoji_id: "6267068789146260253" }77    ],78    // Row 7: Pricing Matrix Configurations (Global Keys)79    [80      { text: "Set All Products Normal Price", callback_data: "/normalprice", style: "primary", icon_custom_emoji_id: "5778145208411624388" },81      { text: "Set All Products Reseller Price", callback_data: "/setresellerprice", style: "success", icon_custom_emoji_id: "6267068789146260253" }82    ],83    // Row 8: Financial Wallet Controls84    [85      { text: "Add Bal", callback_data: "/addbal", style: "success", icon_custom_emoji_id: "5778145208411624388" },86      { text: "Remove Bal", callback_data: "/rembal", style: "danger", icon_custom_emoji_id: "6143299028655280273" },87      { text: "Check Bal", callback_data: "/checkbal", style: "primary", icon_custom_emoji_id: "6039605143601680423" }88    ],89    // Row 8b: Bulk Wallet Control90    [91      { text: "Add Bal To All Users", callback_data: "/addbal_all", style: "success", icon_custom_emoji_id: "5778145208411624388" }92    ],93    // Row 9: Reseller Authorization Cluster94    [95      { text: "Add Reseller", callback_data: "/addreseller", style: "success", icon_custom_emoji_id: "6195245116207143870" },96      { text: "Remove Reseller", callback_data: "/removereseller", style: "danger", icon_custom_emoji_id: "6143299028655280273" },97      { text: "View Role", callback_data: "/role", style: "primary", icon_custom_emoji_id: "6064138396228392033" }98    ],99    // Row 10: Global Parameters & Auditing Tools100    [101      { text: " Set Reseller Upgrade Fee", callback_data: "/setprice", style: "primary", icon_custom_emoji_id: "5463172695132745432" },102      { text: "All Keys", callback_data: "/allkey", style: "success", icon_custom_emoji_id: "6010210211334200822" },103      { text: "Total Users", callback_data: "/check_users", style: "primary", icon_custom_emoji_id: "6039605143601680423" }104    ],105    // Row 11: Core System Communications Hub106    [107      { text: "Broadcast System Terminal", callback_data: "/broadcast", style: "primary", icon_custom_emoji_id: "6041705726206808304" }108    ],109    // Row 12: 🎟 Coupon System (NEW)110    [111      { text: "Generate Coupon", callback_data: "/gencoupon", style: "success", icon_custom_emoji_id: "6093677128295914531" },112      { text: "View Coupons", callback_data: "/coupons", style: "primary", icon_custom_emoji_id: "6102818532393750087" }113    ],114    // Row 13: 👑 Ownership / Co-Admin Controls (NEW — Owner only, not Co-Admins)115    [116      { text: "Manage Co-Admins", callback_data: "/manage_coadmin", style: "primary", icon_custom_emoji_id: "6102856637343600044" },117      { text: "Transfer Ownership", callback_data: "/transfer_ownership", style: "danger", icon_custom_emoji_id: "6215386799133433653" }118    ],119    // Row 14: 🛠 Maintenance Mode120    [121      { text: "Maintenance Mode", callback_data: "/toggle_maintenance", style: "danger", icon_custom_emoji_id: "6100657257605763582" }122    ],123    // Row 15: 💎 Reseller System (NEW)124    [125      { text: "Toggle Reseller System", callback_data: "/toggle_reseller_system", style: "success", icon_custom_emoji_id: "6102856637343600044" },126      { text: "Set Reseller Price", callback_data: "/set_reseller_price", style: "primary", icon_custom_emoji_id: "6312263493051489212" }127    ],128    // Row 16: 👑 Direct Reseller (NEW) — admin types a User ID, no payment needed129    [130      { text: "Direct Reseller (by User ID)", callback_data: "/addreseller_info", style: "success", icon_custom_emoji_id: "6215386799133433653" }131    ],132    // Row 17: 💸 Auto-Discount System (NEW)133    [134      { text: "Set Product/Plan Discount", callback_data: "/set_discount", style: "primary", icon_custom_emoji_id: "6093677128295914531" }135    ],136    // Row 19: 💳 Payment API / UPI Control (NEW)137    [138      { text: "Set Payment (UPI + Fam Pay API)", callback_data: "/set_payment_upi_btn", style: "primary", icon_custom_emoji_id: "6312263493051489212" }139    ],140    // Row 22: 📹 How To Use Link Control (NEW)141    [142      { text: "Set How-To-Use Link", callback_data: "/set_how_link_btn", style: "primary", icon_custom_emoji_id: "5258077307985207053" }143    ],144    // Row 23: ✅ Payment Proof Link Control (NEW)145    [146      { text: "Set Payment Proof Link", callback_data: "/set_proof_link_btn", style: "primary", icon_custom_emoji_id: "5330237710655306682" }147    ],148    // Row 24: 📞 Support Admin Username Link Control (NEW)149    [150      { text: "Set Support Link", callback_data: "/set_support_link_btn", style: "danger", icon_custom_emoji_id: "6267129592998270736" }151    ]152  ];153 154  // 🤖 DISPATCH PIPELINE EXECUTION155  // ✅ FIXED: pehle ye hamesha hardcoded adminId ko panel bhejta tha — agar156  // koi co-admin /admin kholta, to panel unko na milkar owner ke chat me157  // chala jaata tha. Ab panel usi chat me jaata hai jisne /admin request kiya.158  Api.sendMessage({159    chat_id: currentChatId,160    text: adminPanelText,161    parse_mode: "HTML",162    reply_markup: JSON.stringify({163      inline_keyboard: adminKeyboard164    })165  });166 167} catch (err) {168  Bot.sendMessage("Admin Panel Premium Cluster Error: " + err.message);169}