Encrypto27
commited on
Commit
·
511affc
1
Parent(s):
d1da3df
update uglify
Browse files- plugins/encrypt.js +49 -51
plugins/encrypt.js
CHANGED
|
@@ -5,59 +5,57 @@ const { cmd, commands } = require('../command');
|
|
| 5 |
const { fetchJson } = require('../lib/functions'); // Assuming this fetches JSON from a different source
|
| 6 |
|
| 7 |
cmd({
|
| 8 |
-
pattern: 'obfuscate',
|
| 9 |
-
alias: ['obf'],
|
| 10 |
-
react: '🗿',
|
| 11 |
-
desc: 'Minifies JavaScript code (using UglifyJS).',
|
| 12 |
-
category: 'main',
|
| 13 |
-
filename: __filename
|
| 14 |
}, async (conn, mek, m, {
|
| 15 |
-
from,
|
| 16 |
-
quoted,
|
| 17 |
-
body,
|
| 18 |
-
isCmd,
|
| 19 |
-
command,
|
| 20 |
-
args,
|
| 21 |
-
q,
|
| 22 |
-
isGroup,
|
| 23 |
-
sender,
|
| 24 |
-
senderNumber,
|
| 25 |
-
botNumber2,
|
| 26 |
-
botNumber,
|
| 27 |
-
pushname,
|
| 28 |
-
isMe,
|
| 29 |
-
isOwner,
|
| 30 |
-
groupMetadata,
|
| 31 |
-
groupName,
|
| 32 |
-
participants,
|
| 33 |
-
groupAdmins,
|
| 34 |
-
isBotAdmins,
|
| 35 |
-
isAdmins,
|
| 36 |
-
reply
|
| 37 |
}) => {
|
| 38 |
-
|
| 39 |
-
if (!q) return reply('Please provide JavaScript code to minify.');
|
| 40 |
|
| 41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
collapse_vars: true,
|
| 49 |
-
hoist_vars: true
|
| 50 |
-
},
|
| 51 |
-
mangle: {
|
| 52 |
-
toplevel: true, // Mangle global variables (optional)
|
| 53 |
-
properties: true,
|
| 54 |
-
functions: true
|
| 55 |
-
}
|
| 56 |
-
}).code;
|
| 57 |
-
|
| 58 |
-
await conn.sendMessage(m.chat, { text: minifiedCode }, { quoted: m });
|
| 59 |
-
} catch (error) {
|
| 60 |
-
console.error(error);
|
| 61 |
-
reply(`An error occurred: ${error.message}`);
|
| 62 |
-
}
|
| 63 |
});
|
|
|
|
| 5 |
const { fetchJson } = require('../lib/functions'); // Assuming this fetches JSON from a different source
|
| 6 |
|
| 7 |
cmd({
|
| 8 |
+
pattern: 'obfuscate',
|
| 9 |
+
alias: ['obf'],
|
| 10 |
+
react: '🗿',
|
| 11 |
+
desc: 'Minifies JavaScript code (using UglifyJS).',
|
| 12 |
+
category: 'main',
|
| 13 |
+
filename: __filename
|
| 14 |
}, async (conn, mek, m, {
|
| 15 |
+
from,
|
| 16 |
+
quoted,
|
| 17 |
+
body,
|
| 18 |
+
isCmd,
|
| 19 |
+
command,
|
| 20 |
+
args,
|
| 21 |
+
q,
|
| 22 |
+
isGroup,
|
| 23 |
+
sender,
|
| 24 |
+
senderNumber,
|
| 25 |
+
botNumber2,
|
| 26 |
+
botNumber,
|
| 27 |
+
pushname,
|
| 28 |
+
isMe,
|
| 29 |
+
isOwner,
|
| 30 |
+
groupMetadata,
|
| 31 |
+
groupName,
|
| 32 |
+
participants,
|
| 33 |
+
groupAdmins,
|
| 34 |
+
isBotAdmins,
|
| 35 |
+
isAdmins,
|
| 36 |
+
reply
|
| 37 |
}) => {
|
| 38 |
+
if (!q) return reply('Please provide JavaScript code to minify.');
|
|
|
|
| 39 |
|
| 40 |
+
try {
|
| 41 |
+
// Minify the code using UglifyJS
|
| 42 |
+
const minifiedCode = UglifyJS.minify(q, {
|
| 43 |
+
compress: {
|
| 44 |
+
drop_console: true, // Remove console.log statements (optional)
|
| 45 |
+
screw_ie8: true,
|
| 46 |
+
collapse_vars: true,
|
| 47 |
+
hoist_vars: true
|
| 48 |
+
},
|
| 49 |
+
mangle: {
|
| 50 |
+
toplevel: true, // Mangle global variables (optional)
|
| 51 |
+
properties: true,
|
| 52 |
+
functions: true
|
| 53 |
+
}
|
| 54 |
+
}).code;
|
| 55 |
|
| 56 |
+
await conn.sendMessage(m.chat, { text: minifiedCode }, { quoted: m });
|
| 57 |
+
} catch (error) {
|
| 58 |
+
console.error(error);
|
| 59 |
+
reply(`An error occurred: ${error.message}`);
|
| 60 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
});
|