devbro468/Dev_x_store_botPublic · Bot Template
AIThis bot operates a digital storefront (DEV X STORE) selling subscription-based products — likely game hacks, accounts, or access keys — categorized by platform (Android Root, Non-Root, iPhone). It features a reseller program with discounted pricing, a dual-currency wallet (INR balance + Telegram Stars/XTR), and a full admin/co-admin panel for managing products, plans, per-plan pricing, stock (keys/accounts), coupons, and API endpoints. Purchases flow through a plan selection screen offering wallet payment, Stars invoices (sendInvoice with XTR currency), and coupon application. Successful Stars payments are handled via successful_payment webhook, crediting wallet or delivering keys directly. Admin tools include user listing with chunked messaging, stock viewing/deletion with inline keyboards, co-admin management, and API registry updates. The bot registers users on first interaction and
commands/_onProfilePhoto.js
javascript · 114 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 = "8875810358";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 var bonusBal = Number(Bot.getProperty("balance" + userId) || 0);48 return (resBal + bonusBal).toFixed(2);49 })();50 51 var username = user.username ? "@" + user.username : "Not Set";52 var fullName = (user.first_name || "") + (user.last_name ? " " + user.last_name : "");53 54 var role, roleEmojiHtml;55 if (userId === adminId) {56 role = "Admin"; roleEmojiHtml = e_crown;57 } else if (Bot.getProperty("co_admin_" + userId)) {58 role = "Co-Admin"; roleEmojiHtml = e_crown;59 } else {60 var isReseller = Bot.getProperty("is_reseller_" + userId);61 var hasReseller = (isReseller === true || String(isReseller).toLowerCase() === "true");62 role = hasReseller ? "Reseller 🔰" : "Regular User";63 roleEmojiHtml = hasReseller ? "<tg-emoji emoji-id='5346024644635804737'>🔰</tg-emoji>" : "🙋";64 }65 66 var joinedDate = Bot.getProperty("joined_date_" + userId) || "N/A";67 var purchasedKeys = User.getProperty("my_purchased_keys") || [];68 var totalKeys = Array.isArray(purchasedKeys) ? purchasedKeys.length : 0;69 var totalInvested = Number(Bot.getProperty("total_spent_by_" + userId) || 0).toFixed(2);70 71 // 🎨 Premium profile layout (matches the reference design)72 var caption =73 "<blockquote>" + e_profile + " <b>USER PROFILE</b> " + e_profile + "</blockquote>\n\n" +74 e_id + " <b>ID:</b> <code>" + userId + "</code>\n" +75 "<b>Name:</b> " + fullName + "\n" +76 "<b>Username:</b> " + username + "\n" +77 e_calendar + " <b>Joined:</b> " + joinedDate + "\n" +78 roleEmojiHtml + " <b>Account Type:</b> " + role + "\n" +79 "━━━━━━━━━━━━━━━━━━━━━\n\n" +80 e_money + " <b>Balance:</b> ₹" + userBalance + "\n" +81 e_invest + " <b>Spent:</b> ₹" + totalInvested + "\n" +82 e_key + " <b>Keys:</b> " + totalKeys + "\n\n" +83 "<i>" + (dpFileId ? "Profile photo fetched from Telegram." : "No profile photo set.") + "</i>";84 85 var keyboard = [86 [87 { text: "My Keys", callback_data: "/mykey", style: "primary", icon_custom_emoji_id: "6284816251143331422" },88 { text: "Add Fund", callback_data: "/addfund", style: "success", icon_custom_emoji_id: "6312263493051489212" }89 ],90 [91 { text: "Back", callback_data: "/back", style: "danger", icon_custom_emoji_id: "5893163582194978381" }92 ]93 ];94 95 if (dpFileId) {96 Api.sendPhoto({97 chat_id: chatId,98 photo: dpFileId,99 caption: caption,100 parse_mode: "HTML",101 reply_markup: JSON.stringify({ inline_keyboard: keyboard })102 });103 } else {104 Api.sendMessage({105 chat_id: chatId,106 text: caption,107 parse_mode: "HTML",108 reply_markup: JSON.stringify({ inline_keyboard: keyboard })109 });110 }111 112} catch (err) {113 Bot.sendMessage("⚠️ Profile Error: " + err.message, { parse_mode: "HTML" });114}