diff options
Diffstat (limited to '')
| -rw-r--r-- | bot/exts/evergreen/minesweeper.py | 15 | ||||
| -rw-r--r-- | bot/utils/exceptions.py | 6 | 
2 files changed, 7 insertions, 14 deletions
| diff --git a/bot/exts/evergreen/minesweeper.py b/bot/exts/evergreen/minesweeper.py index e98e9027..ae057b30 100644 --- a/bot/exts/evergreen/minesweeper.py +++ b/bot/exts/evergreen/minesweeper.py @@ -7,6 +7,7 @@ import discord  from discord.ext import commands  from bot.constants import Client +from bot.utils.exceptions import UserNotPlayingError  MESSAGE_MAPPING = {      0: ":stop_button:", @@ -29,12 +30,6 @@ MESSAGE_MAPPING = {  log = logging.getLogger(__name__) -class UserNotPlayingError(Exception): -    """Will raised when user try to use game commands when not playing.""" - -    pass - -  class CoordinateConverter(commands.Converter):      """Converter for Coordinates.""" @@ -290,14 +285,6 @@ class Minesweeper(commands.Cog):              await game.chat_msg.edit(content=new_msg)          del self.games[ctx.author.id] -    @reveal_command.error -    @end_command.error -    @flag_command.error -    async def user_not_playing_handler(self, ctx: commands.Context, error: Exception) -> None: -        """Handle `KeyError` that is raised in reveal or end command when getting game.""" -        if isinstance(error, UserNotPlayingError): -            await ctx.send("Game don't exist.") -  def setup(bot: commands.Bot) -> None:      """Load the Minesweeper cog.""" diff --git a/bot/utils/exceptions.py b/bot/utils/exceptions.py index 70c20e12..dc62debe 100644 --- a/bot/utils/exceptions.py +++ b/bot/utils/exceptions.py @@ -2,3 +2,9 @@ class BrandingError(Exception):      """Exception raised by the BrandingManager cog."""      pass + + +class UserNotPlayingError(Exception): +    """Will raised when user try to use game commands when not playing.""" + +    pass | 
