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_rem_prod.js

javascript · 68 lines

Raw
1/**#command2name: /confirm_rem_prod3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12try {13  var adminId = "7839151435";14  if (String(chat.chatid) !== adminId) return;15 16  var callbackId = request ? request.id : null;17  var targetIndex = params ? Number(params.trim()) : -1;18 19  if (targetIndex === -1 || isNaN(targetIndex)) {20    if (callbackId) Api.answerCallbackQuery({ callback_query_id: callbackId, text: "❌ Invalid product data index!", show_alert: true });21    return;22  }23 24  var productList = Bot.getProperty("stored_products") || [];25 26  if (productList.length === 0 || targetIndex >= productList.length) {27    if (callbackId) {28      Api.answerCallbackQuery({ callback_query_id: callbackId, text: "❌ Product already removed or missing!", show_alert: true });29    }30    return;31  }32 33  // Target product ko data array se nikalna (Delete execution)34  var removedProduct = productList[targetIndex];35  var removedName = removedProduct.name;36  37  productList.splice(targetIndex, 1); // Array modification38 39  // Updated array registry ko re-save karna40  Bot.setProperty("stored_products", productList, "json");41 42  var successText = "<blockquote><b>🗑️ PRODUCT SUCCESSFULLY REMOVED</b>\n\n" +43                    "• <b>Product Name:</b> <code>" + removedName.toUpperCase() + "</code>\n" +44                    "• <b>Status:</b> Completely wiped from database matrix.\n" +45                    "• <b>Remaining Products:</b> <code>" + productList.length + " Left</code></blockquote>";46 47  // Message window ko live text update edit dena48  if (request && request.message) {49    HTTP.post({50      url: "https://api.telegram.org/bot" + bot.token + "/editMessageText",51      body: {52        chat_id: String(chat.chatid),53        message_id: Number(request.message.message_id),54        text: successText,55        parse_mode: "HTML"56      }57    });58  } else {59    Bot.sendMessage(successText, { parse_mode: "HTML" });60  }61 62  if (callbackId) {63    Api.answerCallbackQuery({ callback_query_id: callbackId, text: "✅ Product Wiped!" });64  }65 66} catch (err) {67  Bot.sendMessage("⚠️ Execution Error: " + err.message);68}