diff options
| author | 2020-04-07 19:36:32 +0300 | |
|---|---|---|
| committer | 2020-04-07 19:36:32 +0300 | |
| commit | 0af8726612f53ce6e52fbd636e0709c06d78415d (patch) | |
| tree | 0b295732f893ca61f093a655e9d2dcd984197424 /bot/exts/evergreen | |
| parent | (Constants, TicTacToe): Fixed number emojis contants, created helper function... (diff) | |
(TicTacToe): Added check is opponent free when request playing.
Diffstat (limited to 'bot/exts/evergreen')
| -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 55bbb7be..01417f25 100644 --- a/bot/exts/evergreen/tic_tac_toe.py +++ b/bot/exts/evergreen/tic_tac_toe.py @@ -121,6 +121,11 @@ class TicTacToe(Cog):      @command(name="tictactoe", aliases=("ttt",))      async def tic_tac_toe(self, ctx: Context, opponent: discord.User) -> None:          """Tic Tac Toe game. Play agains friends. Use reactions to add your mark to field.""" +        if not all( +            opponent not in (player.user for player in g.players) for g in ctx.cog.games if not g.over +        ): +            await ctx.send("Opponent is already in game.") +            return          game = Game(              ctx.channel,              [Player(ctx.author, ctx), Player(opponent, ctx)], | 
