Encrypto-27-AI-BOT / plugins /hardencrypt.js
Encrypto27
hard encrypt plugin
0704112
raw
history blame
1.58 kB
const { minify } = require('uglify-es'); // Corrected import
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).', // Update description
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
}) => {
try {
if (!q) return reply('Please provide JavaScript code to minify.');
await reply('> *Minifying code...*'); // Update message
// Minify the code using UglifyJS with more aggressive options
const { code } = minify(q, {
compress: {
drop_console: true,
screw_ie8: true,
collapse_vars: true,
hoist_vars: true
},
mangle: {
toplevel: true,
properties: true,
functions: true
}
});
await conn.sendMessage(m.chat, { text: code }, { quoted: m });
} catch (error) {
if (error.message === "Cannot read properties of undefined (reading 'match')") {
reply("Invalid JavaScript code provided. Please check for syntax errors.");
} else {
console.error(error);
reply(`An error occurred: ${error.message}`);
}
}
});