indrajitghosh20006/HgfhhuybotPublic · Bot Template
AIThis bot provides a command‑based admin interface for managing user balances, products, and resellers. It supports adding balances via UPI or Binance Pay, approving payments, and configuring product details and categories. The bot also handles user role changes, stock uploads, and offers a simple calculator UI for entering amounts. All interactions are handled through short commands and inline keyboards, with no long‑running listeners or external frameworks.
Utilityadminbalanceproductresellerpaymentupi
138 commands0 envUpdated 15h agoCreated Sep 27, 2026
commands/_addbal_binance.js
javascript · 110 lines
1/**#command2name: /addbal_binance3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12// =========================================================13// 🟡 "Binance Pay" chosen on Add Balance screen — shows the admin-set14// Binance QR (photo file_id OR image URL, whichever admin configured) with15// the amount converted to USD, plus Binance Pay ID + USDT Address.16// Koi live-verify API nahi hai, isliye "I Paid" ek manual Support flow17// shuru karta hai (UTR + screenshot -> admin ko forward).18// =========================================================19 20try {21 let userId = user.telegramid;22 let callbackId = request ? (request.id || (request.callback_query && request.callback_query.id)) : null;23 24 let inrAmount = String(parseInt(params ? String(params).trim() : "0"));25 if (!inrAmount || inrAmount === "0" || isNaN(parseInt(inrAmount)) || parseInt(inrAmount) <= 0) {26 Bot.sendMessage("❌ Invalid amount!");27 return;28 }29 30 let qrFileId = Bot.getProperty("binance_qr_file_id");31 let qrUrl = Bot.getProperty("binance_qr_url");32 let qrSource = qrFileId || qrUrl;33 34 let binanceId = Bot.getProperty("binance_pay_id");35 let usdtAddress = Bot.getProperty("binance_usdt_address");36 let usdRate = Number(Bot.getProperty("usd_rate") || 91);37 let usdAmount = (parseInt(inrAmount) / usdRate).toFixed(2);38 39 if (!qrSource || !binanceId || !usdtAddress) {40 if (callbackId) {41 Api.answerCallbackQuery({42 callback_query_id: String(callbackId),43 text: "⚠️ Binance Pay abhi configure nahi hua hai. Kripya Support se contact karein.",44 show_alert: true45 });46 }47 return;48 }49 50 User.setProperty("binance_pending_amount_inr", inrAmount, "string");51 User.setProperty("binance_pending_amount_usd", usdAmount, "string");52 53 let e_binance = "<tg-emoji emoji-id='6312263493051489212'>🟡</tg-emoji>";54 let e_check = "<tg-emoji emoji-id='6100657257605763582'>✔️</tg-emoji>";55 56 let caption =57 "<blockquote>" + e_binance + " <b>BINANCE PAY</b></blockquote>\n" +58 "━━━━━━━━━━━━━━━━━━━━━\n\n" +59 "<tg-emoji emoji-id='6312263493051489212'>💰</tg-emoji> <b>Amount:</b> $<code>" + usdAmount + "</code> <i>(₹" + inrAmount + ")</i>\n\n" +60 "<b>Binance Pay ID</b>\n<code>" + binanceId + "</code>\n\n" +61 "<b>USDT Address</b>\n<code>" + usdtAddress + "</code>\n\n" +62 "━━━━━━━━━━━━━━━━━━━━━\n" +63 "<tg-emoji emoji-id='6100170496077204999'>📋</tg-emoji> <b>Instructions</b>\n" +64 "• Scan the QR in your Binance app, or pay to the ID/Address above.\n" +65 "• Pay the exact amount shown.\n" +66 "• Tap <b>I Paid</b> below and follow the steps to submit proof.\n\n" +67 e_check + " <i>Support team will verify and credit your balance.</i>";68 69 let inlineButtons = [70 [{ text: "I Paid", callback_data: "/addbal_binance_paid", style: "success", icon_custom_emoji_id: "6100657257605763582" }],71 [{ text: "Cancel", callback_data: "/cancel_topup", style: "danger", icon_custom_emoji_id: "6219547832169273793" }]72 ];73 74 // Agar purani QR/generating message chat me hai, use hata do75 try {76 let genMsgId = Bot.getProperty("gen_msg_id_" + userId) || User.getProperty("gen_msg_id_" + userId);77 if (genMsgId) {78 try { Api.deleteMessage({ chat_id: chat.chatid, message_id: genMsgId }); } catch (e) {}79 Bot.setProperty("gen_msg_id_" + userId, null, "string");80 User.setProperty("gen_msg_id_" + userId, null, "string");81 }82 } catch (e) {}83 84 if (request && request.message && !request.message.photo) {85 try { Api.deleteMessage({ chat_id: chat.chatid, message_id: request.message.message_id }); } catch (e) {}86 }87 88 let sentMsg = Api.sendPhoto({89 chat_id: chat.chatid,90 photo: qrSource,91 caption: caption,92 parse_mode: "HTML",93 reply_markup: JSON.stringify({ inline_keyboard: inlineButtons })94 });95 96 try {97 let qrMsgId = (sentMsg && sentMsg.result && sentMsg.result.message_id) ? sentMsg.result.message_id : (sentMsg && sentMsg.message_id ? sentMsg.message_id : null);98 if (qrMsgId) {99 Bot.setProperty("qr_msg_id_" + userId, qrMsgId, "string");100 User.setProperty("qr_msg_id_" + userId, qrMsgId, "string");101 }102 } catch (e) {}103 104 if (callbackId) {105 Api.answerCallbackQuery({ callback_query_id: String(callbackId) });106 }107 108} catch (err) {109 Bot.sendMessage("⚠️ System Error: " + err.message);110}