goat
command
restart
No description
0
views
0
likes
0
installs
raw source
const fs = require("fs-extra");
const path = require("path");
module.exports = {
config: {
name: "restart",
version: "2.0.0",
author: "๐๐๐๐ฎ๐
",
countDown: 5,
role: 2,
description: { en: "Restart the bot" },
category: "admin",
guide: { en: "{pn}" }
},
onLoad: async function ({ api }) {
const filePath = path.join(__dirname, "tmp", "restart.txt");
if (fs.existsSync(filePath)) {
const [threadID, startTime] = fs.readFileSync(filePath, "utf8").split(" ");
const timeTaken = ((Date.now() - parseInt(startTime)) / 1000).toFixed(2);
api.sendMessage(
`โ
| ๐ผ'๐ ๐ต๐๐๐ ๐๐ชฝ
๐
๐๐ ๐ก๐๐๐ก ๐๐๐๐\nโฐ | ๐
๐๐ ๐ก๐๐๐ก ๐๐๐๐ : ${timeTaken}s`,
threadID
);
fs.unlinkSync(filePath);
}
},
onStart: async function ({ message, event }) {
const filePath = path.join(__dirname, "tmp", "restart.txt");
fs.writeFileSync(filePath, `${event.threadID} ${Date.now()}`);
await message.reply("โข๏ธ | ๐ธ๐๐ก๐ข ๐๐๐๐ก ๐พ๐๐๐ ๐
๐๐ ๐ก๐๐๐ก ๐ป๐๐๐ก๐๐๐๐'๐๐ -)โบ๏ธ๐ซ");
process.exit(2);
}
};