indrajitghosh20006/Testseller_01botPublic · Bot Template
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
commands/_rembal.js
javascript · 84 lines
1/**#command2name: /rembal3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12// ✅ FIXED (v3): dynamic owner_id + co-admin check (same fix as /addbal).13let admin_id = Bot.getProperty("owner_id") || "7839151435";14let requesterId = String(user.telegramid);15let isCoAdmin = Bot.getProperty("co_admin_" + requesterId);16 17if (requesterId === admin_id || isCoAdmin) {18 19 // ✅ FIXED: instantly ack the button press so it doesn't feel stuck/slow.20 if (request && request.id) {21 try {22 HTTP.post({23 url: "https://api.telegram.org/bot" + bot.token + "/answerCallbackQuery",24 body: { callback_query_id: request.id }25 });26 } catch (ackErr) {}27 }28 29 let params = (typeof message !== "undefined" && message) ? message.split(" ") : [];30 let data = params[1];31 32 // ✅ FIXED: same button-click bug as /addbal — ab prompt aata hai.33 if (!data || !data.includes("|")) {34 User.setProperty("rembal_step", "waiting_input", "string");35 Bot.sendMessage(36 "<tg-emoji emoji-id='5409048419211682843'>💵</tg-emoji> <b>Remove Balance</b>\n\n" +37 "<i>User ID aur amount is format me reply karein:</i>\n<code>user_id|amount</code>\n\n" +38 "<i>Example:</i> <code>7839151435|50</code>",39 {parse_mode: "HTML"}40 );41 return;42 }43 44 let splitData = data.split("|");45 let targetUserId = splitData[0].trim();46 let amountToRemove = parseFloat(splitData[1].trim());47 48 if (!targetUserId || isNaN(amountToRemove) || amountToRemove <= 0) {49 Bot.sendMessage("❌ *Invalid Format! Use:* `user_id|amount`", {parse_mode: "Markdown"});50 return;51 }52 53 try {54 // Balance remove/deduct karna55 let targetUserBalance = Libs.ResourcesLib.anotherUserRes("balance", targetUserId);56 targetUserBalance.remove(amountToRemove);57 58 // Admin notification59 Bot.sendMessage("✅ Success! Removed " + amountToRemove + " from user " + targetUserId, {parse_mode: "HTML"});60 61 // New 3 Premium Emojis in Quote Style62 let notificationText =63 "<blockquote>" +64 "<tg-emoji emoji-id='5893163582194978381'>❌</tg-emoji> Admin Remove: " + amountToRemove + "\n" +65 "<tg-emoji emoji-id='6071272104978814192'>😞</tg-emoji> Check your balance now\n" +66 "<tg-emoji emoji-id='5257963315258204021'>ℹ️</tg-emoji> Use /balance To Check" +67 "</blockquote>";68 69 // ✅ FIXED: raw HTTP.post ki jagah Api.sendMessage — zyada reliable delivery.70 try {71 Api.sendMessage({72 chat_id: targetUserId,73 text: notificationText,74 parse_mode: "HTML"75 });76 } catch (notifyErr) {}77 78 } catch (err) {79 Bot.sendMessage("⚠️ *Error:* " + err.message, {parse_mode: "Markdown"});80 }81 82} else {83 Bot.sendMessage("❌ You are not authorized to use this command.");84}