Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion bot/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 5 additions & 3 deletions tests/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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()



# ---------------------------------------------------------------------------
Expand Down
Loading