File size: 1,362 Bytes
4563f53
 
 
 
 
 
 
511affc
 
 
 
 
 
4563f53
511affc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4563f53
511affc
4563f53
511affc
 
 
 
c490058
44444aa
 
 
511affc
 
 
ee19a29
 
511affc
 
4563f53
511affc
 
 
 
 
4563f53
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
const UglifyJS = require('uglify-js');

const config = require('../config');
const { cmd, commands } = require('../command');
const { fetchJson } = require('../lib/functions'); // Assuming this fetches JSON from a different source

cmd({
  pattern: 'obfuscate',
  alias: ['obf'],
  react: 'Γ°ΕΈβ€”ΒΏ',
  desc: 'Minifies JavaScript code (using UglifyJS).',
  category: 'main',
  filename: __filename
}, async (conn, mek, m, {
  from,
  quoted,
  body,
  isCmd,
  command,
  args,
  q,
  isGroup,
  sender,
  senderNumber,
  botNumber2,
  botNumber,
  pushname,
  isMe,
  isOwner,
  groupMetadata,
  groupName,
  participants,
  groupAdmins,
  isBotAdmins,
  isAdmins,
  reply
}) => {
  if (!q) return reply('Please provide JavaScript code to minify.');

  try {
    // Minify the code using UglifyJS
    const minifiedCode = UglifyJS.minify(q, {
      compress: {
        drop_console: true, // Remove console.log statements (optional)
       //  screw_ie8: true,
       // collapse_vars: true,
    //   hoist_vars: true
      },
      mangle: {
        toplevel: true, // Mangle global variables (optional)
   //     properties: true,
     //   functions: true
      }
    }).code;

    await conn.sendMessage(m.chat, { text: minifiedCode }, { quoted: m });
  } catch (error) {
    console.error(error);
    reply(`An error occurred: ${error.message}`);
  }
});