amanjha18v/AMAN_SHOPS_BOTPublic · Bot Template
AIAMAN SHOP STORE appears to be a Telegram automation bot. Commands include /*, /addbal, /addbal_all, /addbal_binance, /addbal_binance_approve, /addbal_binance_paid, /addbal_upi, /addcat_id. Observed in code: messaging, http, libs, keyboards, payments.
Utilityutility
132 commands0 envUpdated 7h agoCreated Sep 4, 2026
commands/_onVerifyResult.js
javascript · 165 lines
1/**#command2name: /onVerifyResult3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12// =========================================================13// 🚀 COMMAND = /onVerifyResult14// STATUS: ERROR-FREE DATA VALIDATION PIPELINE15// =========================================================16 17try {18 if (!content) {19 Bot.sendMessage("⚠️ Server response was blank. Please contact admin if payment was deducted.");20 return;21 }22 23 var res = (typeof content === "object") ? content : null;24 if (!res) {25 try { res = JSON.parse(content); } catch (e) { res = null; }26 }27 28 // Aapke response scheme ke mutabik status handle matrix29 var paymentVerified = (res && (res.status === "success" || res.status === "PAID" || res.success === true));30 var live_amount = res && res.data && res.data.amount ? res.data.amount : (User.getProperty("deposit_amount") || "0");31 var order_id = params ? params.trim() : "UNKNOWN";32 33 // ✅ BUG FIX: pehle yaha QR message delete/clear karne ka koi code hi nahi tha,34 // isi wajah se balance add hone ke baad bhi purana QR code chat me pada reh35 // jaata tha. Ab /onCheck.js jaisa hi vanish + state-clear logic add kiya gaya36 // hai taaki verify hote hi QR turant hat jaaye.37 var verifyUserId = (typeof user !== "undefined" && user) ? user.telegramid : null;38 var verifyChatId = (typeof chat !== "undefined" && chat) ? chat.chatid : null;39 40 function vanishQrOnVerify(uid, fallbackChatId) {41 try {42 var qrMsgId = Bot.getProperty("qr_msg_id_" + uid) ||43 User.getProperty("qr_msg_id_" + uid) ||44 User.getProperty("last_qr_message_id_" + uid);45 if (qrMsgId && fallbackChatId) {46 try { Api.deleteMessage({ chat_id: fallbackChatId, message_id: qrMsgId }); } catch (e) {}47 }48 } catch (e) {}49 }50 51 function clearQrStateOnVerify(uid) {52 if (!uid) return;53 Bot.setProperty("qr_msg_id_" + uid, null, "string");54 User.setProperty("qr_msg_id_" + uid, null, "string");55 User.setProperty("last_qr_message_id_" + uid, null, "string");56 Bot.setProperty("qr_order_id_" + uid, null, "string");57 User.setProperty("qr_order_id_" + uid, null, "string");58 Bot.setProperty("qr_watch_order_" + uid, null, "string");59 User.setProperty("qr_watch_order_" + uid, null, "string");60 Bot.setProperty("verifying_lock_" + uid, false, "boolean");61 User.setProperty("verifying_lock_" + uid, false, "boolean");62 User.setProperty("pending_order_id", null);63 }64 65 if (paymentVerified == true) {66 67 // Payment verify hote hi sabse pehle QR ko vanish karo (product delivery ho68 // ya sirf wallet balance add — dono cases me QR hatna chahiye)69 vanishQrOnVerify(verifyUserId, verifyChatId);70 clearQrStateOnVerify(verifyUserId);71 72 var prodIdx = User.getProperty("last_selected_prod_idx");73 var planIdx = User.getProperty("last_selected_plan_idx");74 var productList = Bot.getProperty("stored_products") || [];75 76 var product = (prodIdx !== undefined && prodIdx !== null) ? productList[Number(prodIdx)] : null;77 var plan = (product && planIdx !== undefined && planIdx !== null) ? product.plans[Number(planIdx)] : null;78 79 if (product && plan) {80 // 🟢 CASE A: DIRECT KEY EXTRACTION81 var stockList = Bot.getProperty("stock_" + product.name.trim() + "_" + plan.days.trim() + "_Day") || Bot.getProperty("stock_" + prodIdx + "_" + planIdx) || [];82 83 if (stockList.length > 0) {84 var deliveredKey = stockList.shift();85 86 Bot.setProperty("stock_" + product.name.trim() + "_" + plan.days.trim() + "_Day", stockList, "json");87 Bot.setProperty("stock_" + prodIdx + "_" + planIdx, stockList, "json");88 89 var userKeysHistory = User.getProperty("my_purchased_keys") || [];90 userKeysHistory.push({ product: product.name, days: plan.days, price: live_amount, key: deliveredKey, date: new Date().toLocaleDateString() });91 User.setProperty("my_purchased_keys", userKeysHistory, "json");92 93 var gatewaySuccessText = "┏━━━━━━━━━━━━━━━━━━━━━━━━ Club ┓\n" +94 "┃ <tg-emoji emoji-id='5350447674971660988'>✅</tg-emoji> <b>PAYMENT SUCCESSFUL</b> <tg-emoji emoji-id='5352825278672412291'>👆</tg-emoji> ┃\n" +95 "┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛\n\n" +96 "<blockquote>" +97 "<tg-emoji emoji-id='6147767796097884213'>📦</tg-emoji> <b>Product Name:</b> <code>" + product.name + "</code>\n" +98 "<tg-emoji emoji-id='6145391828779672333'>💰</tg-emoji> <b>Validity:</b> <code>" + plan.days + " Days</code>\n" +99 "<tg-emoji emoji-id='6284816251143331422'>🗝</tg-emoji> <b>Your Key:</b> <code>" + deliveredKey + "</code>\n\n" +100 "━━━━━━━━━━━━━━━━━━━━━\n" +101 "✨ <i>Payment auto-verified! Enjoy your premium product.</i>" +102 "</blockquote>";103 104 Bot.sendMessage(gatewaySuccessText, { parse_mode: "HTML" });105 106 // Admin Log107 var adminMsg = "<blockquote>" +108 "🔔 <b>QR PAYMENT DIRECT DELIVERY</b> ✔️\n\n" +109 "👤 <b>Buyer:</b> " + user.first_name + " (<code>" + user.telegramid + "</code>)\n" +110 "📦 <b>Product:</b> " + product.name + "\n" +111 "🔑 <b>Key:</b> <code>" + deliveredKey + "</code>" +112 "</blockquote>";113 114 // ✅ FIXED: pehle yaha ek hardcoded chat_id ("5191323229" — kisi aur bot ka115 // reference ID) tha, jiski wajah se admin log tumhare admin ko kabhi milta116 // hi nahi tha. Ab yeh owner_id property se aata hai (same jo /start me set hai).117 var logAdminId = Bot.getProperty("owner_id") || "5191323229";118 Api.sendMessage({ chat_id: logAdminId, text: adminMsg, parse_mode: "HTML" });119 120 User.setProperty("last_selected_prod_idx", null);121 User.setProperty("last_selected_plan_idx", null);122 return;123 } else {124 Bot.sendMessage("⚠️ Payment received, but item went Out of Stock! Contact Admin with Order ID: <code>" + order_id + "</code>");125 return;126 }127 } else {128 // 🟡 CASE B: RE-ALIGNED BALANCE FALLBACK129 Libs.ResourcesLib.userRes("balance").add(Number(live_amount));130 131 // 🔔 Admin notification for wallet balance top-up132 var walletLogAdminId = Bot.getProperty("owner_id") || "5191323229";133 var walletAdminMsg = "<blockquote>" +134 "🔔 <b>WALLET BALANCE ADDED</b> ✔️\n\n" +135 "👤 <b>User:</b> " + user.first_name + " (<code>" + user.telegramid + "</code>)\n" +136 "💰 <b>Amount Added:</b> ₹" + Number(live_amount).toFixed(2) + "\n" +137 "🆔 <b>Order ID:</b> <code>" + order_id + "</code>" +138 "</blockquote>";139 try {140 Api.sendMessage({ chat_id: walletLogAdminId, text: walletAdminMsg, parse_mode: "HTML" });141 } catch (e) {}142 143 var walletSuccessText = "┏━━━━━━━━━━━━━━━━━━━━━━━━ Club ┓\n" +144 "┃ <tg-emoji emoji-id='6194922667242429131'>🎉</tg-emoji> <b>PAYMENT SUCCESSFUL</b> <tg-emoji emoji-id='6192822213486321961'>✨</tg-emoji> ┃\n" +145 "┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛\n\n" +146 "<blockquote>" +147 "<tg-emoji emoji-id='6194911182499881916'>🗣</tg-emoji> <b>Amount Added:</b> ₹<code>" + Number(live_amount).toFixed(2) + "</code>\n\n" +148 "ℹ️ <i>Click the button below to browse products.</i>" +149 "</blockquote>";150 151 var shopButtons = [[{ text: "🛒 Shop Now", callback_data: "/back", style: "success", icon_custom_emoji_id: "6194922667242429131" }]];152 153 Api.sendMessage({154 chat_id: chat.chatid,155 text: walletSuccessText,156 parse_mode: "HTML",157 reply_markup: JSON.stringify({ inline_keyboard: shopButtons })158 });159 }160 } else {161 Bot.sendMessage("❌ <b>Payment not found yet.</b> Please complete the transaction first and make sure you have paid the exact amount.", { parse_mode: "HTML" });162 }163} catch (err) {164 Bot.sendMessage("⚠️ Process Error: " + err.message);165}