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/_press.js
javascript · 161 lines
1/**#command2name: /press3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12// Command Name: /press (Premium Calculator Keypad Handler)13// ✅ FIXED: "Back" button pehle "/dmenu" call kar raha tha jo bot me exist hi nahi karta14// (dead button — click karne par kuch nahi hota tha). Ab "/back" (real menu command) use hota hai.15// ✅ Number buttons ab addfund screen jaisi hi blue "primary" styling ke saath hain (pehle plain/colorless the).16 17try {18 // Purana set default check: Agar user ne naya deposit shuru kiya hai toh default 0 rahe19 let current_amount = User.getProperty("deposit_amount");20 if (!current_amount) {21 current_amount = "0";22 }23 24 let pressed = params ? params.trim() : "";25 let queryId = request ? (request.id || (request.callback_query && request.callback_query.id)) : null;26 27 // 💎 Premium Emoji Set (same IDs as /addfund — keeps the screen visually identical, no flicker)28 let e_money = "<tg-emoji emoji-id='6312263493051489212'>💰</tg-emoji>";29 let e_clear = "<tg-emoji emoji-id='5348224471050238603'>✏</tg-emoji>";30 let e_confirm = "<tg-emoji emoji-id='5348191451341668809'>✅</tg-emoji>";31 let e_back = "<tg-emoji emoji-id='5893163582194978381'>⬅️</tg-emoji>";32 let e_hour = "<tg-emoji emoji-id='6100657257605763582'>✔️</tg-emoji>";33 let e_check = "<tg-emoji emoji-id='6311870645277825763'>✔️</tg-emoji>";34 let e_gear = "<tg-emoji emoji-id='5348292765325212780'>⚙</tg-emoji>";35 36 // --- CONFIRM BUTTON CLICK ---37 if (pressed == "confirm") {38 if (parseInt(current_amount) <= 0 || current_amount == "" || current_amount == "0") {39 if (queryId) {40 Api.answerCallbackQuery({41 callback_query_id: queryId,42 text: "👀 PLEASE ENTER A VALID AMOUNT!",43 show_alert: true44 });45 }46 return;47 }48 49 // ✅ NEW: ab seedhe QR generate nahi hota — pehle "Choose Payment Method"50 // screen dikhti hai (UPI Pay / Binance Pay), jaise buyitem checkout me hoti hai.51 let finalAmount = String(parseInt(current_amount));52 let usdRate = Number(Bot.getProperty("usd_rate") || 91);53 let usdAmount = (parseInt(current_amount) / usdRate).toFixed(2);54 55 let e_upi = "<tg-emoji emoji-id='5348392971207194994'>💳</tg-emoji>";56 let e_binance = "<tg-emoji emoji-id='6312263493051489212'>🟡</tg-emoji>";57 58 let methodText =59 "<blockquote>" + e_money + " <b>CHOOSE PAYMENT METHOD</b></blockquote>\n" +60 "━━━━━━━━━━━━━━━━━━━━━\n\n" +61 e_money + " <b>Amount:</b> ₹<code>" + finalAmount + "</code> <i>(≈ $" + usdAmount + ")</i>\n\n" +62 "━━━━━━━━━━━━━━━━━━━━━\n" +63 "<i>Select a payment gateway below:</i>";64 65 let methodButtons = [66 [{ text: "UPI Pay ₹" + finalAmount, callback_data: "/addbal_upi " + finalAmount, style: "success", icon_custom_emoji_id: "5348392971207194994" }],67 [{ text: "Binance Pay $" + usdAmount, callback_data: "/addbal_binance " + finalAmount, style: "primary", icon_custom_emoji_id: "6312263493051489212" }],68 [{ text: "Back", callback_data: "/back", style: "danger", icon_custom_emoji_id: "5893163582194978381" }]69 ];70 71 Api.editMessageText({72 chat_id: chat.chatid,73 message_id: request.message.message_id,74 text: methodText,75 parse_mode: "HTML",76 reply_markup: JSON.stringify({ inline_keyboard: methodButtons })77 });78 79 // Amount reset to 0 so next time it starts fresh80 User.setProperty("deposit_amount", "0", "string");81 82 if (queryId) {83 Api.answerCallbackQuery({ callback_query_id: queryId });84 }85 86 return;87 }88 89 // --- KEYPAD INPUT LOGIC ---90 if (pressed == "clear") {91 if (current_amount.length > 1) {92 current_amount = current_amount.slice(0, -1);93 } else {94 current_amount = "0";95 }96 } else if (pressed !== "") {97 if (current_amount == "0") {98 current_amount = pressed;99 } else {100 if ((current_amount + pressed).length <= 6) {101 current_amount = current_amount + pressed;102 }103 }104 }105 106 // Save current keypad amount state107 User.setProperty("deposit_amount", current_amount, "string");108 109 if (queryId) {110 Api.answerCallbackQuery({ callback_query_id: queryId });111 }112 113 // 🎨 Keypad Buttons — same premium colored styling as /addfund114 let inlineKeyboardPayload = [115 [116 { text: "1", callback_data: "/press 1", style: "primary" },117 { text: "2", callback_data: "/press 2", style: "primary" },118 { text: "3", callback_data: "/press 3", style: "primary" }119 ],120 [121 { text: "4", callback_data: "/press 4", style: "primary" },122 { text: "5", callback_data: "/press 5", style: "primary" },123 { text: "6", callback_data: "/press 6", style: "primary" }124 ],125 [126 { text: "7", callback_data: "/press 7", style: "primary" },127 { text: "8", callback_data: "/press 8", style: "primary" },128 { text: "9", callback_data: "/press 9", style: "primary" }129 ],130 [131 { text: "Clear", callback_data: "/press clear", style: "danger", icon_custom_emoji_id: "5348224471050238603" },132 { text: "0", callback_data: "/press 0", style: "primary" },133 { text: "Confirm", callback_data: "/press confirm", style: "success", icon_custom_emoji_id: "5348191451341668809" }134 ],135 [136 // ✅ FIXED: "/dmenu" -> "/back" (dead command replaced with the real menu handler)137 { text: "Back", callback_data: "/back", style: "danger", icon_custom_emoji_id: "5893163582194978381" }138 ]139 ];140 141 let keypadMsg =142 "<blockquote>" + e_money + " <b>ADD BALANCE — ENTER AMOUNT</b> <tg-emoji emoji-id='6312263493051489212'>💎</tg-emoji></blockquote>\n" +143 "━━━━━━━━━━━━━━━━━━━━━\n\n" +144 "<tg-emoji emoji-id='6312263493051489212'>💎</tg-emoji> <b>Amount:</b> ₹<code>" + current_amount + "</code>\n\n" +145 "━━━━━━━━━━━━━━━━━━━━━\n" +146 e_check + " <i>Instant Auto-Credit</i>\n" +147 "<tg-emoji emoji-id='6215386799133433653'>🔒</tg-emoji> <i>100% Secure UPI Payment</i>\n" +148 e_hour + " <i>Verified in Seconds</i>\n\n" +149 "<tg-emoji emoji-id='6100170496077204999'>👑</tg-emoji> <i>Use the keypad below to enter amount</i>";150 151 Api.editMessageText({152 chat_id: chat.chatid,153 message_id: request.message.message_id,154 text: keypadMsg,155 parse_mode: "HTML",156 reply_markup: JSON.stringify({ inline_keyboard: inlineKeyboardPayload })157 });158 159} catch (err) {160 Bot.sendMessage("⚠️ System Error in Keypad: " + err.message);161}