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

javascript · 66 lines

Raw
1/**#command2name: /set_refer_earn_btn3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12// =========================================================13// 🎁 ADMIN PANEL BUTTON — "Set Refer & Earn Amount"14// Pressing this button prompts the admin to send both bonus amounts as15// "topup|buy" text; _start.js (MODULE 5) auto-captures that reply and16// forwards it to /set_refer_earn 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 topupAmt = Bot.getProperty("refer_earn_topup_amount");30  if (topupAmt === undefined || topupAmt === null) topupAmt = "2 (default)";31  var buyAmt = Bot.getProperty("refer_earn_buy_amount");32  if (buyAmt === undefined || buyAmt === null) buyAmt = "2 (default)";33 34  User.setProperty("set_refer_earn_step", "waiting_input", "string");35 36  var promptText =37    "<blockquote><b>Set Refer & Earn Amounts</b></blockquote>\n\n" +38    "<i>Is format me reply karein:</i>\n<code>topup_bonus|buy_bonus</code>\n\n" +39    "<i>Example:</i> <code>2|2</code>\n\n" +40    "• <b>topup_bonus:</b> referrer ko milta hai jab uska referred friend pehli baar balance add kare\n" +41    "• <b>buy_bonus:</b> referrer ko milta hai jab uska referred friend pehli baar purchase kare\n\n" +42    "<b>Current:</b> Topup ₹<code>" + topupAmt + "</code> | Buy ₹<code>" + buyAmt + "</code>";43 44  var queryId = request ? (request.id || (request.callback_query && request.callback_query.id)) : null;45 46  if (request && request.message && request.message.message_id) {47    try {48      Api.editMessageText({49        chat_id: String(chat.chatid),50        message_id: Number(request.message.message_id),51        text: promptText,52        parse_mode: "HTML",53        reply_markup: JSON.stringify({ inline_keyboard: [[{ text: "Cancel", callback_data: "/admin", style: "danger" }]] })54      });55    } catch (e) {56      Api.sendMessage({ chat_id: chat.chatid, text: promptText, parse_mode: "HTML" });57    }58  } else {59    Bot.sendMessage(promptText, { parse_mode: "HTML" });60  }61 62  if (queryId) { try { Api.answerCallbackQuery({ callback_query_id: String(queryId) }); } catch (e) {} }63 64} catch (err) {65  Bot.sendMessage("⚠️ Error: " + err.message);66}