mansuriamaan803/SANJEEVFFSTORE_botPublic · Bot Template

AIThis bot is a commerce platform for selling digital products, primarily focused on FreeFire accounts and related services. It provides admin tools for managing products, categories, stock, reseller roles, and a balance system for user payments. Users can browse products, apply coupons, and check their balance through an interactive interface with premium emojis and inline keyboards.

Commercecommercestoreproductsresellerbalancecoupon
ProfileTelegram
102 commands0 envUpdated 12d agoCreated Aug 26, 2026
Back to folder

commands/_press.js

javascript · 154 lines

Raw
1/**#command2name: /press3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12// Command Name: /press (Premium Calculator Keypad Handler)13// ✅ FIXED: "Back" button pehle "/dmenu" call kar raha tha jo bot me exist hi nahi karta14// (dead button — click karne par kuch nahi hota tha). Ab "/back" (real menu command) use hota hai.15// ✅ Number buttons ab addfund screen jaisi hi blue "primary" styling ke saath hain (pehle plain/colorless the).16 17try {18  // Purana set default check: Agar user ne naya deposit shuru kiya hai toh default 0 rahe19  let current_amount = User.getProperty("deposit_amount");20  if (!current_amount) {21    current_amount = "0";22  }23 24  let pressed = params ? params.trim() : "";25  let queryId = request ? (request.id || (request.callback_query && request.callback_query.id)) : null;26 27  // 💎 Premium Emoji Set (same IDs as /addfund — keeps the screen visually identical, no flicker)28  let e_money   = "<tg-emoji emoji-id='6312263493051489212'>💰</tg-emoji>";29  let e_clear   = "<tg-emoji emoji-id='5348224471050238603'>✏</tg-emoji>";30  let e_confirm = "<tg-emoji emoji-id='5348191451341668809'>✅</tg-emoji>";31  let e_back    = "<tg-emoji emoji-id='5893163582194978381'>⬅️</tg-emoji>";32  let e_hour    = "<tg-emoji emoji-id='6100657257605763582'>✔️</tg-emoji>";33  let e_check   = "<tg-emoji emoji-id='6311870645277825763'>✔️</tg-emoji>";34  let e_gear    = "<tg-emoji emoji-id='5348292765325212780'>⚙</tg-emoji>";35 36  // --- CONFIRM BUTTON CLICK ---37  if (pressed == "confirm") {38    if (parseInt(current_amount) <= 0 || current_amount == "" || current_amount == "0") {39      if (queryId) {40        Api.answerCallbackQuery({41          callback_query_id: queryId,42          text: "👀 PLEASE ENTER A VALID AMOUNT!",43          show_alert: true44        });45      }46      return;47    }48 49    let generatingText =50      "<blockquote>" + e_gear + " <b>Generating QR Code for ₹" + current_amount + "...</b>\n" +51      "<i>Please wait a moment</i></blockquote>";52 53    Api.editMessageText({54      chat_id: chat.chatid,55      message_id: request.message.message_id,56      text: generatingText,57      parse_mode: "HTML"58    });59 60    // ✅ FIX: is "Generating..." message ka ID save karo taaki QR aane par (ya cancel61    // hone par) ye properly vanish ho sake, stale message ki tarah reh na jaaye.62    try {63      Bot.setProperty("gen_msg_id_" + user.telegramid, request.message.message_id, "string");64      User.setProperty("gen_msg_id_" + user.telegramid, request.message.message_id, "string");65    } catch (e) {}66 67    let finalAmount = String(parseInt(current_amount));68    let upiId = "mansuri-sarfaraz@fam";69 70    // Amount reset to 0 so next time it starts fresh71    User.setProperty("deposit_amount", "0", "string");72 73    HTTP.get({74      url: "https://fampay.anujbots.xyz/qr.php?upi=" + encodeURIComponent(upiId) + "&amount=" + encodeURIComponent(finalAmount),75      success: "/onQR",76      error: "/onApiError"77    });78 79    return;80  }81 82  // --- KEYPAD INPUT LOGIC ---83  if (pressed == "clear") {84    if (current_amount.length > 1) {85      current_amount = current_amount.slice(0, -1);86    } else {87      current_amount = "0";88    }89  } else if (pressed !== "") {90    if (current_amount == "0") {91      current_amount = pressed;92    } else {93      if ((current_amount + pressed).length <= 6) {94        current_amount = current_amount + pressed;95      }96    }97  }98 99  // Save current keypad amount state100  User.setProperty("deposit_amount", current_amount, "string");101 102  if (queryId) {103    Api.answerCallbackQuery({ callback_query_id: queryId });104  }105 106  // 🎨 Keypad Buttons — same premium colored styling as /addfund107  let inlineKeyboardPayload = [108    [109      { text: "1", callback_data: "/press 1", style: "primary" },110      { text: "2", callback_data: "/press 2", style: "primary" },111      { text: "3", callback_data: "/press 3", style: "primary" }112    ],113    [114      { text: "4", callback_data: "/press 4", style: "primary" },115      { text: "5", callback_data: "/press 5", style: "primary" },116      { text: "6", callback_data: "/press 6", style: "primary" }117    ],118    [119      { text: "7", callback_data: "/press 7", style: "primary" },120      { text: "8", callback_data: "/press 8", style: "primary" },121      { text: "9", callback_data: "/press 9", style: "primary" }122    ],123    [124      { text: "Clear", callback_data: "/press clear", style: "danger", icon_custom_emoji_id: "5348224471050238603" },125      { text: "0", callback_data: "/press 0", style: "primary" },126      { text: "Confirm", callback_data: "/press confirm", style: "success", icon_custom_emoji_id: "5348191451341668809" }127    ],128    [129      // ✅ FIXED: "/dmenu" -> "/back" (dead command replaced with the real menu handler)130      { text: "Back", callback_data: "/back", style: "danger", icon_custom_emoji_id: "5893163582194978381" }131    ]132  ];133 134  let keypadMsg =135    "<blockquote>" + e_money + " <b>ADD BALANCE — ENTER AMOUNT</b> <tg-emoji emoji-id='6312263493051489212'>💎</tg-emoji></blockquote>\n" +136    "━━━━━━━━━━━━━━━━━━━━━\n\n" +137    "<tg-emoji emoji-id='6312263493051489212'>💎</tg-emoji> <b>Amount:</b> ₹<code>" + current_amount + "</code>\n\n" +138    "━━━━━━━━━━━━━━━━━━━━━\n" +139    e_check + " <i>Instant Auto-Credit</i>\n" +140    "<tg-emoji emoji-id='6215386799133433653'>🔒</tg-emoji> <i>100% Secure UPI Payment</i>\n" +141    e_hour + " <i>Verified in Seconds</i>\n\n" +142    "<tg-emoji emoji-id='6100170496077204999'>👑</tg-emoji> <i>Use the keypad below to enter amount</i>";143 144  Api.editMessageText({145    chat_id: chat.chatid,146    message_id: request.message.message_id,147    text: keypadMsg,148    parse_mode: "HTML",149    reply_markup: JSON.stringify({ inline_keyboard: inlineKeyboardPayload })150  });151 152} catch (err) {153  Bot.sendMessage("⚠️ System Error in Keypad: " + err.message);154}