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/_aiadd_file.js
javascript · 101 lines
1/**#command2name: /aiadd_file3answer: 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// Step 2 of AI Add Product: Telegram getFile answered -> send the screenshot to the18// active (vision-capable, OpenAI-compatible) AI and ask for strict JSON.19try {20 var me = String(chat.chatid);21 var st = User.getProperty("aiadd_state");22 if (typeof st === "string") { try { st = JSON.parse(st); } catch (e) { st = null; } }23 if (!st || st.step !== "processing") { return; }24 25 var filePath = "";26 try {27 var res = (typeof content === "object" && content) ? content : JSON.parse(content);28 filePath = res && res.ok && res.result && res.result.file_path ? String(res.result.file_path) : "";29 } catch (pe) {}30 if (!filePath) {31 st.step = "photo"; st.t = Date.now(); User.setProperty("aiadd_state", st, "json");32 Api.sendMessage({ chat_id: me, parse_mode: "HTML", text: "❌ Screenshot download nahi ho paya. Dobara photo bhejo.\n\nReason: " + (function(){ try { var r = (typeof content === "string") ? content : JSON.stringify(content || ""); return String(r || "no response").replace(/&/g,"&").replace(/</g,"<").slice(0, 300); } catch (e) { return "unknown"; } })() + "\n(Check: /set_bot_token se BotFather wala token set karo)",33 reply_markup: JSON.stringify({ inline_keyboard: [[{ text: "❌ Cancel", callback_data: "/aiadd cancel", style: "danger" }]] }) });34 return;35 }36 37 var activeId = Bot.getProperty("ai_active_api_id");38 var configs = Bot.getProperty("ai_api_configs") || [];39 var ai = null;40 for (var i = 0; i < configs.length; i++) { if (String(configs[i].id) === String(activeId)) { ai = configs[i]; break; } }41 if (!ai || !ai.api_key) {42 User.setProperty("aiadd_state", null, "json");43 Bot.sendMessage("❌ AI API connect nahi hai. /admin_ai me add karo.");44 return;45 }46 47 var __BT2 = (function(){ var t = ""; try { if (typeof bot !== "undefined" && bot && bot.token) t = String(bot.token); } catch (e) {} try { if (!t && typeof process !== "undefined" && process.env && process.env.BOT_TOKEN) t = String(process.env.BOT_TOKEN); } catch (e) {} if (!t) t = String(Bot.getProperty("tg_bot_token") || ""); return t; })();48 if (!__BT2) { User.setProperty("aiadd_state", null, "json"); Bot.sendMessage("⚠️ Bot token nahi mila. Admin chat me ye bhejo:\n/set_bot_token TUMHARA_BOT_TOKEN\n(BotFather wala token. Message apne aap delete ho jayega.)"); return; }49 var imageUrl = "https://api.telegram.org/file/bot" + __BT2 + "/" + filePath;50 var __two = (st.mode === "two"), __shot = Number(st.shot) || 1;51 var sys, __userTxt, __maxTok = 3000;52 if (__two && __shot === 1) {53 sys =54 "You read a screenshot of a reseller/supplier website that shows a product/panel NAME and its PRICE(S). " +55 "Reply with ONLY one JSON object, no markdown, no explanation, in exactly this shape: " +56 "{\"panel_name\":\"<product/panel title exactly as shown, or empty string>\",\"prices\":[{\"duration_value\":<number or null>,\"duration_unit\":\"hour\" or \"day\" or null,\"currency\":\"USD\" or \"INR\",\"price\":<price exactly as shown, plain number, no currency symbol>}]}. " +57 "List every price you can see. If a price is shown next to a duration (e.g. '1 Day $2', '24 Hours Rs 80') fill duration_value and duration_unit, otherwise use null for them. " +58 "currency: USD if the price has $ / USD / dollar, INR if it has \u20b9 / Rs / INR / rupees. Never guess or invent numbers.";59 __userTxt = "Is screenshot se product ka naam aur saare prices (currency USD/INR ke saath) nikaalo.";60 } else if (__two && __shot === 2) {61 sys =62 "You read a screenshot of a reseller/supplier website that shows plan DURATIONS, STOCK and PID (product id) for each row. " +63 "Reply with ONLY one JSON object, no markdown, no explanation, in exactly this shape: " +64 "{\"plans\":[{\"pid\":\"<product id / PID shown for that row>\",\"duration_value\":<number>,\"duration_unit\":\"hour\" or \"day\",\"duration_text\":\"<the duration label EXACTLY as written on the website for that row, same spelling, capitals and plural, e.g. 1 Hours or 7 Days; only the duration words, no price/PID/stock>\",\"stock\":<stock number shown for that row, or null>}]}. " +65 "Examples: '24 Hours' -> duration_value 24, duration_unit hour. '1 Day' -> 1, day. '7 Days' -> 7, day. " +66 "Keep the rows in the same top-to-bottom order as shown. If a value is not clearly visible, use null. Never guess or invent numbers.";67 __userTxt = "Is screenshot se har plan ka PID, duration aur stock nikaalo.";68 } else {69 sys =70 "You read a screenshot of a reseller/supplier website price list. Extract every purchasable plan row you can see. " +71 "Reply with ONLY one JSON object, no markdown, no explanation, in exactly this shape: " +72 "{\"panel_name\":\"<product/panel title as shown, or empty string>\",\"plans\":[{\"pid\":\"<product id / PID shown for that row>\",\"duration_value\":<number>,\"duration_unit\":\"hour\" or \"day\",\"duration_text\":\"<the duration label EXACTLY as written on the website for that row, same spelling, capitals and plural, e.g. 1 Hours or 7 Days; only the duration words, no price/PID/stock>\",\"currency\":\"USD\" or \"INR\",\"price\":<price exactly as shown, plain number, no currency symbol>}]}. " +73 "currency: use USD if the price has $ / USD / dollar, use INR if it has \u20b9 / Rs / INR / rupees. " +74 "Examples: '24 Hours' -> duration_value 24, duration_unit hour. '1 Day' -> 1, day. '7 Days' -> 7, day. " +75 "If a value (pid, duration, price or currency) is not clearly visible, use null. Never guess or invent numbers.";76 __userTxt = "Is screenshot se saare plans (PID, duration, price + currency USD/INR) nikaalo.";77 }78 79 var payload = {80 model: ai.model,81 messages: [82 { role: "system", content: sys },83 { role: "user", content: [84 { type: "text", text: __userTxt },85 { type: "image_url", image_url: { url: imageUrl } }86 ] }87 ],88 temperature: 0,89 max_tokens: __maxTok90 };91 92 HTTP.post({93 url: String(ai.base_url).replace(/\/+$/, "") + "/chat/completions",94 body: JSON.stringify(payload),95 headers: { "Content-Type": "application/json", "Authorization": "Bearer " + ai.api_key },96 success: "/aiadd_result",97 error: "/aiadd_error"98 });99} catch (err) {100 Bot.sendMessage("⚠️ AI Add Error: " + err.message);101}