mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 15:07:42 +02:00
Fix Final Jeopardy not scraping
This commit is contained in:
@@ -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
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiao",
|
||||
"version": "153.0.0",
|
||||
"version": "153.0.1",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Xiao.js",
|
||||
"scripts": {
|
||||
|
||||
@@ -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
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user