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 7h agoCreated Oct 30, 2026
commands/_onDeepLinkPlanShow.js
javascript Β· 152 lines
1/**#command2name: /onDeepLinkPlanShow3answer: 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 53try {54 var userId = user.telegramid;55 var chatId = User.getProperty("dl_wait_chatid") || chat.chatid;56 var loadingMsgId = User.getProperty("dl_wait_msgid");57 var matchedIdx = Number(User.getProperty("dl_wait_prodidx"));58 59 var productList = Bot.getProperty("stored_products") || [];60 var product = productList[matchedIdx];61 62 if (!product) {63 Bot.sendMessage("β οΈ Product data mismatch, dobara try karein.");64 return;65 }66 67 var isResellerDL = Bot.getProperty("is_reseller_" + userId) === true;68 var planButtons = [];69 var planLines = [];70 var plans = product.plans || [];71 72 if (plans.length === 0) {73 plans = [74 { days: "1", unit: "day", durationDisplay: "1 Day", normal_price: "79", reseller_price: "65" },75 { days: "7", unit: "day", durationDisplay: "7 Days", normal_price: "350", reseller_price: "300" }76 ];77 }78 79 for (var j = 0; j < plans.length; j++) {80 var plan = plans[j];81 var planUnit = plan.unit || "day";82 var cleanProdName = product.name.trim().toUpperCase();83 var cleanPlanDays = String(plan.days).replace(/[^0-9.]/g, "").trim();84 85 var priceKeySuffix = planUnit === "day" ? cleanPlanDays : (cleanPlanDays + "_" + planUnit);86 var normalKey = "price_normal_" + cleanProdName + "_" + priceKeySuffix;87 var resellerKey = "price_reseller_" + cleanProdName + "_" + priceKeySuffix;88 var adminNormalPrice = Bot.getProperty(normalKey);89 var adminResellerPrice = Bot.getProperty(resellerKey);90 var currentNormal = (adminNormalPrice !== undefined && adminNormalPrice !== null) ? adminNormalPrice : plan.normal_price;91 var currentReseller = (adminResellerPrice !== undefined && adminResellerPrice !== null) ? adminResellerPrice : plan.reseller_price;92 var baseDisplayPrice = isResellerDL ? Number(currentReseller) : Number(currentNormal);93 94 var memberPriceKey = "member_custom_price_" + userId + "_" + cleanProdName.replace(/[^A-Z0-9_-]/g, "_") + "_" + (planUnit === "day" ? cleanPlanDays : (cleanPlanDays + "_hour"));95 var memberCustomPrice = Bot.getProperty(memberPriceKey);96 var hasMemberCustomPrice = memberCustomPrice !== undefined && memberCustomPrice !== null && isFinite(Number(memberCustomPrice));97 var displayPrice = hasMemberCustomPrice ? Number(memberCustomPrice) : baseDisplayPrice;98 99 var durationLabel = plan.durationDisplay || (cleanPlanDays + " " + (planUnit === "hour" ? (Number(cleanPlanDays) === 1 ? "Hour" : "Hours") : (planUnit === "minute" ? (Number(cleanPlanDays) === 1 ? "Minute" : "Minutes") : (Number(cleanPlanDays) === 1 ? "Day" : "Days"))));100 var priceEmoji = "<tg-emoji emoji-id='6147565374289220368'>π²</tg-emoji>";101 var durationEmoji = "<tg-emoji emoji-id='6147565374289220368'>β±οΈ</tg-emoji>";102 planLines.push(priceEmoji + " <b>βΉ" + Number(displayPrice).toFixed(2) + "</b> β " + durationEmoji + " <b>" + durationLabel.toUpperCase() + "</b>" + (hasMemberCustomPrice ? " π€" : ""));103 104 planButtons.push([{105 text: durationLabel.toUpperCase() + " β βΉ" + Number(displayPrice).toFixed(2),106 callback_data: "/buyitem " + matchedIdx + " " + j,107 style: "success",108 icon_custom_emoji_id: "6147565374289220368"109 }]);110 }111 112 planButtons.push([{113 text: "Back to Products",114 callback_data: "/buy_hack",115 style: "danger",116 icon_custom_emoji_id: "5893163582194978381"117 }]);118 119 var productEmojiId = product.emoji || "6266967801580231067";120 121 var productDLMsg =122 "<blockquote>π <b>" + product.name.toUpperCase() + "</b> π</blockquote>\n\n" +123 "<blockquote>π <b>Your Account Tier: " + (isResellerDL ? "RESELLER" : "USER") + "</b></blockquote>\n\n" +124 "π <b>Choose your access plan:</b>\n\n" +125 planLines.join("\n") + "\n\n" +126 "<blockquote>π <i>Tap any plan below to continue</i></blockquote>";127 128 if (loadingMsgId) {129 Api.editMessageText({130 chat_id: String(chatId),131 message_id: Number(loadingMsgId),132 text: productDLMsg,133 parse_mode: "HTML",134 reply_markup: JSON.stringify({ inline_keyboard: planButtons })135 });136 } else {137 Api.sendMessage({138 chat_id: String(chatId),139 text: productDLMsg,140 parse_mode: "HTML",141 reply_markup: JSON.stringify({ inline_keyboard: planButtons })142 });143 }144 145 // cleanup146 User.setProperty("dl_wait_msgid", null, "number");147 User.setProperty("dl_wait_prodidx", null, "number");148 User.setProperty("dl_wait_chatid", null, "string");149 150} catch (err) {151 Bot.sendMessage("β οΈ Delay Callback Error: " + err.message);152}