tarunpoonia905/OfcDevShopBotPublic · Bot Template

ProfileTelegram

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
Back to folder

commands/_addproduct.js

javascript · 141 lines

Raw
1/**#command2name: /addproduct3answer: 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 17var adminId = Bot.getProperty("owner_id") || "7127818616";18var isCoAdmin0 = Bot.getProperty("co_admin_" + String(chat.chatid));19 20if (chat.chatid == adminId || isCoAdmin0) {21  // Format: /addproduct Name | EmojiID | Category (PID is now plan-level)22  if (!params || params.trim() === "") {23    Bot.sendMessage(24      "⚠️ <b>Galat Format!</b>\n\n" +25      "Kripya is tarah bhejien:\n" +26      "<code>/addproduct Name | EmojiID | Category | UpdateLink | ButtonText</code>\n\n" +27      "<b>Category</b> me likhein: <code>root</code>, <code>nonroot</code>, <code>iphone</code> ya <code>both</code>\n\n" +28      "<b>Example:</b>\n<code>/addproduct Drip Client | 61160843705 | root</code>\n" +29      "<code>/addproduct Drip Client | 61160843705 | nonroot</code>\n" +30      "<code>/addproduct Panther Spoofer | 61160843705 | iphone</code>",31      { parse_mode: "HTML" }32    );33    return;34  }35 36  var parts = params.split("|");37  if (parts.length < 2) {38    Bot.sendMessage("⚠️ Name aur Emoji ID zaroori hain. PID ab Add Product me nahi liya jayega. Update/maintenance link optional hai!", { parse_mode: "HTML" });39    return;40  }41 42  var prodName = parts[0].trim();43  var prodEmoji = parts[1].trim();44 45  // 2nd field is the Telegram custom emoji ID for this hack/panel.46  // It is preserved and rendered on BOTH live and maintenance buttons.47  // 3rd field = category (root / nonroot / iphone / both).48  var rawCategory = parts.length >= 3 ? parts[2].trim().toLowerCase() : "both";49 50  // 4th field = this exact panel's maintenance/update link.51  // 5th field = optional button text.52  // Backward compatible: if the 4th field is NOT a URL, treat it as the old53  // category field instead of breaking an existing /addproduct command.54  var maintenanceLink = "";55  var maintenanceLinkText = parts.length >= 5 ? parts[4].trim() : "📥 Update Files";56 57  if (parts.length >= 4) {58    var field4 = parts[3].trim();59    if (/^https?:\/\//i.test(field4)) {60      maintenanceLink = field4;61    } else if (!parts.length || !rawCategory || rawCategory === "both") {62      rawCategory = field4.toLowerCase();63    }64  }65 66  if (maintenanceLink && !/^https?:\/\//i.test(maintenanceLink)) {67    Bot.sendMessage("⚠️ Maintenance/Update link must start with http:// or https://");68    return;69  }70 71  // Category values accepted: root / nonroot / iphone / both.72  var prodCategory = "both";73  if (rawCategory === "root" || rawCategory === "android root" || rawCategory === "androidroot") {74    prodCategory = "root";75  } else if (rawCategory === "nonroot" || rawCategory === "non root" || rawCategory === "android non root" || rawCategory === "androidnonroot") {76    prodCategory = "nonroot";77  } else if (rawCategory === "iphone" || rawCategory === "ios" || rawCategory === "i phone" || rawCategory === "apple") {78    prodCategory = "iphone";79  } else {80    prodCategory = "both";81  }82 83  // Safe database fetch84  var productList = Bot.getProperty("stored_products");85  if (!Array.isArray(productList)) {86    productList = [];87  }88 89  // ✅ BUG FIX: pehle har /addproduct call ek NAYA duplicate entry bana deta tha,90  // chahe wahi product naam se pehle se maujood ho — isse shop me same product91  // do baar dikhta tha aur plans purani wali entry se hi attached rehte the.92  // Ab existing product (case-insensitive match) ho to usi ko UPDATE karta hai,93  // uske plans (agar honge) safe rehte hain.94  var existingIdx = -1;95  for (var pi = 0; pi < productList.length; pi++) {96    if (productList[pi].name && productList[pi].name.trim().toLowerCase() === prodName.toLowerCase()) {97      existingIdx = pi;98      break;99    }100  }101 102  var isUpdate = existingIdx > -1;103 104  if (isUpdate) {105    productList[existingIdx].name = prodName;106    productList[existingIdx].emoji = prodEmoji;107    // PID intentionally removed from product-level data; each plan owns its PID.108    delete productList[existingIdx].id;109    productList[existingIdx].category = prodCategory;110    if (maintenanceLink) productList[existingIdx].maintenance_link = maintenanceLink;111    if (parts.length >= 5 && maintenanceLinkText) productList[existingIdx].maintenance_link_text = maintenanceLinkText;112    if (!productList[existingIdx].maintenance_link_text) productList[existingIdx].maintenance_link_text = "📥 Update Files";113    if (!Array.isArray(productList[existingIdx].plans)) { productList[existingIdx].plans = []; }114  } else {115    productList.push({116      name: prodName,117      emoji: prodEmoji,118      category: prodCategory,119      maintenance_link: maintenanceLink,120      maintenance_link_text: maintenanceLinkText || "📥 Update Files",121      plans: []122    });123  }124 125  // Save karo126  Bot.setProperty("stored_products", productList, "json");127 128  Bot.sendMessage(129    "<blockquote>✅ <b>Product " + (isUpdate ? "Updated" : "Successfully Added") + "!</b></blockquote>\n\n" +130    "📦 <b>Name:</b> " + prodName + "\n" +131    "💎 <b>Emoji:</b> <code>" + prodEmoji + "</code>\n" +132    "📂 <b>Category:</b> <code>" + (prodCategory === "root" ? "ANDROID ROOT" : prodCategory === "nonroot" ? "ANDROID NON ROOT" : prodCategory === "iphone" ? "iPHONE" : "BOTH") + "</code>\n" +133    "🔗 <b>Maintenance Link:</b> " + (maintenanceLink || (isUpdate && productList[existingIdx] && productList[existingIdx].maintenance_link) || "Not set") + "\n" +134    "🔘 <b>Link Button:</b> <code>" + (maintenanceLinkText || "📥 Update Files") + "</code>\n\n" +135    "<i>" + (isUpdate ? "Existing plans safe rakhe gaye hain. Link change karna ho to /maintenance_link use karein." : "Ab yeh product store me sabhi ko dikhega! Use /addplan to add pricing plans.") + "</i>",136    { parse_mode: "HTML" }137  );138 139} else {140  Bot.sendMessage("❌ You are not the admin!");141}
commands/_addproduct.js · tarunpoonia905/OfcDevShopBot · TeleDevs