/* ║ متمسحش الحقوق دي بي الحب ❤️🌚 ║ الكود من صنع عمو صخر (ROCK) ║ https://whatsapp.com/channel/0029VbDIOZmJZg3xUaL0nZ31 ║ احلا مساء على أحلى ناس 🌚❤️ */ import fetch from 'node-fetch'; const COMMANDS = ['.سكرين', '.screen', '.screenshot']; const SCREENSHOT_APIS = [ (url) => `https://api.microlink.io/?url=${encodeURIComponent(url)}&screenshot=true&embed=screenshot.url`, (url) => `https://api.pikwy.com/v1/screenshot?t=1&w=1280&h=800&u=${encodeURIComponent(url)}`, (url) => `https://free.pagepeeker.com/v2/thumbs.php?size=x&url=${encodeURIComponent(url)}`, (url) => `https://image.thum.io/get/width/1280/crop/800/maxAge/1/${url.replace(/^https?:\/\//, '')}`, (url) => `https://render-tron.appspot.com/screenshot/${encodeURIComponent(url)}` ]; export default async function (conn, m, { command, args, chat }) { if (!COMMANDS.includes(command)) return; console.log('⚡ تم استدعاء أمر السكرين:', command); const react = async (text) => { try { await conn.sendMessage(chat, { react: { text, key: m.key } }); } catch (e) { console.error('[Screenshot Reaction Error]:', e.message); } }; try { const text = args.join(' ').trim(); if (!text) { await conn.sendMessage(chat, { text: `*❖╾─╼ ╼⏣〔☠〕⏣╾ ╾─╼❖* ` + `📸 *وحدة التقاط الشاشة* ` + `📌 *الاستخدام:* ${command} رابط_الموقع ` + `💡 *مثال:* ${command} google.com ` + `*❖╾─╼ ╼⏣〔☠〕⏣╾ ╾─╼❖*` }, { quoted: m }); return; } let url = text; if (!/^https?:\/\//i.test(url)) { url = 'https://' + url; } await react('⏳'); let success = false; for (let i = 0; i < SCREENSHOT_APIS.length; i++) { const screenshotUrl = SCREENSHOT_APIS[i](url); try { const res = await fetch(screenshotUrl, { method: 'GET', headers: { 'User-Agent': 'Mozilla/5.0' }, timeout: 15000 }); if (res.ok) { const buffer = await res.buffer(); if (buffer.length > 1000) { await conn.sendMessage(chat, { image: buffer, caption: `*❖╾─╼ ╼⏣〔☠〕⏣╾ ╾─╼❖* ` + `📸 *تم التقاط الشاشة بنجاح* ` + `🌐 *الهدف:* ${url} ` + `⚙️ *السيرفر:* Method #${i + 1} ` + `*❖╾─╼ ╼⏣〔☠〕⏣╾ ╾─╼❖*` }, { quoted: m }); success = true; await react('✅'); break; } } } catch (e) { continue; } } if (!success) { try { const backupUrl = `https://api.screenshotmachine.com/?key=100346&url=${encodeURIComponent(url)}&device=desktop&dimension=1024x768&format=jpg`; const res = await fetch(backupUrl); if (res.ok) { const buffer = await res.buffer(); await conn.sendMessage(chat, { image: buffer, caption: `*❖╾─╼ ╼⏣〔☠〕⏣╾ ╾─╼❖* ` + `📸 *تم الالتقاط عبر سيرفر الطوارئ* ` + `🌐 *الهدف:* ${url} ` + `*❖╾─╼ ╼⏣〔☠〕⏣╾ ╾─╼❖*` }, { quoted: m }); await react('✅'); success = true; } } catch (e) {} } if (!success) { throw new Error('جميع السيرفرات لا تستجيب حالياً'); } } catch (error) { console.error('[Screenshot Command Error]:', error); await react('❌'); try { await conn.sendMessage(chat, { text: `*❖╾─╼ ╼⏣〔☠〕⏣╾ ╾─╼❖* ` + `❌ *فشل التقاط الشاشة* ` + `🔮 ${error.message || 'حدث خطأ غير معروف أثناء معالجة الطلب.'} ` + `*❖╾─╼ ╼⏣〔☠〕⏣╾ ╾─╼❖*` }, { quoted: m }); } catch (sendError) { console.error('[Screenshot Error Message]:', sendError); } } }