indrajitghosh20006/HgfhhuybotPublic · Bot Template
AIThis bot provides a command‑based admin interface for managing user balances, products, and resellers. It supports adding balances via UPI or Binance Pay, approving payments, and configuring product details and categories. The bot also handles user role changes, stock uploads, and offers a simple calculator UI for entering amounts. All interactions are handled through short commands and inline keyboards, with no long‑running listeners or external frameworks.
Utilityadminbalanceproductresellerpaymentupi
138 commands0 envUpdated 15h agoCreated Sep 27, 2026
commands/_history_receipt.js
javascript · 90 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 21 if (userKeys.length === 0) {22 Bot.sendMessage("<blockquote>🧾 <b>No purchase history found!</b>\n<i>Aapne abhi tak kuch bhi buy nahi kiya.</i></blockquote>", { parse_mode: "HTML" });23 return;24 }25 26 var lines = [];27 lines.push("=========================================");28 lines.push(" BADSHA STORE PANEL — PURCHASE RECEIPT");29 lines.push("=========================================");30 lines.push("User ID : " + userId);31 lines.push("Name : " + ((user.first_name || "") + (user.last_name ? " " + user.last_name : "")));32 lines.push("Username : " + (user.username ? "@" + user.username : "N/A"));33 lines.push("Generated : " + new Date().toLocaleString());34 lines.push("Total Orders: " + userKeys.length);35 lines.push("=========================================\n");36 37 var totalSpent = 0;38 for (var i = 0; i < userKeys.length; i++) {39 var k = userKeys[i];40 var pName = k.productName || k.product || "N/A";41 var pPrice = Number(k.cost || k.price || 0);42 var pKey = k.key || "N/A";43 var pDays = k.days || "N/A";44 var pDate = k.date || "N/A";45 totalSpent += pPrice;46 47 lines.push("Order #" + (i + 1));48 lines.push("-----------------------------------------");49 lines.push("Product : " + pName);50 lines.push("Duration : " + pDays);51 lines.push("Price : Rs. " + pPrice.toFixed(2));52 lines.push("Key : " + pKey);53 lines.push("Date : " + pDate);54 lines.push("");55 }56 57 lines.push("=========================================");58 lines.push("Total Amount Spent: Rs. " + totalSpent.toFixed(2));59 lines.push("=========================================");60 lines.push("Thank you for shopping with BADSHA STORE PANEL!");61 62 var receiptText = lines.join("\n");63 64 Api.sendDocument({65 chat_id: chatId,66 document: {67 content: receiptText,68 filename: "Receipt_" + userId + ".txt"69 },70 caption: "<blockquote>🧾 <b>YOUR PURCHASE RECEIPT</b></blockquote>\n<i>Poori purchase history is file me hai.</i>",71 parse_mode: "HTML"72 });73 74 Api.sendMessage({75 chat_id: chatId,76 text: "<i>Receipt file bheji gayi hai upar 👆</i>",77 parse_mode: "HTML",78 reply_markup: JSON.stringify({79 inline_keyboard: [[80 { text: "Back to Menu", callback_data: "/back", style: "primary", icon_custom_emoji_id: "5893163582194978381" }81 ]]82 })83 });84 85 var queryId = request ? (request.id || (request.callback_query && request.callback_query.id)) : null;86 if (queryId) { try { Api.answerCallbackQuery({ callback_query_id: String(queryId) }); } catch (e) {} }87 88} catch (err) {89 Bot.sendMessage("⚠️ Receipt Error: " + err.message, { parse_mode: "HTML" });90}