Encrypto-27-AI-BOT / plugins /main-restart.js
Encrypto27
36 - 50 besides repo , new plug
1e45726
raw
history blame
1.04 kB
const { cmd } = require('../command');
const { sleep } = require('../lib/functions');
cmd({
pattern: "restart",
desc: "Restart Encrypto-27 AI",
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("> Encrypto-27 AI Bot Restarting...");
await sleep(1500);
exec("pm2 restart all");
} catch (e) {
console.error(e);
reply(`${e}`);
}
});