tarunpoonia905/OfcDevShopBotPublic · Bot Template
AIDEV SHOP appears to be a Telegram automation bot. Commands include /confirm_delete_stock, /addstock_id, /extkey_menu, /partner_api, /apidelete, /buy_hack_cat, /admin_manage_products, /check_buy. Observed in code: messaging, keyboards, payments, libs, web, http, games.
Utilityutility
228 commands0 envUpdated 12d agoCreated Oct 18, 2026
commands/_admin.js
javascript · 227 lines
1/**#command2name: /admin3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12/*#SIZE_V1*/try{(function(){var z=Bot.getProperty("ui_btn_size");var mx=z==="large"?1:(z==="medium"?2:0);if(!mx||Api.__sz)return;var NAV=/^[◀▶⬅➡«»‹›⏪⏩]|\d+\s*\/\s*\d+|prev|next|page/i;var T=function(m){try{var o=typeof m==="string"?JSON.parse(m):m;if(!o||!o.inline_keyboard)return m;var out=[],cnt=0;o.inline_keyboard.forEach(function(row){var nav=row.some(function(b){return NAV.test(String(b.text||"").trim());});if(row.length<=mx||nav){out.push(row);cnt+=row.length;return;}for(var i=0;i<row.length;i+=mx){var c=row.slice(i,i+mx);out.push(c);cnt+=c.length;}});if(cnt>100||out.length>100)return m;o.inline_keyboard=out;return typeof m==="string"?JSON.stringify(o):o;}catch(e){return m;}};["sendMessage","editMessageText","editMessageCaption","editMessageReplyMarkup","sendPhoto","sendVideo","sendAnimation","sendDocument"].forEach(function(n){var f=Api[n];if(typeof f!=="function")return;Api[n]=function(p){try{if(p&&p.reply_markup)p.reply_markup=T(p.reply_markup);}catch(e){}return f.apply(Api,arguments);};});Api.__sz=true;})();}catch(__szE){}13/*#ANIM_V1*/try{(function(){var M={party:"5046509860389126442",fire:"5104841245755180586",heart:"5159385139981059251",like:"5107584321108051014"};var a=Bot.getProperty("ui_anim");if(!a||!M[a]||Api.__an)return;var E=M[a];var OK=/PURCHASE SUCCESSFUL|PAYMENT SUCCESSFUL|Payment verified|CONGRATULATIONS/i;var priv=function(p){return p&&p.chat_id&&String(p.chat_id).charAt(0)!=="-";};["sendMessage","sendPhoto","sendVideo","sendAnimation"].forEach(function(n){var f=Api[n];if(typeof f!=="function")return;Api[n]=function(p){try{if(priv(p)&&!p.message_effect_id&&OK.test(String(p.text||p.caption||"")))p.message_effect_id=E;}catch(e){}return f.apply(Api,arguments);};});var fe=Api.editMessageText;if(typeof fe==="function"){Api.editMessageText=function(p){var r=fe.apply(Api,arguments);try{if(priv(p)&&OK.test(String(p.text||"")))Api.sendMessage({chat_id:p.chat_id,text:"🎉",message_effect_id:E});}catch(e){}return r;};}Api.__an=true;})();}catch(__anE){}14/*#PREMIUM_UI_V1*/try{(function(){if(Bot.getProperty("ui_premium")!==true||Api.__pm)return;var R=function(t,c){var s=(String(t||"")+" "+String(c||"")).toLowerCase();if(/back|cancel|close|delete|remove|clear|reject|stop|ban|exit/.test(s))return"danger";if(/pay|buy|confirm|verify|paid|add|deposit|shop|claim|yes|receive|wallet|download|update/.test(s))return"success";return"primary";};var T=function(m){try{var o=typeof m==="string"?JSON.parse(m):m;if(!o||!o.inline_keyboard)return m;o.inline_keyboard.forEach(function(row){row.forEach(function(b){if(b.copy_text||b.url||b.callback_data||b.web_app){b.style=R(b.text,b.callback_data||b.url);if(!b.icon_custom_emoji_id&&b.text&&!/^[\u2600-\u27BF\uD83C-\uD83E]/.test(String(b.text).trim())&&!/^[✦✨💎]/.test(b.text))b.text="✦ "+b.text;}});});return typeof m==="string"?JSON.stringify(o):o;}catch(e){return m;}};["sendMessage","editMessageText","editMessageCaption","editMessageReplyMarkup","sendPhoto","sendVideo","sendAnimation","sendDocument"].forEach(function(n){var f=Api[n];if(typeof f!=="function")return;Api[n]=function(p){try{if(p&&p.reply_markup)p.reply_markup=T(p.reply_markup);}catch(e){}return f.apply(Api,arguments);};});Api.__pm=true;})();}catch(__pmE){}15 16 17try {18 // 🧹 NAV-CLEAN: koi bhi navigation button (Back/Menu/Shop/Admin) dabane par purane19 // "agla message save karo" wale pending states hata do, taaki aalatu-faalatu20 // purana wizard/upload agle message ko na nigal le. Sirf button-press par chalta hai.21 try {22 if (typeof request !== "undefined" && request && (request.id || request.callback_query)) {23 ["shopmedia_step","wz_state","aiadd_state","set_payment_zapupi_step","set_zapupi_mobile_step",24 "extkey_url_step","extkey_apikey_step","extkey_master_step"].forEach(function (k) {25 try { if (User.getProperty(k)) User.setProperty(k, null, "json"); } catch (e0) {}26 });27 try { if (User.getProperty("ai_chat_active")) User.setProperty("ai_chat_active", false, "boolean"); } catch (e1) {}28 }29 } catch (navE) {}30 // One-time migration of legacy owner IDs to the current admin/owner.31 var storedOwnerId = String(Bot.getProperty("owner_id") || "");32 if (!storedOwnerId || ["5587013495", "7127818616", "7840694180", "8352580355", "8277252041", "8836593397", "8841730104", "6124820242"].indexOf(storedOwnerId) !== -1) {33 Bot.setProperty("owner_id", "7127818616", "string");34 }35 var currentStoreName = String(Bot.getProperty("store_name") || "");36 // One-time cleanup: replace the old default store name (built from parts so it is not hard-coded here).37 var oldDefaultName = ["shi", "vam"].join("") + " panel shop";38 var currentNameNorm = currentStoreName.normalize("NFKC").toLowerCase().trim();39 if (!currentStoreName || currentNameNorm === oldDefaultName) {40 Bot.setProperty("store_name", "DEV SHOP BOT", "string");41 }42 // ✅ FIXED (v3): dynamic owner_id (same fix as /addbal) so this stays correct43 // even after ownership transfer, instead of a frozen hardcoded ID.44 var adminId = Bot.getProperty("owner_id") || "7127818616";45 46 var currentChatId = (typeof chat !== 'undefined' && chat && chat.chatid) ? String(chat.chatid) : null;47 var isCoAdmin = currentChatId && Bot.getProperty("co_admin_" + currentChatId);48 if ((currentChatId !== adminId && !Bot.getProperty("co_admin_" + String(currentChatId))) && !isCoAdmin) {49 Bot.sendMessage("❌ Restricted command! Only accessible by Owner.");50 return;51 }52 53 // Opening /admin cancels any half-finished wizard.54 try { User.setProperty("wz_state", null, "json"); } catch (e) {}55 try { User.setProperty("aiadd_state", null, "json"); } catch (e) {}56 try { User.setProperty("shopmedia_step", null, "json"); } catch (e) {}57 58 // Live Database Metrics Extraction59 var userList = Bot.getProperty("all_users_list") || [];60 var totalUsers = userList.length;61 var currentResellerPrice = Bot.getProperty("reseller_upgrade_price") || "Not Set";62 63 // 📝 PREMIUM ADMINISTRATIVE MASTER INTERFACE64 var adminPanelText = 65 "<blockquote><b><tg-emoji emoji-id='6064138396228392033'>👑</tg-emoji> MASTER ADMINISTRATIVE PANEL</b>\n\n" +66 "<i>Welcome back Boss! Securely manage your store microservices, logs, databases, plans, and inventory control nodes below.</i></blockquote>\n" +67 "━━━━━━━━━━━━━━━━━━━━━━━━━━\n" +68 "<blockquote><b><tg-emoji emoji-id='6039605143601680423'>📊</tg-emoji> BOT INFRASTRUCTURE SUMMARY</b>\n\n" +69 "• <b>Total Registered Users:</b> <code>" + totalUsers + " Users</code>\n" +70 "• <b>Reseller Upgrade Price:</b> <code>₹" + currentResellerPrice + "</code></blockquote>\n" +71 "━━━━━━━━━━━━━━━━━━━━━━━━━━\n" +72 "<tg-emoji emoji-id='5346024644635804737'>🔰</tg-emoji> <b>Select an operational control terminal module:</b>";73 74 // 🎨 ADVANCED SYSTEM CUSTOM-EMOJI INFRASTRUCTURE75 var adminKeyboard = [76 // Row 1: Product Structure (Success vs Danger Vector)77 [78 { text: "Add Product", callback_data: "/wz go add_product", style: "success", icon_custom_emoji_id: "5348392971207194994" },79 { text: "Remove Product", callback_data: "/removeproduct", style: "danger", icon_custom_emoji_id: "6143299028655280273" }80 ],81 [82 { text: "📦 Manage Products", callback_data: "/admin_manage_products", style: "primary", icon_custom_emoji_id: "6039605143601680423" }83 ],84 // Row 1b: ⚡ Quick Add API Key — category -> panel -> hours/days -> price -> reseller -> PID85 [86 { text: "⚡ Quick Add API Key", callback_data: "/wz go quick_add", style: "success", icon_custom_emoji_id: "5348392971207194994" }87 ],88 // Row 1c: 🔑 External Key — simple URL + API Key setup for the reseller89 // panel that fulfills any product/plan with a PID set.90 [91 { text: "🔑 External Key", callback_data: "/extkey_menu", style: "primary", icon_custom_emoji_id: "5348392971207194994" }92 ],93 // Row 1d: 🌐 Multi Website (alag-alag product alag website/API se) + 🆔 PID Badlo94 [95 { text: "🌐 Multi Website (API)", callback_data: "/wz go sites", style: "primary", icon_custom_emoji_id: "5348392971207194994" },96 { text: "🆔 PID Badlo", callback_data: "/wz go pid_edit", style: "primary" }97 ],98 // Row 2: Plan / Validity Variants99 [100 { text: "Add Plan", callback_data: "/wz go add_plan", style: "primary", icon_custom_emoji_id: "6194922667242429131" },101 { text: "Remove Plan", callback_data: "/wz go rem_plan", style: "danger", icon_custom_emoji_id: "6143299028655280273" }102 ],103 // Row 3: License Key Inventory System104 [105 { text: "Add Key", callback_data: "/wz go add_key", style: "success", icon_custom_emoji_id: "6195196054795721892" },106 { text: "Remove Key", callback_data: "/wz go rem_key", style: "danger", icon_custom_emoji_id: "6143299028655280273" }107 ],108 // Row 8: Financial Wallet Controls109 [110 { text: "Add Bal", callback_data: "/wz go bal_add", style: "success", icon_custom_emoji_id: "5778145208411624388" },111 { text: "Remove Bal", callback_data: "/wz go bal_rem", style: "danger", icon_custom_emoji_id: "6143299028655280273" },112 { text: "Check Bal", callback_data: "/checkbal", style: "primary", icon_custom_emoji_id: "6039605143601680423" }113 ],114 // Row: 👥 All Users Balance (name + username + ID + balance)115 [116 { text: "👥 All Users Balance", callback_data: "/allbal", style: "primary", icon_custom_emoji_id: "6039605143601680423" }117 ],118 // Row 8b: Bulk Wallet Control119 [120 { text: "Add Bal To All Users", callback_data: "/addbal_all", style: "success", icon_custom_emoji_id: "5778145208411624388" }121 ],122 // Owner-only live deposit history123 [124 { text: "💰 All Deposit History", callback_data: "/deposit_history page=1", style: "primary", icon_custom_emoji_id: "5348392971207194994" }125 ],126 // Row 9: Reseller Authorization Cluster127 [128 { text: "Add Reseller", callback_data: "/wz go reseller_add", style: "success", icon_custom_emoji_id: "6195245116207143870" },129 { text: "Remove Reseller", callback_data: "/wz go reseller_rem", style: "danger", icon_custom_emoji_id: "6143299028655280273" },130 { text: "View Role", callback_data: "/wz go role", style: "primary", icon_custom_emoji_id: "6064138396228392033" }131 ],132 // Row 10: Global Parameters & Auditing Tools133 [134 { text: " Set Reseller Upgrade Fee", callback_data: "/wz go fee_setprice", style: "primary", icon_custom_emoji_id: "5463172695132745432" },135 { text: "All Keys", callback_data: "/allkey", style: "success", icon_custom_emoji_id: "6010210211334200822" },136 { text: "Total Users", callback_data: "/check_users", style: "primary", icon_custom_emoji_id: "6039605143601680423" }137 ],138 // Row 11: Core System Communications Hub139 [140 { text: "Broadcast System Terminal", callback_data: "/broadcast", style: "primary", icon_custom_emoji_id: "6041705726206808304" }141 ],142 // Row 12: 🎟 Coupon System (NEW)143 [144 { text: "Generate Coupon", callback_data: "/gencoupon", style: "success", icon_custom_emoji_id: "6093677128295914531" },145 { text: "View Coupons", callback_data: "/coupons", style: "primary", icon_custom_emoji_id: "6102818532393750087" }146 ],147 // Row 13b: 🪪 Bot Identity — User ID / Bot Username / Admin Username (Owner only)148 [149 { text: "User ID / Bot & Admin Username", callback_data: "/bot_identity", style: "primary", icon_custom_emoji_id: "6102856637343600044" }150 ],151 // Row 14: 🛠 Maintenance Mode152 [153 { text: "Maintenance Mode", callback_data: "/maintenance_toggle", style: "danger", icon_custom_emoji_id: "6100657257605763582" }154 ],155 // Row 14b: 🛠 Panel-wise Payment / Purchase Maintenance156 [157 { text: "Panel Maintenance", callback_data: "/panel_maintenance", style: "danger", icon_custom_emoji_id: "6100657257605763582" }158 ],159 // Row 16: 👑 Direct Reseller (NEW) — admin types a User ID, no payment needed160 [161 { text: "Direct Reseller (by User ID)", callback_data: "/wz go reseller_add", style: "success", icon_custom_emoji_id: "6215386799133433653" }162 ],163 // Row 17b: 👤 Member-specific pricing164 [165 { text: "Member Custom Price", callback_data: "/wz go mp_set", style: "success", icon_custom_emoji_id: "6312263493051489212" },166 { text: "Remove Member Price", callback_data: "/wz go mp_rem", style: "danger", icon_custom_emoji_id: "6143299028655280273" }167 ],168 // Row 18: 🔗 Download Files Link (NEW)169 [170 { text: "📁 Set Files Channel Link", callback_data: "/set_download_link_btn", style: "primary", icon_custom_emoji_id: "6091571559233755994" }171 ],172 // Row 19: 💳 Payment API / UPI Control (NEW)173 [174 { text: "Set Payment (Paytm Business)", callback_data: "/set_payment_upi_btn", style: "primary", icon_custom_emoji_id: "6312263493051489212" },175 { text: "Set Payment (FamPay)", callback_data: "/set_payment_fampay_btn", style: "primary", icon_custom_emoji_id: "6312263493051489212" }176 ],177 // Row 19b: 🔀 Gateway ON/OFF toggles (NEW)178 [179 { text: "💳 Payment Gateways ON/OFF", callback_data: "/admin_gateways", style: "success", icon_custom_emoji_id: "6102856637343600044" }180 ],181 // Row 19a: 🌐 Online API record / connection check182 [183 { text: "API Record / Connection Check", callback_data: "/api_record", style: "success", icon_custom_emoji_id: "6039605143601680423" }184 ],185 // Row 22: 📹 How To Use Link Control (NEW)186 [187 { text: "Set How-To-Use Link", callback_data: "/set_how_link_btn", style: "primary", icon_custom_emoji_id: "5258077307985207053" }188 ],189 // Row 24: 📞 Support Admin Username Link Control (NEW)190 [191 { text: "Set Support Link", callback_data: "/set_support_link_btn", style: "danger", icon_custom_emoji_id: "6267129592998270736" }192 ],193 // Shop photo and store-name controls removed as requested.194 // Row 24b: 🎬 Shop Welcome GIF/MP4 (Shop -> ROOT / NON ROOT screen ke upar)195 [196 { text: "🎬 Shop Welcome GIF / Video", callback_data: "/shopmedia welcome", style: "primary", icon_custom_emoji_id: "6041705726206808304" }197 ],198 // Row 24c: 🎮 Per-product Gameplay Video (key kharidne wale screen ke upar)199 [200 { text: "Panel Video Demo", callback_data: "/shopmedia prod", style: "success", icon_custom_emoji_id: "6197145471731899280" }201 ],202 // Row 24e: ✏️ Welcome text edit (owner)203 [204 { text: "✏️ Edit Welcome Text", callback_data: "/edit_welcome", style: "primary", icon_custom_emoji_id: "6102856637343600044" }205 ],206 // Row 25: 🤖 AI Support Manager (NEW)207 [208 { text: "🤖 AI Support Manager", callback_data: "/admin_ai", style: "success", icon_custom_emoji_id: "6086672466132865380" }209 ],210 ];211 212 // 🤖 DISPATCH PIPELINE EXECUTION213 // ✅ FIXED: pehle ye hamesha hardcoded adminId ko panel bhejta tha — agar214 // koi co-admin /admin kholta, to panel unko na milkar owner ke chat me215 // chala jaata tha. Ab panel usi chat me jaata hai jisne /admin request kiya.216 Api.sendMessage({217 chat_id: currentChatId,218 text: adminPanelText,219 parse_mode: "HTML",220 reply_markup: JSON.stringify({221 inline_keyboard: adminKeyboard222 })223 });224 225} catch (err) {226 Bot.sendMessage("Admin Panel Premium Cluster Error: " + err.message);227}