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/_clearstock.js
javascript · 155 lines
1/**#command2name: /clearstock3answer: 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 var ADMIN_ID = Bot.getProperty("owner_id") || "8225479428";73 if (String(user.telegramid) !== ADMIN_ID) {74 return;75 }76 var input = (message || "").trim();77 var catSlug = "";78 if (params && params.trim() !== "") {79 catSlug = params.trim().toLowerCase();80 } else if (input.indexOf(" ") !== -1) {81 catSlug = input.split(" ")[1].trim().toLowerCase();82 } else {83 __uiSend("⚠️ <b>Format:</b> <code>/clearstock [category_slug]</code>\n\n<i>Example: /clearstock lodu</i>", { parse_mode: "HTML" });84 return;85 }86 var categories = Bot.getProperty("ff_categories") || {}; if(categories && typeof categories === "object") categories=Object.assign({}, categories);87 if (!categories[catSlug]) {88 __uiSend(89 "❌ Category <code>" + catSlug + "</code> not found.",90 { parse_mode: "HTML" }91 );92 return;93 }94 var oldStock = categories[catSlug].stock_list || Bot.getProperty("ff_stock_" + catSlug) || [];95 if (!Array.isArray(oldStock)) { oldStock = []; }96 var catName = categories[catSlug].name ? categories[catSlug].name.toUpperCase() : catSlug.toUpperCase();97 var text = "<blockquote>⚠️ <b>CONFIRM STOCK DELETION</b></blockquote>\n" +98 "━━━━━━━━━━━━━━━━━━━━━━━━━━\n" +99 "📁 <b>Category:</b> <code>" + catName + "</code>\n" +100 "📦 <b>Total Items:</b> <code>" + oldStock.length + "</code>\n" +101 "━━━━━━━━━━━━━━━━━━━━━━━━━━\n\n" +102 "📋 <b>LIVE STOCK LIST:</b>\n\n";103 if (oldStock.length > 0) {104 for (var i = 0; i < oldStock.length; i++) {105 var rawItem = oldStock[i];106 var email = "N/A";107 var pass = "N/A";108 var price = "N/A"; // Added Price Variable109 if (typeof rawItem === "string") {110 if (rawItem.indexOf("|") !== -1) {111 var parts = rawItem.split("|");112 email = parts[0] ? parts[0].trim() : "N/A";113 pass = parts[1] ? parts[1].trim() : "N/A";114 price = parts[2] ? parts[2].trim() : "N/A"; // Extra Price extraction115 } else {116 email = rawItem.trim();117 }118 } else if (rawItem && typeof rawItem === "object") {119 email = rawItem.email || rawItem.username || "N/A";120 pass = rawItem.password || rawItem.pass || "N/A";121 price = rawItem.price || "N/A";122 }123 text += "🆔 <b>Item #" + (i + 1) + "</b>\n" +124 "📧 <b>Email:</b> <code>" + email + "</code>\n" +125 "🔑 <b>Pass:</b> <code>" + pass + "</code>\n" +126 "💰 <b>Price:</b> <code>$" + price + "</code>\n\n"; // Rendered Price beautifully127 }128 } else {129 text += "❌ <i>Stock is already empty!</i>\n";130 }131 text += "━━━━━━━━━━━━━━━━━━━━━━━━━━\n" +132 "<i>Are you sure you want to permanently delete all items?</i>";133 var inlineButtons = [];134 if (oldStock.length > 0) {135 inlineButtons.push([136 { text: "🗑️ Delete All Stock", 137 callback_data: "/confirm_delete_stock " + catSlug 138 }139 ]);140 }141 inlineButtons.push([142 { text: "Cancel", callback_data: "/back" }143 ]);144 Api.sendMessage({145 chat_id: chat.chatid,146 text: text,147 reply_markup: JSON.stringify({ inline_keyboard: inlineButtons }),148 parse_mode: "HTML"149 });150} catch (e) {151 __uiSend(152 "❌ <b>Error:</b>\n<code>" + e.message + "</code>",153 { parse_mode: "HTML" }154 );155}