"use strict"; const { exec } = require("child_process"); module.exports = { config: { name: "shell", aliases: ["sh"], version: "1.0", author: "Badhon-00", countDown: 5, role: 4, category: "developer", description: { en: "Run a workspace shell command as a bot developer." }, guide: { en: "{pn} " } }, onStart: async ({ message, event, args }) => { if (!args || args.length === 0) { return message.reply("❌ Please provide a shell command to execute.\nExample: /shell ls -la"); } const command = args.join(" "); message.reply(`⚙️ Executing: \`${command}\`\nPlease wait...`); exec(command, { timeout: 30000, maxBuffer: 1024 * 1024 * 10 }, (error, stdout, stderr) => { let response = ""; if (error) { response += `❌ Error: ${error.message}\n`; } if (stderr) { response += `⚠️ Stderr: ${stderr}\n`; } if (stdout) { response += `✅ Output:\n${stdout}`; } if (!response) { response = "✅ Command executed successfully (no output)"; } if (response.length > 4000) { response = response.substring(0, 3900) + "\n... (truncated)"; } return message.reply(response); }); } };