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

javascript · 135 lines

Raw
1/**#command2name: /ff_id_menu3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12try {13 14  // Answer Callback safely15  if (request && request.id) {16    try {17      Api.answerCallbackQuery({ callback_query_id: request.id });18    } catch (e) {}19  } else if (request && request.callback_query && request.callback_query.id) {20    try {21      Api.answerCallbackQuery({ callback_query_id: request.callback_query.id });22    } catch (e) {}23  }24 25  // Safe Chat ID Selection26  var targetChatId = (chat && chat.chatid) ? chat.chatid : ((chat && chat.id) ? chat.id : user.telegramid);27 28  var categories = Bot.getProperty("ff_categories") || {};29  var inlineButtons = [];30  var hasCategories = false;31 32  for (var slug in categories) {33    if (!categories.hasOwnProperty(slug)) continue;34 35    hasCategories = true;36 37    var item = categories[slug];38    var stock = Bot.getProperty("ff_stock_" + slug) || [];39 40    if (!Array.isArray(stock)) stock = [];41 42    var buttonText = item.name;43    var buttonStyle = "primary"; // Default Blue Color44 45    if (stock.length === 0) {46      buttonText += " [OUT OF STOCK]";47      buttonStyle = "danger"; // Native Red Color48    } else {49      buttonText += " [Stock: " + stock.length + "]";50      buttonStyle = "success"; // Native Green Color51    }52 53    // Dynamic Emoji ID: Admin jo ID save karega, exact wahi inject hogi.54    var adminPremiumEmojiId = item.emoji_id || "5334890573281114250";55 56    inlineButtons.push([57      {58        text: buttonText,59        callback_data: "/select_id_product " + slug,60        style: buttonStyle,                         61        icon_custom_emoji_id: adminPremiumEmojiId   62      }63    ]);64  }65 66  // Agar categories na ho toh Danger (Red) Button67  if (!hasCategories) {68    inlineButtons.push([69      {70        text: "⚠️ No Platforms Active",71        callback_data: "/back",72        style: "danger"73      }74    ]);75  }76 77  // ✅ UPDATED: Back button styled to Primary (Blue) with your specific Premium Emoji ID78  inlineButtons.push([79    {80      text: "Back to Dashboard",81      callback_data: "/back",82      style: "primary",83      icon_custom_emoji_id: "5893163582194978381"84    }85  ]);86 87  // 📊 Live stats footer88  var totalCategories = 0;89  var totalStockAll = 0;90  for (var s in categories) {91    if (!categories.hasOwnProperty(s)) continue;92    totalCategories++;93    var st = Bot.getProperty("ff_stock_" + s) || [];94    if (Array.isArray(st)) totalStockAll += st.length;95  }96 97  var text =98    "<blockquote><b><tg-emoji emoji-id='6080228009439141516'>🎮</tg-emoji> FF ID STORE — SELECT A PLATFORM <tg-emoji emoji-id='6093854128193152827'>🔥</tg-emoji></b>\n\n" +99    "<i>Browse our available categories below. Instant delivery, verified accounts.</i></blockquote>\n" +100    "━━━━━━━━━━━━━━━━━━━━━\n" +101    "<tg-emoji emoji-id='6080214566191505147'>📦</tg-emoji> <b>Categories:</b> <code>" + totalCategories + "</code>   " +102    "<tg-emoji emoji-id='6091571559233755994'>📥</tg-emoji> <b>Total Stock:</b> <code>" + totalStockAll + " accounts</code>\n" +103    "━━━━━━━━━━━━━━━━━━━━━";104 105  var targetMessageId = (request && request.message) ? request.message.message_id : null;106 107  var replyMarkupObj = {108    inline_keyboard: inlineButtons109  };110 111  if (targetMessageId) {112    Api.editMessageText({113      chat_id: targetChatId,114      message_id: targetMessageId,115      text: text,116      parse_mode: "HTML",117      reply_markup: JSON.stringify(replyMarkupObj)118    });119  } else {120    Api.sendMessage({121      chat_id: targetChatId,122      text: text,123      parse_mode: "HTML",124      reply_markup: JSON.stringify(replyMarkupObj)125    });126  }127 128} catch (e) {129  var errorChatId = (chat && chat.chatid) ? chat.chatid : user.telegramid;130  Api.sendMessage({131    chat_id: errorChatId,132    text: "❌ Error structure:\n<code>" + e.message + "</code>",133    parse_mode: "HTML"134  });135}