Jonell01's picture
Upload 64 files
2821330 verified
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.");
};