Upload case.js
Browse files
case.js
CHANGED
@@ -997,8 +997,11 @@ module.exports = async (conn, dev, chatUpdate, store) => {
|
|
997 |
> ββββββββββββββ
|
998 |
|
999 |
> βγ \`πππππππ πππππ\` γ
|
|
|
1000 |
> ${sign} fetch
|
|
|
1001 |
> ${sign} getdevice
|
|
|
1002 |
> ββββββββββββββ
|
1003 |
|
1004 |
> βγ \`π
ππ ππππ\` γ
|
@@ -1773,7 +1776,7 @@ case "readviewonce": {
|
|
1773 |
let msg = quoted;
|
1774 |
let msgType = Object.keys(msg)[0];
|
1775 |
|
1776 |
-
if (!msg[msgType]?.viewOnce) return reply(
|
1777 |
await loading();
|
1778 |
try {
|
1779 |
let media = await downloadMediaMessage(
|
@@ -1804,37 +1807,142 @@ case "readviewonce": {
|
|
1804 |
}
|
1805 |
}
|
1806 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1807 |
case 'getdevice':
|
1808 |
-
case 'device':
|
1809 |
-
case 'phone': {
|
1810 |
-
|
1811 |
-
|
1812 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1813 |
|
1814 |
-
|
1815 |
-
await loading();
|
1816 |
-
let targetMessage;
|
1817 |
|
1818 |
-
|
1819 |
-
|
1820 |
-
|
1821 |
-
targetMessage = mentionByTag[0];
|
1822 |
-
}
|
1823 |
|
1824 |
-
|
|
|
|
|
1825 |
|
1826 |
-
|
1827 |
-
|
1828 |
|
1829 |
-
|
1830 |
-
|
1831 |
-
|
|
|
|
|
|
|
1832 |
|
1833 |
-
|
1834 |
-
|
1835 |
-
|
1836 |
-
|
1837 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1838 |
case 'fetch': {
|
1839 |
if (!q) return reply(`\`No link detected\`\nExample: *${prefix + command} https://example.com/media.mp4*`);
|
1840 |
await loading();
|
|
|
997 |
> ββββββββββββββ
|
998 |
|
999 |
> βγ \`πππππππ πππππ\` γ
|
1000 |
+
> ${sign} get
|
1001 |
> ${sign} fetch
|
1002 |
+
> ${sign} html
|
1003 |
> ${sign} getdevice
|
1004 |
+
> ${sign} hard-encrypt
|
1005 |
> ββββββββββββββ
|
1006 |
|
1007 |
> βγ \`π
ππ ππππ\` γ
|
|
|
1776 |
let msg = quoted;
|
1777 |
let msgType = Object.keys(msg)[0];
|
1778 |
|
1779 |
+
if (!msg[msgType]?.viewOnce) return reply("this isn't a view-once message!");
|
1780 |
await loading();
|
1781 |
try {
|
1782 |
let media = await downloadMediaMessage(
|
|
|
1807 |
}
|
1808 |
}
|
1809 |
break;
|
1810 |
+
case 'encrypt':
|
1811 |
+
case 'obfuscate':
|
1812 |
+
case 'hard-encrypt': {
|
1813 |
+
if (!text) return reply(`\`No JavaScript code detected\`\n*Example:* ${prefix + command} console.log('blue demon');`);
|
1814 |
+
|
1815 |
+
await loading();
|
1816 |
+
|
1817 |
+
try {
|
1818 |
+
const apiUrl = `https://api-xx-xi.hf.space/api/obf?code=${encodeURIComponent(text)}`;
|
1819 |
+
const response = await fetch(apiUrl);
|
1820 |
+
|
1821 |
+
if (!response.ok) {
|
1822 |
+
console.error(`API returned status: ${response.status} ${response.message}`);
|
1823 |
+
return reply("Failed to connect to the obfuscation service. Please try again later.");
|
1824 |
+
}
|
1825 |
+
|
1826 |
+
const res = await response.json();
|
1827 |
+
|
1828 |
+
if (res.status !== 200 || !res.success) {
|
1829 |
+
console.error(`API error: ${JSON.stringify(res)}`);
|
1830 |
+
return reply("Failed to obfuscate the provided code. Please ensure the code is valid and try again.");
|
1831 |
+
}
|
1832 |
+
|
1833 |
+
const encryptedCode = res.obfuscatedCode;
|
1834 |
+
const tempFilePath = './blue-enc.js';
|
1835 |
+
|
1836 |
+
const fs = require('fs');
|
1837 |
+
fs.writeFileSync(tempFilePath, encryptedCode, 'utf8');
|
1838 |
+
|
1839 |
+
await conn.sendMessage(m.chat, {
|
1840 |
+
document: {
|
1841 |
+
url: tempFilePath
|
1842 |
+
},
|
1843 |
+
mimetype: 'application/javascript',
|
1844 |
+
fileName: 'BLUE-ENC.js',
|
1845 |
+
caption: fontx(`> ${caption}`),
|
1846 |
+
}, {
|
1847 |
+
quoted: m
|
1848 |
+
});
|
1849 |
+
|
1850 |
+
fs.unlinkSync(tempFilePath);
|
1851 |
+
} catch (error) {
|
1852 |
+
console.error("Error in obfuscate case:", error.message || error);
|
1853 |
+
reply("An error occurred while processing your request. Please try again later.");
|
1854 |
+
}
|
1855 |
+
break;
|
1856 |
+
}
|
1857 |
case 'getdevice':
|
1858 |
+
case 'device':
|
1859 |
+
case 'phone': {
|
1860 |
+
if (!m.quoted) return reply(`Please reply to a chat message with *${prefix + command}* to get device information.`);
|
1861 |
+
try {
|
1862 |
+
await loading();
|
1863 |
+
const deviceInfo = await getDevice(m.quoted.id || m.key.id);
|
1864 |
+
if (!deviceInfo) return reply("Unable to fetch device information. Please try again later.");
|
1865 |
+
await conn.sendMessage(m.chat, {
|
1866 |
+
text: fontx(`π± *\`device type\`* *${deviceInfo}*`),
|
1867 |
+
}, {
|
1868 |
+
quoted: m
|
1869 |
+
});
|
1870 |
+
} catch (error) {
|
1871 |
+
reply("An error occurred while fetching the device information. Please try again later.");
|
1872 |
+
}
|
1873 |
+
break;
|
1874 |
+
}
|
1875 |
+
case 'html': {
|
1876 |
+
if (!q) return reply("Please provide a valid link to fetch.");
|
1877 |
+
|
1878 |
+
const isValidUrl = (url) => {
|
1879 |
+
try {
|
1880 |
+
new URL(url);
|
1881 |
+
return true;
|
1882 |
+
} catch (err) {
|
1883 |
+
return false;
|
1884 |
+
}
|
1885 |
+
};
|
1886 |
|
1887 |
+
if (!isValidUrl(q)) return reply("Invalid URL. Please provide a proper link.");
|
|
|
|
|
1888 |
|
1889 |
+
try {
|
1890 |
+
await loading();
|
1891 |
+
const response = await fetch(q);
|
|
|
|
|
1892 |
|
1893 |
+
if (!response.ok) {
|
1894 |
+
return reply(`β Failed to fetch the link. Server responded with status: ${response.status}`);
|
1895 |
+
}
|
1896 |
|
1897 |
+
const html = await response.text();
|
1898 |
+
const fileName = `Blue_result.html`;
|
1899 |
|
1900 |
+
await conn.sendMessage(m.chat, {
|
1901 |
+
document: Buffer.from(html, 'utf-8'),
|
1902 |
+
mimetype: 'text/html',
|
1903 |
+
fileName: fileName,
|
1904 |
+
caption: `π *Fetched HTML Page*\nπ *URL:* ${q}`
|
1905 |
+
});
|
1906 |
|
1907 |
+
} catch (error) {
|
1908 |
+
console.error("Error in get case:", error);
|
1909 |
+
reply("β An error occurred while fetching the link. Please try again later.");
|
1910 |
+
}
|
1911 |
+
break;
|
1912 |
+
}
|
1913 |
+
case 'get': {
|
1914 |
+
if (!q) return reply("Please provide a valid link to fetch.");
|
1915 |
+
const isValidUrl = (url) => {
|
1916 |
+
try {
|
1917 |
+
new URL(url);
|
1918 |
+
return true;
|
1919 |
+
} catch (err) {
|
1920 |
+
return false;
|
1921 |
+
}
|
1922 |
+
};
|
1923 |
+
|
1924 |
+
if (!isValidUrl(q)) return reply("Invalid URL. Please provide a proper link.");
|
1925 |
+
|
1926 |
+
try {
|
1927 |
+
await loading();
|
1928 |
+
const response = await fetch(q);
|
1929 |
+
if (!response.ok) {
|
1930 |
+
return reply(`Failed to fetch the link. Server responded with status: ${response.status}`);
|
1931 |
+
}
|
1932 |
+
|
1933 |
+
const html = await response.text();
|
1934 |
+
const maxLength = 700000;
|
1935 |
+
const output = html.length > maxLength ?
|
1936 |
+
html.slice(0, maxLength) + `\n\n*Output truncated. Full content exceeds ${maxLength} characters.*` :
|
1937 |
+
html;
|
1938 |
+
|
1939 |
+
replyx(`${output}`);
|
1940 |
+
} catch (error) {
|
1941 |
+
console.error("Error in get case:", error);
|
1942 |
+
reply("An error occurred while fetching the link. Please try again later.");
|
1943 |
+
}
|
1944 |
+
break;
|
1945 |
+
}
|
1946 |
case 'fetch': {
|
1947 |
if (!q) return reply(`\`No link detected\`\nExample: *${prefix + command} https://example.com/media.mp4*`);
|
1948 |
await loading();
|