tarunpoonia905/OfcDevShopBotPublic · Bot Template
AIDEV SHOP appears to be a Telegram automation bot. Commands include /confirm_delete_stock, /addstock_id, /extkey_menu, /partner_api, /apidelete, /buy_hack_cat, /admin_manage_products, /check_buy. Observed in code: messaging, keyboards, payments, libs, web, http, games.
Utilityutility
228 commands0 envUpdated 12d agoCreated Oct 18, 2026
commands/_send_stars_invoice.js
javascript · 99 lines
1/**#command2name: /send_stars_invoice3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12/*#SIZE_V1*/try{(function(){var z=Bot.getProperty("ui_btn_size");var mx=z==="large"?1:(z==="medium"?2:0);if(!mx||Api.__sz)return;var NAV=/^[◀▶⬅➡«»‹›⏪⏩]|\d+\s*\/\s*\d+|prev|next|page/i;var T=function(m){try{var o=typeof m==="string"?JSON.parse(m):m;if(!o||!o.inline_keyboard)return m;var out=[],cnt=0;o.inline_keyboard.forEach(function(row){var nav=row.some(function(b){return NAV.test(String(b.text||"").trim());});if(row.length<=mx||nav){out.push(row);cnt+=row.length;return;}for(var i=0;i<row.length;i+=mx){var c=row.slice(i,i+mx);out.push(c);cnt+=c.length;}});if(cnt>100||out.length>100)return m;o.inline_keyboard=out;return typeof m==="string"?JSON.stringify(o):o;}catch(e){return m;}};["sendMessage","editMessageText","editMessageCaption","editMessageReplyMarkup","sendPhoto","sendVideo","sendAnimation","sendDocument"].forEach(function(n){var f=Api[n];if(typeof f!=="function")return;Api[n]=function(p){try{if(p&&p.reply_markup)p.reply_markup=T(p.reply_markup);}catch(e){}return f.apply(Api,arguments);};});Api.__sz=true;})();}catch(__szE){}13/*#ANIM_V1*/try{(function(){var M={party:"5046509860389126442",fire:"5104841245755180586",heart:"5159385139981059251",like:"5107584321108051014"};var a=Bot.getProperty("ui_anim");if(!a||!M[a]||Api.__an)return;var E=M[a];var OK=/PURCHASE SUCCESSFUL|PAYMENT SUCCESSFUL|Payment verified|CONGRATULATIONS/i;var priv=function(p){return p&&p.chat_id&&String(p.chat_id).charAt(0)!=="-";};["sendMessage","sendPhoto","sendVideo","sendAnimation"].forEach(function(n){var f=Api[n];if(typeof f!=="function")return;Api[n]=function(p){try{if(priv(p)&&!p.message_effect_id&&OK.test(String(p.text||p.caption||"")))p.message_effect_id=E;}catch(e){}return f.apply(Api,arguments);};});var fe=Api.editMessageText;if(typeof fe==="function"){Api.editMessageText=function(p){var r=fe.apply(Api,arguments);try{if(priv(p)&&OK.test(String(p.text||"")))Api.sendMessage({chat_id:p.chat_id,text:"🎉",message_effect_id:E});}catch(e){}return r;};}Api.__an=true;})();}catch(__anE){}14/*#PREMIUM_UI_V1*/try{(function(){if(Bot.getProperty("ui_premium")!==true||Api.__pm)return;var R=function(t,c){var s=(String(t||"")+" "+String(c||"")).toLowerCase();if(/back|cancel|close|delete|remove|clear|reject|stop|ban|exit/.test(s))return"danger";if(/pay|buy|confirm|verify|paid|add|deposit|shop|claim|yes|receive|wallet|download|update/.test(s))return"success";return"primary";};var T=function(m){try{var o=typeof m==="string"?JSON.parse(m):m;if(!o||!o.inline_keyboard)return m;o.inline_keyboard.forEach(function(row){row.forEach(function(b){if(b.copy_text||b.url||b.callback_data||b.web_app){b.style=R(b.text,b.callback_data||b.url);if(!b.icon_custom_emoji_id&&b.text&&!/^[\u2600-\u27BF\uD83C-\uD83E]/.test(String(b.text).trim())&&!/^[✦✨💎]/.test(b.text))b.text="✦ "+b.text;}});});return typeof m==="string"?JSON.stringify(o):o;}catch(e){return m;}};["sendMessage","editMessageText","editMessageCaption","editMessageReplyMarkup","sendPhoto","sendVideo","sendAnimation","sendDocument"].forEach(function(n){var f=Api[n];if(typeof f!=="function")return;Api[n]=function(p){try{if(p&&p.reply_markup)p.reply_markup=T(p.reply_markup);}catch(e){}return f.apply(Api,arguments);};});Api.__pm=true;})();}catch(__pmE){}15 16 17// =========================================================18// ⭐ Sends a real Telegram Stars (XTR) invoice.19// Usage via callback_data:20// /send_stars_invoice deposit <amount>21// /send_stars_invoice buy <prodIdx> <planIdx>22//23// ⚠️ IMPORTANT: This uses the RAW Telegram Bot API (sendInvoice) directly24// via bot.token, bypassing any platform-specific wrapper, since Stars25// payments (XTR currency, empty provider_token) need exact API compliance.26// For Stars: provider_token MUST be an empty string, currency MUST be "XTR".27// =========================================================28 29try {30 var userId = String(user.telegramid);31 var chatId = chat.chatid;32 33 var parts = params ? String(params).trim().split(" ") : [];34 var mode = parts[0];35 36 var title, description, payload, starsAmount;37 38 if (mode === "deposit") {39 starsAmount = parseInt(parts[1]);40 if (isNaN(starsAmount) || starsAmount <= 0) {41 Bot.sendMessage("❌ Invalid Stars amount.");42 return;43 }44 title = "Wallet Deposit — " + starsAmount + " Stars";45 description = "Add " + starsAmount + " Telegram Stars to your Panel Shop wallet balance.";46 payload = "deposit:" + userId + ":" + starsAmount;47 48 } else if (mode === "buy") {49 var prodIdx = Number(parts[1]);50 var planIdx = Number(parts[2]);51 var productList = Bot.getProperty("stored_products") || [];52 var product = productList[prodIdx];53 if (!product || !product.plans || !product.plans[planIdx]) {54 Bot.sendMessage("❌ Product/Plan not found.");55 return;56 }57 var plan = product.plans[planIdx];58 var cleanProdName = product.name.trim().toUpperCase();59 var planUnit = plan.unit || "day";60 var cleanPlanDays = String(plan.days).replace(/[^0-9.]/g, "").trim();61 var starsKeySuffix = (planUnit === "day") ? cleanPlanDays : (cleanPlanDays + "_" + planUnit);62 var starsPriceKey = "stars_price_" + cleanProdName + "_" + starsKeySuffix;63 starsAmount = Number(Bot.getProperty(starsPriceKey) || 0);64 65 if (!starsAmount) {66 Bot.sendMessage("❌ Is plan ke liye Stars price abhi set nahi hai. Admin se contact karein.");67 return;68 }69 70 var durationDisplay = plan.durationDisplay || (cleanPlanDays + " " + (planUnit === "hour" ? "Hour(s)" : planUnit === "minute" ? "Minute(s)" : "Day(s)"));71 title = product.name + " — " + durationDisplay;72 description = "Instant key delivery for " + product.name + " (" + durationDisplay + "), paid via Telegram Stars.";73 payload = "buy:" + userId + ":" + prodIdx + ":" + planIdx;74 75 } else {76 Bot.sendMessage("❌ Invalid invoice request.");77 return;78 }79 80 var invoiceBody = {81 chat_id: chatId,82 title: title,83 description: description,84 payload: payload,85 provider_token: "", // ✅ MUST be empty string for Telegram Stars (XTR)86 currency: "XTR",87 prices: JSON.stringify([{ label: title, amount: starsAmount }])88 };89 90 Api.sendInvoice(invoiceBody);91 92 var queryId = request ? (request.id || (request.callback_query && request.callback_query.id)) : null;93 if (queryId) {94 try { Api.answerCallbackQuery({ callback_query_id: String(queryId), text: "⭐ Invoice sent!" }); } catch (e) {}95 }96 97} catch (err) {98 Bot.sendMessage("⚠️ Stars Invoice Error: " + err.message, { parse_mode: "HTML" });99}