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

javascript · 64 lines

Raw
1/**#command2name: /confirm_delete_stock3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12try {13  var ADMIN_ID = "8963001413";14  if (String(user.telegramid) !== ADMIN_ID) return;15 16  if (!params) return;17  var catSlug = params.trim().toLowerCase();18 19  var categories = Bot.getProperty("ff_categories") || {};20  21  // Stock data clean logic dono references se22  var oldStock = categories[catSlug] && categories[catSlug].stock_list ? categories[catSlug].stock_list : (Bot.getProperty("ff_stock_" + catSlug) || []);23  var totalRemoved = Array.isArray(oldStock) ? oldStock.length : 0;24 25  // 1. Clear from separate property26  Bot.setProperty("ff_stock_" + catSlug, [], "json");27 28  // 2. Clear inside ff_categories property (if exists)29  if (categories[catSlug]) {30    categories[catSlug].stock_list = [];31    Bot.setProperty("ff_categories", categories, "json");32  }33 34  // Purane confirmation message ko edit karke success message dikhana35  var queryId = request.id || (request.callback_query && request.callback_query.id);36  37  var successText = "<blockquote><tg-emoji emoji-id='6267140231632262769'>✨</tg-emoji> <b>STOCK PURGED SUCCESSFULLY</b></blockquote>\n" +38                    "━━━━━━━━━━━━━━━━━━━━━━━━━━\n\n" +39                    "📂 <b>Category Slug:</b> <code>" + catSlug.toUpperCase() + "</code>\n" +40                    "🗑 <b>Removed Count:</b> <code>" + totalRemoved + " Items</code>\n\n" +41                    "━━━━━━━━━━━━━━━━━━━━━━━━━━\n" +42                    "✅ <i>All stock has been permanently wiped from the database.</i>";43 44  HTTP.post({45    url: "https://api.telegram.org/bot" + bot.token + "/editMessageText",46    body: {47      chat_id: chat.chatid,48      message_id: request.message.message_id,49      text: successText,50      parse_mode: "HTML"51    }52  });53 54  if (queryId) {55    Api.answerCallbackQuery({56      callback_query_id: String(queryId),57      text: "🗑️ Stock cleared completely!",58      show_alert: false59    });60  }61 62} catch (e) {63  Bot.sendMessage("Delete Callback Error: " + e.message);64}