Lanbot_Music_V12/commands/Musique/pruning.js

28 lines
749 B
JavaScript
Raw Normal View History

2022-01-04 02:35:59 +01:00
const fs = require("fs");
const { MESSAGES } = require("../../util/constants");
let config;
try {
config = require("../../config");
} catch (error) {
config = null;
}
module.exports.run = (client, message, args, settings) => {
if (!config) return;
config.PRUNING = !config.PRUNING;
fs.writeFile("../../config", JSON.stringify(config, null, 2), (err) => {
if (err) {
console.log(err);
return message.channel.send("Une erreur s'est produite lors de l'écriture dans le fichier.").catch(console.error);
}
return message.channel
.send(`Pruning est ${config.PRUNING ? "**ON**" : "**OFF**"}`)
.catch(console.error);
});
};
module.exports.help = MESSAGES.COMMANDS.MUSIQUE.PRUNING;