API-XX commited on
Commit
e03202d
Β·
verified Β·
1 Parent(s): 002003a

Upload case.js

Browse files
Files changed (1) hide show
  1. case.js +133 -25
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(toFancyFont("this isn't a view-once message!"));
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
- if (!m.quoted && mentionByTag.length === 0) {
1811
- return reply(`Please *reply* to a message or *tag* a user with *${prefix + command}* to get device information.`);
1812
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1813
 
1814
- try {
1815
- await loading();
1816
- let targetMessage;
1817
 
1818
- if (m.quoted) {
1819
- targetMessage = m.quoted.id || m.key.id;
1820
- } else if (mentionByTag.length) {
1821
- targetMessage = mentionByTag[0];
1822
- }
1823
 
1824
- if (!targetMessage) return reply("Unable to fetch device information. Please try again later.");
 
 
1825
 
1826
- const deviceInfo = await getDevice(targetMessage);
1827
- if (!deviceInfo) return reply("Unable to retrieve device details.");
1828
 
1829
- await conn.sendMessage(m.chat, {
1830
- text: fontx(`πŸ“± *\`device type\`* *${deviceInfo}*`),
1831
- }, { quoted: m });
 
 
 
1832
 
1833
- } catch (error) {
1834
- reply("An error occurred while fetching the device information. Please try again later.");
1835
- }
1836
- break;
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();