Added hints to Trivia. Curated Joepardy answers to be more lenient.

This commit is contained in:
ThePendulum 2021-11-14 17:56:07 +01:00
parent 5e36eff8f5
commit 220f4fe727
70 changed files with 2424700 additions and 7 deletions

View File

@ -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);
}

File diff suppressed because one or more lines are too long

3732
assets/trivia/questions_00 Normal file

File diff suppressed because it is too large Load Diff

3904
assets/trivia/questions_01 Normal file

File diff suppressed because it is too large Load Diff

3943
assets/trivia/questions_02 Normal file

File diff suppressed because it is too large Load Diff

3978
assets/trivia/questions_03 Normal file

File diff suppressed because it is too large Load Diff

3911
assets/trivia/questions_04 Normal file

File diff suppressed because it is too large Load Diff

4000
assets/trivia/questions_05 Normal file

File diff suppressed because it is too large Load Diff

3847
assets/trivia/questions_06 Normal file

File diff suppressed because it is too large Load Diff

3998
assets/trivia/questions_07 Normal file

File diff suppressed because it is too large Load Diff

3924
assets/trivia/questions_08 Normal file

File diff suppressed because it is too large Load Diff

3916
assets/trivia/questions_09 Normal file

File diff suppressed because it is too large Load Diff

4000
assets/trivia/questions_10 Normal file

File diff suppressed because it is too large Load Diff

3938
assets/trivia/questions_11 Normal file

File diff suppressed because it is too large Load Diff

3890
assets/trivia/questions_12 Normal file

File diff suppressed because it is too large Load Diff

4000
assets/trivia/questions_13 Normal file

File diff suppressed because it is too large Load Diff

3998
assets/trivia/questions_14 Normal file

File diff suppressed because it is too large Load Diff

4000
assets/trivia/questions_15 Normal file

File diff suppressed because it is too large Load Diff

3857
assets/trivia/questions_16 Normal file

File diff suppressed because it is too large Load Diff

3976
assets/trivia/questions_17 Normal file

File diff suppressed because it is too large Load Diff

3928
assets/trivia/questions_18 Normal file

File diff suppressed because it is too large Load Diff

3620
assets/trivia/questions_19 Normal file

File diff suppressed because it is too large Load Diff

3985
assets/trivia/questions_20 Normal file

File diff suppressed because it is too large Load Diff

3929
assets/trivia/questions_21 Normal file

File diff suppressed because it is too large Load Diff

3394
assets/trivia/questions_22 Normal file

File diff suppressed because it is too large Load Diff

2898
assets/trivia/questions_23 Normal file

File diff suppressed because it is too large Load Diff

3831
assets/trivia/questions_24 Normal file

File diff suppressed because it is too large Load Diff

3960
assets/trivia/questions_25 Normal file

File diff suppressed because it is too large Load Diff

4000
assets/trivia/questions_26 Normal file

File diff suppressed because it is too large Load Diff

4000
assets/trivia/questions_27 Normal file

File diff suppressed because it is too large Load Diff

3964
assets/trivia/questions_28 Normal file

File diff suppressed because it is too large Load Diff

3994
assets/trivia/questions_29 Normal file

File diff suppressed because it is too large Load Diff

3856
assets/trivia/questions_30 Normal file

File diff suppressed because it is too large Load Diff

3971
assets/trivia/questions_31 Normal file

File diff suppressed because it is too large Load Diff

4000
assets/trivia/questions_32 Normal file

File diff suppressed because it is too large Load Diff

3843
assets/trivia/questions_33 Normal file

File diff suppressed because it is too large Load Diff

3880
assets/trivia/questions_34 Normal file

File diff suppressed because it is too large Load Diff

3939
assets/trivia/questions_35 Normal file

File diff suppressed because it is too large Load Diff

4000
assets/trivia/questions_36 Normal file

File diff suppressed because it is too large Load Diff

4000
assets/trivia/questions_37 Normal file

File diff suppressed because it is too large Load Diff

3943
assets/trivia/questions_38 Normal file

File diff suppressed because it is too large Load Diff

3977
assets/trivia/questions_39 Normal file

File diff suppressed because it is too large Load Diff

3828
assets/trivia/questions_40 Normal file

File diff suppressed because it is too large Load Diff

3899
assets/trivia/questions_41 Normal file

File diff suppressed because it is too large Load Diff

3903
assets/trivia/questions_42 Normal file

File diff suppressed because it is too large Load Diff

3992
assets/trivia/questions_43 Normal file

File diff suppressed because it is too large Load Diff

3996
assets/trivia/questions_44 Normal file

File diff suppressed because it is too large Load Diff

3996
assets/trivia/questions_45 Normal file

File diff suppressed because it is too large Load Diff

3883
assets/trivia/questions_46 Normal file

File diff suppressed because it is too large Load Diff

3999
assets/trivia/questions_47 Normal file

File diff suppressed because it is too large Load Diff

3991
assets/trivia/questions_48 Normal file

File diff suppressed because it is too large Load Diff

3999
assets/trivia/questions_49 Normal file

File diff suppressed because it is too large Load Diff

4000
assets/trivia/questions_50 Normal file

File diff suppressed because it is too large Load Diff

4000
assets/trivia/questions_51 Normal file

File diff suppressed because it is too large Load Diff

3937
assets/trivia/questions_52 Normal file

File diff suppressed because it is too large Load Diff

3412
assets/trivia/questions_53 Normal file

File diff suppressed because it is too large Load Diff

3225
assets/trivia/questions_54 Normal file

File diff suppressed because it is too large Load Diff

3503
assets/trivia/questions_55 Normal file

File diff suppressed because it is too large Load Diff

3436
assets/trivia/questions_56 Normal file

File diff suppressed because it is too large Load Diff

3115
assets/trivia/questions_57 Normal file

File diff suppressed because it is too large Load Diff

3467
assets/trivia/questions_58 Normal file

File diff suppressed because it is too large Load Diff

3399
assets/trivia/questions_59 Normal file

File diff suppressed because it is too large Load Diff

3681
assets/trivia/questions_60 Normal file

File diff suppressed because it is too large Load Diff

3656
assets/trivia/questions_61 Normal file

File diff suppressed because it is too large Load Diff

3594
assets/trivia/questions_62 Normal file

File diff suppressed because it is too large Load Diff

3630
assets/trivia/questions_63 Normal file

File diff suppressed because it is too large Load Diff

3783
assets/trivia/questions_64 Normal file

File diff suppressed because it is too large Load Diff

3999
assets/trivia/questions_65 Normal file

File diff suppressed because it is too large Load Diff

2328
assets/trivia/questions_66 Normal file

File diff suppressed because it is too large Load Diff

View File

@ -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);