LiltenBot / plugins /main-restart.js
mrfrank-ofc's picture
Upload 63 files
8d8b0ad verified
raw
history blame
819 Bytes
const { cmd } = require('../command');
const { sleep } = require('../lib/functions');
cmd({
pattern: "restart",
desc: "Restart the SubZero Md",
category: "owner",
filename: __filename
},
async (conn, mek, m, {
from, quoted, body, isCmd, command, args, q, isGroup, senderNumber, reply
}) => {
try {
// Get the bot owner's number dynamically from conn.user.id
const botOwner = conn.user.id.split(":")[0]; // Extract the bot owner's number
if (senderNumber !== botOwner) {
return reply("Only the bot owner can use this command.");
}
const { exec } = require("child_process");
reply("Restarting...");
await sleep(1500);
exec("pm2 restart all");
} catch (e) {
console.error(e);
reply(`${e}`);
}
});