From 4d2c1c29b1d753c73c27cf709211c421997d2e01 Mon Sep 17 00:00:00 2001 From: lilyissillyyy Date: Fri, 22 Aug 2025 21:53:15 -0400 Subject: [PATCH] Fix Final Jeopardy not scraping --- Xiao.js | 22 ++++++++++++++-------- package.json | 2 +- structures/JeopardyScrape.js | 4 ++-- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/Xiao.js b/Xiao.js index e068b84a..21405c15 100644 --- a/Xiao.js +++ b/Xiao.js @@ -304,14 +304,6 @@ client.on('ready', async () => { client.logger.error(`[STYLIZE] Failed to load stylize models\n${err.stack}`); } - // Update Jeopardy questions - try { - const newClues = await client.jeopardy.checkForUpdates(); - client.logger.info(`[JEOPARDY] Added ${newClues} new Jeopardy clues.`); - } catch (err) { - client.logger.error(`[JEOPARDY] Failed to update Jeopardy clues\n${err.stack}`); - } - // Fetch all members try { for (const guild of client.guilds.cache.values()) { @@ -321,6 +313,20 @@ client.on('ready', async () => { } catch (err) { client.logger.error(`[MEMBERS] Failed to fetch guild members\n${err.stack}`); } + + // Update Jeopardy questions + try { + client.logger.info('[JEOPARDY] Starting Jeopardy clue update...'); + const newClues = await client.jeopardy.checkForUpdates(); + client.logger.info(`[JEOPARDY] Added ${newClues} new Jeopardy clues.`); + setInterval(() => { + client.jeopardy.checkForUpdates() + .then(count => client.logger.info(`[JEOPARDY] Added ${count} new Jeopardy clues.`)) + .catch(err => client.logger.error(`[JEOPARDY] Failed to update Jeopardy clues\n${err.stack}`)); + }, 8.64e+7); + } catch (err) { + client.logger.error(`[JEOPARDY] Failed to update Jeopardy clues\n${err.stack}`); + } }); client.on('messageCreate', async msg => { diff --git a/package.json b/package.json index 8cf4561c..dba2ef3c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "153.0.0", + "version": "153.0.1", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": { diff --git a/structures/JeopardyScrape.js b/structures/JeopardyScrape.js index ee71904a..254b73d4 100644 --- a/structures/JeopardyScrape.js +++ b/structures/JeopardyScrape.js @@ -49,12 +49,12 @@ module.exports = class JeopardyScrape { const value = $(elem).find('td[class="clue_value"]').text(); const question = $(elem).find('td[class="clue_text"]').first().text(); const answer = $(elem).find('em[class="correct_response"]').text(); - if (!question || !answer || !value) return; + if (!question || !answer) return; clues.push({ question, answer, category: categoryArr[i % 6], - value: value.match(/[0-9]+/)[0], + value: value ? value.match(/[0-9]+/)[0] : '0', gameID: id }); });