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

javascript · 65 lines

Raw
1/**#command2name: /set_payment_upi_btn3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12// =========================================================13// 💳 ADMIN PANEL BUTTON — "Set Payment UPI"14// Pressing this button prompts the admin to send the new UPI ID as a15// normal text message next; _start.js (MODULE 5) auto-captures that16// reply and forwards it to /set_payment_upi internally.17// =========================================================18 19try {20  var adminId = Bot.getProperty("owner_id") || "7839151435";21  var currentChatId = String(chat.chatid);22  var isCoAdmin = Bot.getProperty("co_admin_" + currentChatId);23 24  if (currentChatId !== adminId && !isCoAdmin) {25    Bot.sendMessage("❌ You are not authorized to use this.");26    return;27  }28 29  var currentUpi = Bot.getProperty("payment_upi_id") || "maidulmidya@fam (default)";30  var currentApiKey = Bot.getProperty("payment_api_key");31  var currentApiKeyDisplay = currentApiKey ? (currentApiKey.substring(0, 10) + "••••••••") : "FAM_b47c7d••••• (default)";32 33  User.setProperty("set_payment_upi_step", "waiting_input", "string");34 35  var promptText =36    "<blockquote><tg-emoji emoji-id='6312263493051489212'>💳</tg-emoji> <b>Set Payment (Fam Pay) Config</b></blockquote>\n\n" +37    "<i>Is format me reply karein:</i>\n<code>upi_id|api_key</code>\n\n" +38    "<i>Example:</i> <code>yourid@fam|FAM_xxxxxxxxxxxxxxxx</code>\n\n" +39    "<i>Sirf UPI change karna ho to bhi pura format bhejein, api_key ko wahi purana daal dein. Agar sirf ek cheez bhejenge (bina | ke), sirf UPI ID update hogi.</i>\n\n" +40    "<b>Current UPI ID:</b> <code>" + currentUpi + "</code>\n" +41    "<b>Current API Key:</b> <code>" + currentApiKeyDisplay + "</code>";42 43  var queryId = request ? (request.id || (request.callback_query && request.callback_query.id)) : null;44 45  if (request && request.message && request.message.message_id) {46    try {47      Api.editMessageText({48        chat_id: String(chat.chatid),49        message_id: Number(request.message.message_id),50        text: promptText,51        parse_mode: "HTML",52        reply_markup: JSON.stringify({ inline_keyboard: [[{ text: "Cancel", callback_data: "/admin", style: "danger" }]] })53      });54    } catch (e) {55      Api.sendMessage({ chat_id: chat.chatid, text: promptText, parse_mode: "HTML" });56    }57  } else {58    Bot.sendMessage(promptText, { parse_mode: "HTML" });59  }60 61  if (queryId) { try { Api.answerCallbackQuery({ callback_query_id: String(queryId) }); } catch (e) {} }62 63} catch (err) {64  Bot.sendMessage("⚠️ Error: " + err.message);65}