aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar vivax3794 <[email protected]>2019-08-09 17:36:56 +0200
committerGravatar vivax3794 <[email protected]>2019-08-09 17:36:56 +0200
commitf32fdda6bb95225ea536c07446a764e015145ca4 (patch)
treea751f3ef0eb3ea4c4956f138ffde96e10a14f560
parentadded minesweeper cog (diff)
added logic for when a user already have a game running
-rw-r--r--bot/seasons/evergreen/minesweeper.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/bot/seasons/evergreen/minesweeper.py b/bot/seasons/evergreen/minesweeper.py
index e5276df5..3540df80 100644
--- a/bot/seasons/evergreen/minesweeper.py
+++ b/bot/seasons/evergreen/minesweeper.py
@@ -1,11 +1,30 @@
+import typing
+
+import discord
from discord.ext import commands
class Minesweeper(commands.Cog):
- """play a game of minesweeper"""
+ """Play a game of minesweeper."""
def __init__(self, bot: commands.Bot) -> None:
self.bot = bot
+ self.games: typing.Dict[discord.member, typing.Dict] = {} # Store the currently running games
+
+ @commands.command(name="minesweeper")
+ async def minesweeper_command(self, ctx: commands.Context) -> None:
+ """Start a game of minesweeper."""
+ if ctx.author in self.games.keys(): # Player is already playing
+ msg = await ctx.send(f"{ctx.author.mention} you already have a game running")
+ await msg.delete(delay=2)
+ await ctx.message.delete(delay=2)
+ return
+
+ # Add game to list
+
+ self.games[ctx.author] = {
+
+ }
def setup(bot: commands.Bot) -> None: