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/_zap_result.js
javascript · 121 lines
1/**#command2name: /zap_result3answer: 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// ✅ Zapupi order-status reply handler.19// Reply: { status:"success", data:{ order_id, status:"Pending|Success|Failed", amount, pay_amount, utr, txn_id, ... } }20// params: <userId> <orderId> <attempt> <mode: auto | manual | test>21// Success + amount match -> /onCheck ko hand-over (credit, claim lock, auto-purchase, admin log sab wahi karta hai).22// =========================================================23 24try {25 var p = (typeof params !== "undefined" && params) ? String(params).trim().split(/\s+/) : [];26 var userId = p[0];27 var orderId = p[1];28 var attempt = Number(p[2]) || 1;29 var mode = p[3] || "auto";30 var ownerId = String(Bot.getProperty("owner_id") || "7127818616");31 // ~100 tries * 3s ≈ 5 min auto-verify window (matches FamPay's window).32 var ZAP_POLL_MAX = 100;33 34 function scheduleNextPoll() {35 if (mode !== "auto") return;36 if (attempt >= ZAP_POLL_MAX) return; // give up silently; "Verify Payment" button still works manually37 var stillActive = Bot.getProperty("qr_order_id_" + userId) || User.getProperty("qr_order_id_" + userId);38 if (!stillActive || String(stillActive) !== String(orderId)) return; // paid/cancelled/new QR already39 Bot.run({ command: "/zap_poll", options: { userId: userId, orderId: orderId, attempt: attempt + 1 }, run_after: 3 });40 }41 42 var raw = (typeof content !== "undefined") ? content : null;43 44 // /zaptest -> raw reply owner ko dikhao45 if (mode === "test") {46 var t = (typeof raw === "string") ? raw : JSON.stringify(raw || "");47 Api.sendMessage({ chat_id: ownerId, parse_mode: "HTML",48 text: "🧪 <b>Zapupi order-status</b>\nOrder: <code>" + orderId + "</code>\n<code>" + String(t || "empty").replace(/&/g, "&").replace(/</g, "<").slice(0, 900) + "</code>" });49 return;50 }51 52 if (!userId || !orderId) return;53 54 var activeOrder = Bot.getProperty("qr_order_id_" + userId) || User.getProperty("qr_order_id_" + userId);55 if (!activeOrder || String(activeOrder) !== String(orderId)) return; // already paid / cancelled56 57 var manual = (mode === "manual");58 function notPaidYet() {59 if (manual) {60 Api.sendMessage({ chat_id: String(userId), parse_mode: "HTML",61 text: "⚠️ <b>Payment abhi received nahi hui.</b>\n<i>Pay Now se payment complete karo; hote hi balance auto-add ho jayega.</i>" });62 } else {63 scheduleNextPoll();64 }65 }66 67 var res = null;68 try { res = (typeof raw === "object" && raw) ? raw : JSON.parse(raw); } catch (pe) { res = null; }69 if (!res || res.status !== "success" || !res.data) { notPaidYet(); return; } // e.g. "Order not found"70 71 var d = res.data;72 var st = String(d.status || "").toLowerCase();73 if (st !== "success") { notPaidYet(); return; } // Pending / Failed -> polling chalti rahegi74 if (d.order_id !== undefined && String(d.order_id) !== String(orderId)) return;75 76 // ---------- Amount lock ----------77 var expected = Number(Bot.getProperty("pay_order_amount_" + orderId) || User.getProperty("pay_order_amount_" + orderId) || 0);78 var gotAmt = parseFloat(d.amount) || 0;79 var gotPay = parseFloat(d.pay_amount) || 0;80 var amountOk;81 if (!(expected > 0)) amountOk = false;82 else if (!(gotAmt > 0) && !(gotPay > 0)) amountOk = true; // gateway ne amount nahi bheja: order-bound success83 else amountOk = (gotAmt > 0 && Math.abs(gotAmt - expected) <= 0.01) || (gotPay > 0 && Math.abs(gotPay - expected) <= 0.01);84 85 if (!amountOk) {86 if (Bot.getProperty("zap_mm_" + orderId)) return;87 Bot.setProperty("zap_mm_" + orderId, true, "boolean");88 Bot.setProperty("qr_watch_order_" + userId, null, "string"); // polling stop89 User.setProperty("qr_watch_order_" + userId, null, "string");90 Api.sendMessage({ chat_id: String(userId), parse_mode: "HTML",91 text: "⚠️ <b>Payment mili, lekin amount match nahi hua</b>\n\nExpected: ₹" + (expected > 0 ? expected.toFixed(2) : "?") +92 "\nReceived: ₹" + (gotAmt || gotPay).toFixed(2) + "\n\n<i>Support se contact karo, order ID:</i> <code>" + orderId + "</code>" });93 Api.sendMessage({ chat_id: ownerId, parse_mode: "HTML",94 text: "⚠️ <b>Zapupi amount mismatch</b>\nUser: <code>" + userId + "</code>\nOrder: <code>" + orderId + "</code>\nExpected ₹" +95 (expected > 0 ? expected.toFixed(2) : "?") + " / Received ₹" + gotAmt.toFixed(2) + " (pay_amount ₹" + gotPay.toFixed(2) + ")\nUTR: <code>" + (d.utr || d.txn_id || "N/A") + "</code>" });96 return;97 }98 99 // duplicate hand-over guard (parallel polls)100 if (Bot.getProperty("zap_done_" + orderId)) return;101 Bot.setProperty("zap_done_" + orderId, true, "boolean");102 103 Bot.run({104 command: "/onCheck",105 options: {106 userId: userId,107 order_id: orderId,108 amount: expected,109 is_background: true,110 auto_verified: !manual,111 response: { status: "success", data: {112 amount: expected, // hamesha locked base amount credit hota hai113 utr: d.utr || d.txn_id || orderId,114 sender_name: d.custumer_mobile ? String(d.custumer_mobile) : "Valued User",115 payment_time_ist: d.create_at || "Now"116 } }117 }118 });119} catch (err) {120 try { Api.sendMessage({ chat_id: String(Bot.getProperty("owner_id") || "7127818616"), text: "⚠️ zap_result error: " + err.message }); } catch (e2) {}121}