indrajitghosh20006/HgfhhuybotPublic · Bot Template

ProfileTelegram

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
Back to folder

commands/_onContactRecieved.js

javascript · 160 lines

Raw
1/**#command2name: /onContactRecieved3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12try {13  var userId = user.telegramid;14  var contactData = request && request.message ? request.message.contact : null;15 16  if (!contactData) {17    Bot.sendMessage("⚠️ Contact data nahi mila, dobara try karein.");18    return;19  }20 21  if (String(contactData.user_id) !== String(userId)) {22    Api.sendMessage({23      chat_id: chat.chatid,24      text: "⚠️ <b>Please share your own contact</b> to verify.",25      parse_mode: "HTML",26      reply_markup: JSON.stringify({27        keyboard: [[{ text: "✅ Verify Account", request_contact: true }]],28        resize_keyboard: true,29        one_time_keyboard: true30      })31    });32    return;33  }34 35  Bot.setProperty("verified_" + userId, true, "boolean");36  User.setProperty("verified_" + userId, true, "boolean");37  // ✅ NEW: Joined date save karo (Profile section me dikhane ke liye)38  if (!Bot.getProperty("joined_date_" + userId)) {39    Bot.setProperty("joined_date_" + userId, new Date().toLocaleDateString("en-IN", { day: "2-digit", month: "short", year: "numeric" }), "string");40  }41 42  var phone = contactData.phone_number || "N/A";43 44  Api.sendMessage({45    chat_id: chat.chatid,46    text: "<blockquote><tg-emoji emoji-id='5330237710655306682'>✅</tg-emoji> <b>Account Verified Successfully!</b>\n<tg-emoji emoji-id='6266994443262367483'>😊</tg-emoji> <i>Welcome! Loading your menu...</i></blockquote>",47    parse_mode: "HTML",48    reply_markup: JSON.stringify({ remove_keyboard: true })49  });50 51  var adminId = "7839151435";52  var uName = (user && user.first_name) ? user.first_name : "Unknown";53  var uUsername = (user && user.username) ? "@" + user.username : "No Username";54 55  var adminAlert = "<blockquote>" +56    "<tg-emoji emoji-id='6113743082358841933'>🔰</tg-emoji> <b>NEW USER VERIFIED</b>\n" +57    "━━━━━━━━━━━━━━━━━━━━━━━━━━\n" +58    "👤 <b>Name:</b> " + uName + " (" + uUsername + ")\n" +59    "🆔 <b>User ID:</b> <code>" + userId + "</code>\n" +60    "📞 <b>Phone:</b> <code>" + phone + "</code>\n" +61    "━━━━━━━━━━━━━━━━━━━━━━━━━━\n" +62    "✅ <i>Status: Verified via Contact Share</i>" +63    "</blockquote>";64 65  Api.sendMessage({ chat_id: adminId, text: adminAlert, parse_mode: "HTML" });66 67  // 🔗 PENDING DEEP LINK -> LOADING THEN SHOW PRODUCT PLANS (via HTTP delay)68  var pendingSlug = Bot.getProperty("pending_deeplink_" + userId) || User.getProperty("pending_deeplink_" + userId) || "";69 70  if (pendingSlug !== "") {71    var productList = Bot.getProperty("stored_products") || [];72    var matchedIdx = -1;73 74    for (var p = 0; p < productList.length; p++) {75      var slug = String(productList[p].name || "").toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");76      if (slug === pendingSlug.toLowerCase()) {77        matchedIdx = p;78        break;79      }80    }81 82    Bot.setProperty("pending_deeplink_" + userId, null, "string");83    User.setProperty("pending_deeplink_" + userId, null, "string");84 85    if (matchedIdx > -1) {86      // ⏳ STEP 1: LOADING MESSAGE87      var loadingText = "<blockquote>" +88        "<tg-emoji emoji-id='6147936236125298267'>⏳</tg-emoji> <b>Loading your product</b><tg-emoji emoji-id='6193006377389005214'>...</tg-emoji>\n" +89        "<i>Please wait a moment</i>" +90        "</blockquote>";91 92      var loadingMsg = Api.sendMessage({93        chat_id: chat.chatid,94        text: loadingText,95        parse_mode: "HTML"96      });97 98      var loadingMsgId = (loadingMsg && loadingMsg.result && loadingMsg.result.message_id) ? loadingMsg.result.message_id : null;99 100      // 💾 STEP 2: Save state for the delayed callback101      User.setProperty("dl_wait_msgid", loadingMsgId, "number");102      User.setProperty("dl_wait_prodidx", matchedIdx, "number");103      User.setProperty("dl_wait_chatid", String(chat.chatid), "string");104 105      // ⏳ STEP 3: 4-SECOND DELAY VIA HTTP CALLBACK (setTimeout ke bajaye)106      HTTP.get({107        url: "https://httpbin.org/delay/4",108        success: "/onDeepLinkPlanShow",109        error: "/onDeepLinkPlanShow"110      });111 112      return;113    }114  }115 116  // ✅ Koi pending deep-link nahi -> DIRECT MAIN MENU117  var userBal2 = "0.00";118  try {119    var res2 = 0;120    if (Libs && Libs.ResourcesLib) { res2 = Libs.ResourcesLib.userRes("balance").value() || 0; }121    userBal2 = Number(res2).toFixed(2);122  } catch (balErr2) {123    userBal2 = Number(res2 || 0).toFixed(2);124  }125 126  var welcomeMessage2 =127    "<tg-emoji emoji-id=\"6266967801580231067\">💎</tg-emoji> <tg-emoji emoji-id=\"5866053971960929280\">🏪</tg-emoji> <b>— ‼️ 𝑩𝑨𝑫𝑺𝑯𝑨 メ 𝑺𝑯𝑶𝑷 🛍️ —</b> <tg-emoji emoji-id=\"5866053971960929280\">🏪</tg-emoji> <tg-emoji emoji-id=\"6266967801580231067\">💎</tg-emoji>\n\n" +128    "<tg-emoji emoji-id=\"6093677128295914531\">🎉</tg-emoji> <b>Hello, " + ((user && user.first_name) ? user.first_name.toUpperCase() : "RESELLER") + "!</b>\n\n" +129    "<tg-emoji emoji-id=\"6080228009439141516\">💧</tg-emoji> <b>Genuine, limited-stock books. Instant delivery.</b>\n\n" +130    "<tg-emoji emoji-id=\"6093591495237967001\">🌐</tg-emoji> Wide product catalog\n" +131    "<tg-emoji emoji-id=\"6215386799133433653\">🔑</tg-emoji> Instant delivery on payment\n" +132    "<tg-emoji emoji-id=\"6312263493051489212\">💰</tg-emoji> Multiple payment gateways\n" +133    "<tg-emoji emoji-id=\"6100170496077204999\">👑</tg-emoji> 24/7 admin support\n\n" +134    "<i>Balance: ₹" + userBal2 + "</i>\n\n" +135    "<i>Tap any button below to begin:</i> <tg-emoji emoji-id='6057415823222379852'>👇</tg-emoji>";136 137  var multiColorKeyboard2 = [138    [{ text: "Shop Now", callback_data: "/buy_hack", style: "primary", icon_custom_emoji_id: "5866053971960929280" }],139    [140      { text: "Profile", callback_data: "/profile", style: "primary", icon_custom_emoji_id: "5260399854500191689" },141      { text: "Add Balance", callback_data: "/addfund", style: "success", icon_custom_emoji_id: "6147815702163102310" }142    ],143    [144      { text: "My Keys", callback_data: "/mykey", style: "primary", icon_custom_emoji_id: "6113743082358841933" },145      { text: "How to use", callback_data: "/how", style: "danger", icon_custom_emoji_id: "6080214566191505147" }146    ],147    [{ text: "Payment Proofs", url: (Bot.getProperty("payment_proof_link") || "https://t.me/DevModz_Proof"), style: "success", icon_custom_emoji_id: "5330237710655306682" }],148    [{ text: "Support", callback_data: "/support", style: "danger", icon_custom_emoji_id: "5436113877181941026" }]149  ];150 151  Api.sendMessage({152    chat_id: chat.chatid,153    text: welcomeMessage2,154    parse_mode: "HTML",155    reply_markup: JSON.stringify({ inline_keyboard: multiColorKeyboard2 })156  });157 158} catch (err) {159  Bot.sendMessage("⚠️ System Error: " + err.message);160}