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/_set_payment_upi.js

javascript · 66 lines

Raw
1/**#command2name: /set_payment_upi3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12// =========================================================13// 🔧 ADMIN — Configure the UPI ID used for all payment QR codes14// Usage: /set_payment_upi yourid@fam15// =========================================================16 17try {18  var adminId = Bot.getProperty("owner_id") || "7839151435";19  var isCoAdmin0 = Bot.getProperty("co_admin_" + String(chat.chatid));20  if (String(chat.chatid) !== adminId && !isCoAdmin0) {21    Bot.sendMessage("❌ You are not the admin!");22    return;23  }24 25  if (!params || params.trim() === "") {26    var currentUpi0 = Bot.getProperty("payment_upi_id") || "devreang@fam (default)";27    var currentKey0 = Bot.getProperty("payment_api_key");28    var currentKeyDisplay0 = currentKey0 ? (currentKey0.substring(0, 10) + "••••••••") : "FAM_b47c7d••••• (default)";29    Bot.sendMessage(30      "⚠️ <b>Format:</b> <code>/set_payment_upi yourid@fam|FAM_xxxx</code>\n" +31      "<i>(sirf UPI change karna ho to:</i> <code>/set_payment_upi yourid@fam</code><i>)</i>\n\n" +32      "<b>Current UPI ID:</b> <code>" + currentUpi0 + "</code>\n" +33      "<b>Current API Key:</b> <code>" + currentKeyDisplay0 + "</code>",34      { parse_mode: "HTML" }35    );36    return;37  }38 39  var rawInput = params.trim();40  var inputParts = rawInput.split("|");41  var newUpi = inputParts[0].trim();42  var newApiKey = (inputParts.length > 1) ? inputParts[1].trim() : null;43 44  if (newUpi.indexOf("@") === -1 || newUpi.indexOf(" ") !== -1) {45    Bot.sendMessage("❌ Invalid UPI ID! Format jaisa hona chahiye: <code>name@bank</code>", { parse_mode: "HTML" });46    return;47  }48  if (newApiKey !== null && (newApiKey === "" || newApiKey.indexOf(" ") !== -1)) {49    Bot.sendMessage("❌ Invalid API Key! Space allowed nahi hai.", { parse_mode: "HTML" });50    return;51  }52 53  Bot.setProperty("payment_upi_id", newUpi, "string");54  var confirmMsg = "✅ <b>Payment config update ho gaya:</b>\n• UPI ID: <code>" + newUpi + "</code>";55 56  if (newApiKey) {57    Bot.setProperty("payment_api_key", newApiKey, "string");58    confirmMsg += "\n• Fam Pay API Key: <code>" + newApiKey.substring(0, 10) + "••••••••</code>";59  }60 61  confirmMsg += "\n\n<i>Ab saare QR generate + payment verify isi UPI/API se honge, koi bhi purana flow break nahi hoga.</i>";62  Bot.sendMessage(confirmMsg, { parse_mode: "HTML" });63 64} catch (err) {65  Bot.sendMessage("⚠️ Error: " + err.message);66}