1
0
Fork 0
mirror of synced 2024-06-21 12:00:16 +12:00

Added a check to ensure that the bot is not being challenged

This commit is contained in:
Phxntxm 2016-08-20 20:55:52 -05:00
parent 5da0830b5c
commit 9cb1cd25b1
2 changed files with 8 additions and 0 deletions

View file

@ -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

View file

@ -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)