| 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."); |
| }; |