Added hints to Trivia. Curated Joepardy answers to be more lenient.
This commit is contained in:
parent
5e36eff8f5
commit
220f4fe727
|
@ -8,9 +8,11 @@ async function init() {
|
|||
const curatedQuestions = questions.map((question) => ({
|
||||
...question,
|
||||
question: question.question.replace(/^'|'$/g, ''),
|
||||
answer: question.answer.replace(/^((the|an|a)\b(?!-)|\(.*\))\s*|\(.*\)$|"/gi, ''),
|
||||
fullAnswer: question.answer,
|
||||
}));
|
||||
|
||||
await fs.writeFile('assets/jeopardy.json', JSON.stringify(curatedQuestions));
|
||||
await fs.writeFile('assets/jeopardy.json', JSON.stringify(curatedQuestions, null, 4));
|
||||
|
||||
console.log(curatedQuestions);
|
||||
}
|
||||
|
|
2169303
assets/jeopardy.json
2169303
assets/jeopardy.json
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -54,11 +54,26 @@ async function playRound(context, round = 0) {
|
|||
context.logger.info(`Trivia asked "${question.question}" with answer: ${question.answer}`);
|
||||
|
||||
try {
|
||||
await timers.setTimeout(game.timeout * 1000, null, {
|
||||
await timers.setTimeout((game.timeout / 3) * 1000, null, {
|
||||
signal: ac.signal,
|
||||
});
|
||||
|
||||
// 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);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
await timers.setTimeout((game.timeout / 3) * 1000, null, {
|
||||
signal: ac.signal,
|
||||
});
|
||||
} catch (error) {
|
||||
// abort expected, not an error
|
||||
// abort expected, probably not an error
|
||||
}
|
||||
|
||||
if (!ac.signal.aborted) {
|
||||
|
@ -78,7 +93,7 @@ async function playRound(context, round = 0) {
|
|||
const scores = scoreRound(context, round);
|
||||
|
||||
if (game.mode === 'first') {
|
||||
context.sendMessage(`**${question.answer}** is the right answer, played in **${((new Date() - now) / 1000).toFixed(3)}s**! ${scores}`, context.room.id);
|
||||
context.sendMessage(`**${question.fullAnswer || question.answer}** is the right answer, played in **${((new Date() - now) / 1000).toFixed(3)}s**! ${scores}`, context.room.id);
|
||||
}
|
||||
|
||||
if (game.mode === 'timeout') {
|
||||
|
@ -141,7 +156,7 @@ function onCommand(args, context) {
|
|||
}
|
||||
|
||||
if (!context.subcommand && game) {
|
||||
context.sendMessage(`There is already a game going on! The current question for round ${game.round + 1} is: ${game.questions[game.round].question}`, context.room.id);
|
||||
context.sendMessage(`There is already a game going on! Use ${config.prefix}trivia:stop to reset. The current question for round ${game.round + 1} is: ${game.questions[game.round].question}`, context.room.id);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -155,7 +170,7 @@ function onCommand(args, context) {
|
|||
|
||||
const subcommand = context.subcommand?.toLowerCase();
|
||||
|
||||
if (subcommand) {
|
||||
if (subcommand && settings[subcommand]) {
|
||||
settings[subcommand] = typeof settings[subcommand] === 'number' ? (Number(args[0]) || settings[subcommand]) : args[0];
|
||||
|
||||
context.sendMessage(`${subcommand} set to ${settings[subcommand]}`, context.room.id);
|
||||
|
|
Loading…
Reference in New Issue