diff options
author | 2020-04-07 17:02:16 +0300 | |
---|---|---|
committer | 2020-04-07 17:02:16 +0300 | |
commit | 88a121db968de07880037ffcc05462ef65cfaa2e (patch) | |
tree | 0d4aeb17d1c0293147f1e6162f1d51856371ae92 /bot/exts/evergreen/tic_tac_toe.py | |
parent | (TicTacToe): Created check `is_channel_free`. (diff) |
(TicTacToe): Created check `is_requester_free`.
Diffstat (limited to 'bot/exts/evergreen/tic_tac_toe.py')
-rw-r--r-- | bot/exts/evergreen/tic_tac_toe.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/bot/exts/evergreen/tic_tac_toe.py b/bot/exts/evergreen/tic_tac_toe.py index 301cb9ff..90f916ef 100644 --- a/bot/exts/evergreen/tic_tac_toe.py +++ b/bot/exts/evergreen/tic_tac_toe.py @@ -89,6 +89,13 @@ class TicTacToe(Cog): return all(game.channel != ctx.channel for game in ctx.cog.games) return check(predicate) + @staticmethod + def is_requester_free() -> t.Callable: + """Check is requester not already in any game.""" + async def predicate(ctx: Context) -> bool: + return all(ctx.author not in (player.user for player in game.players) for game in ctx.cog.games) + return check(predicate) + def setup(bot: SeasonalBot) -> None: """Load TicTacToe Cog.""" |