indrajitghosh20006/Testseller_01botPublic · Bot Template

ProfileTelegram

AIThis bot provides an admin‑controlled system for managing user balances, products, and reseller roles. It includes commands to add balances (via manual input, Binance Pay, or UPI), approve and credit payments, and set up product listings with categories and pricing. Admins can also add resellers, view reseller info, and manage stock entries. The bot uses built‑in TeleBotHost APIs such as Bot, Api, HTTP, and Libs for database operations and message handling.

Commerceadminbalanceproductresellerpaymentsbinance
138 commands0 envUpdated 17h agoCreated Sep 27, 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 = "7839151435";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}