Make sure jeopardy is importing

This commit is contained in:
lilyissillyyy
2026-01-06 13:22:57 -05:00
parent 547fa244ca
commit fb4ef5f8ef
2 changed files with 9 additions and 3 deletions
+1 -1
View File
@@ -27,7 +27,7 @@ module.exports = class XiaoClient extends CommandClient {
this.redis = new Redis(this); this.redis = new Redis(this);
this.timers = new TimerManager(this); this.timers = new TimerManager(this);
this.pokemon = new PokemonStore(); this.pokemon = new PokemonStore();
this.jeopardy = new JeopardyScrape(); this.jeopardy = new JeopardyScrape(this);
this.dispatchers = new Map(); this.dispatchers = new Map();
this.cleverbots = new Map(); this.cleverbots = new Map();
this.phone = new PhoneManager(this); this.phone = new PhoneManager(this);
+8 -2
View File
@@ -7,7 +7,9 @@ const { checkFileExists } = require('../util/Util');
const rounds = ['jeopardy_round', 'double_jeopardy_round', 'final_jeopardy_round']; const rounds = ['jeopardy_round', 'double_jeopardy_round', 'final_jeopardy_round'];
module.exports = class JeopardyScrape { module.exports = class JeopardyScrape {
constructor() { constructor(client) {
Object.defineProperty(this, 'client', { value: client });
this.clues = []; this.clues = [];
this.gameIDs = []; this.gameIDs = [];
this.seasons = []; this.seasons = [];
@@ -102,7 +104,11 @@ module.exports = class JeopardyScrape {
async checkForUpdates() { async checkForUpdates() {
if (!this.imported) { if (!this.imported) {
const fileExists = await checkFileExists(path.join(__dirname, '..', 'jeopardy.json')); const fileExists = await checkFileExists(path.join(__dirname, '..', 'jeopardy.json'));
if (fileExists) await this.importData(); if (fileExists) {
this.client.logger.info('[JEOPARDY] Importing from file...');
await this.importData();
this.client.logger.info('[JEOPARDY] Import complete!');
}
} }
const cluesBefore = this.clues.length; const cluesBefore = this.clues.length;
const latestSeason = this.seasons[this.seasons.length - 1]; const latestSeason = this.seasons[this.seasons.length - 1];