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/_.js
javascript · 158 lines
1/**#command2name: *3answer: 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 17// =========================================================18// 🛡️ WILDCARD FALLBACK — catches any message/input that doesn't match19// a specific registered command.20// ✅ BUG FIX: pehle ye ek 241-line ka STALE duplicate copy tha (purani21// admin checks, plain crown emoji, koi bhi naya fix — maintenance mode,22// coupon wizard, case-insensitive /start — yahan nahi tha). Kyunki ye23// wildcard command hai, koi bhi unmatched input isi purane/buggy logic24// se guzarta tha. Ab ye seedha /start ko delegate karta hai (jahan sab25// latest fixes maujood hain) — koi duplicate/stale logic nahi bacha.26// =========================================================27 28try {29 // ✋ Manual Payment states (admin QR/UPI setup + user screenshot) — checked first.30 var __mpStep = User.getProperty("mp_step");31 var __mpShot = User.getProperty("mp_shot_step");32 if (__mpStep || __mpShot) {33 var __mpTxt = (typeof message !== "undefined" && message) ? String(message).trim() : "";34 var __mpPhoto = null;35 try {36 if (request) {37 if (request.message && request.message.photo && request.message.photo.length) __mpPhoto = request.message.photo;38 else if (request.photo && request.photo.length) __mpPhoto = request.photo;39 else if (request.update && request.update.message && request.update.message.photo && request.update.message.photo.length) __mpPhoto = request.update.message.photo;40 }41 } catch (__mpe) {}42 if (__mpTxt.toLowerCase() === "cancel") {43 User.setProperty("mp_step", null, "string");44 User.setProperty("mp_shot_step", null, "string");45 Bot.sendMessage("❌ Cancelled.");46 return;47 }48 if (__mpStep === "waiting_qr") {49 Bot.run({ command: "/manualpay", options: { params: "save_qr", file_id: __mpPhoto ? __mpPhoto[__mpPhoto.length - 1].file_id : "" } });50 return;51 }52 if (__mpStep === "waiting_upi" && __mpTxt) {53 Bot.run({ command: "/manualpay", options: { params: "save_upi", text: __mpTxt } });54 return;55 }56 if (__mpShot && __mpPhoto) {57 Bot.run({ command: "/manualpay", options: { params: "shot", file_id: __mpPhoto[__mpPhoto.length - 1].file_id } });58 return;59 }60 if (__mpShot) {61 Bot.sendMessage("📸 Payment ka <b>screenshot photo</b> bhejo, ya <code>cancel</code> likho.", { parse_mode: "HTML" });62 return;63 }64 }65 // 🎬 Shop media upload mode ON? (admin ne /admin → Shop Welcome / Product Gameplay Video dabaya)66 // GIF/video me text hota hi nahi, isliye ye check sabse pehle hai. Sirf admin ke User-store me67 // ye flag hota hai, to normal users par iska koi asar nahi.68 if (User.getProperty("shopmedia_step")) {69 Bot.run({ command: "/shopmedia", options: { action: "save" } });70 return;71 }72 73 // 💳 Zapupi key / mobile-number prompt active? -> forward typed text FIRST,74 // before any other state (wz_state included) gets a chance to swallow it.75 // Same class of bug as the extkey fix below: a leftover/stale wz_state could76 // route this number into /wz instead of the actual Zapupi setup saver.77 if (typeof message !== "undefined" && message && String(message).trim()) {78 var zapKeyStep = User.getProperty("set_payment_zapupi_step");79 if (zapKeyStep === "waiting_input") {80 User.setProperty("set_payment_zapupi_step", null, "string");81 try { if (request && request.message_id) Api.deleteMessage({ chat_id: chat.chatid, message_id: request.message_id }); } catch (delKeyErr) {}82 Bot.run({ command: "/set_payment_zapupi", options: { params: String(message).trim() } });83 return;84 }85 var zapMobileStep = User.getProperty("set_zapupi_mobile_step");86 if (zapMobileStep === "waiting_input") {87 User.setProperty("set_zapupi_mobile_step", null, "string");88 Bot.run({ command: "/set_zapupi_mobile", options: { params: String(message).trim() } });89 return;90 }91 }92 93 // 🔑 External Key URL/API-key prompt active? -> forward typed text to the saver.94 // ✅ FIX: checked FIRST now, so a stale wizard / AI state can no longer swallow the typed URL or key.95 // ✅ BUG FIX: /extkey_url_btn and /extkey_apikey_btn set a "waiting_input" flag96 // but nothing was ever reading it back — typed URL/key silently fell through to97 // /start and nothing was saved (no error, no confirmation, no response at all).98 if (typeof message !== "undefined" && message && String(message).trim()) {99 var extkeyUrlStep = User.getProperty("extkey_url_step");100 if (extkeyUrlStep === "waiting_input") {101 User.setProperty("extkey_url_step", null, "string");102 Bot.run({ command: "/extkey_save_url", options: { params: String(message).trim() } });103 return;104 }105 var extkeyApikeyStep = User.getProperty("extkey_apikey_step");106 if (extkeyApikeyStep === "waiting_input") {107 User.setProperty("extkey_apikey_step", null, "string");108 Bot.run({ command: "/extkey_save_apikey", options: { params: String(message).trim() } });109 return;110 }111 var extkeyMasterStep = User.getProperty("extkey_master_step");112 if (extkeyMasterStep === "waiting_input") {113 User.setProperty("extkey_master_step", null, "string");114 Bot.run({ command: "/extkey_save_master", options: { params: String(message).trim() } });115 return;116 }117 }118 // 🧭 Admin wizard active? -> the typed answer belongs to it (see _wz.js)119 var wzActive = User.getProperty("wz_state");120 if (wzActive) {121 Bot.run({ command: "/wz", options: { wz_text: true, text: (typeof message !== "undefined" && message) ? String(message) : "" } });122 return;123 }124 // 🤖 AI Add Product wizard active? -> screenshot (photo) or typed answer goes to /aiadd125 var aiaddSt = User.getProperty("aiadd_state");126 if (aiaddSt) {127 var aiaddPhoto = null;128 try {129 if (request) {130 if (request.message && request.message.photo && request.message.photo.length) aiaddPhoto = request.message.photo;131 else if (request.photo && request.photo.length) aiaddPhoto = request.photo;132 else if (request.update && request.update.message && request.update.message.photo && request.update.message.photo.length) aiaddPhoto = request.update.message.photo;133 }134 } catch (aiPe) {}135 if (aiaddPhoto) {136 Bot.run({ command: "/aiadd", options: { ai_photo: true, file_id: aiaddPhoto[aiaddPhoto.length - 1].file_id } });137 return;138 }139 if (typeof message !== "undefined" && message && String(message).trim()) {140 Bot.run({ command: "/aiadd", options: { ai_text: true, text: String(message).trim() } });141 return;142 }143 }144 // 🤖 AI Support chat active? -> forward the typed question to /ai_ask145 if (User.getProperty("ai_chat_active") && typeof message !== "undefined" && message) {146 var aiMsgText = String(message).trim();147 if (aiMsgText.toLowerCase() === "/cancel") {148 User.setProperty("ai_chat_active", false, "boolean");149 Bot.run({ command: "/support" });150 return;151 }152 Bot.run({ command: "/ai_ask", options: { question: aiMsgText } });153 return;154 }155 Bot.run({ command: "/start" });156} catch (err) {157 try { Bot.sendMessage("⚠️ Kripya /start type karein.", { parse_mode: "HTML" }); } catch (e) {}158}