diff --git a/bot/bot.py b/bot/bot.py index 290c9e5..4af80d4 100644 --- a/bot/bot.py +++ b/bot/bot.py @@ -193,8 +193,11 @@ async def guess(self, ctx: commands.Context, word: str = "") -> None: await ctx.send("No game is currently in progress.") return - if result.is_found: + if result.is_found and not result.already_cited: await ctx.send(f"🎉 {ctx.author.name} found the word '{word}'!") + elif result.is_found and result.already_cited: + found_by = self._game_state.found_by + await ctx.send(f"🎉 The word '{word}' was already found by {found_by}!") elif result.already_cited: if result.entry.score is not None: pct = int(result.entry.score * 100) diff --git a/tests/test_commands.py b/tests/test_commands.py index 1e08d50..7c60c22 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -404,7 +404,7 @@ async def test_guess_already_cited_word_without_score_sends_distinct_message(sel assert "already" in message.lower() async def test_guess_exact_match_not_reported_as_already_cited(self): - """A winning guess should show the win message even if the word was cited before.""" + """Re-guessing the winning word after game is won should show an already-found message.""" bot = _make_bot(cooldown=0) bot._game_state = GameState(scorer=_FakeScorer()) bot._game_state.start_new_game("chat", Difficulty.EASY) @@ -417,9 +417,11 @@ async def test_guess_exact_match_not_reported_as_already_cited(self): ctx2.author.name = "bob" await _guess_fn(bot, ctx2, "chat") message = ctx2.send.call_args[0][0] - # Should show winner message, not "already cited" - assert "bob" in message.lower() + # Should show "already found by alice" message, not "already cited" or a new win + assert "alice" in message.lower() assert "chat" in message.lower() + assert "bob" not in message.lower() + # ---------------------------------------------------------------------------