diff options
author | 2020-04-09 19:10:24 +0300 | |
---|---|---|
committer | 2020-04-09 19:10:24 +0300 | |
commit | 310ac58be883f07a9a410ce19c6b0dd8ffcf09bd (patch) | |
tree | 80d429f46099da865641d1e76a506000b7698498 /bot | |
parent | (TicTacToe): Created helper function `Game.check_for_win`. (diff) |
(TicTacToe): Added winner check to `Game.play`.
Diffstat (limited to 'bot')
-rw-r--r-- | bot/exts/evergreen/tic_tac_toe.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/bot/exts/evergreen/tic_tac_toe.py b/bot/exts/evergreen/tic_tac_toe.py index 970f359d..ed612182 100644 --- a/bot/exts/evergreen/tic_tac_toe.py +++ b/bot/exts/evergreen/tic_tac_toe.py @@ -169,7 +169,12 @@ class Game: self.board[pos] = self.current.symbol await self.edit_board(board) await board.clear_reaction(Emojis.number_emojis[pos]) + if await self.check_for_win(): + await self.ctx.send(f":tada: {self.current.user.mention} is won this game! :tada:") + await board.clear_reactions() + break self.current, self.next = self.next, self.current + self.over = True |