From 78ba1fbd0acd537af8bde3bbb2148c2e1454cca1 Mon Sep 17 00:00:00 2001 From: lilyissillyyy Date: Sun, 14 Sep 2025 00:39:23 -0400 Subject: [PATCH] Async --- structures/JeopardyScrape.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/structures/JeopardyScrape.js b/structures/JeopardyScrape.js index 722c8153..28790803 100644 --- a/structures/JeopardyScrape.js +++ b/structures/JeopardyScrape.js @@ -64,8 +64,8 @@ module.exports = class JeopardyScrape { return clues; } - importData() { - const read = fs.readFileSync(path.join(__dirname, '..', 'jeopardy.json'), { encoding: 'utf8' }); + async importData() { + const read = await fs.promises.readFile(path.join(__dirname, '..', 'jeopardy.json'), { encoding: 'utf8' }); const file = JSON.parse(read); if (typeof file !== 'object' || Array.isArray(file)) return null; if (!file.clues || !file.gameIDs || !file.seasons) return null; @@ -89,7 +89,6 @@ module.exports = class JeopardyScrape { } exportData() { - if (!this.clues.length) this.importData(); const buf = Buffer.from(JSON.stringify({ clues: this.clues, gameIDs: this.gameIDs, @@ -102,7 +101,7 @@ module.exports = class JeopardyScrape { async checkForUpdates() { if (!this.imported) { const fileExists = await checkFileExists(path.join(__dirname, '..', 'jeopardy.json')); - if (fileExists) this.importData(); + if (fileExists) await this.importData(); } const cluesBefore = this.clues.length; const latestSeason = this.seasons[this.seasons.length - 1];