ayushyadav7970824760/goldensellingstore_botPublic · Bot Template
AIThis Telegram store bot lets customers browse digital products and plans, apply coupons, add funds via UPI, and receive purchased keys. It includes a full admin panel for managing products, reordering items, setting reseller prices, viewing and removing key stock, configuring UPI payment details and update links, and checking user balances. Co-admins and resellers are supported, and support tickets are forwarded to the admin.
Commercedigital_storeadmin_panelupi_paymentsresellercouponskey_stock
146 commands0 envUpdated 2d agoCreated Sep 5, 2026
commands/_history_receipt.js
javascript · 94 lines
1/**#command2name: /history_receipt3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12// =========================================================13// 🧾 Sends the user's full purchase history as a downloadable .txt file14// =========================================================15 16try {17 var userId = String(user.telegramid);18 var chatId = chat.chatid;19 var userKeys = User.getProperty("my_purchased_keys") || [];20 // ✅ Manual "Give Key" deliveries bhi receipt me shamil karo (same fix as /mykey)21 var manualKeysR = Bot.getProperty("manual_key_history_" + String(chatId)) || [];22 if (!Array.isArray(userKeys)) { userKeys = []; }23 if (Array.isArray(manualKeysR)) { userKeys = userKeys.concat(manualKeysR); }24 25 if (userKeys.length === 0) {26 Bot.sendMessage("<blockquote>🧾 <b>No purchase history found!</b>\n<i>Aapne abhi tak kuch bhi buy nahi kiya.</i></blockquote>", { parse_mode: "HTML" });27 return;28 }29 30 var lines = [];31 lines.push("=========================================");32 lines.push(" GOLDEN MODS STORE PANEL — PURCHASE RECEIPT");33 lines.push("=========================================");34 lines.push("User ID : " + userId);35 lines.push("Name : " + ((user.first_name || "") + (user.last_name ? " " + user.last_name : "")));36 lines.push("Username : " + (user.username ? "@" + user.username : "N/A"));37 lines.push("Generated : " + new Date().toLocaleString());38 lines.push("Total Orders: " + userKeys.length);39 lines.push("=========================================\n");40 41 var totalSpent = 0;42 for (var i = 0; i < userKeys.length; i++) {43 var k = userKeys[i];44 var pName = k.productName || k.product || "N/A";45 var pPrice = Number(k.cost || k.price || 0);46 var pKey = k.key || "N/A";47 var pDays = k.days || "N/A";48 var pDate = k.date || "N/A";49 totalSpent += pPrice;50 51 lines.push("Order #" + (i + 1));52 lines.push("-----------------------------------------");53 lines.push("Product : " + pName);54 lines.push("Duration : " + pDays);55 lines.push("Price : Rs. " + pPrice.toFixed(2));56 lines.push("Key : " + pKey);57 lines.push("Date : " + pDate);58 lines.push("");59 }60 61 lines.push("=========================================");62 lines.push("Total Amount Spent: Rs. " + totalSpent.toFixed(2));63 lines.push("=========================================");64 lines.push("Thank you for shopping with GOLDEN MODS STORE PANEL!");65 66 var receiptText = lines.join("\n");67 68 Api.sendDocument({69 chat_id: chatId,70 document: {71 content: receiptText,72 filename: "Receipt_" + userId + ".txt"73 },74 caption: "<blockquote>🧾 <b>YOUR PURCHASE RECEIPT</b></blockquote>\n<i>Poori purchase history is file me hai.</i>",75 parse_mode: "HTML"76 });77 78 Api.sendMessage({79 chat_id: chatId,80 text: "<i>Receipt file bheji gayi hai upar 👆</i>",81 parse_mode: "HTML",82 reply_markup: JSON.stringify({83 inline_keyboard: [[84 { text: "Back to Menu", callback_data: "/back", style: "danger" }85 ]]86 })87 });88 89 var queryId = request ? (request.id || (request.callback_query && request.callback_query.id)) : null;90 if (queryId) { try { Api.answerCallbackQuery({ callback_query_id: String(queryId) }); } catch (e) {} }91 92} catch (err) {93 Bot.sendMessage("⚠️ Receipt Error: " + err.message, { parse_mode: "HTML" });94}