Not hinting first letter for Trivia answers shorter than 3 characters.

This commit is contained in:
ThePendulum 2022-10-20 03:00:46 +02:00
parent 59594ae255
commit 5792a0799a
1 changed files with 7 additions and 2 deletions

View File

@ -69,13 +69,18 @@ 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 // 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(`${style.bold(style.green(`${Math.floor(game.timeout / 3) * 2} seconds`))} left, first hint for ${style.bold(style.purple(`question ${round + 1}/${game.questions.length}`))}: ${style.bold(`${question.answer.slice(0, 1)} ${question.answer.slice(1).replace(/\s/g, '').replace(/[^\s]/g, '_ ').trim()}`)}`, context.room.id); if (question.answer.length >= 3) {
context.sendMessage(`${style.bold(style.green(`${Math.floor(game.timeout / 3) * 2} seconds`))} left, first hint for ${style.bold(style.purple(`question ${round + 1}/${game.questions.length}`))}: ${style.bold(`${question.answer.slice(0, 1)} ${question.answer.slice(1).replace(/\s/g, '').replace(/[^\s]/g, '_ ').trim()}`)}`, context.room.id);
} else {
// giving the first letter gives too much away, only give the placeholders
context.sendMessage(`${style.bold(style.green(`${Math.floor(game.timeout / 3) * 2} seconds`))} left, first hint for ${style.bold(style.purple(`question ${round + 1}/${game.questions.length}`))}: ${style.bold(`${question.answer.replace(/\s/g, '').replace(/[^\s]/g, '_ ').trim()}`)}`, context.room.id);
}
await timers.setTimeout((game.timeout / 3) * 1000, null, { await timers.setTimeout((game.timeout / 3) * 1000, null, {
signal: ac.signal, signal: ac.signal,
}); });
if (question.answer.length > 3) { if (question.answer.length >= 4) {
context.sendMessage(`${style.bold(style.green(`${Math.floor(game.timeout / 3)} seconds`))} left, second hint for ${style.bold(style.purple(`question ${round + 1}/${game.questions.length}`))}: ${style.bold(`${question.answer.slice(0, 1)} ${question.answer.slice(1, -1).replace(/\s/g, '').replace(/[^\s]/g, '_ ')}${question.answer.slice(-1)}`)}`, context.room.id); context.sendMessage(`${style.bold(style.green(`${Math.floor(game.timeout / 3)} seconds`))} left, second hint for ${style.bold(style.purple(`question ${round + 1}/${game.questions.length}`))}: ${style.bold(`${question.answer.slice(0, 1)} ${question.answer.slice(1, -1).replace(/\s/g, '').replace(/[^\s]/g, '_ ')}${question.answer.slice(-1)}`)}`, context.room.id);
} }