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/_history_receipt.js
javascript Β· 131 lines
1/**#command2name: /history_receipt3answer: 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// π§Ύ Sends the user's full purchase history as a downloadable .txt file55// =========================================================56 57try {58 var userId = String(user.telegramid);59 var chatId = chat.chatid;60 var userKeys = User.getProperty("my_purchased_keys") || [];61 62 if (userKeys.length === 0) {63 Bot.sendMessage("<blockquote>π§Ύ <b>No purchase history found!</b>\n<i>Aapne abhi tak kuch bhi buy nahi kiya.</i></blockquote>", { parse_mode: "HTML" });64 return;65 }66 67 var lines = [];68 lines.push("=========================================");69 lines.push(" ππ πππππ β PURCHASE RECEIPT");70 lines.push("=========================================");71 lines.push("User ID : " + userId);72 lines.push("Name : " + ((user.first_name || "") + (user.last_name ? " " + user.last_name : "")));73 lines.push("Username : " + (user.username ? "@" + user.username : "N/A"));74 lines.push("Generated : " + new Date().toLocaleString());75 lines.push("Total Orders: " + userKeys.length);76 lines.push("=========================================\n");77 78 var totalSpent = 0;79 for (var i = 0; i < userKeys.length; i++) {80 var k = userKeys[i];81 var pName = k.productName || k.product || "N/A";82 var pPrice = Number(k.cost || k.price || 0);83 var pKey = k.key || "N/A";84 var pDays = k.days || "N/A";85 var pDate = k.date || "N/A";86 totalSpent += pPrice;87 88 lines.push("Order #" + (i + 1));89 lines.push("-----------------------------------------");90 lines.push("Product : " + pName);91 lines.push("Duration : " + pDays);92 lines.push("Price : Rs. " + pPrice.toFixed(2));93 lines.push("Key : " + pKey);94 lines.push("Date : " + pDate);95 lines.push("");96 }97 98 lines.push("=========================================");99 lines.push("Total Amount Spent: Rs. " + totalSpent.toFixed(2));100 lines.push("=========================================");101 lines.push("Thank you for shopping with ππ πππππ!");102 103 var receiptText = lines.join("\n");104 105 Api.sendDocument({106 chat_id: chatId,107 document: {108 content: receiptText,109 filename: "Receipt_" + userId + ".txt"110 },111 caption: "<blockquote>π§Ύ <b>YOUR PURCHASE RECEIPT</b></blockquote>\n<i>Poori purchase history is file me hai.</i>",112 parse_mode: "HTML"113 });114 115 Api.sendMessage({116 chat_id: chatId,117 text: "<i>Receipt file bheji gayi hai upar π</i>",118 parse_mode: "HTML",119 reply_markup: JSON.stringify({120 inline_keyboard: [[121 { text: "Back to Menu", callback_data: "/back", style: "primary", icon_custom_emoji_id: "5893163582194978381" }122 ]]123 })124 });125 126 var queryId = request ? (request.id || (request.callback_query && request.callback_query.id)) : null;127 if (queryId) { try { Api.answerCallbackQuery({ callback_query_id: String(queryId) }); } catch (e) {} }128 129} catch (err) {130 Bot.sendMessage("β οΈ Receipt Error: " + err.message, { parse_mode: "HTML" });131}