aboutsummaryrefslogtreecommitdiffstats
path: root/bot/exts/evergreen/tic_tac_toe.py
diff options
context:
space:
mode:
authorGravatar ks129 <[email protected]>2020-04-09 19:10:24 +0300
committerGravatar ks129 <[email protected]>2020-04-09 19:10:24 +0300
commit310ac58be883f07a9a410ce19c6b0dd8ffcf09bd (patch)
tree80d429f46099da865641d1e76a506000b7698498 /bot/exts/evergreen/tic_tac_toe.py
parent(TicTacToe): Created helper function `Game.check_for_win`. (diff)
(TicTacToe): Added winner check to `Game.play`.
Diffstat (limited to 'bot/exts/evergreen/tic_tac_toe.py')
-rw-r--r--bot/exts/evergreen/tic_tac_toe.py5
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