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/_apply_coupon.js

javascript · 50 lines

Raw
1/**#command2name: /apply_coupon3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12// =========================================================13// ⭐ USER — "Apply Coupon Code" button handler14// Prompts the user for a coupon code; _start.js MODULE 4 handles the reply.15// =========================================================16 17try {18  var parts = params ? String(params).trim().split(" ") : [];19  var prodIdx = parts[0];20  var planIdx = parts[1];21 22  User.setProperty("awaiting_coupon_for", prodIdx + " " + planIdx, "string");23 24  var text =25    "<blockquote><tg-emoji emoji-id='6093677128295914531'>🎫</tg-emoji> <b>APPLY COUPON CODE</b></blockquote>\n\n" +26    "<i>Apna coupon code type karke bhejein...</i>";27 28  if (request && request.message) {29    try {30      Api.editMessageText({31        chat_id: String(chat.chatid),32        message_id: Number(request.message.message_id),33        text: text,34        parse_mode: "HTML"35      });36    } catch (e) {37      Api.sendMessage({ chat_id: chat.chatid, text: text, parse_mode: "HTML" });38    }39  } else {40    Api.sendMessage({ chat_id: chat.chatid, text: text, parse_mode: "HTML" });41  }42 43  var queryId = request ? (request.id || (request.callback_query && request.callback_query.id)) : null;44  if (queryId) {45    try { Api.answerCallbackQuery({ callback_query_id: String(queryId) }); } catch (e) {}46  }47 48} catch (err) {49  Bot.sendMessage("⚠️ Error: " + err.message);50}