Removed Jeopardy questions containing URLs. Including first letter in first hint.
This commit is contained in:
parent
268735b3a8
commit
c23c3ffd32
|
@ -1,20 +1,28 @@
|
|||
'use strict';
|
||||
|
||||
const fs = require('fs').promises;
|
||||
const linkify = require('linkify-it')();
|
||||
|
||||
const questions = require('./jeopardy_raw.json');
|
||||
|
||||
async function init() {
|
||||
const curatedQuestions = questions.map((question) => ({
|
||||
const curatedQuestions = await Promise.all(questions.map(async (question) => {
|
||||
const links = linkify.match(question.question);
|
||||
|
||||
if (links?.length > 0 || /\[jpe?g\]/.test(question.question)) {
|
||||
console.log(`Discarding question due URL: ${question.question}`);
|
||||
return null;
|
||||
}
|
||||
|
||||
return {
|
||||
...question,
|
||||
question: question.question.replace(/^'|'$/g, ''),
|
||||
answer: question.answer.replace(/^((the|an|a)\b(?!-)|\(.*\))\s*|\(.*\)$|"/gi, ''),
|
||||
answer: question.answer.replace(/^((the|an|a)\b(?!-)|\(.*\))\s*|\(.*\)$|"|\\/gi, ''),
|
||||
fullAnswer: question.answer,
|
||||
};
|
||||
}));
|
||||
|
||||
await fs.writeFile('assets/jeopardy.json', JSON.stringify(curatedQuestions, null, 4));
|
||||
|
||||
console.log(curatedQuestions);
|
||||
await fs.writeFile('assets/jeopardy.json', JSON.stringify(curatedQuestions.filter(Boolean), null, 4));
|
||||
}
|
||||
|
||||
init();
|
||||
|
|
115264
assets/jeopardy.json
115264
assets/jeopardy.json
File diff suppressed because it is too large
Load Diff
|
@ -24,7 +24,7 @@ module.exports = {
|
|||
trivia: {
|
||||
mode: 'first', // first or timeout
|
||||
rounds: 10,
|
||||
timeout: 30,
|
||||
timeout: 60,
|
||||
},
|
||||
duck: {
|
||||
interval: [10, 3600], // seconds
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -19,7 +19,10 @@
|
|||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"bhttp": "^1.2.8",
|
||||
"bottleneck": "^2.19.5",
|
||||
"config": "^3.3.6",
|
||||
"jsdom": "^18.1.0",
|
||||
"linkify-it": "^3.0.3",
|
||||
"simple-node-logger": "^21.8.12",
|
||||
"ws": "^8.2.3",
|
||||
"yargs": "^17.2.1"
|
||||
|
|
|
@ -59,14 +59,14 @@ async function playRound(context, round = 0) {
|
|||
});
|
||||
|
||||
// replace space with U+2003 Em Space to separate words, since a single space separates the placeholders, and double spaces are removed during Markdown render
|
||||
context.sendMessage(`**${Math.floor(game.timeout / 3) * 2} seconds** left, first hint for round ${round + 1}/${game.questions.length}: ${question.answer.replace(/\s/g, ' ').replace(/[^\s]/g, '_ ')}`, context.room.id);
|
||||
context.sendMessage(`**${Math.floor(game.timeout / 3) * 2} seconds** left, first hint for **round ${round + 1}/${game.questions.length}**: ${question.answer.slice(0, 1)}${question.answer.slice(1).replace(/\s/g, ' ').replace(/[^\s]/g, '_ ')}`, context.room.id);
|
||||
|
||||
await timers.setTimeout((game.timeout / 3) * 1000, null, {
|
||||
signal: ac.signal,
|
||||
});
|
||||
|
||||
if (question.answer.length > 3) {
|
||||
context.sendMessage(`**${Math.floor(game.timeout / 3)} seconds** left, second hint for round ${round + 1}/${game.questions.length}: **${question.answer.slice(0, 1)} ${question.answer.slice(1).replace(/\s/g, ' ').replace(/[^\s]/g, '_ ')}${question.answer.slice(-1)}**`, context.room.id);
|
||||
context.sendMessage(`**${Math.floor(game.timeout / 3)} seconds** left, second hint for **round ${round + 1}/${game.questions.length}**: **${question.answer.slice(0, 1)} ${question.answer.slice(1).replace(/\s/g, ' ').replace(/[^\s]/g, '_ ')}${question.answer.slice(-1)}**`, context.room.id);
|
||||
}
|
||||
|
||||
await timers.setTimeout((game.timeout / 3) * 1000, null, {
|
||||
|
|
Loading…
Reference in New Issue