kkapil9112/Hguuuuuv45botPublic · Bot Template

AITelegram commerce bot for an admin-managed digital store: admins create categories, products, time-based plans, stock entries and license keys, and can grant reseller roles or adjust user balances. End users can view their balance, start a deposit flow with an inline amount keypad, apply coupon codes, and navigate back to the store menu. It uses Bot properties for product/stock/coupon data and Libs.ResourcesLib for per-user balances.

Commercecommerceshopreselleradmin-panelbalanceproduct-management
ProfileTelegram
102 commands0 envUpdated 29d agoCreated Aug 7, 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 = "8812621370";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}