()
| 1 | const { SendDiscordLog } = require('../utils/Discord.js'); |
| 2 | |
| 3 | async function SaveData() { |
| 4 | if (changedFiles.length == 0) return; |
| 5 | for (let i = 0; i < changedFiles.length; i++) { |
| 6 | if (await FileExist(Config.SaveDirPath + "/" + changedFiles[i] + ".json")) { |
| 7 | await ModifyData(Config.SaveDirPath + "/" + changedFiles[i] + ".json", JSON.stringify(loadedData[changedFiles[i]])); |
| 8 | } |
| 9 | else { |
| 10 | await CreateIfNotExist(Config.SaveDirPath + "/" + changedFiles[i] + ".json", JSON.stringify(loadedData[changedFiles[i]])); |
| 11 | } |
| 12 | } |
| 13 | Log(LogTypes.Debug, `Saved data of ${changedFiles.map(file => file).join(", ")}`); |
| 14 | if (Config.SendSaveData) |
| 15 | SendDiscordLog({ |
| 16 | "content": null, |
| 17 | "embeds": [ |
| 18 | { |
| 19 | "title": "JSON Saved", |
| 20 | "description": "The JSON files have been saved successfully.\n `" + changedFiles.map(file => file).join("\n") + "`", |
| 21 | "color": 16773720 |
| 22 | } |
| 23 | ], |
| 24 | "attachments": [] |
| 25 | }) |
| 26 | changedFiles = []; |
| 27 | |
| 28 | } |
| 29 | |
| 30 | global.exports('SaveData', SaveData); |
nothing calls this directly
no test coverage detected