indrajitghosh20006/Igstore_01botPublic Β· Bot Template
AIThe bot provides an admin interface for a digital store, allowing the owner or coβadmins to add balances, products, plans, and categories. It supports payment workflows via UPI and Binance Pay, automatically generating QR codes and handling manual approval of deposits. The code patches inline keyboards to use premium emoji icons and includes helper functions for user and bot properties. Overall, it serves as a commerce management tool for a Telegram-based storefront.
Commercestoreadminbalanceproductplancategory
170 commands0 envUpdated 8h agoCreated Oct 30, 2026
commands/_onProfilePhoto.js
javascript Β· 155 lines
1/**#command2name: /onProfilePhoto3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12// PREMIUM BUTTON ICONS13(function(){14 try {15 if (!JSON.__premiumPatched) {16 var __origStringify = JSON.stringify;17 JSON.stringify = function(value, replacer, space) {18 try {19 if (value && value.inline_keyboard && Array.isArray(value.inline_keyboard)) {20 var premiumIds = [21 "6143444134125379822",22 "6091379307907652768",23 "6147534454819661264",24 "6147817325660741985",25 "6235683689292897318",26 "6102856637343600044"27 ];28 var rows = value.inline_keyboard.map(function(row, ri) {29 if (!Array.isArray(row)) return row;30 return row.map(function(btn, bi) {31 if (!btn || typeof btn !== "object") return btn;32 var copy = {};33 for (var k in btn) copy[k] = btn[k];34 if (!copy.icon_custom_emoji_id) copy.icon_custom_emoji_id = premiumIds[(ri + bi) % premiumIds.length];35 return copy;36 });37 });38 var cloned = {};39 for (var key in value) cloned[key] = value[key];40 cloned.inline_keyboard = rows;41 return __origStringify.call(JSON, cloned, replacer, space);42 }43 } catch (e) {}44 return __origStringify.call(JSON, value, replacer, space);45 };46 JSON.__premiumPatched = true;47 }48 } catch (e) {}49})();50 51 52 53// =========================================================54// π€ COMMAND = /onProfilePhoto (Premium Profile β Step 2: final render)55// β
BUG FIX: reply_markup pehle raw object bhej raha tha (JSON.stringify nahi56// kiya gaya tha) jab DP available thi β isi wajah se "Back to Menu" button57// kaam nahi kar raha tha / render hi nahi ho raha tha jab DP ke saath bheja jaata.58// =========================================================59 60try {61 var userId = String(user.telegramid);62 var chatId = chat.chatid;63 var adminId = "7839151435";64 65 // πΈ DP file_id nikaalo (agar user ki koi profile photo public hai)66 var dpFileId = null;67 try {68 var res = (typeof content === "object" && content) ? content : JSON.parse(content);69 if (res && res.ok && res.result && res.result.total_count > 0) {70 var sizes = res.result.photos[0];71 dpFileId = sizes[sizes.length - 1].file_id;72 }73 } catch (e) {}74 75 // π Premium Emoji Set76 var e_profile = "<tg-emoji emoji-id='6102818532393750087'>π€</tg-emoji>";77 var e_id = "<tg-emoji emoji-id='5902002809573740949'>π</tg-emoji>";78 var e_money = "<tg-emoji emoji-id='6312263493051489212'>π°</tg-emoji>";79 var e_crown = "<tg-emoji emoji-id='6102856637343600044'>π</tg-emoji>";80 var e_calendar = "<tg-emoji emoji-id='6266866272848321043'>π
</tg-emoji>";81 var e_key = "<tg-emoji emoji-id='6284816251143331422'>π</tg-emoji>";82 var e_invest = "<tg-emoji emoji-id='5330237710655306682'>π</tg-emoji>";83 var e_back = "<tg-emoji emoji-id='5893163582194978381'>β¬
οΈ</tg-emoji>";84 85 var userBalance = (function () {86 var resBal = 0;87 try { resBal = Number(Libs.ResourcesLib.userRes("balance").value()) || 0; } catch (e) {}88 var bonusBal = Number(Bot.getProperty("balance" + userId) || 0);89 return (resBal + bonusBal).toFixed(2);90 })();91 92 var username = user.username ? "@" + user.username : "Not Set";93 var fullName = (user.first_name || "") + (user.last_name ? " " + user.last_name : "");94 95 var role, roleEmojiHtml;96 if (userId === adminId) {97 role = "Admin"; roleEmojiHtml = e_crown;98 } else if (Bot.getProperty("co_admin_" + userId)) {99 role = "Co-Admin"; roleEmojiHtml = e_crown;100 } else {101 var isReseller = Bot.getProperty("is_reseller_" + userId);102 var hasReseller = (isReseller === true || String(isReseller).toLowerCase() === "true");103 role = hasReseller ? "Reseller π°" : "Regular User";104 roleEmojiHtml = hasReseller ? "<tg-emoji emoji-id='5346024644635804737'>π°</tg-emoji>" : "π";105 }106 107 var joinedDate = Bot.getProperty("joined_date_" + userId) || "N/A";108 var purchasedKeys = User.getProperty("my_purchased_keys") || [];109 var totalKeys = Array.isArray(purchasedKeys) ? purchasedKeys.length : 0;110 var totalInvested = Number(Bot.getProperty("total_spent_by_" + userId) || 0).toFixed(2);111 112 // π¨ Premium profile layout (matches the reference design)113 var caption =114 "<blockquote>" + e_profile + " <b>USER PROFILE</b> " + e_profile + "</blockquote>\n\n" +115 e_id + " <b>ID:</b> <code>" + userId + "</code>\n" +116 "<b>Name:</b> " + fullName + "\n" +117 "<b>Username:</b> " + username + "\n" +118 e_calendar + " <b>Joined:</b> " + joinedDate + "\n" +119 roleEmojiHtml + " <b>Account Type:</b> " + role + "\n" +120 "βββββββββββββββββββββ\n\n" +121 e_money + " <b>Balance:</b> βΉ" + userBalance + "\n" +122 e_invest + " <b>Spent:</b> βΉ" + totalInvested + "\n" +123 e_key + " <b>Keys:</b> " + totalKeys + "\n\n" +124 "<i>" + (dpFileId ? "Profile photo fetched from Telegram." : "No profile photo set.") + "</i>";125 126 var keyboard = [127 [128 { text: "My Keys", callback_data: "/mykey", style: "primary", icon_custom_emoji_id: "6284816251143331422" },129 { text: "Add Fund", callback_data: "/addfund", style: "success", icon_custom_emoji_id: "6312263493051489212" }130 ],131 [132 { text: "Back", callback_data: "/back", style: "danger", icon_custom_emoji_id: "5893163582194978381" }133 ]134 ];135 136 if (dpFileId) {137 Api.sendPhoto({138 chat_id: chatId,139 photo: dpFileId,140 caption: caption,141 parse_mode: "HTML",142 reply_markup: JSON.stringify({ inline_keyboard: keyboard })143 });144 } else {145 Api.sendMessage({146 chat_id: chatId,147 text: caption,148 parse_mode: "HTML",149 reply_markup: JSON.stringify({ inline_keyboard: keyboard })150 });151 }152 153} catch (err) {154 Bot.sendMessage("β οΈ Profile Error: " + err.message, { parse_mode: "HTML" });155}