Fix Final Jeopardy not scraping

This commit is contained in:
lilyissillyyy
2025-08-22 21:53:15 -04:00
parent 0a4f259554
commit 4d2c1c29b1
3 changed files with 17 additions and 11 deletions
+14 -8
View File
@@ -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 => {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "153.0.0",
"version": "153.0.1",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {
+2 -2
View File
@@ -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
});
});