mirror of
https://github.com/tiennm99/tiennm99bot.git
synced 2026-10-11 03:13:46 +00:00
feat(loldle): reject duplicate guesses within a round
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.
This commit is contained in:
1 parent
d03b1859a5
commit
da79408542
1 file changed
+7
@@ -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(
|
||||
`🔁 <b>${escapeHtml(guess.name)}</b> 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) {
|
||||
|
||||
Reference in new issue
Block a user