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/_onProfilePhoto.js

javascript · 142 lines

Raw
1/**#command2name: /onProfilePhoto3answer: 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// 👤 COMMAND = /onProfilePhoto (Premium Profile — Step 2: final render)19// ✅ BUG FIX: reply_markup pehle raw object bhej raha tha (JSON.stringify nahi20// kiya gaya tha) jab DP available thi — isi wajah se "Back to Menu" button21// kaam nahi kar raha tha / render hi nahi ho raha tha jab DP ke saath bheja jaata.22// =========================================================23 24try {25  var userId = String(user.telegramid);26  var chatId = chat.chatid;27  var adminId = String(Bot.getProperty("owner_id") || "7127818616");28 29  // 📸 DP file_id nikaalo (agar user ki koi profile photo public hai)30  var dpFileId = null;31  try {32    var res = null;33    if (typeof options !== "undefined" && options && options.photos) {34      var __ph = options.photos;35      res = (__ph.result !== undefined) ? { ok: __ph.ok !== false, result: __ph.result } : { ok: true, result: __ph };36    } else {37      res = (typeof content === "object" && content) ? content : JSON.parse(content);38    }39    if (res && res.ok && res.result && res.result.total_count > 0) {40      var sizes = res.result.photos[0];41      var bestSize = sizes[sizes.length - 1];42      for (var si = 0; si < sizes.length; si++) {43        if ((sizes[si].width || 0) * (sizes[si].height || 0) > (bestSize.width || 0) * (bestSize.height || 0)) bestSize = sizes[si];44      }45      dpFileId = bestSize.file_id; // sabse badi resolution46    }47  } catch (e) {}48 49  // 💎 Premium Emoji Set50  var e_profile = "<tg-emoji emoji-id='6102818532393750087'>👤</tg-emoji>";51  var e_id       = "<tg-emoji emoji-id='5902002809573740949'>🆔</tg-emoji>";52  var e_money    = "<tg-emoji emoji-id='6312263493051489212'>💰</tg-emoji>";53  var e_crown    = "<tg-emoji emoji-id='6102856637343600044'>👑</tg-emoji>";54  var e_calendar = "<tg-emoji emoji-id='6266866272848321043'>📅</tg-emoji>";55  var e_key      = "<tg-emoji emoji-id='6284816251143331422'>🔑</tg-emoji>";56  var e_invest   = "<tg-emoji emoji-id='5330237710655306682'>📊</tg-emoji>";57  var e_back     = "<tg-emoji emoji-id='5893163582194978381'>⬅️</tg-emoji>";58 59  var userBalance = (function () {60    var resBal = 0;61    try { resBal = Number(Libs.ResourcesLib.userRes("balance").value()) || 0; } catch (e) {}62    var bonusBal = Number(Bot.getProperty("balance" + userId) || 0);63    return (resBal + bonusBal).toFixed(2);64  })();65 66  var username = user.username ? "@" + user.username : "Not Set";67  var fullName = (user.first_name || "") + (user.last_name ? " " + user.last_name : "");68 69  var role, roleEmojiHtml;70  if (userId === adminId) {71    role = "Admin"; roleEmojiHtml = e_crown;72  } else if (Bot.getProperty("co_admin_" + userId)) {73    role = "Co-Admin"; roleEmojiHtml = e_crown;74  } else {75    var isReseller = Bot.getProperty("is_reseller_" + userId);76    var hasReseller = (isReseller === true || String(isReseller).toLowerCase() === "true");77    role = hasReseller ? "Reseller 🔰" : "Regular User";78    roleEmojiHtml = hasReseller ? "<tg-emoji emoji-id='5346024644635804737'>🔰</tg-emoji>" : "🙋";79  }80 81  var joinedDate = Bot.getProperty("joined_date_" + userId) || "N/A";82  var purchasedKeys = User.getProperty("my_purchased_keys") || [];83  var totalKeys = Array.isArray(purchasedKeys) ? purchasedKeys.length : 0;84  var totalInvested = Number(Bot.getProperty("total_spent_by_" + userId) || 0).toFixed(2);85 86  var couponLine = "";87  try {88    var activeCpn = User.getProperty("profile_coupon");89    var activeCpnRec = activeCpn ? Bot.getProperty("coupon_" + activeCpn) : null;90    if (activeCpnRec && activeCpnRec.discountPercent) {91      couponLine = "🎟 <b>Coupon:</b> <code>" + activeCpn + "</code> (-" + activeCpnRec.discountPercent + "%)\n";92    }93  } catch (cpnErr) {}94 95  // 🎨 Premium profile layout (matches the reference design)96  var caption =97    "<blockquote>" + e_profile + " <b>USER PROFILE</b> " + e_profile + "</blockquote>\n\n" +98    e_id + " <b>ID:</b> <code>" + userId + "</code>\n" +99    "<b>Name:</b> " + fullName + "\n" +100    "<b>Username:</b> " + username + "\n" +101    e_calendar + " <b>Joined:</b> " + joinedDate + "\n" +102    roleEmojiHtml + " <b>Account Type:</b> " + role + "\n" +103    "━━━━━━━━━━━━━━━━━━━━━\n\n" +104    e_money + " <b>Balance:</b> ₹" + userBalance + "\n" +105    e_invest + " <b>Spent:</b> ₹" + totalInvested + "\n" +106    e_key + " <b>Keys:</b> " + totalKeys + "\n" +107    couponLine + "\n" +108    "<i>" + (dpFileId ? "Profile photo fetched from Telegram." : "No profile photo set.") + "</i>";109 110  var keyboard = [111    [112      { text: "My Keys", callback_data: "/mykey", style: "primary", icon_custom_emoji_id: "6284816251143331422" },113      { text: "Add Fund", callback_data: "/addfund", style: "success", icon_custom_emoji_id: "6312263493051489212" }114    ],115    [116      { text: "Apply Coupon", callback_data: "/profile_coupon", style: "primary", icon_custom_emoji_id: "6093677128295914531" }117    ],118    [119      { text: "Back", callback_data: "/back", style: "danger", icon_custom_emoji_id: "5893163582194978381" }120    ]121  ];122 123  if (dpFileId) {124    Api.sendPhoto({125      chat_id: chatId,126      photo: dpFileId,127      caption: caption,128      parse_mode: "HTML",129      reply_markup: JSON.stringify({ inline_keyboard: keyboard })130    });131  } else {132    Api.sendMessage({133      chat_id: chatId,134      text: caption,135      parse_mode: "HTML",136      reply_markup: JSON.stringify({ inline_keyboard: keyboard })137    });138  }139 140} catch (err) {141  Bot.sendMessage("⚠️ Profile Error: " + err.message, { parse_mode: "HTML" });142}
commands/_onProfilePhoto.js · tarunpoonia905/OfcDevShopBot · TeleDevs