API-XX commited on
Commit
c6ff83b
ยท
verified ยท
1 Parent(s): 29a3c01

Upload case.js

Browse files
Files changed (1) hide show
  1. case.js +94 -1
case.js CHANGED
@@ -997,7 +997,8 @@ module.exports = async (conn, dev, chatUpdate, store) => {
997
  > โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ
998
 
999
  > โ”€ใ€Ž \`๐€๐ƒ๐•๐€๐๐‚๐„ ๐“๐Ž๐Ž๐‹๐’\` ใ€
1000
-
 
1001
  > โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ
1002
 
1003
  > โ”€ใ€Ž \`๐…๐”๐ ๐Œ๐„๐๐”\` ใ€
@@ -1764,8 +1765,100 @@ case 'kick': {
1764
 
1765
 
1766
 
 
 
 
 
 
 
1767
 
 
 
 
 
 
 
 
 
 
1768
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1769
  case 'gross': {
1770
  const grossEmojis = [
1771
  '๐Ÿคข', '๐Ÿคฎ', '๐Ÿ˜–', '๐Ÿ˜ซ', '๐Ÿคข๐Ÿคข', '๐Ÿคฎ๐Ÿคฎ', '๐Ÿ˜ตโ€๐Ÿ’ซ', '๐Ÿคง', '๐Ÿคข๐Ÿคฎ', '๐Ÿ˜ท',
 
997
  > โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ
998
 
999
  > โ”€ใ€Ž \`๐€๐ƒ๐•๐€๐๐‚๐„ ๐“๐Ž๐Ž๐‹๐’\` ใ€
1000
+ > ${sign} fetch
1001
+ > ${sign} getdevice
1002
  > โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ
1003
 
1004
  > โ”€ใ€Ž \`๐…๐”๐ ๐Œ๐„๐๐”\` ใ€
 
1765
 
1766
 
1767
 
1768
+ case 'getdevice':
1769
+ case 'device':
1770
+ case 'phone': {
1771
+ if (!m.quoted && mentionByTag.length === 0) {
1772
+ return reply(`Please *reply* to a message or *tag* a user with *${prefix + command}* to get device information.`);
1773
+ }
1774
 
1775
+ try {
1776
+ await loading();
1777
+ let targetMessage;
1778
+
1779
+ if (m.quoted) {
1780
+ targetMessage = m.quoted.id || m.key.id;
1781
+ } else if (mentionByTag.length) {
1782
+ targetMessage = mentionByTag[0];
1783
+ }
1784
 
1785
+ if (!targetMessage) return reply("Unable to fetch device information. Please try again later.");
1786
+
1787
+ const deviceInfo = await getDevice(targetMessage);
1788
+ if (!deviceInfo) return reply("Unable to retrieve device details.");
1789
+
1790
+ await conn.sendMessage(m.chat, {
1791
+ text: fontx(`๐Ÿ“ฑ *\`device type\`* *${deviceInfo}*`),
1792
+ }, { quoted: m });
1793
+
1794
+ } catch (error) {
1795
+ reply("An error occurred while fetching the device information. Please try again later.");
1796
+ }
1797
+ break;
1798
+ }
1799
+ case 'fetch': {
1800
+ if (!q) return reply(`\`No link detected\`\nExample: *${prefix + command} https://example.com/media.mp4*`);
1801
+ await loading();
1802
+ try {
1803
+ let url = q.trim();
1804
+ let response = await fetch(url, {
1805
+ method: 'HEAD'
1806
+ });
1807
+
1808
+ if (!response.ok) {
1809
+ return conn.sendMessage(m.chat, {
1810
+ text: `โŒ *Failed to fetch the link.*\nStatus: ${response.status}`
1811
+ });
1812
+ }
1813
+
1814
+ let contentType = response.headers.get('content-type') || '';
1815
+ let filename = url.split('/').pop().split('?')[0];
1816
+
1817
+ let messageOptions = {
1818
+ caption: `๐Ÿ”— *Fetched Content*\n๐Ÿ“Ž *Filename:* ${filename}`
1819
+ };
1820
+
1821
+ if (contentType.includes('image')) {
1822
+ conn.sendMessage(m.chat, {
1823
+ image: {
1824
+ url
1825
+ },
1826
+ ...messageOptions
1827
+ });
1828
+ } else if (contentType.includes('video')) {
1829
+ conn.sendMessage(m.chat, {
1830
+ video: {
1831
+ url
1832
+ },
1833
+ ...messageOptions
1834
+ });
1835
+ } else if (contentType.includes('audio')) {
1836
+ conn.sendMessage(m.chat, {
1837
+ audio: {
1838
+ url
1839
+ },
1840
+ mimetype: 'audio/mpeg',
1841
+ ...messageOptions
1842
+ });
1843
+ } else {
1844
+ conn.sendMessage(m.chat, {
1845
+ document: {
1846
+ url
1847
+ },
1848
+ mimetype: contentType || 'application/octet-stream',
1849
+ fileName: filename,
1850
+ ...messageOptions
1851
+ });
1852
+ }
1853
+
1854
+ } catch (error) {
1855
+ console.error("Error in fetch case:", error);
1856
+ conn.sendMessage(m.chat, {
1857
+ text: "โŒ An error occurred while fetching the content. Please try again later."
1858
+ });
1859
+ }
1860
+ break;
1861
+ }
1862
  case 'gross': {
1863
  const grossEmojis = [
1864
  '๐Ÿคข', '๐Ÿคฎ', '๐Ÿ˜–', '๐Ÿ˜ซ', '๐Ÿคข๐Ÿคข', '๐Ÿคฎ๐Ÿคฎ', '๐Ÿ˜ตโ€๐Ÿ’ซ', '๐Ÿคง', '๐Ÿคข๐Ÿคฎ', '๐Ÿ˜ท',