From da79408542dd3653d56a50fe5b58e80a5ca22a28 Mon Sep 17 00:00:00 2001 From: tiennm99 Date: Wed, 22 Apr 2026 09:35:22 +0700 Subject: [PATCH] feat(loldle): reject duplicate guesses within a round MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Prevents two players in a group from wasting a slot on the same champion — re-guessing a previously tried champion replies with a hint and does not consume a guess. --- src/modules/loldle/handlers.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/modules/loldle/handlers.js b/src/modules/loldle/handlers.js index 6b1f038..a4927cd 100644 --- a/src/modules/loldle/handlers.js +++ b/src/modules/loldle/handlers.js @@ -118,6 +118,13 @@ export async function handleLoldle(ctx, db) { const guess = findChampion(champions, arg); if (!guess) return ctx.reply(`Champion not found: "${arg}".`); + if (game.guesses.some((g) => g.champion === guess.name)) { + return ctx.reply( + `🔁 ${escapeHtml(guess.name)} was already guessed this round — try another champion.`, + { parse_mode: "HTML" }, + ); + } + const target = champions.find((c) => c.id === game.target); // champions.json can be refreshed between rounds — an active target may disappear. if (!target) {