From aea2875957c3b12ace4e3fc12dfe10faed9e017a Mon Sep 17 00:00:00 2001 From: NikolajDanger Date: Sun, 4 Apr 2021 18:23:08 +0200 Subject: [PATCH] :bug: You can now challenge other players to connect four --- funcs/games/connectFour.py | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/funcs/games/connectFour.py b/funcs/games/connectFour.py index 7c5a11e..d6fdf9f 100644 --- a/funcs/games/connectFour.py +++ b/funcs/games/connectFour.py @@ -53,16 +53,28 @@ class ConnectFour(): logMessage = "They tried to play against a difficulty that doesn't exist" canStart = False - elif type(opponent) == discord.user: - # Opponent is another player - if ctx.author != opponent: - opponent = f"#{opponent.id}" - difficulty = 5 - diffText = "" + elif type(opponent) == discord.member.Member: + if opponent.bot: + # User has challenged a bot + if opponent == self.bot.user: + # It was Gwendolyn + difficulty = 3 + diffText = f" with difficulty {difficulty}" + opponent = f"#{self.bot.user.id}" + else: + sendMessage = "You can't challenge a bot!" + logMessage = "They tried to challenge a bot" + canStart = False else: - sendMessage = "You can't play against yourself" - logMessage = "They tried to play against themself" - canStart = False + # Opponent is another player + if ctx.author != opponent: + opponent = f"#{opponent.id}" + difficulty = 5 + diffText = "" + else: + sendMessage = "You can't play against yourself" + logMessage = "They tried to play against themself" + canStart = False if canStart: board = [[0 for _ in range(COLUMNCOUNT)] for _ in range(ROWCOUNT)]