ayushyadav7970824760/goldensellingstore_botPublic · Bot Template
AIThis Telegram store bot lets customers browse digital products and plans, apply coupons, add funds via UPI, and receive purchased keys. It includes a full admin panel for managing products, reordering items, setting reseller prices, viewing and removing key stock, configuring UPI payment details and update links, and checking user balances. Co-admins and resellers are supported, and support tickets are forwarded to the admin.
Commercedigital_storeadmin_panelupi_paymentsresellercouponskey_stock
146 commands0 envUpdated 2d agoCreated Sep 5, 2026
commands/_admin.js
javascript · 205 lines
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") || "8477746023";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: "Remove Product", callback_data: "/removeproduct", style: "danger", icon_custom_emoji_id: "6143299028655280273" }46 ],47 // Row 2: Plan / Validity Variants48 [49 { text: "Add Plan", callback_data: "/addplan", style: "primary", icon_custom_emoji_id: "6194922667242429131" },50 { text: "Remove Plan", callback_data: "/removeplan", style: "danger", icon_custom_emoji_id: "6143299028655280273" }51 ],52 // Row 3: License Key Inventory System53 [54 { text: "Add Key", callback_data: "/addkey", style: "success", icon_custom_emoji_id: "6195196054795721892" },55 { text: "Remove Key", callback_data: "/removekey", style: "danger", icon_custom_emoji_id: "6143299028655280273" }56 ],57 // Row 7: Pricing Matrix Configurations (Global Keys)58 [59 { text: "Set All Products Normal Price", callback_data: "/normalprice", style: "primary", icon_custom_emoji_id: "5778145208411624388" },60 { text: "Set All Products Reseller Price", callback_data: "/setresellerprice", style: "success", icon_custom_emoji_id: "6267068789146260253" }61 ],62 // Row 8: Financial Wallet Controls63 [64 { text: "Add Bal", callback_data: "/addbal", style: "success", icon_custom_emoji_id: "5778145208411624388" },65 { text: "Remove Bal", callback_data: "/rembal", style: "danger", icon_custom_emoji_id: "6143299028655280273" },66 { text: "Check Bal", callback_data: "/checkbal", style: "primary", icon_custom_emoji_id: "6039605143601680423" }67 ],68 // Row 8b: Bulk Wallet Control69 [70 { text: "Add Bal To All Users", callback_data: "/addbal_all", style: "success", icon_custom_emoji_id: "5778145208411624388" }71 ],72 // Row 9: Reseller Authorization Cluster73 [74 { text: "Add Reseller", callback_data: "/addreseller", style: "success", icon_custom_emoji_id: "6195245116207143870" },75 { text: "Remove Reseller", callback_data: "/removereseller", style: "danger", icon_custom_emoji_id: "6143299028655280273" },76 { text: "View Role", callback_data: "/role", style: "primary", icon_custom_emoji_id: "6064138396228392033" }77 ],78 // Row 10: Global Parameters & Auditing Tools79 [80 { text: " Set Reseller Upgrade Fee", callback_data: "/setprice", style: "primary", icon_custom_emoji_id: "5463172695132745432" },81 { text: "All Keys", callback_data: "/allkey", style: "success", icon_custom_emoji_id: "6010210211334200822" },82 { text: "Total Users", callback_data: "/check_users", style: "primary", icon_custom_emoji_id: "6039605143601680423" }83 ],84 // Row 11: Core System Communications Hub85 [86 { text: "Broadcast System Terminal", callback_data: "/broadcast", style: "primary", icon_custom_emoji_id: "6041705726206808304" }87 ],88 // Row 12: 🎟 Coupon System (NEW)89 [90 { text: "Generate Coupon", callback_data: "/gencoupon", style: "success", icon_custom_emoji_id: "6093677128295914531" },91 { text: "View Coupons", callback_data: "/coupons", style: "primary", icon_custom_emoji_id: "6102818532393750087" }92 ],93 // Row 13: 👑 Ownership / Co-Admin Controls (NEW — Owner only, not Co-Admins)94 [95 { text: "Manage Co-Admins", callback_data: "/manage_coadmin", style: "primary", icon_custom_emoji_id: "6102856637343600044" },96 { text: "Transfer Ownership", callback_data: "/transfer_ownership", style: "danger", icon_custom_emoji_id: "6215386799133433653" }97 ],98 // Row 14: 🛠 Maintenance Mode99 [100 { text: "Maintenance Mode", callback_data: "/toggle_maintenance", style: "danger", icon_custom_emoji_id: "6100657257605763582" }101 ],102 // Row 15: 💎 Reseller System (NEW)103 [104 { text: "Toggle Reseller System", callback_data: "/toggle_reseller_system", style: "success", icon_custom_emoji_id: "6102856637343600044" },105 { text: "Set Reseller Price", callback_data: "/set_reseller_price", style: "primary", icon_custom_emoji_id: "6312263493051489212" }106 ],107 // Row 16: 👑 Direct Reseller (NEW) — admin types a User ID, no payment needed108 [109 { text: "Direct Reseller (by User ID)", callback_data: "/addreseller_info", style: "success", icon_custom_emoji_id: "6215386799133433653" }110 ],111 // Row 17: 💸 Auto-Discount System (NEW)112 [113 { text: "Set Product/Plan Discount", callback_data: "/set_discount", style: "primary", icon_custom_emoji_id: "6093677128295914531" }114 ],115 // Row 18: 🔗 Download Files Link (NEW)116 [117 { text: "Set Download Link", callback_data: "/set_download_link_btn", style: "primary", icon_custom_emoji_id: "6091571559233755994" }118 ],119 // Row 18b: 🔄 Sync Products from API (NEW)120 [121 { text: "Sync Products from API", callback_data: "/sync_api_products", style: "primary", icon_custom_emoji_id: "6100657257605763582" }122 ],123 // Row 19: 💳 Payment API / UPI Control (NEW)124 [125 { text: "Set Payment (UPI + Fam Pay API)", callback_data: "/set_payment_upi_btn", style: "primary", icon_custom_emoji_id: "6312263493051489212" }126 ],127 // Row 19b: 🟡 Binance Pay Control (NEW)128 [129 { text: "Set Payment (Binance Pay)", callback_data: "/set_payment_binance_btn", style: "primary", icon_custom_emoji_id: "6312263493051489212" }130 ],131 // Row 20: 🎁 Daily Gift Price Control (NEW)132 [133 { text: "Set Daily Gift Price", callback_data: "/set_dailygift_price_btn", style: "success", icon_custom_emoji_id: "6194922667242429131" }134 ],135 // Row 21: 🎁 Refer & Earn Amount Control (NEW)136 [137 { text: "Set Refer & Earn Amount", callback_data: "/set_refer_earn_btn", style: "success", icon_custom_emoji_id: "5823654080584618403" }138 ],139 // Row 22: 📹 How To Use Link Control (NEW)140 [141 { text: "Set How-To-Use Link", callback_data: "/set_how_link_btn", style: "primary", icon_custom_emoji_id: "5258077307985207053" }142 ],143 // Row 23: ✅ Payment Proof Link Control (NEW)144 [145 { text: "Set Payment Proof Link", callback_data: "/set_proof_link_btn", style: "primary", icon_custom_emoji_id: "5330237710655306682" }146 ],147 // Row 24: 📞 Support Admin Username Link Control (NEW)148 [149 { text: "Set Support Link", callback_data: "/set_support_link_btn", style: "danger", icon_custom_emoji_id: "6267129592998270736" }150 ],151 // Row 25: 📢 Sale Announcement Channel Control (NEW)152 [153 { text: "Set Sale Channel", callback_data: "/set_sale_channel_btn", style: "primary", icon_custom_emoji_id: "6102856637343600044" }154 ],155 // Row 26: 🎨 Menu Button Emoji Customization (NEW)156 [157 { text: "Set Menu Button Emoji", callback_data: "/set_menu_emoji", style: "success", icon_custom_emoji_id: "5348191451341668809" }158 ],159 // Row 27: 📝 Welcome Message Editor (NEW)160 [161 { text: "Edit Welcome Message", callback_data: "/set_welcome_message_btn", style: "primary", icon_custom_emoji_id: "6082603117763894396" }162 ],163 // Row 28: 🔀 UPI Payment Mode Toggle (Auto Fampay / Manual Approve) (NEW)164 [165 { text: "Toggle UPI Payment Mode", callback_data: "/toggle_upi_mode", style: "danger", icon_custom_emoji_id: "5348292765325212780" }166 ],167 // Row 29: 🔧 Product Stock Toggle (In Stock / Under Maintenance) (NEW)168 [169 { text: "Toggle Product Stock", callback_data: "/toggle_stock", style: "danger", icon_custom_emoji_id: "6100657257605763582" }170 ],171 // Row 30: 📥 Export Users List (NEW)172 [173 { text: "Export Users List", callback_data: "/export_users", style: "primary", icon_custom_emoji_id: "5208790878931415568" }174 ],175 // Row 31: 🔥 Backup to Firebase (NEW)176 [177 { text: "Backup to Firebase", callback_data: "/backup_firebase", style: "success", icon_custom_emoji_id: "6100170496077204999" }178 ],179 // Row 32: 🔀 Reorder Products / ✏️ Rename Product (NEW)180 [181 { text: "Reorder Products", callback_data: "/reorder_products", style: "primary", icon_custom_emoji_id: "6100657257605763582" },182 { text: "Rename Product", callback_data: "/rename_product", style: "primary", icon_custom_emoji_id: "6093677128295914531" }183 ],184 // Row 33: 🖼️ Set Bot Logo for QR (NEW)185 [186 { text: "Set Bot Logo (for QR)", callback_data: "/set_bot_logo_btn", style: "success", icon_custom_emoji_id: "5866053971960929280" }187 ]188 ];189 190 // 🤖 DISPATCH PIPELINE EXECUTION191 // ✅ FIXED: pehle ye hamesha hardcoded adminId ko panel bhejta tha — agar192 // koi co-admin /admin kholta, to panel unko na milkar owner ke chat me193 // chala jaata tha. Ab panel usi chat me jaata hai jisne /admin request kiya.194 Api.sendMessage({195 chat_id: currentChatId,196 text: adminPanelText,197 parse_mode: "HTML",198 reply_markup: JSON.stringify({199 inline_keyboard: adminKeyboard200 })201 });202 203} catch (err) {204 Bot.sendMessage("Admin Panel Premium Cluster Error: " + err.message);205}