diff options
| author | 2020-05-24 20:18:56 -0400 | |
|---|---|---|
| committer | 2020-05-24 20:18:56 -0400 | |
| commit | 2defff0491ad15dcb692c3a60b74662378d472bd (patch) | |
| tree | 346f8e57933423d086c66a512692f2615e101065 /bot/exts/evergreen | |
| parent | 5/24 - bot utils - added encoding, and notes for persist (diff) | |
| parent | Merge pull request #401 from fuzzmz/minesweeper-disabled-dm-handling (diff) | |
Merge branch 'master' into encoding_bug_fix
Diffstat (limited to 'bot/exts/evergreen')
| -rw-r--r-- | bot/exts/evergreen/minesweeper.py | 17 | ||||
| -rw-r--r-- | bot/exts/evergreen/snakes/snakes_cog.py | 8 |
2 files changed, 16 insertions, 9 deletions
diff --git a/bot/exts/evergreen/minesweeper.py b/bot/exts/evergreen/minesweeper.py index ae057b30..3e40f493 100644 --- a/bot/exts/evergreen/minesweeper.py +++ b/bot/exts/evergreen/minesweeper.py @@ -141,9 +141,20 @@ class Minesweeper(commands.Cog): await ctx.message.delete(delay=2) return + try: + await ctx.author.send( + f"Play by typing: `{Client.prefix}ms reveal xy [xy]` or `{Client.prefix}ms flag xy [xy]` \n" + 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") + await ctx.send(f":x: {ctx.author.mention}, please enable DMs to play minesweeper.") + return + # Add game to list board: GameBoard = self.generate_board(bomb_chance) revealed_board: GameBoard = [["hidden"] * 10 for _ in range(10)] + 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") @@ -151,12 +162,6 @@ class Minesweeper(commands.Cog): else: chat_msg = None - await ctx.author.send( - f"Play by typing: `{Client.prefix}ms reveal xy [xy]` or `{Client.prefix}ms flag xy [xy]` \n" - f"Close the game with `{Client.prefix}ms end`\n" - ) - dm_msg = await ctx.author.send(f"Here's your board!\n{self.format_for_discord(revealed_board)}") - self.games[ctx.author.id] = Game( board=board, revealed=revealed_board, diff --git a/bot/exts/evergreen/snakes/snakes_cog.py b/bot/exts/evergreen/snakes/snakes_cog.py index 36c176ce..b3896fcd 100644 --- a/bot/exts/evergreen/snakes/snakes_cog.py +++ b/bot/exts/evergreen/snakes/snakes_cog.py @@ -945,13 +945,15 @@ class Snakes(Cog): title="About the snake cog", description=( "The features in this cog were created by members of the community " - "during our first ever [code jam event](https://gitlab.com/discord-python/code-jams/code-jam-1). \n\n" + "during our first ever " + "[code jam event](https://pythondiscord.com/pages/code-jams/code-jam-1-snakes-bot/). \n\n" "The event saw over 50 participants, who competed to write a discord bot cog with a snake theme over " "48 hours. The staff then selected the best features from all the best teams, and made modifications " "to ensure they would all work together before integrating them into the community bot.\n\n" "It was a tight race, but in the end, <@!104749643715387392> and <@!303940835005825024> " - "walked away as grand champions. Make sure you check out `!snakes sal`, `!snakes draw` " - "and `!snakes hatch` to see what they came up with." + f"walked away as grand champions. Make sure you check out `{ctx.prefix}snakes sal`," + f"`{ctx.prefix}snakes draw` and `{ctx.prefix}snakes hatch` " + "to see what they came up with." ) ) |