ashoksarande3/ASHOK_HACK_STORE_BOTPublic ยท Bot Template
AIThis bot operates as a commercial storefront for selling Free Fire game hacks and cheats via UPI QR code payments. It features a dynamic pricing system with separate normal and reseller prices, product plans with flexible durations (days, hours, minutes), and a reseller program requiring a one-time upgrade fee. The bot handles payment verification through QR code generation and expiry tracking, user verification via Telegram contact sharing, and admin tools for stock management, plan creation, and ownership transfer. It includes a balance system, maintenance mode, and Telegram Stars payment fallback. The codebase uses TeleBotHost's TBL JavaScript APIs (Bot, Api, HTTP, db properties, Libs) for all logic.
commands/_coupons.js
javascript ยท 89 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") || "8660373585";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 var couponMarkup = JSON.stringify({ inline_keyboard: buttons });56 var couponQueryId = request ? (request.id || (request.callback_query && request.callback_query.id)) : null;57 if (couponQueryId) {58 try { Api.answerCallbackQuery({ callback_query_id: String(couponQueryId) }); } catch (e) {}59 }60 61 if (request && request.message && request.message.message_id && !request.message.photo) {62 try {63 Api.editMessageText({64 chat_id: chat.chatid,65 message_id: Number(request.message.message_id),66 text: text,67 parse_mode: "HTML",68 reply_markup: couponMarkup69 });70 } catch (e) {71 Api.sendMessage({72 chat_id: chat.chatid,73 text: text,74 parse_mode: "HTML",75 reply_markup: couponMarkup76 });77 }78 } else {79 Api.sendMessage({80 chat_id: chat.chatid,81 text: text,82 parse_mode: "HTML",83 reply_markup: couponMarkup84 });85 }86 87} catch (err) {88 Bot.sendMessage("โ ๏ธ Error: " + err.message);89}