diff options
Diffstat (limited to 'bot')
-rw-r--r-- | bot/exts/evergreen/tic_tac_toe.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/bot/exts/evergreen/tic_tac_toe.py b/bot/exts/evergreen/tic_tac_toe.py index 28f48e11..301cb9ff 100644 --- a/bot/exts/evergreen/tic_tac_toe.py +++ b/bot/exts/evergreen/tic_tac_toe.py @@ -2,7 +2,7 @@ import asyncio import typing as t import discord -from discord.ext.commands import Cog, Context +from discord.ext.commands import Cog, Context, check from bot.bot import SeasonalBot from bot.constants import Emojis @@ -82,6 +82,13 @@ class TicTacToe(Cog): self.bot = bot self.games: t.List[Game] = [] + @staticmethod + def is_channel_free() -> t.Callable: + """Check is channel where command will be invoked free.""" + async def predicate(ctx: Context) -> bool: + return all(game.channel != ctx.channel for game in ctx.cog.games) + return check(predicate) + def setup(bot: SeasonalBot) -> None: """Load TicTacToe Cog.""" |