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/_coupons.js
javascript · 64 lines
1/**#command2name: /coupons3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12// =========================================================13// 🎟 ADMIN/CO-ADMIN — View all coupons with usage stats + Pause/Resume/Delete14// =========================================================15 16try {17 var ownerId = Bot.getProperty("owner_id") || "7839151435";18 var isCoAdmin = Bot.getProperty("co_admin_" + String(chat.chatid));19 if (String(chat.chatid) !== ownerId && !isCoAdmin) {20 Bot.sendMessage("❌ Restricted command!");21 return;22 }23 24 var couponList = Bot.getProperty("coupon_list") || [];25 26 if (couponList.length === 0) {27 Bot.sendMessage("<blockquote>🎟 <b>No coupons created yet.</b>\n<i>Use /gencoupon to create one.</i></blockquote>", { parse_mode: "HTML" });28 return;29 }30 31 var text = "<blockquote>🎟 <b>ALL COUPONS</b></blockquote>\n━━━━━━━━━━━━━━━━━━━━━\n\n";32 var buttons = [];33 34 for (var i = 0; i < couponList.length; i++) {35 var code = couponList[i];36 var c = Bot.getProperty("coupon_" + code);37 if (!c) continue;38 39 var claimedCount = Array.isArray(c.claimedBy) ? c.claimedBy.length : 0;40 var statusLabel = c.isPaused ? "⏸ Paused" : "✅ Active";41 var scopeLabel = c.scope === "global" ? "🌍 Global" : "📦 " + (c.productName || "?") + " (" + (c.duration || "?") + ")";42 43 text += "🏷 <b>" + code + "</b> — " + statusLabel + "\n" +44 "💸 " + c.discountPercent + "% off | 👥 " + claimedCount + "/" + c.maxClaims + " claimed\n" +45 scopeLabel + "\n\n";46 47 buttons.push([48 { text: (c.isPaused ? "▶ Resume" : "⏸ Pause") + " " + code, callback_data: "/pause_coupon " + code, style: c.isPaused ? "success" : "primary" },49 { text: "🗑 Delete " + code, callback_data: "/delete_coupon " + code, style: "danger" }50 ]);51 }52 53 buttons.push([{ text: "Back to Admin Panel", callback_data: "/admin", style: "primary", icon_custom_emoji_id: "5893163582194978381" }]);54 55 Api.sendMessage({56 chat_id: chat.chatid,57 text: text,58 parse_mode: "HTML",59 reply_markup: JSON.stringify({ inline_keyboard: buttons })60 });61 62} catch (err) {63 Bot.sendMessage("⚠️ Error: " + err.message);64}