mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Make sure jeopardy is importing
This commit is contained in:
@@ -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);
|
||||||
|
|||||||
@@ -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];
|
||||||
|
|||||||
Reference in New Issue
Block a user