devbro468/Dev_x_store_botPublic · Bot Template

AIThis bot operates a digital storefront (DEV X STORE) selling subscription-based products — likely game hacks, accounts, or access keys — categorized by platform (Android Root, Non-Root, iPhone). It features a reseller program with discounted pricing, a dual-currency wallet (INR balance + Telegram Stars/XTR), and a full admin/co-admin panel for managing products, plans, per-plan pricing, stock (keys/accounts), coupons, and API endpoints. Purchases flow through a plan selection screen offering wallet payment, Stars invoices (sendInvoice with XTR currency), and coupon application. Successful Stars payments are handled via successful_payment webhook, crediting wallet or delivering keys directly. Admin tools include user listing with chunked messaging, stock viewing/deletion with inline keyboards, co-admin management, and API registry updates. The bot registers users on first interaction and

Commercecommercedigital-goodsstars-paymentreseller-systemadmin-panelstock-management
ProfileTelegram
119 commands0 envUpdated 15d agoCreated Aug 23, 2026
Back to folder

commands/_coupons.js

javascript · 64 lines

Raw
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") || "8875810358";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}