levix-bot 4.2.1 → 4.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app.cjs +50 -4
- package/package.json +1 -1
- package/public/dashboard/assets/index-BCXZoPGP.js +446 -0
- package/public/dashboard/index.html +1 -1
- package/public/dashboard.css +71 -1
- package/public/gateway.js +41 -0
- package/src/bootstrap/core.js +4 -0
- package/src/bootstrap/panel.js +2 -0
- package/src/commands/autoschedule.cjs +10 -13
- package/src/commands/block.cjs +1 -1
- package/src/commands/restart.cjs +46 -17
- package/src/commands/schedule.cjs +8 -10
- package/src/commands/send.cjs +116 -0
- package/src/commands/stopbot.cjs +68 -0
- package/src/commands/unblock.cjs +1 -1
- package/src/config/defaults.cjs +2 -1
- package/src/config/settings.cjs +4 -2
- package/src/core/session-holder.cjs +23 -0
- package/src/handlers/command.handler.js +3 -5
- package/src/panel/password-reset.cjs +187 -0
- package/src/routes/dashboard.api.esm.js +48 -78
- package/src/services/settingsTransfer.cjs +246 -0
- package/views/login.ejs +209 -9
- package/views/setup.ejs +19 -5
- package/public/dashboard/assets/index-4AuqfnH5.js +0 -431
- package/src/commands/shutdown.cjs +0 -55
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
// file: /commands/shutdown.js (Now with shell command execution)
|
|
2
|
-
const { delay } = require("@whiskeysockets/baileys");
|
|
3
|
-
const { exec } = require("child_process"); // 1. Import the 'exec' function
|
|
4
|
-
const logger = require("../utils/logger.cjs");
|
|
5
|
-
const { tr } = require("../utils/i18n.cjs");
|
|
6
|
-
|
|
7
|
-
module.exports = {
|
|
8
|
-
name: "shutdown",
|
|
9
|
-
description: {
|
|
10
|
-
en: "Stops the bot process permanently (via PM2).",
|
|
11
|
-
ar: "يوقف عملية البوت نهائيًا (عبر PM2).",
|
|
12
|
-
},
|
|
13
|
-
usage: {
|
|
14
|
-
en: "shutdown",
|
|
15
|
-
ar: "shutdown",
|
|
16
|
-
},
|
|
17
|
-
chat: "all",
|
|
18
|
-
|
|
19
|
-
async execute(sock, msg) {
|
|
20
|
-
const commandToExecute = "pm2 stop wa-bot"; // The exact command to run on the server
|
|
21
|
-
|
|
22
|
-
logger.warn(`Received !shutdown command. Executing: ${commandToExecute}`);
|
|
23
|
-
|
|
24
|
-
// 2. Send a final message to the user before shutting down
|
|
25
|
-
await sock.sendMessage(msg.key.remoteJid, {
|
|
26
|
-
text: tr(
|
|
27
|
-
"🔌 Shutdown received. Stopping the bot now... goodbye! 👋",
|
|
28
|
-
"🔌 تم استلام أمر الإيقاف النهائي. سيتم إيقاف البوت الآن... وداعًا! 👋",
|
|
29
|
-
),
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
// A small delay to ensure the WhatsApp message is sent out
|
|
33
|
-
await delay(2000);
|
|
34
|
-
|
|
35
|
-
// 3. Execute the shell command
|
|
36
|
-
exec(commandToExecute, (error, stdout, stderr) => {
|
|
37
|
-
if (error) {
|
|
38
|
-
// This log is crucial if something goes wrong
|
|
39
|
-
logger.error(
|
|
40
|
-
{
|
|
41
|
-
err: error.message,
|
|
42
|
-
stderr: stderr,
|
|
43
|
-
},
|
|
44
|
-
`Failed to execute shutdown command: ${commandToExecute}`,
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
// We can't reliably send a message here because the process might be stopping.
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// This log will appear just before the process is stopped by PM2
|
|
52
|
-
logger.info(`PM2 stop command executed successfully. STDOUT: ${stdout}`);
|
|
53
|
-
});
|
|
54
|
-
},
|
|
55
|
-
};
|