indrajitghosh20006/Testseller_01botPublic · Bot Template
AIThis bot provides an admin‑controlled system for managing user balances, products, and reseller roles. It includes commands to add balances (via manual input, Binance Pay, or UPI), approve and credit payments, and set up product listings with categories and pricing. Admins can also add resellers, view reseller info, and manage stock entries. The bot uses built‑in TeleBotHost APIs such as Bot, Api, HTTP, and Libs for database operations and message handling.
Commerceadminbalanceproductresellerpaymentsbinance
138 commands0 envUpdated 17h agoCreated Sep 27, 2026
commands/_onProfilePhoto.js
javascript · 113 lines
1/**#command2name: /onProfilePhoto3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12// =========================================================13// 👤 COMMAND = /onProfilePhoto (Premium Profile — Step 2: final render)14// ✅ BUG FIX: reply_markup pehle raw object bhej raha tha (JSON.stringify nahi15// kiya gaya tha) jab DP available thi — isi wajah se "Back to Menu" button16// kaam nahi kar raha tha / render hi nahi ho raha tha jab DP ke saath bheja jaata.17// =========================================================18 19try {20 var userId = String(user.telegramid);21 var chatId = chat.chatid;22 var adminId = "7839151435";23 24 // 📸 DP file_id nikaalo (agar user ki koi profile photo public hai)25 var dpFileId = null;26 try {27 var res = (typeof content === "object" && content) ? content : JSON.parse(content);28 if (res && res.ok && res.result && res.result.total_count > 0) {29 var sizes = res.result.photos[0];30 dpFileId = sizes[sizes.length - 1].file_id;31 }32 } catch (e) {}33 34 // 💎 Premium Emoji Set35 var e_profile = "<tg-emoji emoji-id='6102818532393750087'>👤</tg-emoji>";36 var e_id = "<tg-emoji emoji-id='5902002809573740949'>🆔</tg-emoji>";37 var e_money = "<tg-emoji emoji-id='6312263493051489212'>💰</tg-emoji>";38 var e_crown = "<tg-emoji emoji-id='6102856637343600044'>👑</tg-emoji>";39 var e_calendar = "<tg-emoji emoji-id='6266866272848321043'>📅</tg-emoji>";40 var e_key = "<tg-emoji emoji-id='6284816251143331422'>🔑</tg-emoji>";41 var e_invest = "<tg-emoji emoji-id='5330237710655306682'>📊</tg-emoji>";42 var e_back = "<tg-emoji emoji-id='5893163582194978381'>⬅️</tg-emoji>";43 44 var userBalance = (function () {45 var resBal = 0;46 try { resBal = Number(Libs.ResourcesLib.userRes("balance").value()) || 0; } catch (e) {}47 return resBal.toFixed(2);48 })();49 50 var username = user.username ? "@" + user.username : "Not Set";51 var fullName = (user.first_name || "") + (user.last_name ? " " + user.last_name : "");52 53 var role, roleEmojiHtml;54 if (userId === adminId) {55 role = "Admin"; roleEmojiHtml = e_crown;56 } else if (Bot.getProperty("co_admin_" + userId)) {57 role = "Co-Admin"; roleEmojiHtml = e_crown;58 } else {59 var isReseller = Bot.getProperty("is_reseller_" + userId);60 var hasReseller = (isReseller === true || String(isReseller).toLowerCase() === "true");61 role = hasReseller ? "Reseller 🔰" : "Regular User";62 roleEmojiHtml = hasReseller ? "<tg-emoji emoji-id='5346024644635804737'>🔰</tg-emoji>" : "🙋";63 }64 65 var joinedDate = Bot.getProperty("joined_date_" + userId) || "N/A";66 var purchasedKeys = User.getProperty("my_purchased_keys") || [];67 var totalKeys = Array.isArray(purchasedKeys) ? purchasedKeys.length : 0;68 var totalInvested = Number(Bot.getProperty("total_spent_by_" + userId) || 0).toFixed(2);69 70 // 🎨 Premium profile layout (matches the reference design)71 var caption =72 "<blockquote>" + e_profile + " <b>USER PROFILE</b> " + e_profile + "</blockquote>\n\n" +73 e_id + " <b>ID:</b> <code>" + userId + "</code>\n" +74 "<b>Name:</b> " + fullName + "\n" +75 "<b>Username:</b> " + username + "\n" +76 e_calendar + " <b>Joined:</b> " + joinedDate + "\n" +77 roleEmojiHtml + " <b>Account Type:</b> " + role + "\n" +78 "━━━━━━━━━━━━━━━━━━━━━\n\n" +79 e_money + " <b>Balance:</b> ₹" + userBalance + "\n" +80 e_invest + " <b>Spent:</b> ₹" + totalInvested + "\n" +81 e_key + " <b>Keys:</b> " + totalKeys + "\n\n" +82 "<i>" + (dpFileId ? "Profile photo fetched from Telegram." : "No profile photo set.") + "</i>";83 84 var keyboard = [85 [86 { text: "My Keys", callback_data: "/mykey", style: "primary", icon_custom_emoji_id: "6284816251143331422" },87 { text: "Add Fund", callback_data: "/addfund", style: "success", icon_custom_emoji_id: "6312263493051489212" }88 ],89 [90 { text: "Back", callback_data: "/back", style: "danger", icon_custom_emoji_id: "5893163582194978381" }91 ]92 ];93 94 if (dpFileId) {95 Api.sendPhoto({96 chat_id: chatId,97 photo: dpFileId,98 caption: caption,99 parse_mode: "HTML",100 reply_markup: JSON.stringify({ inline_keyboard: keyboard })101 });102 } else {103 Api.sendMessage({104 chat_id: chatId,105 text: caption,106 parse_mode: "HTML",107 reply_markup: JSON.stringify({ inline_keyboard: keyboard })108 });109 }110 111} catch (err) {112 Bot.sendMessage("⚠️ Profile Error: " + err.message, { parse_mode: "HTML" });113}