yaainnnxitstore/YASIN_XIT_BOTPublic · Bot Template

ProfileTelegram

AIYASIN XIT FREE KEY appears to be a Telegram automation bot. Commands include /menu, /addfund, /confirm_buyitem, /rembal, /sendorderkey_input, /removeproduct, /add_reseller, /addkey. Observed in code: messaging, keyboards, payments, games, libs, web.

Utilityutility
140 commands0 envUpdated 1mo agoCreated Sep 11, 2026
Back to folder

commands/_onCheck.js

javascript · 296 lines

Raw
1/**#command2name: /onCheck3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12function __esc(v){return String(v==null?"":v).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");}13var __swfUpdate = (typeof update !== "undefined" && update) ? update : null;14var __swfCb = (__swfUpdate && __swfUpdate.callback_query) ? __swfUpdate.callback_query : null;15var __swfCbMsg = (__swfCb && __swfCb.message) ? __swfCb.message : null;16var __swfMsgId = __swfCbMsg && __swfCbMsg.message_id ? Number(__swfCbMsg.message_id) : 0;17var __swfCbId = __swfCb && __swfCb.id ? String(__swfCb.id) : "";18try {19  if (typeof request !== "undefined" && request && __swfCb) {20    if (__swfCb.message) request.message = __swfCb.message;21    if (!request.id && __swfCb.id) request.id = __swfCb.id;22  }23} catch(__swf_norm_err) {}24function __swfEditMessage(a) {25  a = a || {};26  var mid = Number(a.message_id || __swfMsgId || 0);27  var cid = a.chat_id || (typeof chat !== "undefined" && chat ? (chat.id || chat.chatid) : null);28  if (!mid || !cid) throw new Error("Callback message ID not found");29  var markup = a.reply_markup;30  if (typeof markup === "string") { try { markup = JSON.parse(markup); } catch(_) {} }31  var base = {chat_id:cid,message_id:mid,parse_mode:a.parse_mode,reply_markup:markup};32  var cm = __swfCbMsg;33  if (cm && (cm.photo || cm.video || cm.document || cm.audio || cm.animation)) {34    return Api.editMessageCaption({chat_id:cid,message_id:mid,caption:String(a.text == null ? "" : a.text),parse_mode:a.parse_mode,reply_markup:markup});35  }36  return Api.editMessageText({chat_id:cid,message_id:mid,text:String(a.text == null ? "" : a.text),parse_mode:a.parse_mode,reply_markup:markup});37}38function __uiSend(text, opts) {39  opts = opts || {};40  var req = (typeof request !== "undefined" && request) ? request : null;41  var chatId = (typeof chat !== "undefined" && chat && chat.chatid) ? chat.chatid : null;42  var isCallback = !!__swfCb;43  var mid = 0;44  if (isCallback && update.callback_query.message && update.callback_query.message.message_id) mid = Number(update.callback_query.message.message_id);45  if (!mid) { try { mid = Number(User.getProperty("pending_menu_message_id") || User.getProperty("main_menu_message_id") || User.getProperty("support_message_id") || 0); } catch(e0) { mid = 0; } }46  var markup = opts.reply_markup;47  if (markup && typeof markup !== "string") { try { markup = JSON.stringify(markup); } catch(e1) {} }48  var textValue = String(text == null ? "" : text);49  if (mid && chatId) {50    try {51      __swfEditMessage({chat_id:chatId,message_id:mid,text:textValue,parse_mode:opts.parse_mode,reply_markup:markup});52      try { User.setProperty("main_menu_message_id",String(mid),"string"); User.setProperty("pending_menu_message_id",String(mid),"string"); } catch(se) {}53      return true;54    } catch(e2) {55      var s=String(e2).toLowerCase();56      if(s.indexOf("message is not modified")>=0 || s.indexOf("not modified")>=0) return true;57      if(isCallback && update.callback_query.message && update.callback_query.message.photo) {58        try { Api.editMessageCaption({chat_id:chatId,message_id:mid,caption:textValue,parse_mode:opts.parse_mode,reply_markup:markup}); return true; } catch(e3) {59          var s3=String(e3).toLowerCase(); if(s3.indexOf("not modified")>=0) return true;60        }61      }62      if(isCallback) { try { Api.answerCallbackQuery({callback_query_id:String(update.callback_query.id),text:"⚠️ Could not update the screen.",show_alert:true}); } catch(e4) {} return false; }63    }64  }65  if (isCallback) { try { Api.answerCallbackQuery({callback_query_id:String(update.callback_query.id),text:"⚠️ Screen message not found.",show_alert:true}); } catch(e5) {} return false; }66  try {67    var sent=Api.sendMessage({chat_id:chatId,text:textValue,parse_mode:opts.parse_mode,reply_markup:markup});68    try { if(sent&&sent.message_id){User.setProperty("pending_menu_message_id",String(sent.message_id),"string");User.setProperty("main_menu_message_id",String(sent.message_id),"string");} } catch(e6) {}69    return true;70  } catch(e7) { return false; }71}72try {73  var opts = (typeof options !== "undefined" && options) ? options : {};74  let isBackground = opts.is_background || false;75  let orderId = opts.order_id;76  let amount = opts.amount;77  let chatId = chat ? chat.chatid : null;78  let attempt = opts.attempt || 1;79  if (typeof params !== "undefined" && params && params.trim() !== "") {80    let splitParams = params.trim().split(" ");81    if (splitParams.length >= 1 && splitParams[0].length > 5) {82      orderId = splitParams[0];83    }84    if (splitParams.length >= 2) amount = splitParams[1];85  }86  let targetUserId = (typeof user !== "undefined" && user) ? user.telegramid : null;87  if ((!orderId || orderId.trim() === "") && targetUserId) {88    orderId = User.getProperty("pending_order_id") || 89              Bot.getProperty("qr_order_id_" + targetUserId) || 90              User.getProperty("qr_order_id_" + targetUserId) ||91              User.getProperty("buy_pending_order_id");92  }93  let queryId = null;94  if (typeof request !== "undefined" && request) {95    if (__swfCb && __swfCb.id) {96      queryId = __swfCb.id;97    } else if (request.id) {98      queryId = request.id;99    }100  }101  try {102    if (request && __swfCb && __swfCb.message && __swfCb.message.message_id) {103      User.setProperty("main_menu_message_id",String(__swfCb.message.message_id),"string");104      User.setProperty("pending_menu_message_id",String(__swfCb.message.message_id),"string");105    }106  } catch(e0) {}107  let e_chart = "📊";108  let e_plus = "➕";109  let e_arrow = "➡️";110  let e_coin = "🪙";111  let e_money = "💰";112  let e_time = "🕓";113  let e_check = "✅";114  function vanishQrMessage(uid, fallbackChatId) {115    try {116      let qrMsgId = Bot.getProperty("qr_msg_id_" + uid) ||117                    User.getProperty("qr_msg_id_" + uid) ||118                    User.getProperty("last_qr_message_id_" + uid);119      if (qrMsgId) {120        try { Api.deleteMessage({ chat_id: fallbackChatId, message_id: qrMsgId }); } catch (e) {}121      }122    } catch (e) {}123  }124  function clearQrState(uid) {125    Bot.setProperty("qr_msg_id_" + uid, null, "string");126    User.setProperty("qr_msg_id_" + uid, null, "string");127    User.setProperty("last_qr_message_id_" + uid, null, "string");128    Bot.setProperty("qr_order_id_" + uid, null, "string");129    User.setProperty("qr_order_id_" + uid, null, "string");130    Bot.setProperty("qr_watch_order_" + uid, null, "string");131    User.setProperty("qr_watch_order_" + uid, null, "string");132    Bot.setProperty("verifying_lock_" + uid, false, "boolean");133    User.setProperty("verifying_lock_" + uid, false, "boolean");134    User.setProperty("topup_verifying_lock_" + uid, false, "boolean");135    User.setProperty("pending_order_id", null);136  }137  function getUnifiedBalance(uid) {138    let resBal = 0;139    try { resBal = Number(Libs.ResourcesLib.userRes("balance").value()) || 0; } catch (e) {}140    let legacy = Number(Bot.getProperty("balance" + uid) || 0);141    if (isFinite(legacy) && legacy > 0) {142      try { Libs.ResourcesLib.userRes("balance").add(legacy); resBal += legacy; Bot.setProperty("balance" + uid, 0, "number"); } catch (e2) {}143    }144    return resBal;145  }146  function editCurrentUserScreen(text, markup) {147    let mid = 0;148    try {149      if (request && __swfCb && __swfCb.message && __swfCb.message.message_id) mid = Number(__swfCb.message.message_id);150      if (!mid) mid = Number(User.getProperty("main_menu_message_id") || User.getProperty("pending_menu_message_id") || 0);151    } catch(e) {}152    if (!mid || !chatId) return false;153    try {154      __swfEditMessage({chat_id:chatId,message_id:mid,text:text,parse_mode:"HTML",reply_markup:markup});155      User.setProperty("main_menu_message_id",String(mid),"string");156      User.setProperty("pending_menu_message_id",String(mid),"string");157      return true;158    } catch(e) {159      try {160        if (request && __swfCb && __swfCb.message && __swfCb.message.photo) {161          Api.editMessageCaption({chat_id:chatId,message_id:mid,caption:text,parse_mode:"HTML",reply_markup:markup});162          return true;163        }164      } catch(e2) {}165      return false;166    }167  }168  if (!orderId || orderId.trim() === "") {169    if (queryId) {170      try {171        Api.answerCallbackQuery({172          callback_query_id: queryId,173          text: "⚠️ No active payment request found. Please create a new payment request first.",174          show_alert: true175        });176      } catch (e) {}177    }178    return;179  }180  if (targetUserId && !isBackground) {181    let isChecking = User.getProperty("topup_verifying_lock_" + targetUserId);182    if (isChecking) {183      if (queryId) { try { Api.answerCallbackQuery({callback_query_id:queryId,text:"⏳ VERIFYING... PLEASE WAIT...",show_alert:true}); } catch(e) {} }184      return;185    }186    User.setProperty("topup_verifying_lock_" + targetUserId, true, "boolean");187  }188  if (Bot.getProperty("claimed_topup_" + orderId)) {189    vanishQrMessage(targetUserId, chatId);190    if (targetUserId) clearQrState(targetUserId);191    if (queryId) {192      try {193        Api.answerCallbackQuery({194          callback_query_id: queryId,195          text: "✅ ALREADY APPROVED ✅\nThis payment was already verified and credited to your balance.",196          show_alert: true197        });198      } catch (e) {}199    }200    return;201  }202  let responseData = (typeof content !== "undefined" && content) ? (typeof content === "object" ? content : JSON.parse(content)) : null;203  if (responseData && (responseData.status === "success" || responseData.status === "SUCCESS") && responseData.data) {204    let txData = responseData.data;205    let txAmount = txData.amount || amount;206    let utr = txData.utr || txData.transaction_id || "N/A";207    let senderName = txData.sender_name || (typeof user !== "undefined" && user ? user.first_name : "Valued User");208    let payTime = txData.payment_time_ist || "N/A";209    let addedAmount = parseFloat(txAmount) || 0;210    try {211      Libs.ResourcesLib.userRes("balance").add(addedAmount);212    } catch (e) {}213    let newBalance = getUnifiedBalance(targetUserId);214    Bot.setProperty("claimed_topup_" + orderId, true, "boolean");215    Bot.setProperty("total_deposit_by_" + String(targetUserId), Number(Bot.getProperty("total_deposit_by_" + String(targetUserId)) || 0) + addedAmount, "number");216    if (queryId) {217      try {218        Api.answerCallbackQuery({219          callback_query_id: queryId,220          text: "✅ PAYMENT VERIFIED SUCCESSFULLY!",221          show_alert: false222        });223      } catch (e) {}224    }225    if (targetUserId) {226      vanishQrMessage(targetUserId, chatId);227      clearQrState(targetUserId);228    }229    if (User.getProperty("buy_reseller_upgrade")) {230      let resellerPrice = Number(User.getProperty("buy_reseller_price") || 0);231      User.setProperty("buy_reseller_upgrade", null, "boolean");232      User.setProperty("buy_reseller_price", null, "number");233      Bot.setProperty("is_reseller_" + targetUserId, true, "boolean");234      let resellerText = "<blockquote>🎉 <b>CONGRATULATIONS!</b></blockquote>\n\n" +235              "👑 <b>You are now a Reseller!</b>\n\n" +236              "<i>Your payment was verified and your permanent Reseller status is now active!</i>";237      let resellerMarkup = JSON.stringify({ inline_keyboard: [[{ text: "Go to Shop", callback_data: "/vipshop" }]] });238      if (!editCurrentUserScreen(resellerText, resellerMarkup) && !(request && __swfCb)) {239        Api.sendMessage({chat_id:chatId,text:resellerText,parse_mode:"HTML",reply_markup:resellerMarkup});240      }241      if (targetUserId) User.setProperty("topup_verifying_lock_" + targetUserId, false, "boolean");242      return;243    }244    let pendingProdIdx = User.getProperty("buy_prod_idx");245    let pendingPlanIdx = User.getProperty("buy_plan_idx");246    if (pendingProdIdx !== null && pendingProdIdx !== undefined && pendingProdIdx !== "" &&247        pendingPlanIdx !== null && pendingPlanIdx !== undefined && pendingPlanIdx !== "") {248      let verifyBuyText = e_check + " <b>Payment verified!</b>\n\nCreating your order...";249      let verifyBuyMarkup = JSON.stringify({inline_keyboard:[[ {text:"🏠 Main Menu",callback_data:"/back"} ]]});250      if (!editCurrentUserScreen(verifyBuyText, verifyBuyMarkup) && !(request && __swfCb)) {251        Api.sendMessage({chat_id:chatId,text:verifyBuyText,parse_mode:"HTML",reply_markup:verifyBuyMarkup});252      }253      Bot.run({254        command: "/confirm_buyitem",255        options: { params: pendingProdIdx + " " + pendingPlanIdx }256      });257      User.setProperty("buy_prod_idx", null);258      User.setProperty("buy_plan_idx", null);259      User.setProperty("buy_price", null);260      User.setProperty("buy_needpay", null);261      if (targetUserId) User.setProperty("topup_verifying_lock_" + targetUserId, false, "boolean");262      return;263    }264    let successText = "━━━━━━━━━━━━━━━━━━━━\n" +265                      e_plus + " <b>PAYMENT SUCCESSFUL</b> " + e_plus + "\n" +266                      "━━━━━━━━━━━━━━━━━━━━\n\n" +267                      e_money + " <b>Amount Added:</b> $<b>" + addedAmount.toFixed(2) + "</b>\n" +268                      e_chart + " <b>New Balance:</b> $<b>" + newBalance.toFixed(2) + "</b>\n" +269                      e_arrow + " <b>UTR / Ref ID:</b> <code>" + utr + "</code>\n" +270                      e_time + " <b>Zaman:</b> " + payTime + "\n\n" +271                      "━━━━━━━━━━━━━━━━━━━━\n" +272                      e_coin + " <i>Your balance has been credited successfully! 🎉</i>";273    let successMarkup = JSON.stringify({inline_keyboard:[[{text:"Go to Shop",callback_data:"/vipshop"},{text:"🔰 Profile",callback_data:"/profile"}]]});274    if (!editCurrentUserScreen(successText, successMarkup) && !(request && __swfCb)) {275      Api.sendMessage({chat_id:chatId,text:successText,parse_mode:"HTML",reply_markup:successMarkup});276    }277    if (targetUserId) User.setProperty("topup_verifying_lock_" + targetUserId, false, "boolean");278    return;279  }280  if (queryId && !isBackground) {281    try {282      Api.answerCallbackQuery({283        callback_query_id: queryId,284        text: "⚠️ PAYMENT NOT RECEIVED YET\nPlease complete your payment first.",285        show_alert: true286      });287    } catch (e) {}288  }289  if (targetUserId) User.setProperty("topup_verifying_lock_" + targetUserId, false, "boolean");290} catch (err) {291  try {292    let uid = (typeof user !== "undefined" && user) ? user.telegramid : null;293    if (uid) User.setProperty("topup_verifying_lock_" + uid, false, "boolean");294  } catch (e) {}295  __uiSend("⚠️ Error in verification check: " + err.message);296}