aboutsummaryrefslogtreecommitdiffstats
path: root/bot/exts/evergreen/minesweeper.py
diff options
context:
space:
mode:
Diffstat (limited to 'bot/exts/evergreen/minesweeper.py')
-rw-r--r--bot/exts/evergreen/minesweeper.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/bot/exts/evergreen/minesweeper.py b/bot/exts/evergreen/minesweeper.py
index 3031debc..d0cc28c5 100644
--- a/bot/exts/evergreen/minesweeper.py
+++ b/bot/exts/evergreen/minesweeper.py
@@ -6,6 +6,7 @@ from random import randint, random
import discord
from discord.ext import commands
+from bot.bot import Bot
from bot.constants import Client
from bot.utils.exceptions import UserNotPlayingError
from bot.utils.extensions import invoke_help_command
@@ -37,7 +38,7 @@ class CoordinateConverter(commands.Converter):
async def convert(self, ctx: commands.Context, coordinate: str) -> typing.Tuple[int, int]:
"""Take in a coordinate string and turn it into an (x, y) tuple."""
if not 2 <= len(coordinate) <= 3:
- raise commands.BadArgument('Invalid co-ordinate provided')
+ raise commands.BadArgument('Invalid co-ordinate provided.')
coordinate = coordinate.lower()
if coordinate[0].isalpha():
@@ -78,7 +79,7 @@ GamesDict = typing.Dict[int, Game]
class Minesweeper(commands.Cog):
"""Play a game of Minesweeper."""
- def __init__(self, bot: commands.Bot) -> None:
+ def __init__(self, _bot: Bot) -> None:
self.games: GamesDict = {} # Store the currently running games
@commands.group(name='minesweeper', aliases=('ms',), invoke_without_command=True)
@@ -148,7 +149,7 @@ class Minesweeper(commands.Cog):
f"Close the game with `{Client.prefix}ms end`\n"
)
except discord.errors.Forbidden:
- log.debug(f"{ctx.author.name} ({ctx.author.id}) has disabled DMs from server members")
+ log.debug(f"{ctx.author.name} ({ctx.author.id}) has disabled DMs from server members.")
await ctx.send(f":x: {ctx.author.mention}, please enable DMs to play minesweeper.")
return
@@ -158,7 +159,7 @@ class Minesweeper(commands.Cog):
dm_msg = await ctx.author.send(f"Here's your board!\n{self.format_for_discord(revealed_board)}")
if ctx.guild:
- await ctx.send(f"{ctx.author.mention} is playing Minesweeper")
+ await ctx.send(f"{ctx.author.mention} is playing Minesweeper.")
chat_msg = await ctx.send(f"Here's their board!\n{self.format_for_discord(revealed_board)}")
else:
chat_msg = None
@@ -247,7 +248,7 @@ class Minesweeper(commands.Cog):
"""
Reveal one square.
- return is True if the game ended, breaking the loop in `reveal_command` and deleting the game
+ return is True if the game ended, breaking the loop in `reveal_command` and deleting the game.
"""
revealed[y][x] = board[y][x]
if board[y][x] == "bomb":
@@ -285,13 +286,13 @@ class Minesweeper(commands.Cog):
game = self.games[ctx.author.id]
game.revealed = game.board
await self.update_boards(ctx)
- new_msg = f":no_entry: Game canceled :no_entry:\n{game.dm_msg.content}"
+ new_msg = f":no_entry: Game canceled. :no_entry:\n{game.dm_msg.content}"
await game.dm_msg.edit(content=new_msg)
if game.activated_on_server:
await game.chat_msg.edit(content=new_msg)
del self.games[ctx.author.id]
-def setup(bot: commands.Bot) -> None:
+def setup(bot: Bot) -> None:
"""Load the Minesweeper cog."""
bot.add_cog(Minesweeper(bot))