kkapil9112/Hguuuuuv45botPublic · Bot Template

AITelegram commerce bot for an admin-managed digital store: admins create categories, products, time-based plans, stock entries and license keys, and can grant reseller roles or adjust user balances. End users can view their balance, start a deposit flow with an inline amount keypad, apply coupon codes, and navigate back to the store menu. It uses Bot properties for product/stock/coupon data and Libs.ResourcesLib for per-user balances.

Commercecommerceshopreselleradmin-panelbalanceproduct-management
ProfileTelegram
102 commands0 envUpdated 29d agoCreated Aug 7, 2026
Back to folder

commands/_admin.js

javascript · 143 lines

Raw
1/**#command2name: /admin3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12try {13  var adminId = "8812621370"; // 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  Api.sendMessage({133    chat_id: adminId,134    text: adminPanelText,135    parse_mode: "HTML",136    reply_markup: JSON.stringify({137      inline_keyboard: adminKeyboard138    })139  });140 141} catch (err) {142  Bot.sendMessage("Admin Panel Premium Cluster Error: " + err.message);143}