yaainnnxitstore/YASIN_XIT_BOTPublic · Bot Template
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
commands/_confirm_rem_prod.js
javascript · 147 lines
1/**#command2name: /confirm_rem_prod3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12var __swfUpdate = (typeof update !== "undefined" && update) ? update : null;13var __swfCb = (__swfUpdate && __swfUpdate.callback_query) ? __swfUpdate.callback_query : null;14var __swfCbMsg = (__swfCb && __swfCb.message) ? __swfCb.message : null;15var __swfMsgId = __swfCbMsg && __swfCbMsg.message_id ? Number(__swfCbMsg.message_id) : 0;16var __swfCbId = __swfCb && __swfCb.id ? String(__swfCb.id) : "";17try {18 if (typeof request !== "undefined" && request && __swfCb) {19 if (__swfCb.message) request.message = __swfCb.message;20 if (!request.id && __swfCb.id) request.id = __swfCb.id;21 }22} catch(__swf_norm_err) {}23function __swfEditMessage(a) {24 a = a || {};25 var mid = Number(a.message_id || __swfMsgId || 0);26 var cid = a.chat_id || (typeof chat !== "undefined" && chat ? (chat.id || chat.chatid) : null);27 if (!mid || !cid) throw new Error("Callback message ID not found");28 var markup = a.reply_markup;29 if (typeof markup === "string") { try { markup = JSON.parse(markup); } catch(_) {} }30 var base = {chat_id:cid,message_id:mid,parse_mode:a.parse_mode,reply_markup:markup};31 var cm = __swfCbMsg;32 if (cm && (cm.photo || cm.video || cm.document || cm.audio || cm.animation)) {33 return Api.editMessageCaption({chat_id:cid,message_id:mid,caption:String(a.text == null ? "" : a.text),parse_mode:a.parse_mode,reply_markup:markup});34 }35 return Api.editMessageText({chat_id:cid,message_id:mid,text:String(a.text == null ? "" : a.text),parse_mode:a.parse_mode,reply_markup:markup});36}37function __uiSend(text, opts) {38 opts = opts || {};39 var req = (typeof request !== "undefined" && request) ? request : null;40 var chatId = (typeof chat !== "undefined" && chat && chat.chatid) ? chat.chatid : null;41 var isCallback = !!__swfCb;42 var mid = 0;43 if (isCallback && update.callback_query.message && update.callback_query.message.message_id) mid = Number(update.callback_query.message.message_id);44 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; } }45 var markup = opts.reply_markup;46 if (markup && typeof markup !== "string") { try { markup = JSON.stringify(markup); } catch(e1) {} }47 var textValue = String(text == null ? "" : text);48 if (mid && chatId) {49 try {50 __swfEditMessage({chat_id:chatId,message_id:mid,text:textValue,parse_mode:opts.parse_mode,reply_markup:markup});51 try { User.setProperty("main_menu_message_id",String(mid),"string"); User.setProperty("pending_menu_message_id",String(mid),"string"); } catch(se) {}52 return true;53 } catch(e2) {54 var s=String(e2).toLowerCase();55 if(s.indexOf("message is not modified")>=0 || s.indexOf("not modified")>=0) return true;56 if(isCallback && update.callback_query.message && update.callback_query.message.photo) {57 try { Api.editMessageCaption({chat_id:chatId,message_id:mid,caption:textValue,parse_mode:opts.parse_mode,reply_markup:markup}); return true; } catch(e3) {58 var s3=String(e3).toLowerCase(); if(s3.indexOf("not modified")>=0) return true;59 }60 }61 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; }62 }63 }64 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; }65 try {66 var sent=Api.sendMessage({chat_id:chatId,text:textValue,parse_mode:opts.parse_mode,reply_markup:markup});67 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) {}68 return true;69 } catch(e7) { return false; }70}71try {72 if (typeof request !== "undefined" && request && __swfCb && __swfCb.message) { request.message = __swfCb.message; }73 var adminId = Bot.getProperty("owner_id") || "8225479428";74 if (String(chat.chatid) !== adminId) return;75 var callbackId = request ? request.id : null;76 var targetIndex = params ? Number(params.trim()) : -1;77 if (targetIndex === -1 || isNaN(targetIndex)) {78 if (callbackId) Api.answerCallbackQuery({ callback_query_id: callbackId, text: "❌ Invalid product data index!", show_alert: true });79 return;80 }81 var productList = Bot.getProperty("stored_products") || []; if(Array.isArray(productList)) productList=productList.slice();82 if (productList.length === 0 || targetIndex >= productList.length) {83 if (callbackId) {84 Api.answerCallbackQuery({ callback_query_id: callbackId, text: "❌ Product already removed or missing!", show_alert: true });85 }86 return;87 }88 var removedProduct = productList[targetIndex];89 var removedName = removedProduct.name;90 productList.splice(targetIndex, 1); // Array modification91 var cleanRemoved = String(removedName || "").trim().toUpperCase();92 Bot.setProperty("stored_products", productList, "json");93 try {94 var catMap = Bot.getProperty("ff_categories") || {}; if(catMap && typeof catMap === "object") catMap=Object.assign({}, catMap);95 for (var catKey in catMap) {96 if (!catMap.hasOwnProperty(catKey) || !catMap[catKey]) continue;97 var catObj = catMap[catKey];98 if (Array.isArray(catObj.products)) {99 var kept = [];100 for (var cp=0; cp<catObj.products.length; cp++) {101 var cpName = String(catObj.products[cp] && catObj.products[cp].name || "").trim().toLowerCase();102 if (cpName !== String(removedName || "").trim().toLowerCase()) kept.push(catObj.products[cp]);103 }104 catObj.products = kept;105 }106 catMap[catKey] = catObj;107 }108 Bot.setProperty("ff_categories", catMap, "json");109 } catch (syncDeleteErr) {}110 var allProps = ["price_normal_"+cleanRemoved+"_1","price_reseller_"+cleanRemoved+"_1"];111 try { Bot.setProperty("auto_discount_"+cleanRemoved+"_ALL",null); } catch(__adErr) {}112 var removedPlans = removedProduct.plans || [];113 for(var rp=0;rp<removedPlans.length;rp++){114 var rv=String(removedPlans[rp].days).replace(/[^0-9.]/g,"");115 var ru=removedPlans[rp].unit||"day";116 var unitLabel=ru==="hour"?"Hour":ru==="minute"?"Minute":"Day";117 Bot.setProperty("price_normal_"+cleanRemoved+"_"+rv+"_"+ru,null);118 Bot.setProperty("price_reseller_"+cleanRemoved+"_"+rv+"_"+ru,null);119 Bot.setProperty("price_normal_"+cleanRemoved+"_"+rv,null);120 Bot.setProperty("price_reseller_"+cleanRemoved+"_"+rv,null);121 Bot.setProperty("manual_keys_"+cleanRemoved+"_"+rv+"_"+ru,null);122 Bot.setProperty("manual_keys_"+cleanRemoved+"_"+rv,null);123 Bot.setProperty("stock_"+removedName+"_"+rv+"_"+unitLabel,null);124 Bot.setProperty("stock_"+removedName+"_"+rv+"_Day",null);125 Bot.setProperty("stock_"+String(targetIndex)+"_"+rp,null);126 Bot.setProperty("auto_discount_"+cleanRemoved+"_"+rv+"_"+(ru==="hour"?"HOUR":ru==="minute"?"MINUTE":"DAY"),null);127 }128 var successText = "<blockquote><b>🗑️ PRODUCT SUCCESSFULLY REMOVED</b>\n\n" +129 "• <b>Product Name:</b> <code>" + removedName.toUpperCase() + "</code>\n" +130 "• <b>Status:</b> The product was removed from the shop records.\n" +131 "• <b>Remaining products:</b> <code>" + productList.length + "</code></blockquote>";132 if (request && request.message) {133 __swfEditMessage({134 chat_id: String(chat.chatid),135 message_id: Number(request.message.message_id),136 text: successText,137 parse_mode: "HTML"138 });139 } else {140 __uiSend(successText, { parse_mode: "HTML" });141 }142 if (callbackId) {143 Api.answerCallbackQuery({ callback_query_id: callbackId, text: "✅ Product wiped!" });144 }145} catch (err) {146 __uiSend("⚠️ Execution Error: " + err.message);147}