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 18h agoCreated Sep 27, 2026
Back to folder

commands/_setresellerprice.js

javascript · 50 lines

Raw
1/**#command2name: /setresellerprice3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12// =========================================================13// 💰 COMMAND = /setresellerprice14// STATUS: 100% ACCURATE KEY MATCHING FIX15// =========================================================16 17var input = message.replace("/setresellerprice", "").trim(); 18var parts = input.split("|");19 20if (parts.length === 3) {21  // 1️⃣ PRODUCT NAME: UpperCase + Trim (Jaise main buyitem script me hai)22  var pName = parts[0].trim().toUpperCase(); 23  24  // 2️⃣ PLAN DAYS: Sirf number nikalenge (Jaise "7_Day" ya "7 Days" se "7" bachega)25  var pPlan = String(parts[1]).replace(/[^0-9]/g, "").trim(); 26  27  // 3️⃣ PRICE: Force Floating/Integer Number parsing28  var pPrice = parseFloat(parts[2].trim());29 30  if (isNaN(pPrice)) {31    Bot.sendMessage("❌ Price ek number hona chahiye!");32    return;33  }34 35  // 🔥 MAIN MATCHING KEY FIX: direct buyitem loop database properties alignment36  var targetDatabaseKey = "price_reseller_" + pName + "_" + pPlan;37 38  // Real number me save karenge taaki exact math response aaye39  Bot.setProperty(targetDatabaseKey, pPrice, "number");40  41  Bot.sendMessage("✅ <b>Reseller Price Updated Successfully!</b>\n\n" +42                  "📦 <b>Product:</b> <code>" + pName + "</code>\n" +43                  "⏱️ <b>Plan:</b> <code>" + pPlan + " Days</code>\n" +44                  "💵 <b>New Price:</b> ₹" + pPrice, { parse_mode: "HTML" });45 46} else {47  Bot.sendMessage("⚠️ <b>Galat Format!</b>\n\n" +48                  "📝 <b>Format:</b>\n<code>/setresellerprice PRODUCT NAME | DAYS | PRICE</code>\n\n" +49                  "💡 <b>Example:</b>\n<code>/setresellerprice PRIME HOOK | 7 | 64</code>", { parse_mode: "HTML" });50}