module.exports.config = { name: "maintenance", hasPermssion: 2, version: "1.0.0", description: "Maintenance bot", usePrefix: true, hide: true, credits: "Jonell Magallanes", cooldowns: 5, commandCategory: "System" }; module.exports.run = async function({ api, event, args }) { var fs = require("fs"); var request = require("request"); const content = args.join(" "); api.getThreadList(30, null, ["INBOX"], (err, list) => { if (err) { console.error("ERR: "+ err); return; } list.forEach(thread => { if(thread.isGroup == true && thread.threadID != event.threadID) { var link = "https://i.postimg.cc/NFdDc0vV/RFq-BU56n-ES.gif"; var callback = () => api.sendMessage({ body: `š—•š—¼š˜ š— š—®š—¶š—»š˜š—²š—»š—®š—»š—°š—² š— š—¼š—±š—²\n━━━━━━━━━━━━━━━━━━\n${adminConfig.botName} š—š–ŗš—Œ š–»š–¾š–¾š—‡ š–¬š–ŗš—‚š—‡š—š–¾š—‡š–ŗš—‡š–¼š–¾. š–Æš—…š–¾š–ŗš—Œš–¾ š–»š–¾ š—‰š–ŗš—š—‚š–¾š—‡š—.\n\nš–±š–¾š–ŗš—Œš—ˆš—‡: ${content}\n\nš–£š–¾š—š–¾š—…š—ˆš—‰š–¾š—‹: ${global.config.OWNER}`, attachment: fs.createReadStream(__dirname + "/cache/maintenance.gif") }, thread.threadID, () => { fs.unlinkSync(__dirname + "/cache/maintenance.gif"); console.log(`Maintenance message sent to ${thread.threadID}. Now shutting down.`); process.exit(0); }); return request(encodeURI(link)) .pipe(fs.createWriteStream(__dirname + "/cache/maintenance.gif")) .on("close", callback); } }); }); console.log("The bot is now off for maintenance."); };