From 9cb1cd25b123ea5025f55e35ceb14077f87de0ff Mon Sep 17 00:00:00 2001 From: Phxntxm Date: Sat, 20 Aug 2016 20:55:52 -0500 Subject: [PATCH] Added a check to ensure that the bot is not being challenged --- cogs/hangman.py | 4 ++++ cogs/tictactoe.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/cogs/hangman.py b/cogs/hangman.py index f774d31..9de0a11 100644 --- a/cogs/hangman.py +++ b/cogs/hangman.py @@ -130,6 +130,10 @@ class Hangman: if self.games.get(ctx.message.server.id) is not None: await self.bot.say("Sorry but only one Hangman game can be running per server!") return + # Make sure we're not being challenged, I always win anyway + if player2 == ctx.message.server.me: + await self.bot.say("You want to play? Alright lets play.\n\nI win, so quick you didn't even notice it.") + return # Make sure the phrase is less than 30 characters check = lambda m: len(m.content) < 30 diff --git a/cogs/tictactoe.py b/cogs/tictactoe.py index 683e67e..ed77247 100644 --- a/cogs/tictactoe.py +++ b/cogs/tictactoe.py @@ -251,6 +251,10 @@ class TicTacToe: if self.boards.get(ctx.message.server.id) is not None: await self.bot.say("Sorry but only one Tic-Tac-Toe game can be running per server!") return + # Make sure we're not being challenged, I always win anyway + if player2 == ctx.message.server.me: + await self.bot.say("You want to play? Alright lets play.\n\nI win, so quick you didn't even notice it.") + return # Create the board and return who has been decided to go first x_player = self.create(ctx.message.server.id, player1, player2) fmt = "A tictactoe game has just started between {} and {}".format(player1.display_name, player2.display_name)