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

javascript · 109 lines

Raw
1/**#command2name: /buy_hack3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12// =========================================================13// 🛒 SHOP MENU — Product listing (entry point of the whole buy flow)14// ✅ BUG FIX: reply_markup pehle raw object bheja jaa raha tha (JSON.stringify15// missing) — is wajah se product buttons kabhi kabhi properly render/work16// nahi karte the, jisse poora buy flow shuru hone se pehle hi tootta tha.17// ✅ BUG FIX: photo-message (jaise Profile) se yahan aane par editMessageText18// fail ho jaata — ab photo detect hoke delete + fresh send hota hai.19// ✅ Premium redesign.20// =========================================================21 22try {23  var rawData = Bot.getProperty("stored_products");24  var productList = [];25 26  if (Array.isArray(rawData)) {27    productList = rawData;28  } else if (typeof rawData === "string") {29    try {30      productList = JSON.parse(rawData);31      if (!Array.isArray(productList)) { productList = []; }32    } catch (e) {33      productList = [];34    }35  }36 37  // Agar list bilkul khali hai toh ek default product dal do taaki store khali na dikhe38  if (productList.length === 0) {39    productList.push({40      name: "Drip Client (Non Root)",41      emoji: "5226656353744862682",42      id: "1",43      plans: []44    });45    Bot.setProperty("stored_products", productList, "json");46  }47 48  var chatId = chat.chatid;49  var firstName = user && user.first_name ? user.first_name : "User";50  var productButtons = [];51 52  for (var i = 0; i < productList.length; i++) {53    var item = productList[i];54    var itemName = (item && item.name) ? String(item.name) : "Product " + (i + 1);55    var itemEmoji = (item && item.emoji) ? String(item.emoji) : "5226656353744862682";56    var stockBadge = "";57 58    productButtons.push([59      {60        text: itemName,61        callback_data: "/viewprod " + i,62        style: "primary",63        icon_custom_emoji_id: itemEmoji64      }65    ]);66  }67 68  productButtons.push([69    {70      text: "Back to Menu",71      callback_data: "/back",72      style: "danger",73      icon_custom_emoji_id: "5893163582194978381"74    }75  ]);76 77  var storeText =78    "<blockquote>🛒 <b>SELECT A PRODUCT</b> ✨</blockquote>\n" +79    "━━━━━━━━━━━━━━━━━━━━━\n\n" +80    "<tg-emoji emoji-id='6091571559233755994'>👋</tg-emoji> <b>Yoo " + firstName + "!</b>\n" +81    "<i>Choose any product below to view its price and available duration plans.</i>\n" +82    "━━━━━━━━━━━━━━━━━━━━━";83 84  var replyMarkupStr = JSON.stringify({ inline_keyboard: productButtons });85 86  if (request && request.message && request.message.message_id) {87    if (request.message.photo) {88      try { Api.deleteMessage({ chat_id: chatId, message_id: request.message.message_id }); } catch (e) {}89      Api.sendMessage({ chat_id: chatId, text: storeText, parse_mode: "HTML", reply_markup: replyMarkupStr });90    } else {91      Api.editMessageText({92        chat_id: chatId,93        message_id: request.message.message_id,94        text: storeText,95        parse_mode: "HTML",96        reply_markup: replyMarkupStr97      });98    }99  } else {100    Api.sendMessage({ chat_id: chatId, text: storeText, parse_mode: "HTML", reply_markup: replyMarkupStr });101  }102 103  if (request && request.id) {104    try { Api.answerCallbackQuery({ callback_query_id: request.id }); } catch (e) {}105  }106 107} catch (err) {108  Bot.sendMessage("⚠️ Shop Menu Error: " + err.message, { parse_mode: "HTML" });109}