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/_addbal_zapupi.js
javascript · 127 lines
1/**#command2name: /addbal_zapupi3answer: 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 Pay" chosen on Add Balance screen.19// Zapupi POST /api/create-order -> payment_url (hosted checkout link).20// Verification: /zap_poll (background) + Verify button -> order-status API.21// =========================================================22 23try {24 var userId = user.telegramid;25 var callbackId = request ? (request.id || (request.callback_query && request.callback_query.id)) : null;26 27 var __rawAmt = (typeof options !== "undefined" && options && options.params) ? options.params : params;28 var finalAmount = String(parseInt(__rawAmt ? String(__rawAmt).trim() : "0"));29 if (!finalAmount || finalAmount === "0" || isNaN(parseInt(finalAmount)) || parseInt(finalAmount) <= 0) {30 Bot.sendMessage("❌ Invalid amount!");31 return;32 }33 34 if (Bot.getProperty("gateway_zapupi_enabled") !== true) {35 Bot.sendMessage("❌ Zapupi gateway is currently disabled by admin.");36 return;37 }38 var zapKey = Bot.getProperty("zapupi_key");39 if (!zapKey) {40 Bot.sendMessage("⚠️ Zapupi gateway abhi admin ne configure nahi kiya hai. /set_payment_zapupi ZAP_KEY chalao.");41 return;42 }43 44 var e_gear = "<tg-emoji emoji-id='5348292765325212780'>⚙</tg-emoji>";45 46 // 🧹 Add Balance = sirf wallet top-up. Kisi purane adhoore checkout/reseller-upgrade ka47 // context bacha ho to payment ke baad /onCheck usse auto-purchase chalata tha (aur fail ho sakta tha).48 try {49 User.setProperty("buy_prod_idx", null);50 User.setProperty("buy_plan_idx", null);51 User.setProperty("buy_price", null);52 User.setProperty("buy_needpay", null);53 User.setProperty("buy_reseller_upgrade", null, "boolean"); try { Bot.setProperty("reseller_upg_" + user.telegramid, null, "number"); } catch (__ru) {}54 User.setProperty("buy_reseller_price", null, "number");55 } catch (clrErr) {}56 57 User.setProperty("deposit_amount", finalAmount, "string");58 User.setProperty("pending_pay_amount_" + userId, finalAmount, "string");59 User.setProperty("buy_expected_amount", Number(finalAmount), "number");60 61 var zapOrderId = "ZP" + new Date().getTime() + Math.floor(100 + Math.random() * 900);62 Bot.setProperty("zap_oid_" + userId, zapOrderId, "string");63 Bot.setProperty("zap_amt_" + userId, Number(finalAmount).toFixed(2), "string");64 65 var zapBotUser = String(Bot.getProperty("bot_username") || "JASSMODZSHOP_BOT").replace(/^@/, "");66 var zapOrderBody = {67 zap_key: zapKey,68 order_id: zapOrderId,69 amount: Number(finalAmount).toFixed(2),70 customer_mobile: String(Bot.getProperty("zapupi_customer_mobile") || "9999999999"),71 remark: "TG" + userId,72 success_url: "https://t.me/" + zapBotUser + "?start=success_" + zapOrderId,73 failed_url: "https://t.me/" + zapBotUser + "?start=failed_" + zapOrderId,74 timeout_url: "https://t.me/" + zapBotUser + "?start=timeout_" + zapOrderId75 };76 // ⚠️ webhook_url intentionally NOT sent: ZapUPI ka WAF TeleBotHost ke signed webhook URL77 // (encoded-JSON query string) par poora create-order {"status":"error","message":"Malicious input detected"}78 // se reject kar deta hai. /pay_zapupi me ye pehle hi hata diya gaya tha, yahan reh gaya tha.79 // Verification: background /zap_poll + "Verify Payment" button.80 81 HTTP.post({82 url: "https://pay.zapupi.com/api/create-order",83 headers: { "Content-Type": "application/json" },84 body: JSON.stringify(zapOrderBody),85 success: "/zap_onOrder",86 error: "/onApiError"87 });88 89 // ⏱ watchdog: gateway hang ho to user ko retry option (see /qr_timeout)90 try {91 var qrTs = String(new Date().getTime());92 Bot.setProperty("qr_gen_ts_" + userId, qrTs, "string");93 // (TeleBotHost Bot.run me run_after hota hi nahi — docs: command/options/user_id/chat_id/ignoreMissingCommand. Isliye delayed watchdog/poll hata diya.)94 } catch (wdErr) {}95 96 var generatingText =97 "<blockquote>" + e_gear + " <b>Creating order for ₹" + finalAmount + "...</b>\n" +98 "<i>Please wait a moment</i></blockquote>";99 100 if (request && request.message) {101 Api.editMessageText({102 chat_id: chat.chatid,103 message_id: request.message.message_id,104 text: generatingText,105 parse_mode: "HTML"106 });107 try {108 Bot.setProperty("gen_msg_id_" + userId, request.message.message_id, "string");109 User.setProperty("gen_msg_id_" + userId, request.message.message_id, "string");110 } catch (e) {}111 } else {112 var genMsg = Api.sendMessage({ chat_id: chat.chatid, text: generatingText, parse_mode: "HTML" });113 try {114 var gmid = (genMsg && genMsg.result && genMsg.result.message_id) ? genMsg.result.message_id : (genMsg && genMsg.message_id ? genMsg.message_id : null);115 if (gmid) {116 Bot.setProperty("gen_msg_id_" + userId, gmid, "string");117 User.setProperty("gen_msg_id_" + userId, gmid, "string");118 }119 } catch (e) {}120 }121 122 if (callbackId) {123 Api.answerCallbackQuery({ callback_query_id: String(callbackId) });124 }125} catch (err) {126 Bot.sendMessage("⚠️ System Error: " + err.message);127}