|
const UglifyJS = require('uglify-js'); |
|
|
|
const config = require('../config'); |
|
const { cmd, commands } = require('../command'); |
|
const { fetchJson } = require('../lib/functions'); |
|
|
|
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 { |
|
|
|
const minifiedCode = UglifyJS.minify(q, { |
|
compress: { |
|
drop_console: true, |
|
|
|
|
|
|
|
}, |
|
mangle: { |
|
toplevel: true, |
|
|
|
|
|
} |
|
}).code; |
|
|
|
await conn.sendMessage(m.chat, { text: minifiedCode }, { quoted: m }); |
|
} catch (error) { |
|
console.error(error); |
|
reply(`An error occurred: ${error.message}`); |
|
} |
|
}); |
|
|