mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-25 06:42:51 +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}`);
|
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
|
// Fetch all members
|
||||||
try {
|
try {
|
||||||
for (const guild of client.guilds.cache.values()) {
|
for (const guild of client.guilds.cache.values()) {
|
||||||
@@ -321,6 +313,20 @@ client.on('ready', async () => {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
client.logger.error(`[MEMBERS] Failed to fetch guild members\n${err.stack}`);
|
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 => {
|
client.on('messageCreate', async msg => {
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiao",
|
"name": "xiao",
|
||||||
"version": "153.0.0",
|
"version": "153.0.1",
|
||||||
"description": "Your personal server companion.",
|
"description": "Your personal server companion.",
|
||||||
"main": "Xiao.js",
|
"main": "Xiao.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -49,12 +49,12 @@ module.exports = class JeopardyScrape {
|
|||||||
const value = $(elem).find('td[class="clue_value"]').text();
|
const value = $(elem).find('td[class="clue_value"]').text();
|
||||||
const question = $(elem).find('td[class="clue_text"]').first().text();
|
const question = $(elem).find('td[class="clue_text"]').first().text();
|
||||||
const answer = $(elem).find('em[class="correct_response"]').text();
|
const answer = $(elem).find('em[class="correct_response"]').text();
|
||||||
if (!question || !answer || !value) return;
|
if (!question || !answer) return;
|
||||||
clues.push({
|
clues.push({
|
||||||
question,
|
question,
|
||||||
answer,
|
answer,
|
||||||
category: categoryArr[i % 6],
|
category: categoryArr[i % 6],
|
||||||
value: value.match(/[0-9]+/)[0],
|
value: value ? value.match(/[0-9]+/)[0] : '0',
|
||||||
gameID: id
|
gameID: id
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user