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/_refer.js
javascript · 72 lines
1/**#command2name: /refer3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12// =========================================================13// 🎁 REFER & EARN — user-facing screen14// Shows the user's own referral link + how much they've earned so far.15// Bonus crediting logic lives in _start.js (capture), _onCheck.js16// (topup bonus) and _confirm_buyitem.js / _onWebKeyReceive.js (buy bonus).17// =========================================================18 19try {20 var userId = String(user.telegramid);21 var botUsername = Bot.getProperty("bot_username") || "@Badsha_shop_bot";22 23 var referralLink = "https://t.me/" + botUsername + "?start=ref" + userId;24 25 var referralCount = (Bot.getProperty("referrals_of_" + userId) || []).length;26 var totalEarned = Number(Bot.getProperty("refer_earnings_" + userId) || 0);27 28 var topupBonus = Number(Bot.getProperty("refer_earn_topup_amount"));29 if (isNaN(topupBonus)) topupBonus = 2;30 var buyBonus = Number(Bot.getProperty("refer_earn_buy_amount"));31 if (isNaN(buyBonus)) buyBonus = 2;32 33 var referText =34 "<blockquote><b>REFER & EARN</b></blockquote>\n" +35 "━━━━━━━━━━━━━━━━━━━━━\n\n" +36 "<i>Apne dosto ko neeche wale link se invite karein aur free me kamaye!</i>\n\n" +37 "<tg-emoji emoji-id='5346004239246183111'>➕</tg-emoji> <b>Aapko milega:</b>\n" +38 "• ₹" + topupBonus.toFixed(2) + " — jab friend pehli baar balance add kare\n" +39 "• ₹" + buyBonus.toFixed(2) + " — jab friend pehli baar koi purchase kare\n\n" +40 "━━━━━━━━━━━━━━━━━━━━━\n" +41 "<tg-emoji emoji-id='6039605143601680423'>📊</tg-emoji> <b>Total Referrals:</b> <code>" + referralCount + "</code>\n" +42 "<tg-emoji emoji-id='6267068789146260253'>💰</tg-emoji> <b>Total Earned:</b> <code>₹" + totalEarned.toFixed(2) + "</code>\n\n" +43 "<tg-emoji emoji-id='6091571559233755994'>🔗</tg-emoji> <b>Your Referral Link:</b>\n<code>" + referralLink + "</code>";44 45 var referButtons = [46 [{ text: "📤 Share Link", url: "https://t.me/share/url?url=" + encodeURIComponent(referralLink) + "&text=" + encodeURIComponent("Join karo aur turant discount pao!"), style: "success" }],47 [{ text: "Back to Menu", callback_data: "/back", style: "danger", icon_custom_emoji_id: "5893163582194978381" }]48 ];49 50 if (request && request.message && request.message.message_id) {51 Api.editMessageText({52 chat_id: String(chat.chatid),53 message_id: Number(request.message.message_id),54 text: referText,55 parse_mode: "HTML",56 reply_markup: JSON.stringify({ inline_keyboard: referButtons })57 });58 } else {59 Api.sendMessage({60 chat_id: String(chat.chatid),61 text: referText,62 parse_mode: "HTML",63 reply_markup: JSON.stringify({ inline_keyboard: referButtons })64 });65 }66 67 var qid = request ? (request.id || (request.callback_query && request.callback_query.id)) : null;68 if (qid) { try { Api.answerCallbackQuery({ callback_query_id: String(qid) }); } catch (e) {} }69 70} catch (err) {71 Bot.sendMessage("⚠️ <b>Refer & Earn Error:</b> <code>" + err.message + "</code>", { parse_mode: "HTML" });72}