File size: 1,857 Bytes
2821330 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
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.");
}; |