← back to browse
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);
 }
};

View raw file